/* AppScience — machine-room theme
   dark engineering palette keyed off the logo mark (teal #40c0c0 + violet hint) */

:root {
  --bg: #070d1a;
  --bg-alt: #0b1322;
  --panel: #0d1626;
  --line: #1c2a42;
  --text: #dbe4f0;
  --muted: #8fa0b8;
  --accent: #38d1d1;      /* from logo mark */
  --accent-dim: #229797;
  --violet: #8b7fd6;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --content-max: 1100px;
  --pad-x: clamp(1.25rem, 5vw, 4rem);
  --btn-fg: #04252a;
  --brand-filter: none;
  --t-bg: #050a14;
  --t-prompt: #38d1d1;
  --t-fg: #8fa0b8;
  --t-strong: #dbe4f0;
  --diag-fill: #0a1120;
  --diag-stroke: #223452;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 110px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem var(--pad-x);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand img { display: block; height: 44px; width: auto; filter: var(--brand-filter); }

.nav { display: flex; align-items: center; gap: 1.4rem; }

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

/* ---------- buttons ---------- */

a.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--btn-fg);
  font-weight: 650;
  padding: 0.7rem 1.3rem;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--accent);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

a.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn-small { padding: 0.45rem 0.9rem; font-size: 0.9rem; }

a.btn-ghost {
  background: transparent;
  color: var(--accent);
}

a.btn-ghost:hover { box-shadow: none; background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: clamp(4rem, 10vw, 7.5rem) var(--pad-x) clamp(3rem, 6vw, 5rem);
  max-width: var(--content-max);
  margin: 0 auto;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 6%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 30% 20%, black 30%, transparent 75%);
  pointer-events: none;
}

.hero > * { position: relative; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }

.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
}

.hero h1 {
  font-size: clamp(2rem, 5.2vw, 3.2rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

.lede {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 2rem;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-bottom: 3rem; }

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.stat {
  background: var(--panel);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-n {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-l { font-size: 0.85rem; color: var(--muted); line-height: 1.45; }

/* ---------- sections ---------- */

.section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--pad-x);
}

.section-alt {
  max-width: none;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(3rem, 7vw, 5.5rem) var(--pad-x);
}

.shell {
  max-width: calc(var(--content-max) - 2 * var(--pad-x));
  margin-left: auto;
  margin-right: auto;
}

.section h2,
.section h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: -0.015em;
  margin-bottom: 1rem;
}

.section h2::before,
.section h1::before {
  content: "// ";
  font-family: var(--mono);
  color: var(--accent-dim);
}

.section-sub {
  color: var(--muted);
  max-width: 68ch;
  margin-bottom: 2rem;
}

/* ---------- offer cards ---------- */

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
}

.card-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--violet);
  margin-bottom: 0.9rem;
}

.card h3, .prose-head .card h2 { font-size: 1.3rem; margin-bottom: 0.75rem; }

.card > p { color: var(--muted); margin-bottom: 1rem; }

.card ul { list-style: none; margin-bottom: 1.25rem; }

.card li {
  padding-left: 1.4rem;
  position: relative;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.card li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.card-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
}

/* ---------- offer diagram ---------- */

.diag {
  width: 100%;
  height: auto;
  margin: 0.25rem 0 1rem;
  font-family: var(--mono);
}

.diag .n { fill: var(--diag-fill); stroke: var(--diag-stroke); }
.diag .n-gpu { stroke: var(--accent); }
.diag .t { fill: var(--text); font-size: 12px; }
.diag .t-gpu { fill: var(--accent); }
.diag .t2 { fill: var(--muted); font-size: 9.5px; }
.diag .d-title { fill: var(--accent); font-size: 9px; letter-spacing: 0.12em; }

/* ---------- FAQ ---------- */

.faq details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.faq summary {
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2.6rem;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-family: var(--mono);
}

.faq details[open] summary::after { content: "\2013"; }

.faq details p {
  padding: 0 1.25rem 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ---------- article prose ---------- */

.prose { max-width: 760px; margin: 0 auto; }

.prose h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 1rem;
}

.prose .meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--violet);
  display: block;
  margin-bottom: 2.2rem;
}

.prose h2 { font-size: 1.3rem; margin: 2.4rem 0 0.8rem; }

.prose p { margin-bottom: 1.05rem; font-size: 1.02rem; color: var(--text); }

.prose ul { margin: 0 0 1.05rem 1.25rem; color: var(--text); }

.prose li { margin-bottom: 0.45rem; }

.post-link { color: var(--text); text-decoration: none; }
.post-link:hover { color: var(--accent); }

.prose a, .section-sub a, .footnote a { color: var(--accent); }

.prose .meta a { color: var(--violet); }

/* ---------- utility ---------- */

.nf-main { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.nf-main .section-sub { margin-bottom: 1.5rem; }

.skip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translateX(-9999px);
  background: var(--accent);
  color: var(--btn-fg);
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
  z-index: 100;
  font-weight: 600;
  text-decoration: none;
}

.skip:focus { transform: translateX(0); }

.card-planned { border-style: dashed; }

.card-wide { grid-column: 1 / -1; }

/* ---------- utility ---------- */

/* ---------- who this is for ---------- */

.verticals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.verticals > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
}

.verticals b {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-size: 0.98rem;
}

.verticals span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ---------- terminal ---------- */

.terminal {
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--t-strong);
  background: var(--t-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  box-shadow: inset 0 0 60px rgba(56, 209, 209, 0.04);
}

.t-prompt { color: var(--t-prompt); }

.t-out { color: var(--t-fg); }
.t-out b { color: var(--t-strong); font-weight: 650; }

.t-cursor { color: var(--t-prompt); animation: blink 1.1s steps(1) 6; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .t-cursor { animation: none; }
  a.btn:hover { transform: none; }
}

.stats-tight { max-width: calc(var(--content-max) - 2 * var(--pad-x)); margin: 0 auto 1.25rem; }

.footnote {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 68ch;
}

.gh-callout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: calc(var(--content-max) - 2 * var(--pad-x));
  margin: 1.5rem auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 1.1rem 1.4rem;
  font-size: 0.93rem;
  color: var(--muted);
}

.gh-callout > div { align-self: flex-start; }

.gh-callout b { color: var(--text); }

/* ---------- how I work ---------- */

.how {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.how li {
  counter-increment: step;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem;
  font-size: 0.98rem;
  color: var(--muted);
  position: relative;
}

.how li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  color: var(--violet);
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.how b { color: var(--text); display: block; margin-bottom: 0.3rem; }

.sig {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}

.sig b { color: var(--text); }

/* ---------- contact ---------- */

.contact { text-align: center; }

.contact h2 { max-width: 30ch; margin: 0 auto 1.75rem; }

.contact .cta-row { justify-content: center; margin-bottom: 1.5rem; }

.contact .footnote { margin: 0 auto; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem var(--pad-x);
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.site-footer .sep { color: var(--line); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .nav { flex-wrap: wrap; row-gap: 0.4rem; }
  .cards, .how { grid-template-columns: 1fr; }
  .verticals { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stat { flex-direction: row; align-items: baseline; gap: 0.9rem; }
  .stat-n { white-space: nowrap; }
  .brand img { height: 38px; }
}

/* ---------- light scheme ----------
   Default: follows the OS. A manual choice (html[data-theme], set by /assets/theme.js)
   wins over it. The terminal keeps its dark artifact look in both schemes via --t-*. */

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7fa;
    --bg-alt: #edf0f5;
    --panel: #ffffff;
    --line: #d9e0eb;
    --text: #16202f;
    --muted: #55647a;
    --accent: #0b7373;
    --accent-dim: #095e5e;
    --violet: #6a5fc2;
    --btn-fg: #ffffff;
    --brand-filter: brightness(0.72) saturate(1.15);
    --diag-fill: #e9eef6;
    --diag-stroke: #b9c6da;
  }
}

:root[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-alt: #edf0f5;
  --panel: #ffffff;
  --line: #d9e0eb;
  --text: #16202f;
  --muted: #55647a;
  --accent: #0b7373;
  --accent-dim: #095e5e;
  --violet: #6a5fc2;
  --btn-fg: #ffffff;
  --brand-filter: brightness(0.72) saturate(1.15);
  --diag-fill: #e9eef6;
  --diag-stroke: #b9c6da;
}

/* ---------- theme toggle ---------- */

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}

.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

.theme-btn svg { width: 1.05rem; height: 1.05rem; }

.icon-moon { display: none; }

:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun { display: none; }
  :root:not([data-theme]) .icon-moon { display: block; }
}
