/* =========================================================
   Infra Services — stylesheet
   Light + Dark themes, modern minimal aesthetic
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --header-height: 64px;
  --container: 1140px;

  --radius-card: 18px;
  --radius-btn: 12px;
  --radius-pill: 999px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --transition-fast: 0.18s ease;
  --transition: 0.25s ease;
  --transition-slow: 0.5s ease;

  /* Brand accent — shared across themes */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.14);
  --accent-glow: rgba(79, 70, 229, 0.35);
}

/* ---------- Light theme (default) ---------- */
:root,
[data-theme="light"] {
  color-scheme: light;

  --bg: #fafbfd;
  --bg-alt: #f1f4f9;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f6f8fc;

  --text: #0b1220;
  --text-soft: #525a6b;
  --text-muted: #7a8395;

  --border: rgba(11, 18, 32, 0.08);
  --border-strong: rgba(11, 18, 32, 0.14);

  --header-bg: rgba(255, 255, 255, 0.78);
  --header-border: rgba(11, 18, 32, 0.08);

  --hero-bg: radial-gradient(
      1200px 600px at 80% -10%,
      rgba(79, 70, 229, 0.18),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 0% 100%,
      rgba(14, 165, 233, 0.12),
      transparent 60%
    ),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f8 100%);

  --shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.04),
    0 1px 1px rgba(11, 18, 32, 0.03);
  --shadow-md: 0 10px 30px rgba(11, 18, 32, 0.06);
  --shadow-lg: 0 22px 50px rgba(11, 18, 32, 0.10);

  --grid-line: rgba(11, 18, 32, 0.05);
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a0e1a;
  --bg-alt: #0d1322;
  --bg-elevated: #131a2d;
  --surface: #131a2d;
  --surface-soft: #182039;

  --text: #e7eaf3;
  --text-soft: #a3acc2;
  --text-muted: #6e7791;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --header-bg: rgba(10, 14, 26, 0.72);
  --header-border: rgba(255, 255, 255, 0.06);

  --accent: #818cf8;
  --accent-hover: #a5b0ff;
  --accent-soft: rgba(129, 140, 248, 0.18);
  --accent-glow: rgba(129, 140, 248, 0.45);

  --hero-bg: radial-gradient(
      1200px 600px at 80% -10%,
      rgba(129, 140, 248, 0.22),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 0% 100%,
      rgba(56, 189, 248, 0.10),
      transparent 60%
    ),
    linear-gradient(180deg, #0a0e1a 0%, #0d1322 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);

  --grid-line: rgba(255, 255, 255, 0.05);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* =========================================================
   Header
   ========================================================= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  transition: background var(--transition), border-color var(--transition);
  will-change: transform;
}

.header-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.logo {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #38bdf8 100%);
  box-shadow: 0 0 14px var(--accent-glow);
  vertical-align: middle;
}

.main-nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 28px;
}

.main-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  transition: color var(--transition-fast);
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.main-nav a:hover {
  color: var(--text);
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.language-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.language-picker a {
  color: var(--text-soft);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.language-picker a:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.language-picker a.active {
  color: var(--text);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  padding-top: var(--header-height);
  background: var(--hero-bg);
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: background var(--transition-slow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.6) 0%,
    transparent 70%
  );
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.6) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
  margin-bottom: 22px;
  border: 1px solid var(--accent-soft);
}

.hero-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.hero h2 {
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  max-width: 920px;
  margin-bottom: 24px;
  color: var(--text);
  font-weight: 700;
}

.hero h2 .accent-text {
  background: linear-gradient(135deg, var(--accent) 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  max-width: 720px;
  margin-bottom: 38px;
  color: var(--text-soft);
}

/* =========================================================
   Buttons
   ========================================================= */
.cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  text-decoration: none;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.96rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--transition-fast),
    background var(--transition-fast), border-color var(--transition-fast),
    box-shadow var(--transition-fast), color var(--transition-fast);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 22px var(--accent-glow);
}

.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 12px 28px var(--accent-glow);
}

.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.secondary:hover {
  background: var(--surface-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================================
   Sections
   ========================================================= */
.section {
  position: relative;
  padding: 120px 0;
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.section h2 {
  font-size: clamp(2rem, 3.6vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 700;
}

.section p {
  color: var(--text-soft);
}

.section-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-intro {
  max-width: 720px;
  font-size: 1.07rem;
  color: var(--text-soft);
  margin-bottom: 50px;
}

.section-toggle {
  display: none;
}

.section-more {
  margin: 44px auto 0;
  max-width: 640px;
  text-align: center;
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.section-more a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.section-more a:hover {
  border-bottom-color: var(--accent);
}

.section.alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-services {
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.section-services::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -120px;
  width: 480px;
  height: 480px;
  background: radial-gradient(
    circle,
    var(--accent-soft) 0%,
    transparent 70%
  );
  pointer-events: none;
}

/* =========================================================
   Cards / grids
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
}

.card {
  position: relative;
  display: block;
  background: var(--surface);
  padding: 30px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
    border-color var(--transition), background var(--transition);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

a.card {
  cursor: pointer;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.93rem;
  transition: gap var(--transition-fast);
}

.card:hover .card-cta {
  gap: 10px;
}

.card-cta::after {
  content: "→";
  display: inline-block;
  transition: transform var(--transition-fast);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    transparent 50%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.card:hover::after {
  opacity: 1;
}

.card.featured {
  background: linear-gradient(
    180deg,
    var(--surface) 0%,
    var(--surface-soft) 100%
  );
  border-color: var(--accent-soft);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-size: 1.5rem;
  background: var(--accent-soft);
  margin-bottom: 18px;
  border: 1px solid var(--accent-soft);
}

.card h3 {
  font-size: 1.25rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
  color: var(--text);
  font-weight: 700;
}

.card p {
  color: var(--text-soft);
  margin-bottom: 18px;
  font-size: 0.97rem;
}

.card-points {
  list-style: none;
  display: grid;
  gap: 10px;
}

.card-points li {
  position: relative;
  padding-left: 22px;
  color: var(--text-soft);
  font-size: 0.93rem;
}

.card-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 12px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* =========================================================
   Process
   ========================================================= */
.process {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  counter-reset: step;
}

@media (max-width: 900px) {
  .process {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .section-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    margin-top: -20px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
  }

  .section-toggle:hover {
    border-color: var(--accent-soft);
  }

  .section-toggle::after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.25s;
  }

  .section-toggle[aria-expanded="true"]::after {
    transform: rotate(-135deg) translate(-2px, -2px);
  }

  .section-services .grid,
  .section-systems .grid {
    display: none;
    margin-top: 28px;
  }

  .section-services.expanded .grid,
  .section-systems.expanded .grid {
    display: grid;
  }

  .section-services .section-more,
  .section-systems .section-more {
    display: none;
  }

  .section-services.expanded .section-more,
  .section-systems.expanded .section-more {
    display: block;
  }
}

@media (max-width: 560px) {
  .process {
    grid-template-columns: 1fr;
  }
}

.process div {
  position: relative;
  background: var(--surface);
  padding: 26px 24px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.process div:hover {
  transform: translateY(-4px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-md);
}

.process h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 700;
}

.process p {
  font-size: 0.94rem;
  color: var(--text-soft);
}

/* =========================================================
   Contact
   ========================================================= */
.contact {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.contact .container {
  max-width: 820px;
}

.contact > .container > p {
  max-width: 640px;
  font-size: 1.05rem;
}

.contact form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 32px;
}

.contact form .field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.contact form .field.full,
.contact form > button,
.contact form > #contactErrorMessages {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  font-size: 0.97rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast), background var(--transition-fast),
    transform var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23808a9d' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 42px;
  cursor: pointer;
}

input:hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: var(--text-muted);
  background: var(--surface-soft);
}

input:hover::placeholder,
textarea:hover::placeholder {
  color: var(--text-soft);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 5px var(--accent-soft),
    0 6px 18px rgba(0, 0, 0, 0.05);
}

input.invalid,
select.invalid,
textarea.invalid {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.04);
}

input.invalid:focus,
select.invalid:focus,
textarea.invalid:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.15),
    0 6px 18px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] input.invalid,
[data-theme="dark"] select.invalid,
[data-theme="dark"] textarea.invalid {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.06);
}

[data-theme="dark"] input.invalid:focus,
[data-theme="dark"] select.invalid:focus,
[data-theme="dark"] textarea.invalid:focus {
  border-color: #f87171;
  box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.18),
    0 6px 18px rgba(0, 0, 0, 0.05);
}

/* Inline error text below the field. Collapses to zero height when empty
   so the form stays compact; smoothly slides into view when an error is set. */
.field-error {
  display: block;
  overflow: hidden;
  max-height: 0;
  padding: 0 2px;
  font-size: 0.82rem;
  line-height: 1.4;
  font-weight: 500;
  color: #dc2626;
  opacity: 0;
  transition: max-height 0.25s ease, padding-top 0.25s ease,
    opacity 0.18s ease;
}

.field-error:not(:empty) {
  max-height: 80px;
  padding-top: 7px;
  opacity: 1;
}

[data-theme="dark"] .field-error {
  color: #f87171;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.contact form button.primary {
  transition: transform var(--transition-fast),
    background var(--transition-fast), box-shadow var(--transition-fast);
}

.contact form button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px var(--accent-glow);
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

#status {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--text-soft);
  min-height: 1.4em;
  transition: color var(--transition-fast);
}

#status[data-state="success"] {
  color: #16a34a;
}

[data-theme="dark"] #status[data-state="success"] {
  color: #4ade80;
}

#status[data-state="error"] {
  color: #dc2626;
}

[data-theme="dark"] #status[data-state="error"] {
  color: #f87171;
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  background: var(--bg-alt);
  color: var(--text-muted);
  text-align: center;
  padding: 32px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* =========================================================
   Fade-in animation
   ========================================================= */
.fade-section,
.grid:not(.no-fade) > .card,
.process > div,
.feature-list > li,
.service-content > h2,
.service-content > p,
.service-content > .tech-stack,
.service-content > .tech-stack-note,
.service-content > .info-box,
.service-content > .service-cta-box {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.fade-section.visible,
.grid:not(.no-fade) > .card.visible,
.process > div.visible,
.feature-list > li.visible,
.service-content > h2.visible,
.service-content > p.visible,
.service-content > .tech-stack.visible,
.service-content > .tech-stack-note.visible,
.service-content > .info-box.visible,
.service-content > .service-cta-box.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Double-fade guard: if an auto-fade element is already inside a .fade-section
   ancestor (e.g. the reality list), disable the per-child animation so the
   whole block just fades once with the parent. */
.fade-section .grid:not(.no-fade) > .card,
.fade-section .process > div,
.fade-section .feature-list > li,
.fade-section .service-content > h2,
.fade-section .service-content > p,
.fade-section .service-content > .tech-stack,
.fade-section .service-content > .tech-stack-note,
.fade-section .service-content > .info-box,
.fade-section .service-content > .service-cta-box {
  opacity: 1;
  transform: none;
  transition: none;
}

/* Stagger — auto-fade children cascade in instead of popping together */
.grid:not(.no-fade) > .card:nth-child(1) { transition-delay: 0s; }
.grid:not(.no-fade) > .card:nth-child(2) { transition-delay: 0.08s; }
.grid:not(.no-fade) > .card:nth-child(3) { transition-delay: 0.16s; }
.grid:not(.no-fade) > .card:nth-child(4) { transition-delay: 0.24s; }
.grid:not(.no-fade) > .card:nth-child(5) { transition-delay: 0.32s; }
.grid:not(.no-fade) > .card:nth-child(6) { transition-delay: 0.40s; }

.process > div:nth-child(1) { transition-delay: 0s; }
.process > div:nth-child(2) { transition-delay: 0.06s; }
.process > div:nth-child(3) { transition-delay: 0.12s; }
.process > div:nth-child(4) { transition-delay: 0.18s; }
.process > div:nth-child(5) { transition-delay: 0.24s; }
.process > div:nth-child(6) { transition-delay: 0.30s; }

.feature-list > li:nth-child(1) { transition-delay: 0s; }
.feature-list > li:nth-child(2) { transition-delay: 0.05s; }
.feature-list > li:nth-child(3) { transition-delay: 0.10s; }
.feature-list > li:nth-child(4) { transition-delay: 0.15s; }
.feature-list > li:nth-child(5) { transition-delay: 0.20s; }
.feature-list > li:nth-child(6) { transition-delay: 0.25s; }

.fade-section-hero {
  opacity: 0;
  transition: opacity 1.1s ease;
}

.fade-section-hero.visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .contact form {
    grid-template-columns: 1fr;
  }

  .contact form .field,
  .contact form .field.full,
  .contact form > button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 160px;
  }

  .header {
    height: auto;
    padding: 14px 0;
  }

  .header-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-left {
    justify-content: space-between;
  }

  .logo {
    text-align: left;
    font-size: 1.15rem;
  }

  .main-nav {
    width: 100%;
    justify-content: flex-start;
    gap: 22px;
    flex-wrap: wrap;
  }

  .main-nav a {
    font-size: 0.9rem;
  }

  .hero h2 {
    font-size: 2.2rem;
    line-height: 1.12;
  }

  .hero p {
    font-size: 1rem;
  }

  .section {
    padding: 90px 0;
  }

  .section-intro {
    margin-bottom: 36px;
  }

  .card {
    padding: 26px 22px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }

  .logo {
    font-size: 1rem;
  }

  .hero h2 {
    font-size: 1.85rem;
  }

  .hero p {
    font-size: 0.96rem;
  }

  .btn {
    width: 100%;
    padding: 13px 18px;
  }

  .cta {
    flex-direction: column;
    align-items: stretch;
  }

  .section {
    padding: 76px 0;
  }

  .card h3 {
    font-size: 1.15rem;
  }
}

/* =========================================================
   Service detail pages
   ========================================================= */
.service-hero {
  position: relative;
  background: var(--hero-bg);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.service-hero > .container {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--header-height);
  padding-bottom: 48px;
}

.service-hero .hero-top-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.service-hero .hero-top-row .hero-eyebrow {
  margin: 0;
}

.service-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.55) 0%,
    transparent 70%
  );
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.55) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.service-hero .container {
  position: relative;
}

.service-hero h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 18px 0 20px;
  max-width: 820px;
  font-weight: 700;
}

.service-hero p.lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  color: var(--text-soft);
  max-width: 720px;
  margin-bottom: 32px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  transition: color var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast);
  width: fit-content;
}

.back-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-2px);
}

.back-link::before {
  content: "←";
  font-weight: 700;
}

.service-content {
  max-width: 860px;
}

.service-content h2 {
  font-size: clamp(1.5rem, 2.2vw, 1.9rem);
  margin-top: 48px;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.service-content h2:first-child {
  margin-top: 0;
}

.service-content p {
  margin-bottom: 16px;
  font-size: 1.03rem;
  line-height: 1.75;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: 14px;
  margin: 20px 0 10px;
}

.reality-container {
  max-width: var(--container);
}

#services .grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1099px) {
  #services .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 559px) {
  #services .grid {
    grid-template-columns: 1fr;
  }
}

#systems .grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
  #systems .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  #systems .grid {
    grid-template-columns: 1fr;
  }
}

.reality-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 38px;
}

@media (max-width: 900px) {
  .reality-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .reality-groups {
    grid-template-columns: 1fr;
  }
}

/* Flippable card: .reality-group is the perspective wrapper, .reality-group-inner
   does the rotation, and .reality-group-front / .reality-group-back carry the
   actual card surface. Both faces are stacked in the same grid cell so the
   parent's height matches the taller of the two faces. */
.reality-group {
  position: relative;
  perspective: 1400px;
  cursor: pointer;
  min-height: 260px;
  /* Disable double-tap-to-zoom and the legacy 300ms click delay on mobile
     so the tap registers as a click immediately, without racing any other
     synthetic events. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.reality-group-inner {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 260px;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.2, 0.7, 0.25, 1);
}

/* Mouse hover flips the card — but only when the most recent pointer input
   was actually a mouse. On hybrid devices the JS input tracker flips the
   html[data-pointer-type] attribute to "touch" as soon as the user touches
   the screen, so the hover rule below stops matching and we don't get a
   ghost flip from synthetic hover events. */
@media (hover: hover) {
  html[data-pointer-type="mouse"]
    .reality-group:not(.flipped):hover
    .reality-group-inner {
    transform: rotateY(180deg);
  }
}

.reality-group.flipped .reality-group-inner {
  transform: rotateY(180deg);
}

.reality-group-front,
.reality-group-back {
  grid-area: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-sm);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: border-color var(--transition),
    box-shadow var(--transition), background var(--transition);
}

/* Only the currently visible face captures pointer events. Without this,
   mobile taps on a flipped card often hit the (invisible) front element
   instead of the back, because `backface-visibility: hidden` hides the
   face visually but doesn't exclude it from touch hit-testing. */
.reality-group:not(.flipped) .reality-group-back {
  pointer-events: none;
}

.reality-group.flipped .reality-group-front {
  pointer-events: none;
}

@media (hover: hover) {
  html[data-pointer-type="mouse"] .reality-group:hover .reality-group-front,
  html[data-pointer-type="mouse"] .reality-group:hover .reality-group-back {
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-md);
    background: var(--surface-soft);
  }
}

.reality-group.flipped .reality-group-front,
.reality-group.flipped .reality-group-back {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-md);
  background: var(--surface-soft);
}

.reality-group-front {
  position: relative;
}

.reality-group-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.reality-group-front h3 {
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  margin: 0 44px 16px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.reality-group-front ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.reality-group-front ul li {
  position: relative;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.reality-group-front ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 10px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Flip indicator in the top-right of the front face. Always subtly visible
   so users know the card is interactive, brightens on hover. */
.flip-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  opacity: 0.55;
  pointer-events: none;
  transition: opacity var(--transition-fast),
    transform var(--transition-fast),
    border-color var(--transition-fast);
}

@media (hover: hover) {
  html[data-pointer-type="mouse"] .reality-group:hover .flip-indicator {
    opacity: 0.95;
    border-color: var(--accent-soft);
  }
}

/* Back face content */
.reality-group-back h4 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px;
}

.reality-group-back p {
  color: var(--text-soft);
  font-size: 0.96rem;
  line-height: 1.6;
  margin: 0 0 14px;
}

.reality-group-back .back-footer {
  margin: auto 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-muted);
}

.reality-footer {
  margin: 38px auto 0;
  max-width: 760px;
  text-align: center;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.55;
}

.feature-list li {
  position: relative;
  padding: 16px 18px 16px 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.98rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), transform var(--transition);
}

.feature-list li:hover {
  border-color: var(--accent-soft);
  transform: translateX(2px);
}

.feature-list li::before {
  content: "✓";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

.feature-list li strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}

.feature-list li span {
  color: var(--text-soft);
  font-size: 0.92rem;
}

.env-note {
  padding: 14px 18px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  color: var(--text-soft);
  font-size: 0.97rem;
  line-height: 1.55;
  max-width: 720px;
  margin-bottom: 32px;
}

.env-note strong {
  color: var(--text);
  font-weight: 600;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.tech-stack span {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-soft);
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "SF Mono", Consolas,
    "Liberation Mono", monospace;
  transition: color var(--transition-fast),
    border-color var(--transition-fast), background var(--transition-fast);
}

.tech-stack span:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--surface-soft);
}

.tech-stack-note {
  margin: 0 0 44px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.tech-stack-note strong {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-right: 8px;
}

.info-box {
  margin: 40px 0 20px;
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  background: var(--surface-soft);
}

.info-box-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.info-box p {
  margin: 0;
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.7;
}

.info-box p strong {
  color: var(--text);
  font-weight: 600;
}

.service-cta-box {
  margin-top: 60px;
  padding: 36px 32px;
  background: linear-gradient(
    135deg,
    var(--accent-soft) 0%,
    transparent 100%
  );
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-card);
  text-align: center;
}

.service-cta-box h3 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--text);
}

.service-cta-box p {
  color: var(--text-soft);
  margin-bottom: 20px;
}
