/* Infinihex site styles. Palette mirrors the app's dark theme
   (src/ui/tokens/themes.ts): cool-neutral grays, cyan accent. */

:root {
  --surface-base: #0e1115;
  --surface-panel: #161a20;
  --surface-raised: #1c2128;
  --border-subtle: #262b33;
  --border-strong: #343a44;
  --text-primary: #e6ecf2;
  --text-secondary: #aab2bd;
  --text-muted: #8b95a3;
  --accent: #5db4e0;
  --accent-fill: #2a6f8f;
  --accent-text: #7ac6e8;
  --maxw: 1024px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface-base);
  color: var(--text-primary);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; }

.muted { color: var(--text-muted); }

/* --- Header / nav ------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 24px;
}
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; }
.site-nav { display: flex; gap: 22px; font-size: 15px; }
.site-nav a { color: var(--text-secondary); }
.site-nav a:hover { color: var(--text-primary); text-decoration: none; }

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

/* --- Hero (the living hex map) ------------------------------------------ */
/* Full-bleed band: breaks out of main's max-width so the generated hex world
   spans the whole viewport behind the copy. */
.hero {
  position: relative;
  margin-left: calc(50% - 50vw);
  width: 100vw;
  text-align: center;
  padding: 56px 24px 40px;
  box-sizing: border-box;
  overflow: hidden;
}
/* The seeded hex-map canvas, filling the band. */
.hero-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
/* Scrim: a radial darken so the copy + form stay readable over the map. The map
   reads loud at the edges, calm behind the text. */
.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    /* readability darken behind the copy */
    radial-gradient(ellipse 60% 70% at 50% 42%, rgba(14,17,21,0.92) 0%, rgba(14,17,21,0.72) 45%, rgba(14,17,21,0.45) 100%),
    /* top + bottom EDGE FADES → solid base, so the map melts into the page
       instead of ending on a hard seam. Bottom ramps to fully opaque base in the
       last ~22% of the band; top has a gentler fade under the header. */
    linear-gradient(
      to bottom,
      var(--surface-base) 0%,
      rgba(14,17,21,0.35) 14%,
      rgba(14,17,21,0.2) 55%,
      rgba(14,17,21,0.65) 82%,
      var(--surface-base) 100%
    );
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; }

.hero-logo { width: 300px; max-width: 80%; height: auto; margin-bottom: 20px; }
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin: 0 0 16px;
  text-shadow: 0 2px 24px rgba(14,17,21,0.8); /* lift off the busy map */
}
.lede {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 28px;
  text-shadow: 0 1px 12px rgba(14,17,21,0.9);
}

/* Seed bar — bottom-right of the hero band, ties the world to a seed. */
.hero-seedbar {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 12px ui-monospace, Menlo, Consolas, monospace;
  color: var(--text-muted);
  background: rgba(14,17,21,0.55);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 8px 5px 12px;
}
.hero-seedbar-label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 10px; }
.hero-seedbar-value { color: var(--text-secondary); }
.hero-reroll {
  font: 12px system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.hero-reroll:hover { filter: brightness(1.2); }

/* Reduced motion / no-JS: the map is static-per-seed anyway (no animation yet),
   so nothing to disable here — but keep the canvas from being a tab stop. */
.hero-map { user-select: none; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn-primary { background: var(--accent-fill); color: #fff; border-color: var(--accent); }

/* --- Signup form (hero) — the page's primary CTA ----------------------- */
/* This is a funnel page: the signup IS the action, so the form reads as a
   confident inline bar (email + button on one row), centered, with the privacy
   line small below. The wrapper width caps the bar so it stays a tidy focal
   unit rather than stretching the full hero column. */
/* Subtle panel behind the CTA so it reads as a distinct focal block. */
.signup {
  max-width: 440px;
  margin: 8px auto 0;
  padding: 18px 20px;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

/* MailerLite signup form — on-brand overrides + inline-bar layout.
   The embed (index.njk) ships with MailerLite's light, stacked defaults; these
   scoped #mlb2-… rules remap it onto the site's dark/cyan tokens AND relayout it
   into a single-row signup bar. !important throughout because MailerLite's own
   inline rules use !important (incl. float:left / width:100% on every row) — we
   have to match to win. If you re-export and the container ID changes, update
   this selector prefix. */
#mlb2-42948475.ml-form-embedContainer { width: 100% !important; display: block !important; }
/* Kill the card chrome — the form reads as part of the hero, not a box. */
#mlb2-42948475 .ml-form-embedWrapper {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 100% !important;
  max-width: none !important;
  display: block !important;
}
#mlb2-42948475 .ml-form-embedBody { padding: 0 !important; }
/* Hide the form's own heading/subhead — the hero lede already covers it. */
#mlb2-42948475 .ml-form-embedContent { display: none !important; }

/* Lay the form out as a row: [ email (grows) ] [ button ], privacy wraps below. */
#mlb2-42948475 .ml-block-form {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: stretch !important;
  gap: 8px !important;
}
/* Email row: grow to eat all remaining space so there's no dead gap between the
   field and the button (flex-basis 0 → the flex-grow does the sizing). */
#mlb2-42948475 .ml-form-formContent {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  float: none !important;
  margin: 0 !important;
  width: auto !important;
}
#mlb2-42948475 .ml-form-fieldRow { margin: 0 !important; width: 100% !important; }
/* Submit row: natural width, sits beside the email; clear float + margin. */
#mlb2-42948475 .ml-form-embedSubmit {
  flex: 0 0 auto !important;
  float: none !important;
  margin: 0 !important;
  width: auto !important;
}
/* Privacy line: force onto its own full-width line below the bar. */
#mlb2-42948475 .ml-form-embedPermissions {
  flex: 1 1 100% !important;
  float: none !important;
  order: 9 !important;
  width: 100% !important;
  margin: 0 !important;
}

/* Email input → match the app's text fields. */
#mlb2-42948475 .ml-form-fieldRow input {
  background-color: var(--surface-sunken) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 8px !important;
  font: 15px system-ui, -apple-system, "Segoe UI", sans-serif !important;
  padding: 12px 14px !important;
  height: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
#mlb2-42948475 .ml-form-fieldRow input::placeholder { color: var(--text-muted) !important; }

/* Submit button → the .btn-primary look; sized to sit in the bar. */
#mlb2-42948475 .ml-form-embedSubmit button.primary {
  background: var(--accent-fill) !important;
  border: 1px solid var(--accent) !important;
  color: #fff !important;
  border-radius: 8px !important;
  font: 600 15px system-ui, -apple-system, "Segoe UI", sans-serif !important;
  padding: 12px 22px !important;
  width: auto !important;
  white-space: nowrap !important;
  height: 100% !important;
  transition: filter 0.15s ease !important;
}
#mlb2-42948475 .ml-form-embedSubmit button.primary:hover { filter: brightness(1.12); background: var(--accent-fill) !important; }

/* Privacy line → small, muted, centered under the bar; link → accent. */
#mlb2-42948475 .ml-form-embedPermissionsContent p,
#mlb2-42948475 .ml-form-embedPermissionsContent.privacy-policy p {
  color: var(--text-muted) !important;
  font: 0.82rem/1.5 system-ui, sans-serif !important;
  text-align: center !important;
  margin: 4px 0 0 !important;
}
#mlb2-42948475 .ml-form-embedPermissionsContent p a { color: var(--accent-text) !important; }

/* Success state → on-brand, centered. */
#mlb2-42948475 .ml-form-successContent { text-align: center !important; }
#mlb2-42948475 .ml-form-successContent h4 { color: var(--text-primary) !important; font-weight: 700 !important; }
#mlb2-42948475 .ml-form-successContent p { color: var(--text-secondary) !important; }

/* On narrow screens, stack the bar (email above button, both full-width). */
@media (max-width: 520px) {
  #mlb2-42948475 .ml-form-formContent,
  #mlb2-42948475 .ml-form-embedSubmit { flex: 1 1 100% !important; }
  #mlb2-42948475 .ml-form-embedSubmit button.primary { width: 100% !important; }
}

/* --- Screenshot carousel ------------------------------------------------ */
.screenshot { margin: 16px 0 48px; }

.carousel {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--surface-panel);
}
/* Frame holds the (≈3:2) screenshots; slides stack and crossfade. */
.carousel-track { position: relative; aspect-ratio: 2374 / 1560; }
.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.shot.is-active { opacity: 1; pointer-events: auto; }

/* Prev/next arrows. */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--text-primary);
  background: rgba(14, 17, 21, 0.6);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.carousel-arrow:hover { background: rgba(14, 17, 21, 0.85); }
.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }

/* Dots. */
.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}
.carousel-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(14, 17, 21, 0.6);
  cursor: pointer;
  transition: background 0.15s ease;
}
.carousel-dot.is-active { background: var(--accent); border-color: var(--accent); }

/* --- Pitch / features --------------------------------------------------- */
.pitch { padding: 24px 0 48px; }
.pitch h2 { font-size: 1.8rem; text-align: center; margin: 0 0 12px; }
.pitch-rule {
  text-align: center; max-width: 680px; margin: 0 auto 36px;
  color: var(--text-secondary);
}
/* Real three-up: three equal columns, description on top, title below it (like
   a caption). Collapses to one column on narrow screens. */
/* Feature grid — the page's layout language is the hex.
   A clean 3-wide aligned grid (no stagger — the offset read as broken). The hex
   motif comes from each card's faceted corners + the hexagon icon plate, which
   is plenty to carry the theme without sacrificing alignment or readability. */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 26px;
  align-items: stretch; /* equal-height rows so the faceted cards line up */
}

.feature {
  position: relative;
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  padding: 24px 22px;
  /* Hex-edge nod: clip the top-right and bottom-left corners on a 45° so the
     card reads as a faceted comb cell rather than a plain rounded box. */
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  border-radius: 6px;
}
/* Hexagon icon plate (pointy-top), tinted in accent. */
.feature-icon {
  width: 44px;
  height: 48px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-text);
  background: var(--surface-raised);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.feature-icon svg { width: 24px; height: 24px; display: block; }
.feature h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: var(--text-primary);
}
.feature p { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }

/* Reflow to 2-up, then 1-up on narrower screens. */
@media (max-width: 860px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .features { grid-template-columns: 1fr; }
}

/* Re-CTA after the feature grid — funnel re-prompt that scrolls to the form. */
.recta { text-align: center; padding: 8px 0 48px; }
.recta-lead { font-size: 1.1rem; color: var(--text-secondary); margin: 0 0 16px; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }

.closing { text-align: center; padding: 24px 0 56px; }
.closing h2 { font-size: 1.5rem; margin: 0 0 8px; }

/* --- Legal page --------------------------------------------------------- */
.legal { max-width: 720px; margin: 0 auto; padding: 32px 0 56px; }
.legal h1 { margin: 0 0 24px; }
.legal p { color: var(--text-secondary); margin: 0 0 16px; }

/* --- Blog --------------------------------------------------------------- */
/* Index: a clean list of posts, newest first. */
.blog-index { max-width: 720px; margin: 0 auto; padding: 32px 0 56px; }
.blog-index h1 { margin: 0 0 6px; }
.blog-intro { color: var(--text-muted); margin: 0 0 32px; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list-item { padding: 18px 0; border-top: 1px solid var(--border-subtle); }
.post-list-item:last-child { border-bottom: 1px solid var(--border-subtle); }
.post-list-link { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.post-list-link:hover { text-decoration: none; }
.post-list-title { font-size: 1.15rem; font-weight: 600; color: var(--text-primary); }
.post-list-link:hover .post-list-title { color: var(--accent-text); }
.post-list-date { flex: 0 0 auto; font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.post-list-excerpt { margin: 6px 0 0; color: var(--text-secondary); font-size: 0.95rem; }

/* Single post: readable measure + typographic rhythm. */
.post { max-width: 680px; margin: 0 auto; padding: 28px 0 64px; }
.post-back { display: inline-block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 24px; }
.post-back:hover { color: var(--text-secondary); text-decoration: none; }
.post-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 8px; }
.post-meta { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 32px; }
.post-body { color: var(--text-secondary); font-size: 1.05rem; line-height: 1.7; }
.post-body h2 { color: var(--text-primary); font-size: 1.5rem; margin: 2em 0 0.6em; }
.post-body h3 { color: var(--text-primary); font-size: 1.2rem; margin: 1.6em 0 0.5em; }
.post-body p { margin: 0 0 1.2em; }
.post-body a { color: var(--accent-text); }
.post-body ul, .post-body ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.post-body li { margin: 0 0 0.4em; }
.post-body blockquote {
  margin: 1.6em 0; padding: 14px 20px;
  border-left: 3px solid var(--accent);
  background: var(--surface-panel);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}
.post-body blockquote p { margin: 0; }            /* no stray top/bottom gaps */
.post-body blockquote p + p { margin-top: 0.6em; } /* but space the cite line */
.post-body blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.post-body code {
  background: var(--surface-raised); padding: 2px 6px; border-radius: 4px;
  font: 0.9em ui-monospace, Menlo, Consolas, monospace;
}
.post-body img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border-subtle); }

/* Figure: a centered image with a caption (e.g. the campaign-map shot). */
.post-figure { margin: 2em 0; text-align: center; }
.post-figure img { display: block; margin: 0 auto; }
.post-figure figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

/* Feature rows — alternating text + image, an eye-pleasing break from prose
   walls (the {% feature %} shortcode). Stacks image-on-top on narrow screens. */
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
  margin: 2.4em 0;
}
.feature-row--right .feature-row-media { order: 2; }   /* image right */
.feature-row--left .feature-row-text { order: 2; }     /* image left */
.feature-row--solo { grid-template-columns: 1fr; }     /* no image → full width */
.feature-row-text > :first-child { margin-top: 0; }
.feature-row-text > :last-child { margin-bottom: 0; }
.feature-row-text h2, .feature-row-text h3 { margin-top: 0; }
.feature-row-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}
@media (max-width: 640px) {
  .feature-row { grid-template-columns: 1fr; gap: 16px; }
  /* always image-on-top, text below, regardless of desktop side */
  .feature-row--right .feature-row-media,
  .feature-row--left .feature-row-text { order: 0; }
  .feature-row-media { order: -1; }
}

/* End-of-post CTA — the signup form (reuses .signup + the #mlb2 overrides).
   TODO: becomes a Buy block when the app ships. */
.post-cta {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 0 64px;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  padding-top: 36px;
}
.post-cta-lead { font-size: 1.15rem; color: var(--text-secondary); margin: 0 0 18px; }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 48px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.site-footer p { margin: 4px 0; }

/* --- Docs --------------------------------------------------------------- */
.docs-shell { display: grid; grid-template-columns: 200px 1fr; gap: 36px; padding: 32px 0 56px; }
.docs-sidebar-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 10px; }
.docs-sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.docs-sidebar nav a { color: var(--text-secondary); font-size: 0.95rem; }
.docs-sidebar nav a:hover { color: var(--text-primary); text-decoration: none; }
.docs-content { min-width: 0; }
.docs-content h1 { margin-top: 0; }
.docs-content h2 { margin-top: 2em; border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px; }
.docs-content blockquote {
  margin: 1.4em 0; padding: 12px 18px;
  background: var(--surface-panel);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}
.docs-content code {
  background: var(--surface-raised);
  padding: 2px 6px; border-radius: 4px;
  font: 0.9em ui-monospace, Menlo, Consolas, monospace;
}

@media (max-width: 720px) {
  .docs-shell { grid-template-columns: 1fr; gap: 20px; }
  .docs-sidebar { border-bottom: 1px solid var(--border-subtle); padding-bottom: 16px; }
  .docs-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 16px; }
}
