/* ==========================================================================
   wbtech.in — "Widget Tree" design system
   Warm paper + ink, one terracotta accent, and Flutter-DevTools details:
   the DEBUG banner, debug-paint outlines and widget-inspector size labels.
   See DESIGN.md for the full rationale.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces & ink */
  --paper: #F4F0E8;
  --paper-2: #ECE6DA;
  --surface: #FBF9F4;
  --ink: #17161C;
  --ink-2: #4B4853;
  --ink-3: #7A7581;
  --line: #DDD5C6;

  /* Accent: Bishnupur terracotta */
  --clay: #C4462A;
  --clay-soft: #F3DCD3;
  --on-clay: #FFFFFF;

  /* Inspector cyan (Flutter debug paint) & status green */
  --debug: #0094B3;
  --live: #2E7D4F;

  /* App tile palette */
  --c-clay: #C4462A;
  --c-ink: #26242E;
  --c-indigo: #3A4AA6;
  --c-plum: #7B3F73;
  --c-saffron: #D9962B;
  --c-leaf: #2E6B4E;
  --c-cyan: #0A8AA6;

  /* Type */
  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-display: clamp(2.75rem, 5.6vw + 0.6rem, 5.75rem);
  --fs-h2: clamp(2rem, 2.8vw + 0.9rem, 3.25rem);
  --fs-h3: 1.125rem;
  --fs-lead: clamp(1.0625rem, 0.5vw + 0.95rem, 1.25rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;
  --fs-mono: 0.75rem;

  /* Space (4pt grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;

  /* Shape */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* Layout */
  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 64px;

  --shadow: 0 1px 0 rgba(23, 22, 28, 0.04), 0 12px 32px -16px rgba(23, 22, 28, 0.25);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131217;
    --paper-2: #1A1920;
    --surface: #1E1D24;
    --ink: #F1ECE2;
    --ink-2: #B8B2BD;
    --ink-3: #8C8693;
    --line: #2F2D37;
    --clay: #EE6A45;
    --clay-soft: #3A211B;
    --on-clay: #160C09;
    --debug: #3FCFEA;
    --live: #5BC487;
    --c-ink: #3B3946;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 40px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131217;
  --paper-2: #1A1920;
  --surface: #1E1D24;
  --ink: #F1ECE2;
  --ink-2: #B8B2BD;
  --ink-3: #8C8693;
  --line: #2F2D37;
  --clay: #EE6A45;
  --clay-soft: #3A211B;
  --on-clay: #160C09;
  --debug: #3FCFEA;
  --live: #5BC487;
  --c-ink: #3B3946;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 40px -18px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--fs-body)/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Faint blueprint grid behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000, transparent 70vh);
  pointer-events: none;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); color: var(--ink); text-wrap: balance; }
h2 { font-size: var(--fs-h2); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; }
h3 { font-size: var(--fs-h3); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 600; color: var(--ink); }
em { font-style: normal; font-family: var(--f-mono); font-size: 0.9em; color: var(--ink); }
.mono { font-family: var(--f-mono); }
:focus-visible { outline: 2px dashed var(--debug); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--clay); color: var(--on-clay); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 8px 14px; background: var(--ink); color: var(--paper); border-radius: var(--r-sm);
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1.5px solid var(--ink); border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 1rem/1 var(--f-body);
  text-decoration: none; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn span { transition: transform 0.2s var(--ease); }
.btn:hover span { transform: translateX(3px); }
.btn:active { transform: translateY(1px); }
.btn-primary { --btn-bg: var(--ink); --btn-fg: var(--paper); }
.btn-primary:hover { --btn-bg: var(--clay); --btn-fg: var(--on-clay); border-color: var(--clay); }
.btn-ghost:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 0.9375rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--debug); border-color: var(--debug); }

/* ---------- DEBUG-banner ribbon ---------- */
.ribbon {
  position: fixed; top: 0; right: 0; z-index: 60;
  width: 112px; height: 112px;
  overflow: hidden; pointer-events: none;
}
.ribbon a {
  position: absolute; top: 24px; right: -38px;
  width: 152px; padding: 6px 0;
  transform: rotate(45deg);
  background: var(--clay); color: var(--on-clay);
  font: 600 0.6875rem/1 var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; text-align: center; text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}
.ribbon a:hover { filter: brightness(1.08); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner {
  height: 100%;
  display: flex; align-items: center; gap: var(--s-5);
  padding-right: max(var(--gutter), 88px); /* clears the ribbon */
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font: 700 1.125rem/1 var(--f-display); letter-spacing: -0.02em;
  text-decoration: none;
}
.brand img { border-radius: 8px; }
.brand-tld { color: var(--ink-3); font-weight: 500; }
.nav { display: flex; gap: var(--s-1); margin-left: auto; }
.nav a {
  padding: 8px 12px; border-radius: var(--r-pill);
  color: var(--ink-2); font-weight: 500; font-size: 0.9375rem; text-decoration: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.header-tools { display: flex; align-items: center; gap: var(--s-2); }

@media (max-width: 860px) {
  .nav { display: none; }
  .header-tools { margin-left: auto; }
}
@media (max-width: 520px) {
  .header-cta { display: none; } /* the ribbon becomes the CTA */
}

/* ---------- Section scaffolding: the widget-tree rail ---------- */
.section { padding-block: clamp(72px, 10vw, 128px); position: relative; }
.section-alt { background: var(--paper-2); }
.section-head {
  display: grid; gap: var(--s-4);
  max-width: 720px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.section-head p { color: var(--ink-2); font-size: var(--fs-lead); }

.node {
  position: relative;
  display: inline-flex; align-items: baseline; gap: 10px;
  margin-bottom: var(--s-4);
  font: 600 var(--fs-mono)/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink);
}
.node-idx { color: var(--clay); }
.node-paren { color: var(--ink-3); margin-left: -8px; }

@media (min-width: 1320px) {
  main { position: relative; }
  main::before {
    content: "";
    position: absolute; top: 0; bottom: 0;
    left: calc((100% - var(--maxw)) / 2 - 36px);
    border-left: 1px dashed var(--line);
    pointer-events: none;
  }
  .node::before {
    content: "";
    position: absolute; left: -41px; top: 50%;
    width: 11px; height: 11px; margin-top: -6px;
    border-radius: 50%; background: var(--paper); border: 2px solid var(--clay);
  }
  .node::after {
    content: "";
    position: absolute; left: -30px; top: 50%;
    width: 20px; border-top: 1px dashed var(--line);
  }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 6vw, 88px) 0; overflow: hidden; }
.hero-grid {
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(40px, 6vw, 88px);
}
.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 12px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface);
  font: 500 var(--fs-small)/1 var(--f-body); color: var(--ink-2);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.display {
  margin-top: var(--s-5);
  font-size: var(--fs-display); font-weight: 800;
  line-height: 0.94; letter-spacing: -0.045em;
}
.accent { color: var(--clay); }
.lead {
  margin-top: var(--s-5); max-width: 34em;
  font-size: var(--fs-lead); color: var(--ink-2);
}
.cta-row { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

/* Credentials under the CTAs: rating line + stats */
.rating-line {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  margin-top: var(--s-6);
  padding: 10px 18px 10px 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-small); color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.rating-line:hover { border-color: var(--ink); transform: translateY(-1px); }
.stars {
  position: relative; display: inline-block;
  font-size: 1.125rem; line-height: 1; letter-spacing: 2px;
  color: var(--line);
}
.stars-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 92%; /* 4.6 / 5 */
  overflow: hidden; white-space: nowrap;
  color: #E8A21E;
}
.rating-line strong { font: 800 1.125rem/1 var(--f-display); letter-spacing: -0.02em; color: var(--ink); }
.rating-line strong span { font-size: 0.75em; font-weight: 500; color: var(--ink-3); }
.hero-stats {
  display: flex; flex-wrap: wrap;
  margin: var(--s-5) 0 0;
}
.hero-stats > div { padding: 0 clamp(14px, 1.8vw, 24px); border-left: 1px solid var(--line); }
.hero-stats > div:first-child { padding-left: 0; border-left: 0; }
.hero-stats dt { font: 800 clamp(1.375rem, 1.6vw, 1.625rem)/1.1 var(--f-display); letter-spacing: -0.03em; }
.hero-stats dd { margin: 4px 0 0; font-size: var(--fs-small); color: var(--ink-3); }
@media (max-width: 560px) {
  .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
  .hero-stats > div { padding: 0; border-left: 0; }
  .rating-line { border-radius: var(--r-md); }
}

/* Hero stage: three real app screens in front of a terracotta arch */
.hero-visual {
  --pw: clamp(150px, 15.5vw, 228px); /* phone width drives the whole composition */
  position: relative;
  justify-self: center;
  width: calc(var(--pw) * 2.6);
  height: calc(var(--pw) * 2.8);
}
.arch {
  position: absolute; left: 50%; bottom: 0;
  width: calc(var(--pw) * 2.15); height: calc(var(--pw) * 2.5);
  transform: translateX(-50%);
  border-radius: 999px 999px 28px 28px;
  background: #B5482B url("/assets/hero/terracotta.jpg") center / cover;
  box-shadow:
    inset 0 -120px 140px -60px rgba(50, 12, 4, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    var(--shadow);
}
.arch::after {
  content: "";
  position: absolute; inset: 12px;
  border-radius: inherit;
  border: 1.5px dashed rgba(255, 240, 225, 0.45);
}
.device {
  position: absolute; margin: 0;
  width: var(--pw);
  padding: calc(var(--pw) * 0.035);
  border-radius: calc(var(--pw) * 0.17);
  background: #121116;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 40px 60px -28px rgba(40, 10, 0, 0.6),
    0 12px 24px -12px rgba(0, 0, 0, 0.35);
}
.device img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 403 / 900; object-fit: cover;
  border-radius: calc(var(--pw) * 0.14);
  background: #222;
}
.device-center { left: 50%; bottom: calc(var(--pw) * 0.24); z-index: 3; transform: translateX(-50%); }
.device-left  { left: 0;  bottom: calc(var(--pw) * 0.06); z-index: 2; transform: rotate(-8deg) scale(0.84); transform-origin: 100% 100%; }
.device-right { right: 0; bottom: calc(var(--pw) * 0.06); z-index: 2; transform: rotate(8deg) scale(0.84); transform-origin: 0 100%; }
.js .device-left, .js .device-right { animation: fan-in 0.9s 0.15s var(--ease) both; }
@keyframes fan-in { from { opacity: 0; transform: rotate(0) scale(0.84); } }

/* Inspector selection around the center phone */
.device-center::after {
  content: "";
  position: absolute; inset: -9px;
  border: 1.5px dashed var(--debug);
  border-radius: calc(var(--pw) * 0.2);
  pointer-events: none;
}
.device-center::before {
  content: attr(data-widget) " · " attr(data-size);
  position: absolute; right: -9px; top: -9px; z-index: 1;
  transform: translateY(-100%);
  padding: 4px 7px; border-radius: 6px 6px 0 0;
  background: var(--debug); color: var(--paper);
  font: 600 10px/1 var(--f-mono); white-space: nowrap;
}

.float-card {
  position: absolute; z-index: 4;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: float 6s ease-in-out infinite;
}
.rating-card {
  right: calc(var(--pw) * -0.04); top: calc(var(--pw) * 0.62);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 10px;
}
.rating-card img { width: 36px; height: 36px; border-radius: 24%; background: #fff; }
.rating-card span { display: grid; gap: 2px; }
.rating-card strong { font: 800 1.125rem/1 var(--f-display); letter-spacing: -0.02em; }
.rating-card small { font: 500 11px/1 var(--f-mono); color: var(--ink-3); }
.code-chip {
  right: calc(var(--pw) * -0.06); bottom: calc(var(--pw) * -0.04);
  margin: 0; padding: 0 0 12px;
  font: 400 11.5px/1.55 var(--f-mono); color: var(--ink-2);
  animation-delay: 1.5s;
  overflow: hidden;
}
.code-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px; padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 10.5px; color: var(--ink-3);
}
.code-chip code { display: block; padding: 0 14px; }
.bolt { color: #E8A21E; }
.tk-k { color: var(--clay); }
.tk-t { color: var(--debug); }
.tk-s { color: var(--live); }
@keyframes float { 50% { translate: 0 -6px; } }

/* Capability ticker */
.ticker {
  margin-top: clamp(56px, 8vw, 104px);
  border-block: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track {
  display: flex; align-items: center; gap: clamp(20px, 3vw, 40px);
  width: max-content;
  padding: clamp(16px, 2vw, 22px) 0;
  font: 700 clamp(1.125rem, 1.6vw, 1.5rem)/1 var(--f-display); letter-spacing: -0.02em;
  white-space: nowrap;
  animation: ticker 45s linear infinite;
}
.ticker-track i { font-style: normal; font-size: 0.8em; color: var(--clay); }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { --pw: clamp(126px, 34vw, 210px); margin-top: var(--s-6); }
}
@media (max-width: 520px) {
  .rating-card { right: -6px; top: calc(var(--pw) * 0.55); padding: 8px 10px 8px 8px; }
  .rating-card img { width: 28px; height: 28px; }
  .code-chip { display: none; }
}

/* ---------- Work ---------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-6); }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-2);
  font: 500 0.9375rem/1 var(--f-body);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.chip span { font: 400 11px/1 var(--f-mono); color: var(--ink-3); }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip.is-active span { color: color-mix(in srgb, var(--paper) 65%, transparent); }

.app-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.app-card {
  position: relative;
  display: flex; gap: var(--s-4); align-items: flex-start;
  padding: var(--s-5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.app-card[hidden] { display: none; }
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.app-icon {
  flex: none;
  width: 56px; height: 56px; border-radius: 24%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent);
}
.app-body { display: grid; gap: 6px; min-width: 0; }
.app-body > p:not(.app-meta) { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }
.app-meta { display: flex; align-items: center; gap: var(--s-3); margin-top: 4px; }
.tag {
  padding: 4px 9px; border-radius: var(--r-pill);
  background: var(--paper-2);
  font: 500 11px/1 var(--f-mono); color: var(--ink-2); letter-spacing: 0.02em;
}
.rating { font: 600 12px/1 var(--f-mono); color: var(--clay); }
/* Whole card is the link (stretched) */
.app-link { position: absolute; inset: 0; border-radius: inherit; font-size: 0; color: transparent; }
.app-card::before {
  content: "↗";
  position: absolute; top: 18px; right: 20px;
  color: var(--ink-3);
  transition: color 0.2s var(--ease), transform 0.2s var(--ease);
}
.app-card:hover::before { color: var(--clay); transform: translate(2px, -2px); }

.more-link { margin-top: var(--s-6); }
.more-link a {
  font: 600 0.9375rem/1 var(--f-mono); color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--clay); text-underline-offset: 6px; text-decoration-thickness: 2px;
}

/* Featured apps (real Play Store feature graphics) */
.feature-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: clamp(48px, 7vw, 72px);
}
.feature-card {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-art {
  width: 100%; height: auto; aspect-ratio: 1024 / 500;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  transition: transform 0.5s var(--ease);
}
.feature-card:hover .feature-art { transform: scale(1.02); }
.feature-body {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
}
.feature-body > div { flex: 1; min-width: 0; }
.feature-body p { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.45; }
.feature-icon {
  flex: none; width: 44px; height: 44px; border-radius: 24%;
  object-fit: cover; background: #fff;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent);
}
.feature-body .tag { flex: none; }
.subhead {
  margin-bottom: var(--s-4);
  font: 600 var(--fs-mono)/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}
@media (max-width: 760px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-body .tag { display: none; }
}

/* Inspector hover label on any [data-widget] (hover-capable devices) */
@media (hover: hover) {
  [data-widget]:not(.device)::after {
    z-index: 2;
    content: attr(data-widget) " · " attr(data-size);
    position: absolute; left: -1px; top: -1px;
    transform: translateY(-100%);
    padding: 3px 7px;
    border-radius: 6px 6px 0 0;
    background: var(--debug); color: var(--paper);
    font: 600 10px/1.2 var(--f-mono); letter-spacing: 0.02em; white-space: nowrap;
    opacity: 0; pointer-events: none;
    transition: opacity 0.15s var(--ease);
  }
  [data-widget]:not(.device):hover { outline: 1.5px dashed var(--debug); outline-offset: 0; border-top-left-radius: 0; }
  [data-widget]:not(.device):hover::after { opacity: 1; }
  .feature-card[data-widget]::after { transform: none; border-radius: 0 0 6px 0; }
}

/* ---------- Services ---------- */
.service-grid {
  display: grid; gap: 1px;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--line);
}
.service {
  position: relative;
  display: grid; align-content: start; gap: var(--s-3);
  padding: clamp(24px, 3vw, 36px);
  background: var(--surface);
}
.service:first-child { border-top-left-radius: var(--r-lg); }
.service:nth-child(3) { border-top-right-radius: var(--r-lg); }
.service:nth-child(4) { border-bottom-left-radius: var(--r-lg); }
.service:last-child { border-bottom-right-radius: var(--r-lg); }
.service p { color: var(--ink-2); font-size: 0.9375rem; }
.service-glyph {
  display: grid; place-items: center;
  width: 44px; height: 44px; margin-bottom: var(--s-2);
  border-radius: 12px;
  background: var(--clay-soft); color: var(--clay);
  font-size: 1.25rem;
}
@media (max-width: 960px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .service:nth-child(n) { border-radius: 0; }
  .service:first-child { border-top-left-radius: var(--r-lg); }
  .service:nth-child(2) { border-top-right-radius: var(--r-lg); }
  .service:nth-child(5) { border-bottom-left-radius: var(--r-lg); }
  .service:last-child { border-bottom-right-radius: var(--r-lg); }
}
@media (max-width: 600px) {
  .service-grid { grid-template-columns: 1fr; }
  .service:nth-child(n) { border-radius: 0; }
  .service:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .service:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
}

/* ---------- Stack (always-dark band) ---------- */
.section-stack {
  --st-bg: #17161C;
  --st-card: #1F1E26;
  --st-fg: #F1ECE2;
  --st-mute: #A8A2AE;
  --st-line: #34323C;
  background: var(--st-bg);
  color: var(--st-fg);
}
:root[data-theme="dark"] .section-stack { --st-bg: #0C0B0F; --st-card: #18171D; --st-line: #2A2830; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .section-stack { --st-bg: #0C0B0F; --st-card: #18171D; --st-line: #2A2830; }
}
.section-stack h2, .section-stack .node { color: var(--st-fg); }
.section-stack .accent, .section-stack .node-idx { color: #EE6A45; }
.section-stack .node-paren { color: var(--st-mute); }
.section-stack .tk-t { color: #3FCFEA; }
.stack-grid {
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(40px, 6vw, 88px);
}
.stack-copy h2 { margin-bottom: var(--s-5); }
.stack-copy > p:not(.node) { color: var(--st-mute); font-size: var(--fs-lead); max-width: 34em; }
.checks { display: grid; gap: var(--s-3); margin-top: var(--s-6); }
.checks li { display: flex; align-items: flex-start; gap: var(--s-3); }
.checks li::before {
  content: "✓";
  flex: none; display: grid; place-items: center;
  width: 22px; height: 22px; margin-top: 2px; border-radius: 50%;
  background: rgba(91, 196, 135, 0.16); color: #5BC487;
  font-size: 12px; font-weight: 700;
}
.tree-card {
  position: relative;
  border: 1px solid var(--st-line); border-radius: var(--r-lg);
  background: var(--st-card);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.7);
  font: 400 0.875rem/1.6 var(--f-mono); color: var(--st-mute);
}
.tree-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--st-line);
  font-size: 12px;
}
.tree-dots { display: flex; gap: 6px; }
.tree-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--st-line); }
.tree-dots i:first-child { background: #EE6A45; }
.tree-body { padding: 20px clamp(16px, 3vw, 28px) 24px; }
.tree-indent { padding-left: 2ch; }
.tree { margin: 4px 0 4px 3ch; padding: 2px 0; border-left: 1px dashed #4A4753; }
.tree li { position: relative; display: grid; gap: 2px; padding: 10px 0 10px 28px; }
.tree li::before {
  content: "";
  position: absolute; left: 0; top: 21px;
  width: 18px; border-top: 1px dashed #4A4753;
}
.tree li::after {
  content: "";
  position: absolute; left: -4px; top: 18px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #EE6A45;
}
.tree code { font: 600 0.9375rem/1.3 var(--f-mono); color: var(--st-fg); }
.tree span { font: 400 0.875rem/1.4 var(--f-body); color: var(--st-mute); }
@media (max-width: 900px) { .stack-grid { grid-template-columns: 1fr; } }

/* ---------- Process ---------- */
.steps {
  display: grid; gap: var(--s-4);
  grid-template-columns: repeat(5, 1fr);
  counter-reset: step;
}
.step {
  position: relative;
  display: grid; gap: var(--s-4); align-content: start;
  padding-top: var(--s-5);
  border-top: 2px solid var(--ink);
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--ink-2); font-size: 0.9375rem; }
.step-n { font: 600 var(--fs-mono)/1 var(--f-mono); color: var(--clay); }
.step::before {
  content: "";
  position: absolute; top: -7px; left: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--ink);
}
@media (max-width: 1000px) {
  .steps { grid-template-columns: 1fr; gap: 0; }
  .step {
    grid-template-columns: 48px 1fr;
    padding: 0 0 var(--s-6) 0;
    border-top: 0;
  }
  .step::before { top: 0; left: auto; display: none; }
  .step-n {
    display: grid; place-items: center; align-self: start;
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid var(--ink); background: var(--paper);
    position: relative; z-index: 1;
  }
  .step:not(:last-child)::after {
    content: "";
    position: absolute; left: 17px; top: 36px; bottom: 0;
    border-left: 2px solid var(--line);
  }
}

.why {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4);
  margin-top: clamp(48px, 7vw, 80px);
}
.why-item {
  display: grid; gap: var(--s-2);
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--ink); color: var(--paper);
}
.why-item h3 { color: var(--paper); }
.why-item p { color: color-mix(in srgb, var(--paper) 72%, transparent); font-size: 0.9375rem; }
.why-item:first-child { background: var(--clay); }
.why-item:first-child h3, .why-item:first-child p { color: var(--on-clay); }
@media (max-width: 860px) { .why { grid-template-columns: 1fr; } }

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-4);
  padding: var(--s-5) 0;
  font: 700 1.125rem/1.3 var(--f-display); letter-spacing: -0.01em;
  cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line);
  font: 400 1.125rem/1 var(--f-mono); color: var(--ink-2);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); background: var(--ink); color: var(--paper); border-color: var(--ink); }
.faq details p { padding: 0 48px var(--s-5) 0; color: var(--ink-2); }
.faq details a { color: var(--ink); text-decoration-color: var(--clay); text-underline-offset: 3px; }
@media (max-width: 860px) { .faq-grid { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(40px, 6vw, 96px); align-items: start;
}
.contact h2 { font-size: clamp(2.5rem, 4.5vw + 0.8rem, 4.5rem); line-height: 0.95; letter-spacing: -0.045em; }
.contact-copy > p:not(.node) { margin-top: var(--s-5); color: var(--ink-2); font-size: var(--fs-lead); max-width: 28em; }
.contact-links { display: grid; gap: var(--s-2); margin-top: var(--s-6); }
.contact-links a {
  font: 500 1rem/1.4 var(--f-mono);
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 5px;
  transition: text-decoration-color 0.2s var(--ease);
}
.contact-links a:hover { text-decoration-color: var(--clay); }

.brief {
  position: relative;
  display: grid; gap: var(--s-5);
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.brief fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.brief legend, .field > span {
  display: block; margin-bottom: 10px; padding: 0;
  font: 600 var(--fs-mono)/1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}
.chip-set { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip-opt { position: relative; cursor: pointer; }
.chip-opt input { position: absolute; opacity: 0; pointer-events: none; }
.chip-opt span {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  font-weight: 500; font-size: 0.9375rem; color: var(--ink-2);
  transition: all 0.2s var(--ease);
}
.chip-opt:hover span { border-color: var(--ink); color: var(--ink); }
.chip-opt input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip-opt input:focus-visible + span { outline: 2px dashed var(--debug); outline-offset: 3px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.field { display: block; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); color: var(--ink);
  font: 400 1rem/1.4 var(--f-body);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 112px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--debug);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--debug) 22%, transparent);
}
.field .is-invalid { border-color: var(--clay); }
.form-note { min-height: 1.2em; font-size: var(--fs-small); color: var(--ink-2); text-align: center; }

@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: var(--s-6); }
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3);
  font-size: var(--fs-small); color: var(--ink-3);
}
.footer-inner .mono { font-size: var(--fs-mono); }

/* ---------- Widget inspector mode (debugPaintSizeEnabled) ---------- */
.debug-paint main :where(section, div, article, header, li, p, h1, h2, h3, a, button, form, fieldset, label, ul, ol, dl, pre) {
  outline: 1px solid color-mix(in srgb, var(--debug) 55%, transparent);
  outline-offset: -1px;
}
.debug-paint main :where(h1, h2, h3, p) {
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(1lh - 1px), color-mix(in srgb, var(--clay) 25%, transparent) calc(1lh - 1px) 1lh);
}
.inspector-tip {
  position: fixed; z-index: 90;
  padding: 5px 8px; border-radius: 6px;
  background: var(--debug); color: var(--paper);
  font: 600 11px/1.2 var(--f-mono); white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; }
}
