/* ============================================================
   UNDINE — dev-tool dark theme
   ============================================================ */

:root {
  --bg:        #0a0d12;
  --bg-elev:   #11151c;
  --bg-card:   #141923;
  --line:      #1e2531;
  --line-soft: #181d27;

  --text:      #e7ecf3;
  --text-dim:  #9aa6b6;
  --muted:     #6c7888;

  --accent:    #4dd2ff;   /* CUDA cyan / water */
  --accent-2:  #79f0c2;   /* good / GPU green  */
  --warn:      #ff8a4c;   /* highlight numbers */
  --bad:       #ff4d6d;

  --maxw:      1180px;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 30px 60px -20px rgba(0,0,0,.55);

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

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle global grain / grid */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

/* ---------- typography ---------- */
h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 .6em;
  font-weight: 600;
}
h1 { font-size: clamp(2.2rem, 4.6vw, 3.8rem); font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); }
h3 { font-size: 1.05rem; letter-spacing: 0; }

p  { margin: 0 0 1rem; color: var(--text-dim); }
em { font-style: normal; color: var(--accent); }
strong { color: var(--text); font-weight: 600; }
code {
  font-family: var(--mono);
  font-size: .9em;
  color: var(--accent);
  background: rgba(77, 210, 255, .08);
  padding: .08em .35em;
  border-radius: 4px;
}
a { color: inherit; text-decoration: none; }

.container {
  width: min(100% - 2.4rem, var(--maxw));
  margin-inline: auto;
}

.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  text-transform: lowercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .9rem;
}

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

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 13, 18, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  font-family: var(--display);
  font-weight: 600;
  color: var(--text);
}
.logo-mark {
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1;
  transform: translateY(2px);
}
.logo-text {
  font-size: 1.1rem;
  letter-spacing: -.01em;
}

.menu {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu a {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--text-dim);
  transition: color .15s ease;
}
.menu a:hover { color: var(--text); }

.menu-cta {
  background: var(--accent);
  color: #00141d !important;
  padding: .42rem .8rem;
  border-radius: 999px;
  font-weight: 600;
}
.menu-cta:hover { background: #7adfff; color: #00141d; }

.menu-toggle {
  display: none;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .45rem .75rem;
  font: inherit;
  font-family: var(--mono);
  cursor: pointer;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  padding: 5rem 0 6rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: -10% -5% auto auto;
  width: 720px; height: 720px;
  background:
    radial-gradient(circle at 30% 30%, rgba(77,210,255,.18), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(121,240,194,.10), transparent 60%);
  filter: blur(40px);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 3.5rem;
  align-items: center;
}

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: .3rem .6rem;
  border-radius: 999px;
  margin-bottom: 1.4rem;
}

.lede {
  font-size: 1.08rem;
  color: var(--text-dim);
  max-width: 52ch;
  margin-block: 1.2rem 1.8rem;
}
.lede strong { color: var(--accent); font-family: var(--mono); font-weight: 500; }

.hero-actions {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  margin-bottom: 2.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .85rem 1.3rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }

.btn.primary {
  background: var(--accent);
  color: #00141d;
}
.btn.primary:hover { background: #7adfff; }

.btn.ghost {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}
.btn.ghost:hover { border-color: var(--text-dim); }

/* stat strip */
.stat-row {
  display: flex;
  gap: 2.4rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--line);
}
.stat-row > div {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.stat-row dt {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: .04em;
}
.stat-row dd {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: .15rem;
  color: var(--text);
}
.stat-row .num {
  font-size: 1.8rem;
  color: var(--accent);
  font-feature-settings: "tnum";
}
.stat-row .unit {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* viewport frame */
.viewport-frame {
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.frame-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .85rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}
.frame-bar .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line);
}
.frame-bar .dot:nth-child(1) { background: #ff5f57; }
.frame-bar .dot:nth-child(2) { background: #ffbd2e; }
.frame-bar .dot:nth-child(3) { background: #28c940; }
.frame-title {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  margin-left: .8rem;
}
.frame-media {
  position: relative;
  background: #1a1a1a;
}
.frame-media img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 320px;
  object-fit: cover;
}
.frame-hud {
  position: absolute;
  top: .9rem; left: .9rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--accent-2);
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}
.frame-hud b {
  color: var(--accent);
  font-weight: 500;
}
.frame-foot {
  padding: .55rem .9rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
}

/* ============================================================
   SECTION SCAFFOLD
   ============================================================ */
.section-head {
  max-width: 64ch;
  margin-bottom: 2.4rem;
}
.section-head .section-sub {
  font-size: 1.02rem;
  color: var(--text-dim);
}

/* ============================================================
   ORIGIN
   ============================================================ */
.origin {
  padding: 5rem 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.origin-grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 3rem;
  align-items: center;
}
.origin-art {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0e1218;
  aspect-ratio: 4/5;
}
.origin-art img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .55;
  mix-blend-mode: lighten;
  filter: hue-rotate(170deg) saturate(.9);
}
.origin-text h2 {
  max-width: 22ch;
}
.origin-text p {
  font-size: 1.02rem;
  max-width: 60ch;
}
.origin-text em { color: var(--warn); }
.signature {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--muted);
  margin-top: 1.4rem;
}

/* ============================================================
   SOLVER CORE
   ============================================================ */
.core { padding: 6rem 0; }

.core-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
  align-items: stretch;
}

.block-title {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: .05em;
  margin: 0 0 1.2rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
}

.kv {
  margin: 0;
  display: grid;
  gap: .15rem;
}
.kv dt {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-top: 1rem;
}
.kv dt:first-of-type { margin-top: 0; }
.kv dd {
  margin: .15rem 0 0;
  color: var(--text-dim);
  font-size: .94rem;
  max-width: 52ch;
}

/* terminal block */
.terminal {
  margin: 0;
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.7;
  color: var(--text);
}
.terminal code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.t-comment { color: var(--muted); }
.t-key     { color: var(--text-dim); }
.t-good    { color: var(--accent-2); }
.t-accent  { color: var(--accent); font-weight: 500; }
.t-dim     { color: var(--line); }

/* ============================================================
   BENCHMARK
   ============================================================ */
.bench {
  padding: 6rem 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(77,210,255,.06), transparent 60%),
    var(--bg-elev);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.bench h2 { max-width: 22ch; }
.bench-sub {
  max-width: 60ch;
  font-size: 1.02rem;
  margin-bottom: 2.6rem;
}

.bars {
  display: grid;
  gap: 1.1rem;
  margin-bottom: 1.8rem;
}
.bar-row {
  display: grid;
  grid-template-columns: 220px 1fr 110px;
  gap: 1.4rem;
  align-items: center;
}
.bar-label {
  font-family: var(--mono);
  font-size: .88rem;
  color: var(--text);
  line-height: 1.4;
}
.bar-meta {
  font-size: .72rem;
  color: var(--muted);
}
.bar {
  height: 22px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 6px 0 0 6px;
  transition: width 1s cubic-bezier(.2,.8,.2,1);
}
.bar-fill.bad  { background: var(--bad); }
.bar-fill.good {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.bar-val {
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--text-dim);
  text-align: right;
}
.bar-val b {
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 500;
}

.bench-foot {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 1.1rem;
  margin: 0;
}

/* ============================================================
   DIAGNOSTICS
   ============================================================ */
.diag { padding: 6rem 0; }
.diag-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 3rem;
  align-items: center;
}
.diag h2 { max-width: 18ch; }
.diag em { color: var(--warn); }

.checks {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0 0;
  display: grid;
  gap: .55rem;
}
.checks li {
  font-family: var(--sans);
  font-size: .96rem;
  color: var(--text);
  padding-left: 1.4rem;
  position: relative;
}
.checks li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
}

.diag-shot {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.diag-shot img {
  display: block;
  width: 100%;
  height: 360px;
  object-fit: cover;
  filter: grayscale(.2) contrast(1.05);
}
.diag-shot figcaption {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  padding: .65rem .9rem;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
}

/* ============================================================
   USE CASES
   ============================================================ */
.use {
  padding: 6rem 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.use h2 { max-width: 28ch; margin-bottom: 2.4rem; }

.use-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}
.use-grid article {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.5rem;
  position: relative;
  transition: border-color .15s ease, transform .15s ease;
}
.use-grid article:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.use-num {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  display: block;
  margin-bottom: 1.6rem;
}
.use-grid h3 {
  font-size: 1.1rem;
  margin-bottom: .55rem;
  color: var(--text);
}
.use-grid p {
  font-size: .94rem;
  margin: 0;
}

/* ============================================================
   BUY
   ============================================================ */
.buy {
  padding: 6rem 0 7rem;
  position: relative;
}
.buy::before {
  content: "";
  position: absolute;
  inset: 0 0 50% 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(77,210,255,.10), transparent 70%);
  pointer-events: none;
}
.buy-head {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 3rem;
  position: relative;
}
.buy-head .eyebrow { display: inline-block; }
.buy-head h2 { line-height: 1.18; }
.buy-sub {
  color: var(--text-dim);
  font-size: 1rem;
  max-width: 52ch;
  margin: 1rem auto 0;
}

.shops {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  position: relative;
}

.shop {
  --shop-img: none;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  padding: 1.3rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(10,13,18,.55) 0%, rgba(10,13,18,.92) 100%),
    var(--shop-img),
    var(--bg-card);
  background-size: cover;
  background-position: center;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.shop:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 18px 40px -16px rgba(77,210,255,.35);
}

.shop.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 18px 40px -20px rgba(77,210,255,.35);
}

.shop-meta {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.shop-store {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-dim);
  text-transform: lowercase;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.shop-price {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.shop-cta {
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--accent);
  align-self: flex-start;
}

.badge {
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: lowercase;
  background: var(--accent);
  color: #00141d;
  padding: .12rem .45rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .03em;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: 3rem 0 2.5rem;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: center;
}
.footer-grid nav {
  display: flex;
  gap: 1.6rem;
  justify-content: center;
}
.footer-grid nav a {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--text-dim);
  transition: color .15s ease;
}
.footer-grid nav a:hover { color: var(--accent); }
.foot-tag {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  margin: .3rem 0 0;
}
.foot-meta {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--muted);
  margin: 0;
  text-align: right;
}

/* ============================================================
   REVEAL ANIM
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .65s ease, transform .65s cubic-bezier(.2,.8,.2,1);
}
.reveal.in-view {
  opacity: 1;
  transform: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .hero { padding: 3.5rem 0 4rem; }
  .hero-grid,
  .origin-grid,
  .core-grid,
  .diag-grid {
    grid-template-columns: 1fr;
    gap: 2.4rem;
  }
  .origin-art { aspect-ratio: 16/9; }
  .stat-row { gap: 1.6rem; }
  .stat-row .num { font-size: 1.5rem; }
}

@media (max-width: 760px) {
  .menu-toggle { display: inline-flex; }
  .menu {
    position: absolute;
    top: 60px; right: 1.2rem;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .7rem;
    min-width: 200px;
    gap: .25rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease;
    box-shadow: var(--shadow);
  }
  .menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .menu li { padding: .35rem .4rem; }

  .use-grid,
  .shops {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
  .bar-val { text-align: left; }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .footer-grid nav { justify-content: flex-start; flex-wrap: wrap; }
  .foot-meta { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
