/* ===================================================================
   Pan En Environmental — Global Unified Stylesheet
   Shared color system, typography, and component rules for all pages.
   ================================================================ */

/* --- Global CSS Variables (single source of truth for all pages) --- */
:root {
  /* Brand colors — Dark SaaS Tech Theme */
  --color-primary: #7A3CF0;       /* Purple primary button / highlight */
  --color-primary-dark: #6229D1;  /* Hover deepened purple */
  --color-accent: #FF7D29;        /* Orange accent (eyebrow, small highlights) */
  --color-accent-dark: #E06B1A;   /* Hover deepened orange */
  --color-star: #FFB845;          /* Star rating orange-yellow */

  /* Neutrals — Dark theme base */
  --color-white: #FFFFFF;
  --color-bg: #0A1220;            /* Page main dark background */
  --color-card-bg: #101A2E;       /* Card / content block container */
  --color-deeper: #080F1C;        /* Deeper black-blue (navbar, CTA block) */

  /* Text colors — Dark theme hierarchy */
  --color-title: #FFFFFF;
  --color-body: #C5CDE0;
  --color-muted: #8A96B3;

  /* Layout */
  --radius-card: 8px;
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.25);
  --shadow-card-hover: 0 8px 28px rgba(122, 60, 240, 0.12);
  --transition-base: 250ms ease;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- Base reset & typography --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-body);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-title);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.125rem, 2.5vw, 1.5rem); }

p { color: var(--color-body); }

a { text-decoration: none; color: inherit; }

/* --- Utility layout helpers --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

.section-tight {
  padding: 3.5rem 0;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-muted); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.bg-light { background-color: var(--color-card-bg); }
.bg-dark { background-color: var(--color-deeper); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-card);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

/* Primary button: deep blue background, white text, hover deepened */
.btn-primary {
  background-color: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  transform: translateY(-1px);
}

/* Secondary button: transparent background, white border, hover purple */
.btn-secondary {
  background-color: transparent;
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.35);
}
.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

/* --- Cards --- */
.card {
  background-color: var(--color-card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  border: 1px solid rgba(122, 60, 240, 0.12);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.card-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background-color: rgba(122, 60, 240, 0.12);
  color: var(--color-primary);
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
}

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 2rem 0;
}

/* --- Section eyebrow label --- */
.eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

/* --- Image placeholder container --- */
.img-placeholder {
  width: 100%;
  height: 100%;
  min-height: 240px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background-color: var(--color-card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Grid helpers --- */
.grid {
  display: grid;
  gap: 2rem;
}
.grid-3 { grid-template-columns: repeat(1, 1fr); }
.grid-2 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* --- Timeline (polarizer process) --- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
@media (min-width: 768px) {
  .timeline {
    flex-direction: row;
    align-items: stretch;
  }
  .timeline-step {
    flex: 1;
  }
}

/* --- Navbar specific styles --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: var(--color-deeper);
  transition: box-shadow var(--transition-base);
}
.navbar.scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.nav-link {
  position: relative;
  font-weight: 500;
  color: var(--color-body);
  padding: 0.5rem 0;
  transition: color var(--transition-base);
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-base);
}
.nav-link:hover,
.nav-link.active {
  color: var(--color-white);
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Mobile hamburger menu */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  background-color: var(--color-deeper);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  transition: right 300ms ease;
  z-index: 1100;
  padding: 5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.mobile-menu.open {
  right: 0;
}
.mobile-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease;
  z-index: 1050;
}
.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* --- Footer --- */
.footer {
  background-color: var(--color-deeper);
  color: var(--color-muted);
  padding: 3.5rem 0 1.5rem;
}
.footer a {
  color: var(--color-muted);
  transition: color var(--transition-base);
}
.footer a:hover {
  color: var(--color-primary);
}
.footer h4 {
  color: var(--color-white);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* --- Hero section --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: var(--color-bg);
  overflow: hidden;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 820px;
  padding: 6rem 1.5rem 3rem;
}
.hero h1 {
  color: var(--color-white);
  margin-bottom: 1.25rem;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--color-body);
  max-width: 640px;
  margin: 0 auto 2.5rem;
}

/* --- Alternating text-image layout (technology page) --- */
.alt-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 768px) {
  .alt-row {
    grid-template-columns: 1fr 1fr;
  }
  .alt-row.reverse .alt-text { order: 2; }
  .alt-row.reverse .alt-media { order: 1; }
}

/* --- Process step badge --- */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-white);
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

/* --- Form fields --- */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.form-field label {
  font-weight: 600;
  color: var(--color-body);
  font-size: 0.9375rem;
}
.form-field input,
.form-field select,
.form-field textarea {
  padding: 0.75rem 1rem;
  border: 1.5px solid rgba(122, 60, 240, 0.2);
  border-radius: var(--radius-card);
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--color-body);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  background-color: var(--color-bg);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--color-muted);
}
.form-field textarea {
  resize: vertical;
  min-height: 130px;
}

/* ===================================================================
   Interaction Animation Enhancements
   Scroll-triggered fade-in, enhanced card hover, button ripple, etc.
   All durations kept within 200-300ms per project requirements.
   ================================================================ */

/* --- Scroll-triggered fade-in animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Initial state: hidden before intersection observer triggers */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children animation */
.animate-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-stagger.animated > * {
  opacity: 1;
  transform: translateY(0);
}

.animate-stagger.animated > *:nth-child(1) { transition-delay: 0.05s; }
.animate-stagger.animated > *:nth-child(2) { transition-delay: 0.15s; }
.animate-stagger.animated > *:nth-child(3) { transition-delay: 0.25s; }
.animate-stagger.animated > *:nth-child(4) { transition-delay: 0.35s; }
.animate-stagger.animated > *:nth-child(5) { transition-delay: 0.45s; }

/* --- Enhanced card hover effects --- */
.card-enhanced {
  transition: transform 250ms ease, box-shadow 250ms ease, border-color 250ms ease;
}
.card-enhanced:hover {
  transform: translateY(-4px) rotateX(2deg);
  box-shadow: 0 12px 36px rgba(122, 60, 240, 0.18);
  border-color: rgba(122, 60, 240, 0.3);
}

/* --- Button click ripple effect --- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
  opacity: 1;
  transition: width 0s, height 0s, opacity 0s;
}

/* --- Timeline step connector animation --- */
.timeline-animated {
  position: relative;
}

.timeline-animated::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s ease;
  z-index: 0;
}

.timeline-animated.animated::before {
  transform: scaleX(1);
}

/* Step badge pulse animation */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(122, 60, 240, 0.5);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(122, 60, 240, 0);
  }
}

.step-badge-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* --- Form input focus glow effect --- */
.form-field-enhanced input:focus,
.form-field-enhanced select:focus,
.form-field-enhanced textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(122, 60, 240, 0.15);
  transition: border-color 250ms ease, box-shadow 250ms ease;
}

/* --- Hero image parallax-like effect (subtle) --- */
.hero-parallax {
  transition: transform 0.3s ease-out;
}

/* --- Smooth underline animation for links --- */
.nav-link-animated {
  position: relative;
  display: inline-block;
}

.nav-link-animated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width 250ms ease;
}

.nav-link-animated:hover::after {
  width: 100%;
}

/* --- Floating label animation for form inputs --- */
.form-floating {
  position: relative;
}

.form-floating label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: var(--color-muted);
  font-size: 1rem;
  pointer-events: none;
  transition: top 200ms ease, font-size 200ms ease, color 200ms ease;
}

.form-floating input:focus + label,
.form-floating input:not(:placeholder-shown) + label {
  top: 0.25rem;
  font-size: 0.75rem;
  color: var(--color-primary);
  background: var(--color-card-bg);
  padding: 0 0.25rem;
}

/* --- Counter animation for numbers (used in roadmap) --- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.counter-animated {
  animation: countUp 0.5s ease forwards;
}

/* --- Icon bounce on hover --- */
.icon-bounce:hover .card-icon {
  animation: iconBounce 0.4s ease;
}

@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
