/* Untangle landing — Midnight Refined, dark + light. Tokens mirror the app
   (webapp/css/app.css) so the page and the embedded demo share one identity.
   Fonts (Space Grotesk + JetBrains Mono) come from the submodule's fonts.css. */

/* ---------- theme tokens ---------- */
html.theme-midnight {
  --bg: #0a0c10; --bg-soft: #0d1015; --panel: #11151c; --panel2: #161b23;
  --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.14);
  --text: #e7ebf0; --muted: #8a93a0; --accent: #ffd76a; --accent-2: #ff7a59;
  --glow: rgba(255,215,106,.10); --shadow: rgba(0,0,0,.5);
}
html.theme-midnight-light {
  --bg: #eef0f3; --bg-soft: #f4f6f8; --panel: #ffffff; --panel2: #f1f3f6;
  --line: #e2e6ea; --line-strong: #d4dade;
  --text: #1b2230; --muted: #5d6675; --accent: #c98a0f; --accent-2: #e5604d;
  --glow: rgba(201,138,15,.10); --shadow: rgba(20,30,50,.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* ambient gold glow + faint grid, behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 78% -8%, var(--glow), transparent 60%),
    radial-gradient(700px 480px at 0% 0%, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 55%);
}
a { color: inherit; }
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.1; margin: 0; }
em { font-style: normal; color: var(--accent); }
code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .92em; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 15px "Space Grotesk", sans-serif; text-decoration: none;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .15s ease, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #1a1407; box-shadow: 0 6px 22px -8px var(--accent); }
.btn-primary:hover { box-shadow: 0 10px 28px -8px var(--accent); transform: translateY(-1px); }
.btn-ghost { background: var(--panel2); color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 26px;
  padding: 14px clamp(18px, 5vw, 56px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 19px; }
.brand-logo { display: block; }
.nav-links { display: flex; gap: 22px; margin-left: 8px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.gh { padding: 9px 15px; font-size: 14px; }

/* theme toggle (mirrors the app's switch) */
.theme-toggle { cursor: pointer; background: transparent; border: 0; padding: 0; }
.mt-track { position: relative; display: block; width: 52px; height: 27px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line-strong); }
.mt-ico { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; opacity: .45; color: var(--text); }
.mt-moon { left: 8px; } .mt-sun { right: 8px; }
.mt-knob { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--accent); box-shadow: 0 1px 3px var(--shadow); transition: transform .2s cubic-bezier(.4,1.3,.5,1); }
.theme-toggle.is-light .mt-knob { transform: translateX(25px); }
.theme-toggle.is-light .mt-sun { opacity: 1; }
.theme-toggle:not(.is-light) .mt-moon { opacity: 1; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center;
  max-width: 1200px; margin: 0 auto; padding: clamp(40px, 7vw, 86px) clamp(18px, 5vw, 56px) clamp(30px, 5vw, 60px);
}
.eyebrow {
  display: inline-block; font: 600 12.5px "JetBrains Mono", monospace; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); padding: 6px 12px; border-radius: 999px;
}
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); font-weight: 700; margin: 20px 0 0; }
.lede { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.16rem); margin: 20px 0 0; max-width: 38ch; }
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.cta-row.center { justify-content: center; }
.badges { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 28px 0 0; padding: 0; }
.badges li { font: 500 13px "JetBrains Mono", monospace; color: var(--muted); }
.badges li::before { content: "✓ "; color: var(--accent); }
.badges li:first-child::before { content: ""; }

/* ---------- the app-window demo frame ---------- */
.hero-demo { min-width: 0; }
.app-window {
  margin: 0; border-radius: 16px; overflow: hidden; background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px -30px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
}
.aw-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.aw-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); }
.aw-dot:nth-child(1) { background: #ff5f57; } .aw-dot:nth-child(2) { background: #febc2e; } .aw-dot:nth-child(3) { background: #28c840; }
.aw-title { margin-left: 10px; font: 500 12px "JetBrains Mono", monospace; color: var(--muted); }
.aw-graph {
  height: clamp(320px, 42vw, 440px); width: 100%;
  background:
    radial-gradient(420px 280px at 50% 42%, color-mix(in srgb, var(--accent) 5%, transparent), transparent 70%),
    var(--bg-soft);
}
.aw-caption { padding: 13px 16px; font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--line); background: var(--panel); text-align: center; }
.aw-caption b { color: var(--text); }
.cap-danger { color: var(--accent-2); font-weight: 600; }

/* ---------- generic section ---------- */
.section { max-width: 1080px; margin: 0 auto; padding: clamp(48px, 8vw, 96px) clamp(18px, 5vw, 56px); }
.section-title { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 700; text-align: center; }
.section-sub { color: var(--muted); text-align: center; max-width: 56ch; margin: 16px auto 0; font-size: 1.05rem; }

/* ---------- feature grid ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; }
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: 16px; padding: 26px 24px;
  transition: transform .15s ease, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 18px 40px -24px var(--shadow); }
.card-ic {
  width: 46px; height: 46px; border-radius: 12px; margin-bottom: 16px;
  background-color: var(--accent); background-repeat: no-repeat; background-position: center; background-size: 60%;
  background-image: none; /* set by site.js to the app's type-icon */
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #000 18%, transparent), 0 6px 16px -8px var(--accent);
}
.card h3 { font-size: 1.16rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: .96rem; margin: 0; }

/* ---------- how it works ---------- */
.how .steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 48px 0 0; padding: 0; }
.steps li { position: relative; padding: 26px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.step-n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font: 700 16px "JetBrains Mono", monospace; color: #1a1407; background: var(--accent); margin-bottom: 14px; }
.steps h3 { font-size: 1.1rem; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: .95rem; margin: 0; }
.steps code { color: var(--text); background: var(--panel2); padding: 1px 6px; border-radius: 5px; }

.codeblock { max-width: 720px; margin: 36px auto 0; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--bg-soft); }
.cb-bar { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); font: 500 12px "JetBrains Mono", monospace; color: var(--muted); }
.cb-copy { cursor: pointer; background: transparent; border: 1px solid var(--line-strong); color: var(--text); border-radius: 7px; padding: 4px 12px; font: 500 12px "JetBrains Mono", monospace; transition: border-color .15s; }
.cb-copy:hover { border-color: var(--accent); }
.codeblock pre { margin: 0; padding: 18px; overflow-x: auto; }
.codeblock code { color: var(--text); font-size: 13.5px; line-height: 1.7; }
.codeblock code { white-space: pre; }
/* comment lines a touch dimmer via accent-free muted is hard without tokens; keep simple */

/* ---------- pitch ---------- */
.pitch { text-align: center; }
.pitch .section-sub { margin-bottom: 30px; }

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line); padding: 34px clamp(18px, 5vw, 56px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; max-width: 1200px; margin: 0 auto;
}
.foot-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.foot-links { display: flex; gap: 20px; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: 14px; transition: color .15s; }
.foot-links a:hover { color: var(--accent); }
.foot-fine { color: var(--muted); font-size: 13px; margin: 0 0 0 auto; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; }
  .hero-demo { order: 2; }
  .lede { max-width: none; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .how .steps { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .nav-links { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .foot-fine { margin: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
