/* Forma-inspired porcelain editorial layout — variant 1 */
:root {
  --page: #efece3;
  --surface: #ffffff;
  --surface-accent: #dad7f7;
  --text: #00012f;
  --text-soft: #15004f;
  --muted: #5a6270;
  --accent: #4970a9;
  --accent-bright: #7751e2;
  --accent-ink: #ffffff;
  --line: rgba(0, 1, 47, 0.12);
  --line-strong: rgba(0, 1, 47, 0.22);
  --radius: 1rem;
  --radius-pill: 3.25rem;
  --rail-width: clamp(220px, 18vw, 300px);
  --content-max: 1280px;
  --section-space: clamp(4rem, 8vw, 7rem);
  --font-display: "Segoe UI", Candara, "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--page);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
}

body, button, input, select, textarea { font: inherit; }

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }

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

h1, h2, h3, p { margin-top: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.4rem, 5.5vw, 4.8rem);
  margin-bottom: 1.25rem;
}

h2 {
  font-size: clamp(1.85rem, 3.2vw, 3rem);
  margin-bottom: 0.85rem;
}

h3 {
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  margin-bottom: 0.5rem;
}

p { color: var(--muted); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* Page shell: side rail + canvas */
.page-frame {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  max-width: 2160px;
  margin: 0 auto;
}

.site-rail {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-strong);
}

.rail-inner { width: 100%; }

.page-canvas {
  min-width: 0;
  width: 100%;
}

.page-main {
  width: min(var(--content-max), calc(100% - clamp(1.25rem, 4vw, 3rem)));
  margin: 0 auto;
  padding-bottom: 4rem;
}

/* Rail header */
.rail-header.site-header {
  position: static;
  background: transparent;
  border: 0;
  color: var(--text);
}

.rail-header .header-inner {
  width: 100%;
  margin: 0;
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem);
  min-height: auto;
  display: grid;
  gap: 0.85rem;
  align-items: center;
}

.rail-header .brand {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.05rem;
  min-width: 0;
}

.rail-header .brand-logo {
  width: clamp(40px, 8vw, 64px);
  height: clamp(40px, 8vw, 64px);
  max-width: 64px;
  max-height: 64px;
  border-radius: calc(var(--radius) * 0.75);
  overflow: hidden;
  flex-shrink: 0;
}

.rail-header .brand-logo svg { width: 100%; height: 100%; }

.rail-header .brand small {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
}

.rail-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  min-width: 0;
}

.rail-header nav a {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  white-space: nowrap;
}

.rail-header nav a:hover { border-color: var(--accent); color: var(--accent); }

.rail-header .header-cta {
  justify-self: start;
  padding: 0.72rem 1.15rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  white-space: nowrap;
}

/* Buttons */
.button, .header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1.35rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  border: 1px solid var(--accent);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  color: var(--accent-ink);
}

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

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

.button-secondary:hover { border-color: var(--accent); }

/* Hero — asymmetric band */
.hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 var(--section-space);
}

.hero-grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}

.hero-copy { min-width: 0; order: 2; }

.hero-visual {
  order: 1;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: calc(var(--radius) * 1.25);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 64px color-mix(in srgb, var(--accent) 14%, transparent);
}

.hero-visual > svg { width: 100%; height: 100%; }

.eyebrow, .section-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

.lead {
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
  max-width: 54ch;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 1rem;
}

.geo-line {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* Sections */
.section {
  padding: var(--section-space) 0;
  border-top: 1px solid var(--line);
}

.section-inner { min-width: 0; }

.section-heading {
  max-width: 780px;
  margin-bottom: clamp(1.5rem, 3vw, 2.75rem);
}

.section-heading > p { font-size: 1.05rem; }

.fact-disclaimer {
  font-size: 0.78rem !important;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Card grids — bento on wide screens */
.cards-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.card {
  min-width: 0;
  padding: 1.35rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.card p { margin-bottom: 0; }

.card-icon, .step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 1rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border-radius: 12px;
}

.card-icon svg, .step-icon svg { width: 26px; height: 26px; }

.card-label {
  display: block;
  color: var(--accent);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.65rem;
  font-weight: 700;
}

.card small {
  display: block;
  color: var(--muted);
  margin-top: 0.45rem;
  font-size: 0.82rem;
}

/* Process — vertical timeline */
.process-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
  position: relative;
}

.process-list::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 20%, transparent));
}

.process-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1.25rem 0 1.25rem 0.5rem;
  position: relative;
}

.step-icon {
  margin-bottom: 0;
  position: relative;
  z-index: 1;
  background: var(--page);
}

/* Stats */
.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.stat {
  padding: 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  border-top: 3px solid var(--accent);
}

.stat strong {
  display: block;
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat span { font-weight: 700; color: var(--text); }

.stat p { font-size: 0.88rem; margin: 0.5rem 0 0; }

/* Geography */
.component-geography {
  background: var(--text) !important;
  color: #f4f6fa;
  border-radius: calc(var(--radius) * 1.5);
  margin: 0 calc(-1 * clamp(0px, 2vw, 1rem));
  padding-left: clamp(1rem, 3vw, 2rem);
  padding-right: clamp(1rem, 3vw, 2rem);
}

.component-geography p,
.component-geography span { color: #c8d0de; }

.component-geography .section-kicker { color: #8fabd3; }

.geo-chips {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

.geo-chip {
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.geo-chip strong,
.geo-chip span { display: block; }

.geo-chip span { font-size: 0.88rem; margin-top: 0.35rem; }

/* Guide — two-column chapters */
.guide-body {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.chapter {
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.chapter ul {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
}

.chapter li { color: var(--muted); margin: 0.45rem 0; }

/* FAQ */
.faq-list { max-width: 920px; }

.faq-list details {
  border-bottom: 1px solid var(--line-strong);
  padding: 1rem 0;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list p { padding-right: 1.5rem; }

/* Forms */
.contact-grid,
.calculator-grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  grid-template-columns: 1fr;
}

.contact-form,
.calculator-form {
  display: grid;
  gap: 1rem;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.component-calculator .section-inner {
  background: var(--surface-accent);
  color: var(--text);
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: calc(var(--radius) * 1.5);
}

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

.component-calculator .calculator-form {
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-accent));
}

.contact-form label,
.calculator-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--page);
  color: var(--text);
  padding: 0.82rem 0.9rem;
  border-radius: calc(var(--radius) * 0.65);
}

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

output {
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 800;
}

.form-message { color: var(--accent); margin: 0; }

/* Footer */
.site-footer {
  padding: 3.5rem 0 2rem;
  margin-top: var(--section-space);
  border-top: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 70%, var(--page));
}

.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}

.footer-brand { font-size: 1.45rem; font-weight: 800; }

.site-footer a {
  display: block;
  color: var(--muted);
  margin: 0.35rem 0;
}

.site-footer a:hover { color: var(--accent); }

/* Icon motion — min 10s loops */
.icon-draw path { stroke-dasharray: 34 8; animation: iconDraw 12s linear infinite; }
.icon-pulse { transform-box: fill-box; transform-origin: center; animation: iconPulse 12s ease-in-out infinite; }
.icon-slide { animation: iconSlide 12s ease-in-out infinite; }
.icon-spin { transform-box: fill-box; transform-origin: center; animation: iconSpin 14s linear infinite; }

@keyframes iconDraw { to { stroke-dashoffset: -84; } }
@keyframes iconPulse { 50% { transform: scale(0.9); opacity: 0.75; } }
@keyframes iconSlide { 50% { transform: translateX(4px); } }
@keyframes iconSpin { to { transform: rotate(360deg); } }

/* Desktop side rail */
@media (min-width: 1100px) {
  .page-frame {
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
    gap: 0;
    align-items: start;
  }

  .site-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    border-bottom: 0;
    border-right: 1px solid var(--line-strong);
    display: flex;
    flex-direction: column;
  }

  .rail-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem 1.25rem;
  }

  .rail-header .header-inner {
    padding: 0;
    height: 100%;
    grid-template-rows: auto 1fr auto;
    align-content: space-between;
  }

  .rail-header .brand {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .rail-header nav {
    flex-direction: column;
    align-items: stretch;
  }

  .rail-header nav a { text-align: left; }

  .rail-header .header-cta { width: 100%; }

  .page-main {
    width: min(var(--content-max), calc(100% - 4rem));
    padding-top: 1rem;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: clamp(2rem, 4vw, 4rem);
  }

  .hero-copy { order: 1; }
  .hero-visual { order: 2; }

  .cards-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .cards-grid .card:nth-child(6n+1),
  .cards-grid .card:nth-child(6n+2) { grid-column: span 6; }
  .cards-grid .card:nth-child(6n+3),
  .cards-grid .card:nth-child(6n+4),
  .cards-grid .card:nth-child(6n+5) { grid-column: span 4; }
  .cards-grid .card:nth-child(6n) { grid-column: span 12; }

  #services .cards-grid .card { grid-column: span 4; }
  #scenarios .cards-grid .card:nth-child(odd) { grid-column: span 7; }
  #scenarios .cards-grid .card:nth-child(even) { grid-column: span 5; }

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

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

  .guide-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .contact-grid,
  .calculator-grid { grid-template-columns: 1fr 1fr; }

  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }

  .process-list li {
    grid-template-columns: auto 1fr;
    max-width: 720px;
  }
}

@media (min-width: 720px) and (max-width: 1099px) {
  .rail-header .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand cta"
      "nav nav";
  }

  .rail-header .brand { grid-area: brand; }
  .rail-header nav { grid-area: nav; }
  .rail-header .header-cta { grid-area: cta; justify-self: end; margin: 0; }

  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-copy { order: 1; }
  .hero-visual { order: 2; }

  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .geo-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 719px) {
  .rail-header nav { display: none; }
  .rail-header .header-cta { margin-left: auto; }
  .hero-visual { min-height: 220px; }
  .section { padding: 3.5rem 0; }
}

@media (min-width: 1440px) {
  .page-frame {
    --content-max: 1360px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover { transform: none; }
}
