/* ==========================================================================
   MANDA — web design system
   Warm monochrome editorial · light primary, dark secondary
   Type: Hedvig Letters Serif (display) + Hedvig Letters Sans (body/UI) + mono
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* ----- Palette (light = principal) ----- */
:root {
  --surface: #faf9f6;   /* page background — warm cream */
  --card: #ffffff;      /* card inner surfaces */
  --ink: #121212;       /* primary text, filled buttons */
  --ink-soft: #333333;  /* tertiary text, subheadings */
  --ink-mid: #555555;   /* secondary body text */
  --ink-muted: #666666; /* footer / caption copy */
  --ink-faint: #888888; /* placeholder / metadata */
  --sand: #e6e4e0;      /* card borders, outlines */
  --stone: #c9c7c2;     /* hairline borders */
  --divider: #d9d6d0;   /* subtle secondary dividers */
  --nav-bg: rgba(250, 249, 246, 0.85);

  --serif: "Hedvig Letters Serif", Georgia, "Times New Roman", serif;
  --sans: "Hedvig Letters Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --r-md: 8px;     /* control corner */
  --r-card: 12px;  /* control corner */
  --r-panel: 16px; /* card corner */
  --r-pill: 24px;  /* large surface corner */

  --nav-h: 66px;
}

/* ----- Dark mode (secondary) ----- */
[data-theme="dark"] {
  --surface: #171512;   /* warm near-black */
  --card: #1f1c18;
  --ink: #ece9e2;
  --ink-soft: #c9c4ba;
  --ink-mid: #a49e92;
  --ink-muted: #8a8478;
  --ink-faint: #6f695d;
  --sand: #2f2b24;
  --stone: #3b362d;
  --divider: #262219;
  --nav-bg: rgba(23, 21, 18, 0.85);
}

/* ----- Base ----- */
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}
::selection { background: var(--ink); color: var(--surface); }
img { max-width: 100%; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.section { padding: 88px 0 8px; }
.section-tight { padding: 56px 0 8px; }

/* ----- Type roles (per design system) ----- */
h1, h2, h3 { margin: 0; }
.kicker {
  font-size: 11px; font-weight: 500; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-muted);
  margin: 0 0 14px;
}
h1.display {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 5.6vw, 60px);
  line-height: 1.06; letter-spacing: -1.5px; margin: 0 0 22px;
}
h1.display em { font-style: italic; }
h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(28px, 3.6vw, 36px);
  line-height: 1.12; letter-spacing: -0.5px; margin: 0 0 16px;
}
h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: 20px; line-height: 1.4; margin: 0 0 10px;
}
.lead { max-width: 620px; margin: 0; color: var(--ink-mid); font-size: 16px; line-height: 1.7; }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--mono); }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--r-pill);
  font-family: var(--sans); font-size: 14px; font-weight: 500; line-height: 1;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: var(--surface); transform: translateY(-1px); }
.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn-lg { padding: 15px 30px; font-size: 15px; }

/* ----- Nav ----- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--divider);
}
.nav .wrap { display: flex; align-items: center; gap: 28px; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: 0.03em; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  background: var(--ink); color: var(--surface); border-radius: var(--r-md);
  font-family: var(--mono); font-size: 12px; line-height: 1;
}
.brand-name { font-family: var(--serif); font-size: 19px; letter-spacing: 0.04em; }
.nav-links { display: flex; align-items: center; gap: 22px; margin-left: auto; font-size: 14px; }
.nav-links a { text-decoration: none; color: var(--ink-mid); transition: color 0.15s ease; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 14px; margin-left: 4px; }
.lang { display: inline-flex; gap: 2px; font-size: 12px; letter-spacing: 0.04em; }
.lang a { padding: 3px 6px; border-radius: var(--r-md); color: var(--ink-faint); text-decoration: none; }
.lang a:hover { color: var(--ink); }
.lang a.active { color: var(--ink); font-weight: 600; background: var(--sand); }
.theme-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--sand); background: transparent; color: var(--ink);
  border-radius: var(--r-md); cursor: pointer; font-size: 15px; line-height: 1;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.theme-btn:hover { border-color: var(--ink); }
.theme-btn .icon-sun { display: none; }
[data-theme="dark"] .theme-btn .icon-sun { display: inline; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }
.nav-toggle { display: none; }

/* ----- Hero ----- */
.hero {
  display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 56px; align-items: center;
  padding: 104px 0 80px;
}
.hero .badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-muted); border: 1px solid var(--sand); border-radius: var(--r-pill);
  padding: 6px 14px; margin-bottom: 22px;
}
.hero .badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.hero .sub { max-width: 560px; margin: 0 0 30px; color: var(--ink-mid); font-size: 17px; line-height: 1.7; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .meta { margin: 18px 0 0; font-size: 12px; color: var(--ink-muted); letter-spacing: 0.02em; }

/* ----- Code / terminal card (dark terminal window) ----- */
.code-card {
  --tbg: #14120f;
  --tbar: #1c1915;
  --tbord: #2e2a22;
  --tink: #e8e4db;
  --tsoft: #b8b2a6;
  --tmuted: #8a8478;
  --tfaint: #6b655a;
  --tok: #a9c48c;
  background: var(--tbg);
  border: 1px solid var(--tbord);
  border-radius: var(--r-panel);
  overflow: hidden;
  box-shadow: 0 24px 48px -28px rgba(18, 18, 18, 0.35);
}
.code-card .bar {
  display: flex; align-items: center; gap: 6px; padding: 12px 14px;
  background: var(--tbar);
  border-bottom: 1px solid var(--tbord);
}
.code-card .bar .dot { width: 10px; height: 10px; border-radius: 50%; background: #3a352c; }
.code-card .bar .label {
  margin-left: 8px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.04em; color: var(--tmuted);
}
.code-card pre {
  margin: 0; padding: 22px 24px;
  font-family: var(--mono); font-size: 13px; line-height: 1.75; color: var(--tsoft);
  tab-size: 4;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  overflow-x: hidden;
}
.code-card pre .p { color: var(--tmuted); }
.code-card pre .k { color: var(--tink); font-weight: 500; }
.code-card pre .v { color: #cbbfae; }
.code-card pre .c { color: var(--tfaint); font-style: italic; }
.code-card pre .ok { color: var(--tok); }

/* blinking terminal cursor */
.code-card pre .cursor {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--tink); vertical-align: text-bottom; margin-left: 3px;
  border-radius: 1px;
  animation: manda-cursor 1.1s steps(2, start) infinite;
}
@keyframes manda-cursor { 50% { opacity: 0; } }

/* typing effect: reveal command, then result + final prompt */
.code-card pre .done-line,
.code-card pre .prompt-final {
  opacity: 0;
  transition: opacity 0.45s ease;
}
.code-card pre .done-line.visible,
.code-card pre .prompt-final.visible {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .code-card pre .done-line,
  .code-card pre .prompt-final {
    opacity: 1;
  }
}

/* ----- Cyclic shortcut carousel in the hero terminal ----- */
.code-card pre .cycle-result {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.code-card pre .cycle-result.visible {
  opacity: 1;
}
.code-card pre .cycle-text {
  opacity: 1;
  transition: opacity 0.18s ease;
}
.code-card pre .cycle-text.hiding {
  opacity: 0;
}

/* ----- Cards / grid ----- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 40px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--sand); border-radius: var(--r-card);
  padding: 28px 26px; transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--stone); }
.card .num {
  display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-muted); margin-bottom: 18px;
}
.card p { margin: 0; color: var(--ink-mid); font-size: 14px; line-height: 1.65; }
.card code, .step code {
  font-family: var(--mono); font-size: 12px; background: var(--sand); color: var(--ink);
  border-radius: var(--r-md); padding: 2px 7px;
}

/* ----- Stats strip ----- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.stat {
  text-align: center; padding: 24px 16px; border: 1px solid var(--divider);
  border-radius: var(--r-card);
}
.stat .num { font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -0.5px; }
.stat .lbl {
  margin-top: 6px; font-size: 11px; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-muted);
}

/* ----- AI steps ----- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 40px; }
.step { border: 1px solid var(--divider); border-radius: var(--r-card); padding: 26px 24px; background: var(--card); }
.step .num { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--ink-muted); }
.step h3 { margin-top: 12px; }
.step p { margin: 0; color: var(--ink-mid); font-size: 14px; line-height: 1.65; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.chip {
  font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
  border: 1px solid var(--sand); background: var(--card); border-radius: var(--r-pill);
  padding: 7px 14px;
}

/* ----- Table ----- */
.table-scroll { overflow-x: auto; border: 1px solid var(--divider); border-radius: var(--r-panel); margin-top: 40px; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th {
  font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-muted); text-align: left; padding: 14px 20px;
  border-bottom: 1px solid var(--stone); background: var(--card);
}
td { padding: 15px 20px; border-bottom: 1px solid var(--divider); font-size: 14px; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
td:first-child { color: var(--ink-mid); }
kbd {
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--stone); border-bottom-width: 2px;
  border-radius: var(--r-md); padding: 3px 8px; white-space: nowrap;
}

/* ----- Inline links ----- */
.link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 22px;
  font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--stone); padding-bottom: 2px;
  transition: border-color 0.15s ease;
}
.link:hover { border-color: var(--ink); }
.link .arrow { transition: transform 0.15s ease; }
.link:hover .arrow { transform: translateX(3px); }

/* ----- Download panel ----- */
.panel {
  background: var(--card); border: 1px solid var(--sand); border-radius: var(--r-panel);
  padding: 44px; text-align: center;
}
.panel h2 { margin-bottom: 10px; }
.panel p { max-width: 520px; margin: 0 auto 26px; color: var(--ink-mid); }

/* ----- Page header (subpages) ----- */
.page-head { padding: 88px 0 8px; }
.page-head h1 { margin-bottom: 16px; }

/* ----- FAQ accordion (clean list, divider-aligned) ----- */
.faq { max-width: 760px; margin-top: 40px; }
.faq-item { border-bottom: 1px solid var(--divider); }
.faq-item:first-of-type { border-top: 1px solid var(--divider); }
.faq-item summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 4px;
  font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.4;
  color: var(--ink); transition: color 0.15s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--ink-soft); }
.faq-item summary code {
  font-family: var(--mono); font-size: 14px; background: var(--sand);
  color: var(--ink); border-radius: var(--r-md); padding: 1px 6px;
}
.faq-item .chev {
  flex: none; font-family: var(--mono); font-size: 16px; line-height: 1;
  color: var(--ink-muted); transition: transform 0.2s ease;
}
.faq-item[open] summary .chev { transform: rotate(45deg); }
.faq-item .answer {
  padding: 0 4px 24px; max-width: 660px;
  color: var(--ink-mid); font-size: 14.5px; line-height: 1.7;
}
.faq-item .answer p { margin: 0 0 10px; }
.faq-item .answer p:last-child { margin-bottom: 0; }
.faq-item .answer code {
  font-family: var(--mono); font-size: 12.5px; background: var(--sand);
  color: var(--ink); border-radius: var(--r-md); padding: 2px 7px;
}
.faq-item .answer pre {
  background: var(--card); border: 1px solid var(--divider);
  border-radius: var(--r-card); padding: 14px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7; margin: 12px 0;
  color: var(--ink-soft);
}
.faq-item .answer a { text-decoration: underline; text-underline-offset: 2px; }

/* ----- Footer ----- */
footer { border-top: 1px solid var(--divider); margin-top: 110px; padding: 48px 0 56px; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 36px; justify-content: space-between; }
.footer-col h4 {
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-muted); margin: 0 0 12px;
}
.footer-col a { display: block; font-size: 14px; color: var(--ink-mid); text-decoration: none; margin-bottom: 8px; }
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--divider);
  font-size: 12.5px; color: var(--ink-muted);
}
.footer-bottom .right { margin-left: auto; display: flex; gap: 16px; }

/* ----- Responsive ----- */
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 72px 0 48px; }
  .stats { grid-template-columns: 1fr; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 40;
    flex-direction: column; align-items: flex-start; gap: 4px;
    background: var(--surface); border-bottom: 1px solid var(--divider);
    padding: 12px 24px 18px; margin: 0;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 0; width: 100%; }
  .nav-toggle {
    display: grid; place-items: center; width: 34px; height: 34px; margin-left: auto;
    background: transparent; border: 1px solid var(--sand); border-radius: var(--r-md);
    color: var(--ink); cursor: pointer;
  }
  .nav-right { margin-left: 12px; }
  .nav .wrap { gap: 12px; }
}

/* ----- Install from terminal ----- */
.install { margin-top: 28px; text-align: left; max-width: 560px; margin-left: auto; margin-right: auto; }
.install .install-label {
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-muted); margin: 0 0 12px;
}
.install pre {
  margin: 8px 0; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-card);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--ink-soft);
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}

/* ----- Copy button (corner of code blocks) ----- */
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  padding: 4px 10px; border-radius: var(--r-md); line-height: 1.2;
  border: 1px solid var(--stone); background: var(--card); color: var(--ink-mid);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.copy-btn:hover { border-color: var(--ink); color: var(--ink); }
.copy-btn:active { transform: scale(0.96); }
.copy-btn.copied { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.copy-wrap { position: relative; }
.copy-wrap .copy-btn { position: absolute; top: 8px; right: 8px; z-index: 2; }
.copy-wrap pre { padding-right: 72px; }
[data-theme="dark"] .copy-wrap .copy-btn { background: var(--card); }
