/* ==========================================================================
   Signals Lab — single source of truth for the site's look.
   Linked by index.html, /ham/, the deck template, and every Worker-rendered
   page (/presentations/, /notes/, /projects/, /admin/). Change it once here.
   ========================================================================== */

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

:root {
  /* Light — cool, instrument-panel neutral */
  --bg: #f6f8fa;
  --bg-secondary: #eef2f6;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #44546a;
  --text-muted: #708098;
  --border: #d3dce6;
  --border-soft: #e4eaf0;
  --accent: #0e7490;          /* signal teal */
  --accent-strong: #155e75;
  --accent-soft: #d9f0f5;
  --link: #0369a1;
  --link-hover: #075985;
  --good: #047857;
  --warn: #b45309;
  --danger: #b42318;
  --shadow: 0 1px 3px rgba(15, 40, 60, .07), 0 4px 12px rgba(15, 40, 60, .04);
  --shadow-strong: 0 4px 16px rgba(15, 40, 60, .11), 0 10px 30px rgba(15, 40, 60, .08);
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-article: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-mono: 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;
  --wave-stroke: %230e7490;
}

[data-theme="dark"] {
  /* Dark — night shift at the radio desk */
  --bg: #0b1220;
  --bg-secondary: #121d30;
  --bg-card: #111c2e;
  --text: #e2e8f0;
  --text-secondary: #a8b8cc;
  --text-muted: #6e819b;
  --border: #27374d;
  --border-soft: #1c2a3e;
  --accent: #22d3ee;
  --accent-strong: #67e8f9;
  --accent-soft: #0c3444;
  --link: #56ccf2;
  --link-hover: #8ee0f7;
  --good: #34d399;
  --warn: #fbbf24;
  --danger: #fca5a5;
  --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .3);
  --shadow-strong: 0 4px 16px rgba(0, 0, 0, .55), 0 10px 30px rgba(0, 0, 0, .4);
  --wave-stroke: %2322d3ee;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  transition: background .3s, color .3s;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ── Signal motif: a faint sine carrier behind the page ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-size: 160px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 40'><path d='M0 20 Q 15 4 30 20 T 60 20 T 90 20 T 120 20' fill='none' stroke='%230e7490' stroke-width='1' opacity='0.10'/></svg>");
}
[data-theme="dark"] body::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 40'><path d='M0 20 Q 15 4 30 20 T 60 20 T 90 20 T 120 20' fill='none' stroke='%2322d3ee' stroke-width='1' opacity='0.09'/></svg>");
}

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

/* ── Header / nav ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header-inner {
  max-width: 1120px; margin: 0 auto; padding: .8rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand-mark {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.08rem;
  color: var(--text); letter-spacing: -.01em;
}
.brand-mark:hover { text-decoration: none; color: var(--accent-strong); }
.brand-mark img, .brand-mark svg { width: 30px; height: 30px; }
.brand-call {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
  letter-spacing: .08em; color: var(--accent-strong);
  background: var(--accent-soft); border-radius: 5px; padding: .1rem .4rem;
}
.nav-links { display: flex; gap: 1.4rem; align-items: center; }
.nav-links a { color: var(--text-secondary); font-size: .94rem; font-weight: 500; }
.nav-links a:hover { color: var(--accent-strong); text-decoration: none; }
.nav-links a.active { color: var(--accent-strong); font-weight: 600; }
.theme-toggle {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px;
  padding: .32rem .55rem; cursor: pointer; font-size: 15px; color: var(--text); line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ── Generic page shell ── */
.page-shell { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.page-head { padding: 2.6rem 0 .5rem; }
.page-head h1 {
  font-family: var(--font-display); font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.04; letter-spacing: -.025em; text-wrap: balance;
}
.page-head .lede {
  font-family: var(--font-article); font-size: 1.18rem;
  color: var(--text-secondary); max-width: 62ch; margin-top: .55rem;
}

/* ── Hero (landing) ── */
.hero {
  max-width: 1120px; margin: 3.2rem auto 0; padding: 0 1.5rem;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 3rem; align-items: center;
}
.hero-text h1 {
  font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05; letter-spacing: -.03em; margin-bottom: 1.1rem; text-wrap: balance;
}
.hero-text h1 .accent { color: var(--accent-strong); }
.hero-tagline {
  font-size: 1.2rem; color: var(--text-secondary);
  margin-bottom: 1.6rem; max-width: 40ch; line-height: 1.55;
}
.hero-cta {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--accent); color: #fff; font-weight: 600;
  padding: .8rem 1.35rem; border-radius: 8px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.hero-cta:hover {
  background: var(--accent-strong); color: #fff; text-decoration: none;
  transform: translateY(-1px); box-shadow: var(--shadow-strong);
}
[data-theme="dark"] .hero-cta { color: #06202b; }
[data-theme="dark"] .hero-cta:hover { color: #06202b; }
.hero-art { display: flex; align-items: center; justify-content: center; }
.hero-art img { width: 100%; height: auto; border-radius: 16px; box-shadow: var(--shadow-strong); }
.hero-art svg { width: 100%; height: auto; }

/* ── Divider with a signal blip ── */
.wave-divider {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin: 3.5rem auto 1rem; color: var(--accent); opacity: .55;
}
.wave-divider::before, .wave-divider::after {
  content: ""; flex: 1; max-width: 90px; height: 1px; background: var(--border);
}
.wave-divider svg { width: 34px; height: 12px; }

/* ── Doors (top-level chooser) ── */
.doors {
  max-width: 1120px; margin: 2.4rem auto 0; padding: 0 1.5rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem;
}
.door {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 14px;
  padding: 1.5rem 1.35rem; color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.door:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-strong);
  border-color: var(--accent); color: var(--text); text-decoration: none;
}
/* radiating-signal arcs in the corner */
.door::after {
  content: ""; position: absolute; top: -18px; right: -18px; width: 72px; height: 72px;
  pointer-events: none; opacity: .5; transition: opacity .2s;
  background-repeat: no-repeat; background-size: contain;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><g fill='none' stroke='%230e7490' stroke-width='2'><circle cx='30' cy='30' r='8'/><circle cx='30' cy='30' r='17'/><circle cx='30' cy='30' r='26'/></g></svg>");
}
[data-theme="dark"] .door::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'><g fill='none' stroke='%2322d3ee' stroke-width='2'><circle cx='30' cy='30' r='8'/><circle cx='30' cy='30' r='17'/><circle cx='30' cy='30' r='26'/></g></svg>");
  opacity: .28;
}
.door:hover::after { opacity: .75; }
.door-kind {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent-strong); font-weight: 700;
}
.door h2 {
  font-family: var(--font-display); font-size: 1.35rem; line-height: 1.2;
  letter-spacing: -.02em; color: var(--text);
}
.door p { color: var(--text-muted); font-size: .92rem; line-height: 1.5; flex: 1; }
.door .enter { color: var(--link); font-weight: 600; font-size: .92rem; margin-top: .2rem; }

/* ── Filter controls (index pages) ── */
.controls {
  position: sticky; top: 56px; z-index: 20; background: var(--bg);
  padding: 1rem 0 .6rem; display: flex; flex-wrap: wrap; gap: .75rem;
  align-items: center; border-bottom: 1px solid var(--border-soft);
}
.search { flex: 1; min-width: 240px; position: relative; }
.search svg {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.search input {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: .68rem .9rem .68rem 2.4rem;
}
.search input::placeholder { color: var(--text-muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select {
  font-family: var(--font-body); font-size: .9rem; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  /* Right padding clears the custom chevron, which is a background image and so
     does not reserve any layout space of its own. The min-width matters too:
     browsers size a select to its longest option WITHOUT accounting for that
     padding, so the label runs under the chevron without a floor here. */
  padding: .68rem 2.2rem .68rem .8rem; min-width: 10.5rem;
  cursor: pointer; appearance: none;
  background-repeat: no-repeat; background-position: right .7rem center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M3 4.5 6 8l3-3.5' fill='none' stroke='%23708098' stroke-width='1.4'/></svg>");
}
.count { font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.count b { color: var(--text); }
.clear {
  font-size: .85rem; color: var(--accent-strong); background: none; border: none;
  cursor: pointer; font-weight: 600; padding: .3rem .1rem; display: none;
}
.clear.show { display: inline; }
.filters { padding: 1rem 0 .25rem; display: flex; flex-direction: column; gap: .7rem; }
.filt-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 700; margin-right: .4rem;
}
.chips { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.chip {
  font-family: var(--font-body); font-size: .82rem; font-weight: 600;
  color: var(--text-secondary); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 999px; padding: .3rem .7rem;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { border-color: var(--accent); }
.chip .n { color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .chip.on { color: #06202b; }
.chip.on .n { color: rgba(255, 255, 255, .8); }
[data-theme="dark"] .chip.on .n { color: rgba(6, 32, 43, .7); }
.chip.cat.on { background: var(--accent-strong); border-color: var(--accent-strong); }
.more { font-size: .8rem; color: var(--link); background: none; border: none; cursor: pointer; font-weight: 600; }

/* ── Card grid ── */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem; margin: 1.5rem 0 4rem;
}
.card {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 14px;
  box-shadow: var(--shadow); color: var(--text);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.card:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-strong);
  border-color: var(--accent); text-decoration: none; color: var(--text);
}
.card-thumb {
  width: 100%; height: 168px; object-fit: cover; display: block;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border-soft);
}
.card-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: var(--accent); background: var(--accent-soft);
}
.card-body { display: flex; flex-direction: column; gap: .5rem; padding: 1.15rem 1.35rem 1.25rem; flex: 1; }
.eyebrow {
  font-size: .71rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent-strong); font-weight: 700;
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
}
.eyebrow .dot { color: var(--border); }
.eyebrow .date, .eyebrow .read { color: var(--text-muted); font-weight: 600; }
.card h2 {
  font-family: var(--font-display); font-size: 1.18rem; line-height: 1.24;
  letter-spacing: -.02em; font-weight: 700; color: var(--text); text-wrap: balance;
}
.card p { font-family: var(--font-article); font-size: .97rem; line-height: 1.5; color: var(--text-secondary); flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.tag {
  font-size: .72rem; font-weight: 600; color: var(--accent-strong);
  background: var(--accent-soft); border-radius: 6px; padding: .12rem .5rem;
  cursor: pointer; border: 1px solid transparent;
}
.tag:hover { border-color: var(--accent); }
.tag.on { background: var(--accent); color: #fff; }
[data-theme="dark"] .tag.on { color: #06202b; }
.tag.static { cursor: default; }
.tag.static:hover { border-color: transparent; }

/* repo/status pill on project cards */
.repo-pill {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; padding: .1rem .45rem;
  border-radius: 5px; border: 1px solid var(--border); color: var(--text-muted);
  white-space: nowrap;
}
.repo-pill.public { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.repo-pill.live { color: var(--accent-strong); border-color: var(--accent); }

.empty { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty b { color: var(--text); }

/* ── About / instructor block ── */
.about {
  max-width: 900px; margin: 4.5rem auto 0; padding: 2.4rem;
  background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 16px;
  box-shadow: var(--shadow); display: grid; grid-template-columns: auto 1fr;
  gap: 2rem;
  /* Top-aligned, not centered: against three paragraphs a centered photo drifts
     down beside the middle of the text instead of sitting with the heading. */
  align-items: start;
}

/* The header is sticky, so an anchor jump would otherwise tuck the target
   heading underneath it. Applies to any in-page anchor target, not just #about. */
:target, [id] { scroll-margin-top: 5rem; }
.about-photo {
  width: 140px; height: 140px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--accent-soft); box-shadow: var(--shadow); flex-shrink: 0;
}
.about-photo-placeholder {
  width: 140px; height: 140px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-strong);
  border: 3px solid var(--accent-soft); font-family: var(--font-mono);
  font-size: 1.1rem; font-weight: 700; letter-spacing: .05em;
}
.about h2 { font-family: var(--font-display); font-size: 1.45rem; margin-bottom: .45rem; letter-spacing: -.02em; }
.about .credentials { color: var(--text-muted); font-size: .92rem; margin-bottom: .1rem; }
.about p { color: var(--text-secondary); margin-bottom: .75rem; line-height: 1.65; }
.about-links { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; font-weight: 600; }
.about-links .sep { color: var(--border); }
@media (max-width: 760px) { .about-links { justify-content: center; } }

/* ── Long-form prose (notes, ham page) ── */
.prose { max-width: 68ch; margin: 0 auto; padding: 1rem 0 4rem; }
.prose h2 {
  font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -.02em;
  margin: 2.2rem 0 .7rem; color: var(--text);
}
.prose h3 { font-family: var(--font-display); font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
.prose p, .prose li { font-family: var(--font-article); font-size: 1.06rem; line-height: 1.75; color: var(--text-secondary); }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem 1.3rem; }
.prose li { margin-bottom: .35rem; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--bg-secondary); border: 1px solid var(--border-soft); border-radius: 4px; padding: .08em .35em; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding-left: 1rem; margin: 1.2rem 0;
  color: var(--text-muted); font-style: italic;
}

/* spec table — station gear, project facts */
.spec { width: 100%; border-collapse: collapse; margin: 1rem 0 1.6rem; font-size: .95rem; }
.spec th, .spec td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border-soft); }
.spec th { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.spec td { color: var(--text-secondary); }

/* ── Footer ── */
.site-footer {
  margin-top: 4rem; padding: 2.4rem 1.5rem; border-top: 1px solid var(--border-soft);
  text-align: center; color: var(--text-muted); font-size: .9rem;
}
.site-footer .footer-mark { font-weight: 600; color: var(--text-secondary); }
.site-footer a { color: var(--text-secondary); }

/* ── Responsive ── */
@media (max-width: 1000px) { .doors { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; margin-top: 2rem; gap: 1.8rem; }
  .hero-art { order: -1; }
  .about { grid-template-columns: 1fr; text-align: center; }
  .about-photo, .about-photo-placeholder { margin: 0 auto; }
}
@media (max-width: 640px) {
  .nav-links a { display: none; }
  .controls { top: 0; }
  .doors { grid-template-columns: 1fr; }
}

@media print {
  body::before, .site-header, .controls, .filters, .site-footer { display: none !important; }
}
