:root {
  /* Theme-flipping surfaces & text (dark is default) */
  --bg: #17110c;
  --surface: #221a13;
  --surface-2: #2b2118;
  --border: #3a2c20;
  --border-soft: #2c2118;
  --text: #f3ebe1;
  --dim: #b7a897;
  --faint: #8b7c6b;
  --macbar-bg: rgba(23, 17, 12, 0.72);

  /* Warm accents (fixed across themes) */
  --accent: #ff8a3d;
  --accent-2: #ff5e33;
  --accent-shadow: rgba(255, 122, 60, 0.34);
  --accent-shadow-strong: rgba(255, 122, 60, 0.46);

  /* Warm token colors, reused for dots / feature labels / syntax */
  --blue: #f2b34e;   /* amber   */
  --green: #b7c26a;  /* olive   */
  --amber: #ffcf6b;  /* gold    */
  --purple: #ff9068; /* coral   */

  /* Code windows stay dark in both themes */
  --panel: #17110c;
  --panel-border: #38291d;
  --panel-text: #f3ebe1;
  --panel-dim: #a2917d;
  --panel-faint: #857766;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
  --display: "Space Grotesk", var(--sans);

  --maxw: 1120px;
}

:root[data-theme="light"] {
  --bg: #f8f1e6;
  --surface: #fdf8f0;
  --surface-2: #f2e7d6;
  --border: #e7d8c4;
  --border-soft: #efe4d5;
  --text: #2c2118;
  --dim: #6f5f4d;
  --faint: #9c8b76;
  --macbar-bg: rgba(255, 248, 240, 0.78);

  /* Code windows go light too, matching the app's light-mode editor */
  --panel: #fffdf8;
  --panel-border: #ecdcc6;
  --panel-text: #2c2118;
  --panel-dim: #6f5f4d;
  --panel-faint: #9c8b76;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

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

::selection {
  background: rgba(255, 138, 61, 0.3);
  color: inherit;
}
::-moz-selection {
  background: rgba(255, 138, 61, 0.3);
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Menu bar (nav) ---------- */
.macbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 38px;
  background: var(--macbar-bg);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.macbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.brand-glyph {
  width: 17px;
  height: 17px;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

:root[data-theme="light"] .brand-glyph {
  filter: none;
  opacity: 0.82;
}

.macbar-nav {
  display: flex;
  gap: 20px;
  margin-left: 8px;
}

.macbar-nav a {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  transition: color 0.15s;
}

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

.macbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-btn svg {
  display: block;
}

/* Show one glyph per theme. Scoped to [data-theme] so these out-specify
   `.icon-btn svg { display: block }`; the visible one stays block from that rule. */
:root[data-theme="dark"] .icon-moon {
  display: none;
}
:root[data-theme="light"] .icon-sun {
  display: none;
}

.macbar-time {
  margin-left: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 122, 60, 0.12);
  transition: border-color 0.15s, background 0.15s;
}

.macbar-time:hover {
  border-color: var(--accent);
  background: rgba(255, 122, 60, 0.2);
}

/* ---------- Shared ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}

.eyebrow.center {
  text-align: center;
}

.section-h {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 auto 46px;
  text-align: center;
  max-width: 18ch;
}

.section-h.left {
  text-align: left;
  margin-left: 0;
}

.kbd {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.86em;
  padding: 2px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  color: var(--text);
  white-space: nowrap;
}

.kbd-sm {
  font-size: 11px;
  padding: 2px 7px;
}

.kbd-xs {
  font-size: 10.5px;
  padding: 1px 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  padding: 13px 22px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px var(--accent-shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px var(--accent-shadow-strong);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--faint);
  transform: translateY(-2px);
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.cta-row.center {
  justify-content: center;
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) 20px clamp(40px, 6vw, 72px);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 56px;
  align-items: center;
}

/* Let grid/flex children shrink below their content so nothing overflows. */
.hero-copy,
.hero-demo,
.files-copy,
.file-card,
.capture-win,
.code {
  min-width: 0;
}

.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 1.03;
  letter-spacing: -0.035em;
  margin: 0 0 22px;
  overflow-wrap: break-word;
}

.grad {
  color: var(--accent);
}

.lede {
  font-size: 18px;
  color: var(--dim);
  max-width: 46ch;
  margin: 0 0 30px;
  overflow-wrap: break-word;
}

.fineprint {
  margin: 20px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--faint);
}

/* Signature: capture window dropped from the bar */
.hero-demo {
  position: relative;
  display: flex;
  justify-content: center;
}

.drop-line {
  position: absolute;
  top: -104px;
  right: 64px;
  width: 2px;
  height: 104px;
  background: linear-gradient(var(--accent), transparent);
  opacity: 0.55;
}

.capture-win {
  width: 100%;
  max-width: 420px;
  color: var(--panel-text);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 140, 60, 0.08);
  overflow: hidden;
  animation: drop 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

:root[data-theme="light"] .capture-win {
  box-shadow: 0 24px 60px rgba(120, 80, 30, 0.18), 0 0 0 1px rgba(255, 140, 60, 0.1);
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-26px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.capture-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--panel-border);
}

.capture-title {
  font-weight: 600;
  font-size: 13.5px;
}

.chip {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
}

.chip-blue {
  color: var(--blue);
  background: rgba(242, 179, 78, 0.16);
}

.capture-top .kbd-sm {
  margin-left: auto;
}

/* Keycaps sit on dark code panels in dark mode... */
.capture-win .kbd,
.file-card .kbd {
  background: #262019;
  border-color: #3d2e22;
  color: #efe7dc;
}

/* ...but follow the panel to a light keycap in light mode. */
:root[data-theme="light"] .capture-win .kbd,
:root[data-theme="light"] .file-card .kbd {
  background: #f1e6d4;
  border-color: #ddccb4;
  color: #2c2118;
}

.code {
  margin: 0;
  padding: 18px 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--panel-text);
}

.code code {
  font-family: inherit;
}

.c-key { color: var(--purple); }
.c-var { color: var(--panel-text); }
.c-fn { color: var(--blue); }
.c-comment { color: var(--panel-faint); font-style: italic; }
.c-fence { color: var(--panel-faint); }
.c-fm { color: var(--amber); }

/* On the light panel the warm tokens wash out — deepen them for contrast. */
:root[data-theme="light"] .c-key { color: #c2410c; }
:root[data-theme="light"] .c-fn { color: #9a6410; }
:root[data-theme="light"] .c-fm { color: #9a6410; }
:root[data-theme="light"] .chip-blue {
  color: #9a6410;
  background: rgba(154, 100, 16, 0.12);
}

.caret {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  vertical-align: -2px;
  margin-left: 1px;
  background: var(--accent);
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.capture-hint {
  display: flex;
  gap: 16px;
  padding: 11px 16px;
  border-top: 1px solid var(--panel-border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--panel-faint);
}

/* ---------- Loop ---------- */
.loop {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) 20px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.step {
  position: relative;
  padding: 26px 24px 28px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border-soft);
  border-radius: 16px;
}

.step-n {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.1em;
}

.step h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  margin: 12px 0 8px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.step p {
  margin: 0;
  color: var(--dim);
  font-size: 14.5px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-blue { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.dot-green { background: var(--green); box-shadow: 0 0 12px var(--green); }
.dot-amber { background: var(--amber); box-shadow: 0 0 12px var(--amber); }

/* ---------- Features ---------- */
.features {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) 20px clamp(56px, 8vw, 96px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feat {
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.feat:hover {
  transform: translateY(-3px);
  border-color: var(--border);
}

.token {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.token-blue { color: var(--blue); }
.token-green { color: var(--green); }
.token-amber { color: var(--amber); }
.token-purple { color: var(--purple); }

.feat h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18.5px;
  margin: 14px 0 9px;
  letter-spacing: -0.01em;
}

.feat p {
  margin: 0;
  color: var(--dim);
  font-size: 14.5px;
}

.feat code,
.step code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--purple);
  background: rgba(255, 144, 104, 0.15);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ---------- Files ---------- */
.files {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) 20px;
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 52px;
  align-items: center;
}

.files-lede {
  font-size: 16px;
  color: var(--dim);
  max-width: 44ch;
  margin: 0 0 24px;
}

.files-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.files-list li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  color: var(--text);
}

.file-card {
  color: var(--panel-text);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.file-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--panel-border);
}

.dots {
  display: flex;
  gap: 7px;
}

.dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--panel-border);
}

.file-name {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--panel-dim);
}

/* ---------- Download ---------- */
.download {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(64px, 9vw, 110px) 20px;
  text-align: center;
}

.download-icon {
  width: 82px;
  height: 82px;
  border-radius: 20px;
  margin-bottom: 26px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}

/* the icon follows the theme: espresso ground on dark, cream on light */
.download-icon.on-light {
  display: none;
}

:root[data-theme="light"] .download-icon.on-dark {
  display: none;
}

:root[data-theme="light"] .download-icon.on-light {
  display: inline-block;
  box-shadow: 0 16px 38px rgba(122, 74, 34, 0.18);
}

.download h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(28px, 4.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.download p {
  color: var(--dim);
  margin: 0 0 30px;
  font-family: var(--mono);
  font-size: 13.5px;
}

.install-top {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 20px 0;
}

.install-note {
  max-width: 540px;
  margin: 40px auto 0;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
}

.install-top .install-note {
  margin: 0 auto;
}

.install-note-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 6px;
  color: var(--text);
}

.install-note-body {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--dim);
}

.copy-row {
  display: flex;
  gap: 8px;
}

.copy-row code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--panel-text);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  padding: 11px 13px;
  overflow-x: auto;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12.5px;
  color: #fff;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border: none;
  border-radius: 9px;
  padding: 0 16px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s;
}

.copy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-shadow);
}

.copy-btn.copied {
  background: var(--green);
  color: #10240f;
}

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--border-soft);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 20px 40px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
}

.foot-mono {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12.5px;
  color: var(--faint);
}

.foot a {
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 12.5px;
  color: var(--dim);
}

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

/* ---------- Responsive ---------- */
/* ---------- Command palette ---------- */
.macbar-key {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
}

.macbar-key:hover {
  opacity: 1;
}

.macbar-key:hover .kbd {
  border-color: var(--accent);
  color: var(--accent);
}

.palette[hidden] {
  display: none;
}

.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 13vh 16px 16px;
}

.palette-scrim {
  position: absolute;
  inset: 0;
  background: rgba(12, 8, 5, 0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.palette.is-open .palette-scrim {
  opacity: 1;
}

.palette-panel {
  position: relative;
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.palette.is-open .palette-panel {
  opacity: 1;
  transform: none;
}

.palette-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.palette-prompt {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent);
}

.palette-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text);
  padding: 0;
}

.palette-input::placeholder {
  color: var(--faint);
}

.palette-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(46vh, 340px);
  overflow-y: auto;
}

.palette-list:empty {
  padding: 0;
}

.palette-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--dim);
  font-size: 14.5px;
}

.palette-item[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.palette-item mark {
  background: none;
  color: var(--accent);
  font-weight: 600;
}

.palette-hint {
  margin-left: auto;
  padding-left: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

.palette-empty {
  margin: 0;
  padding: 18px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
}

.palette-empty[hidden] {
  display: none;
}

.palette-foot {
  display: flex;
  gap: 18px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--faint);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-demo {
    justify-content: flex-start;
  }
  .drop-line {
    display: none;
  }
  .steps,
  .features {
    grid-template-columns: 1fr;
  }
  .files {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .macbar-nav {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 38px;
  }
  .foot a {
    margin-left: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .capture-win {
    animation: none;
  }
  .caret {
    animation: none;
  }
  .btn:hover,
  .feat:hover {
    transform: none;
  }
  .palette-scrim,
  .palette-panel {
    transition: none;
  }
  .palette-panel {
    transform: none;
  }
}
