/* ──────────────────────────────────────────────────────────────────────
   Enscrive Impeccable — api.enscrive.io regional placeholder

   Pure CSS (no Tailwind runtime on edge hosts). Tokens match
   enscrive.io and docs.enscrive.io per
   enscrive-governance/docs/internal/IMPECCABLE-DESIGN.md §5.

   This stylesheet is served statically by Caddy on each regional edge
   host (us / eu / ap). Fonts load via <link> tags in index.html.
   ────────────────────────────────────────────────────────────────────── */

:root {
  /* Neutrals (ink = background, fog = foreground) */
  --ink-975: oklch(0.16 0.01 255);
  --ink-925: oklch(0.22 0.015 255);
  --ink-850: oklch(0.30 0.018 255);
  --ink-800: oklch(0.36 0.020 255);

  --fog-100: oklch(0.97 0.005 260);
  --fog-300: oklch(0.85 0.012 260);
  --fog-500: oklch(0.70 0.015 260);
  --fog-600: oklch(0.60 0.015 260);

  /* Primary */
  --signal-400: oklch(0.75 0.17 255);
  --signal-500: oklch(0.68 0.19 255);
  --signal-600: oklch(0.58 0.20 255);

  /* Semantic */
  --field-500: oklch(0.74 0.16 155);
  --ember-500: oklch(0.80 0.14 85);
  --flare-500: oklch(0.66 0.22 25);

  /* Motion */
  --t-fast: 150ms;
  --t-base: 300ms;
  --t-big:  700ms;
  --e-out:   cubic-bezier(0.22, 1, 0.36, 1);
  --e-brand: cubic-bezier(0.65, 0, 0.35, 1);

  /* Families (loaded via <link> in index.html) */
  --font-sans:  "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-family: var(--font-sans);
  color: var(--fog-300);
  background: var(--ink-975);
}
body {
  background:
    radial-gradient(ellipse 70% 48% at 24% 0%, oklch(0.68 0.19 255 / 0.08), transparent 70%),
    var(--ink-975);
  min-height: 100vh;
  font-size: 1rem;
  line-height: 1.6;
}

a {
  color: var(--signal-400);
  text-decoration: none;
  transition: color var(--t-fast) var(--e-out);
}
a:hover { color: oklch(0.82 0.14 255); }
a:focus-visible {
  outline: 2px solid var(--signal-500);
  outline-offset: 2px;
  border-radius: 2px;
}

strong { color: var(--fog-100); font-weight: 600; }

/* Serif italic display accent: <em> inside h1/h2 picks it up */
h1 em, h2 em, h3 em, .display-serif {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  color: inherit;
}

/* ──────────────────────────────────────────────────────────────────────
   Layout shell
   ────────────────────────────────────────────────────────────────────── */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 3vw, 2rem) 6rem;
}

/* ── Brand header ─────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 2.5rem;
  margin-bottom: 3.5rem;
  border-bottom: 1px solid var(--ink-850);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.wordmark-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.region {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal-400);
  padding: 0.25rem 0.6rem;
  background: oklch(0.68 0.19 255 / 0.10);
  border: 1px solid oklch(0.68 0.19 255 / 0.25);
  border-radius: 0.4rem;
}

header nav {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  font-size: 0.88rem;
}
header nav a {
  color: var(--fog-500);
  transition: color var(--t-fast) var(--e-out);
}
header nav a:hover { color: var(--fog-100); }

/* ──────────────────────────────────────────────────────────────────────
   Hero (Anchor section)
   ────────────────────────────────────────────────────────────────────── */
.hero {
  padding: 1rem 0 3.5rem;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.5vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--fog-100);
  margin: 0.25rem 0 0;
  max-width: 22ch;
}
.hero .tagline {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--fog-300);
  margin: 1.25rem 0 0;
  max-width: 62ch;
}
.hero .tagline .divider {
  color: var(--fog-600);
  margin: 0 0.4em;
}
.hero .status {
  margin: 1.5rem 0 0;
  font-size: 0.92rem;
  color: var(--fog-500);
  max-width: 62ch;
}

/* ──────────────────────────────────────────────────────────────────────
   Kickers (uppercase section labels above headings)
   ────────────────────────────────────────────────────────────────────── */
.kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fog-500);
  margin: 0 0 1rem;
}

/* ──────────────────────────────────────────────────────────────────────
   Sections (Narrative / Grid)
   ────────────────────────────────────────────────────────────────────── */
section {
  padding: 2.75rem 0;
  border-top: 1px solid var(--ink-850);
}
section h2 {
  font-size: clamp(1.5rem, 2.8vw, 1.875rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fog-100);
  margin: 0 0 0.75rem;
  max-width: 30ch;
}
section > p {
  max-width: 62ch;
  color: var(--fog-300);
}
.lead {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--fog-300);
  margin: 0 0 1.5rem;
  max-width: 62ch;
}

/* ──────────────────────────────────────────────────────────────────────
   Regional list (dot active state)
   ────────────────────────────────────────────────────────────────────── */
.regions {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
}
.regions li {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  background: var(--ink-925);
  border: 1px solid var(--ink-850);
  border-radius: 0.6rem;
  color: var(--fog-300);
  transition: border-color var(--t-fast) var(--e-out);
  font-size: 0.95rem;
  font-weight: 500;
}
.regions li small {
  color: var(--fog-500);
  font-size: 0.78rem;
  font-weight: 400;
  font-family: var(--font-mono);
  letter-spacing: 0;
  margin-left: auto;
}
.regions li .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ink-800);
  box-shadow: 0 0 0 3px oklch(0.36 0.020 255 / 0.25);
  flex-shrink: 0;
  transform: translateY(-1px);
}
.regions li[data-active="true"] {
  border-color: oklch(0.68 0.19 255 / 0.45);
  background: oklch(0.68 0.19 255 / 0.06);
  color: var(--fog-100);
}
.regions li[data-active="true"] .dot {
  background: var(--signal-400);
  box-shadow: 0 0 0 3px oklch(0.75 0.17 255 / 0.25), 0 0 12px oklch(0.75 0.17 255 / 0.5);
}

/* ──────────────────────────────────────────────────────────────────────
   Install code block (single canonical card-code)
   ────────────────────────────────────────────────────────────────────── */
.install pre {
  margin: 1.5rem 0 1rem;
  padding: 1.15rem 1.4rem;
  background: var(--ink-975);
  border: 1px solid var(--ink-850);
  border-radius: 0.75rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fog-100);
  transition: border-color var(--t-fast) var(--e-out);
}
.install pre:hover { border-color: var(--ink-800); }
.install pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font-family: inherit;
}
.install .fine-print {
  font-size: 0.85rem;
  color: var(--fog-500);
  max-width: 62ch;
  margin-top: 0.75rem;
}

/* Inline code token (used in body copy) */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--ink-925);
  border: 1px solid var(--ink-850);
  padding: 0.12em 0.38em;
  border-radius: 0.35rem;
  color: var(--fog-100);
}

/* ──────────────────────────────────────────────────────────────────────
   Coming-soon list
   ────────────────────────────────────────────────────────────────────── */
.coming ul {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.coming ul li {
  padding: 1rem 1.2rem;
  background: var(--ink-925);
  border: 1px solid var(--ink-850);
  border-radius: 0.6rem;
  transition: border-color var(--t-fast) var(--e-out);
  color: var(--fog-300);
  line-height: 1.55;
}
.coming ul li:hover { border-color: var(--ink-800); }
.coming ul li strong {
  font-family: var(--font-mono);
  font-size: 0.95em;
  color: var(--fog-100);
}

/* ──────────────────────────────────────────────────────────────────────
   Footer
   ────────────────────────────────────────────────────────────────────── */
footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ink-850);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
  color: var(--fog-500);
  font-size: 0.85rem;
}
.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--fog-600);
  margin: 0;
}
.footer-meta span:first-child { color: var(--fog-500); }
.footer-meta .sep { margin: 0 0.5rem; color: var(--ink-800); }
.footer-contact { margin: 0; }

/* ──────────────────────────────────────────────────────────────────────
   Wordmark choreography — matches enscrive.io brand motion
   ────────────────────────────────────────────────────────────────────── */
@keyframes enscrive-nav-wordmark-ring-draw {
  from { stroke-dashoffset: 194; }
  to   { stroke-dashoffset: 0; }
}
@keyframes enscrive-nav-wordmark-collapse {
  from { width: 16rem; }
  to   { width: 4rem; }
}
@keyframes enscrive-nav-wordmark-tail-collapse {
  from { width: 14.4rem; opacity: 1; }
  to   { width: 0rem;    opacity: 0; }
}

.enscrive-nav-wordmark-shell {
  display: inline-flex;
  flex: 0 0 auto;
  width: 16rem;
  overflow: hidden;
  animation: enscrive-nav-wordmark-collapse 420ms var(--e-brand) 1500ms forwards;
  will-change: width;
}
.enscrive-nav-wordmark-track {
  display: flex;
  align-items: center;
  width: 16rem;
}
.enscrive-nav-wordmark-mark {
  width: 4rem;
  height: 2.75rem;
  flex: 0 0 4rem;
  max-width: none;
  filter: drop-shadow(0 0 12px oklch(0.68 0.19 255 / 0.18));
}
.enscrive-nav-wordmark-tail-shell {
  display: block;
  width: 14.4rem;
  flex: 0 0 14.4rem;
  margin-left: -2.4rem;
  overflow: hidden;
  animation: enscrive-nav-wordmark-tail-collapse 420ms var(--e-brand) 1500ms forwards;
  will-change: width, opacity;
}
.enscrive-nav-wordmark-tail {
  width: 14.4rem;
  height: 2.75rem;
  max-width: none;
  filter: drop-shadow(0 0 12px oklch(0.68 0.19 255 / 0.18));
}
.enscrive-nav-wordmark-ring {
  stroke-dasharray: 194;
  stroke-dashoffset: 194;
  animation: enscrive-nav-wordmark-ring-draw 700ms var(--e-brand) 430ms forwards;
}

/* ──────────────────────────────────────────────────────────────────────
   Reduced motion
   ────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .enscrive-nav-wordmark-shell        { width: 4rem; }
  .enscrive-nav-wordmark-tail-shell   { width: 0; opacity: 0; }
  .enscrive-nav-wordmark-ring         { stroke-dashoffset: 0; }
}

/* ──────────────────────────────────────────────────────────────────────
   Small screens
   ────────────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  header nav { flex-wrap: wrap; }
  .hero { padding-bottom: 2rem; }
  section { padding: 2rem 0; }
}
