/* ==========================================================================
   hounsfieldhub — layout and components
   No external requests: fonts are self-hosted, there is no analytics,
   no CDN, no cookie. That is a claim this site has to keep true.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.021em;
  margin: 0 0 0.6em;
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: -0.01em; }

p { margin: 0 0 1.1em; max-width: var(--measure); text-wrap: pretty; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--accent); color: var(--on-accent);
  padding: 0.7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-head .wrap {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 68px; padding-block: 0.6rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--fg); }
.brand .mark { width: 34px; height: 34px; flex: 0 0 auto; }
.brand .wordmark {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.18rem; letter-spacing: -0.03em;
}
.brand .wordmark .hub { color: var(--accent); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1.4rem; }
.site-nav a {
  color: var(--fg-muted); text-decoration: none; font-size: var(--step--1);
  font-weight: 600; letter-spacing: 0.01em;
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--fg); }
@media (max-width: 720px) { .site-nav .nav-optional { display: none; } }

.theme-toggle {
  background: transparent; border: 1px solid var(--border); color: var(--fg-muted);
  border-radius: 999px; width: 38px; height: 38px; cursor: pointer;
  display: grid; place-items: center; font-size: 1rem; line-height: 1;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4.5rem); position: relative; overflow: hidden; }
.hero::after {   /* heel subtle radiology grid, never busy photography */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 30% 20%, black, transparent 72%);
  opacity: var(--grid-opacity);
}
.hero .mark { width: clamp(120px, 22vw, 190px); height: auto; margin-bottom: 2rem; }
.hero h1 { max-width: 20ch; }
.hero h1 .accent { color: var(--accent); }
.hero .lede { font-size: var(--step-1); color: var(--fg-muted); max-width: 54ch; }

.tagline-strip {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: var(--step--1);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-muted);
  margin-bottom: 1.75rem;
}
.tagline-strip .sep { color: var(--accent); font-weight: 400; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.8rem 1.5rem; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: var(--step--1);
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- sections ---------- */
section { padding-block: clamp(2.75rem, 6vw, 4.5rem); }
.section-alt { background: var(--bg-raised); border-block: 1px solid var(--border); }
.eyebrow {
  font-family: var(--font-display); font-weight: 600; font-size: var(--step--1);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 0.9rem;
}

.grid { display: grid; gap: 1.25rem; margin-top: 2rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem 1.4rem;
}
.section-alt .card { background: var(--bg); }
.card h3 { margin-bottom: 0.45rem; }
.card p { margin-bottom: 0; color: var(--fg-muted); font-size: var(--step--1); }

.icon-row { display: flex; gap: 1rem; align-items: flex-start; }
.icon-row svg { flex: 0 0 auto; width: 30px; height: 30px; stroke: var(--accent); fill: none; stroke-width: 1.7; }
.icon-row.human svg { stroke: var(--human); }

.status-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.status-list li {
  display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem;
  padding: 0.85rem 0; border-top: 1px solid var(--border);
}
.status-list li:last-child { border-bottom: 1px solid var(--border); }
.status-list .state {
  font-family: var(--font-display); font-weight: 600; font-size: var(--step--1);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.state-done { color: var(--accent); }
.state-wip  { color: var(--fg); }
.state-todo { color: var(--fg-muted); }
.status-list .what { font-size: var(--step--1); color: var(--fg-muted); }

pre {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem 1.15rem; overflow-x: auto;
  font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.6;
}
code { font-family: var(--font-mono); font-size: 0.9em; }
pre code { font-size: inherit; }

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--border); background: var(--bg-sunken);
  padding-block: 2.5rem; font-size: var(--step--1); color: var(--fg-muted);
}
.site-foot .cols { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; }
.site-foot a { color: var(--fg-muted); }
.site-foot a:hover { color: var(--accent); }
.site-foot .privacy { max-width: 40ch; }
.site-foot strong { color: var(--fg); font-family: var(--font-display); }

/* ---------- the mark (inline SVG, driven by the theme) ---------- */
.mark { display: block; }
.mark .mk-arc, .mark .mk-ring {
  fill: none; stroke: var(--mark-line); stroke-width: 3.4; stroke-linecap: round;
}
.mark .mk-disc { fill: var(--mark-disc); }
.mark .mk-core { fill: var(--mark-core); }
.mark .mk-node { fill: var(--accent); }
.mark .mk-node.human { fill: var(--human); }

/* the concept section is a deliberate 2x2, not an accidental 3+1 */
.grid-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 660px) { .grid-2x2 { grid-template-columns: 1fr; } }
