/* cst1 likes cameras. The first :root block and the dark one below are also read by images.py for the
   drawings' palette: keep --bg --fg --muted --line --accent --card plain hex. */
:root {
  --bg: #faf8f4;
  --fg: #1d1b18;
  --muted: #655f56;
  --line: #e4ded3;
  --accent: #b4441c;
  --card: #ffffff;
  --on-accent: #ffffff;
  --accent-soft: #f6e6dd;
  --field: #8f877b; /* form field borders: 3:1 against --card and --bg */
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 6px 20px rgba(40, 30, 20, .06);
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --fg: #ece8e1;
    --muted: #a39d93;
    --line: #34312c;
    --accent: #f08a5d;
    --card: #1f1d1a;
    --on-accent: #1a1209;
    --accent-soft: #3a2519;
    --field: #736c62;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: .14em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Inline links get a small radius for their ring; components keep their own shape (the outline follows it). */
a:not([class]):focus-visible { border-radius: 3px; }
[hidden] { display: none !important; }
code {
  font: .88em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--card); border: 1px solid var(--line); border-radius: 5px; padding: .05em .3em;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.35rem + 2.6vw, 3rem); font-weight: 750; letter-spacing: -.03em; margin: .25rem 0 1rem; }
h2 { font-size: clamp(1.35rem, 1.15rem + .8vw, 1.65rem); font-weight: 700; margin: 2.75rem 0 .75rem; }
h3 { font-size: 1.15rem; font-weight: 650; margin: 2rem 0 .4rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------------------------------------------------------------- frame */
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 48rem) { .wrap { padding: 0 1.5rem; } }
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10; padding: .6rem 1rem; border-radius: 8px;
  background: var(--accent); color: var(--on-accent); font-weight: 650; text-decoration: none;
}
.skip:focus { top: .75rem; }
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .9rem; padding-bottom: .5rem; }
.brand {
  display: inline-flex; align-items: center; gap: .6rem; color: var(--fg); text-decoration: none;
  font-weight: 750; font-size: 1.1rem; letter-spacing: -.02em;
}
.brand { min-height: 44px; white-space: nowrap; }
@media (max-width: 22rem) { .brand { font-size: 1rem; } .ask-link { font-size: .85rem; padding: 0 .7rem; } }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; }
.ask-link {
  font-size: .9rem; font-weight: 650; text-decoration: none; color: var(--accent);
  border: 1.5px solid currentColor; border-radius: 999px; padding: 0 .85rem; white-space: nowrap;
  display: inline-flex; align-items: center; min-height: 40px;
}
.ask-link:hover { background: var(--accent-soft); }
.navwrap { position: relative; }
/* On phones the nav scrolls sideways; a fade on the right edge says there is more. */
.navwrap::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: .4rem; width: 2.5rem; pointer-events: none;
  background: linear-gradient(to right, transparent, var(--bg) 85%);
}
nav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; padding: .15rem 2rem .5rem 0; margin: 0 -.6rem; scroll-padding-inline: .6rem; }
nav::-webkit-scrollbar { display: none; }
nav a {
  flex: none; color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 550;
  padding: 0 .6rem; border-radius: 8px; white-space: nowrap; display: inline-flex; align-items: center; min-height: 40px;
}
nav a:hover { color: var(--fg); background: var(--line); }
nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }
@media (min-width: 64rem) { nav { flex-wrap: wrap; overflow: visible; padding-right: 0; } .navwrap::after { display: none; } }

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin: 0; padding: 1rem 0 0; font-size: .875rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: .5rem; color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; min-height: 32px; }
.crumbs a { color: var(--muted); padding: .35rem 0; }
.crumbs a:hover { color: var(--accent); }

main { margin: 0 auto; padding: 1.75rem 1rem 3rem; }
main.narrow { max-width: calc(68ch + 2rem); }
main.medium { max-width: 62rem; }
main.wide { max-width: 72rem; }
@media (min-width: 48rem) { main { padding: 2.5rem 1.5rem 4rem; } main.narrow { max-width: calc(68ch + 3rem); } }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding: 2rem 0 2.75rem; }
.site-footer .wrap { display: grid; gap: 1rem; }
.agent-note { margin: 0; max-width: 62ch; }
.foot-links { list-style: none; margin: 0 -.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0 .25rem; }
.foot-links a { color: var(--fg); font-weight: 550; display: inline-flex; align-items: center; min-height: 40px; padding: 0 .5rem; }

/* ---------------------------------------------------------------- prose */
.prose ul, .prose ol { padding-left: 1.25rem; margin: 0 0 1.25rem; }
.prose li { margin: .45rem 0; padding-left: .2rem; }
.prose ul li::marker { color: var(--accent); }
.prose ol li::marker { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.prose h2 { padding-top: .25rem; }
.prose strong { font-weight: 650; }
.lede, .lede p { font-size: 1.125rem; color: var(--fg); }
.ask-note {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: .7rem 1rem; margin: 0 0 1.5rem; font-size: .95rem; color: var(--muted);
}
/* Every drawing slot has the same frame, so a placeholder and a finished drawing sit the same way. */
.page-art { margin: 0 0 2rem; }
.page-art img, .hero-art img, .gear-art > img {
  width: 100%; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
}
.wide-art { max-width: 48rem; }
/* Wider than a phone, a guide's drawing is letterboxed to 3:1 so the first paragraph stays above the fold. */
@media (min-width: 40rem) { .page-art img { aspect-ratio: 3 / 1; object-fit: contain; } }
@media (max-width: 40rem) {
  .page-art { margin-bottom: 1.5rem; }
}

/* ---------------------------------------------------------------- cards and chips */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.card {
  display: flex; flex-direction: column; gap: .35rem; height: 100%; padding: 1.1rem 1.15rem 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--fg); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-icon { width: 44px; height: 44px; margin-bottom: .35rem; border-radius: 10px; }
@media (max-width: 40rem) {
  /* On a phone the icon sits beside the title: stacked, six cards made two screens of mostly air. */
  .cards { gap: .75rem; }
  .card:has(.card-icon) { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: .9rem; row-gap: .2rem; padding: 1rem; }
  .card:has(.card-icon) .card-icon { grid-row: 1 / span 2; margin: 0; }
}
.card-title { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.card:hover .card-title { color: var(--accent); }
.card-text { display: block; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.card-text::first-letter { text-transform: uppercase; }
.card-stats { font-variant-numeric: tabular-nums; }
.card-stats b { font-weight: 700; color: var(--accent); }
.card-meta { font-size: .85rem; color: var(--muted); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: center; min-height: 40px; font: inherit; font-size: .88rem; line-height: 1.3; font-weight: 550;
  text-decoration: none; text-align: left; color: var(--fg); background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: .45rem .9rem; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------------------------------------------------------------- ask */
.ask-box label { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: .2rem; }
.ask-hint { color: var(--muted); font-size: .9rem; margin: 0 0 .6rem; }
.ask-row { display: flex; gap: .5rem; margin-top: .5rem; }
.ask-box input {
  flex: 1; min-width: 0; font: inherit; padding: .7rem .95rem; color: var(--fg);
  background: var(--card); border: 1.5px solid var(--field); border-radius: 12px;
}
.ask-box input:focus-visible, .convert-form input:focus-visible, .convert-form select:focus-visible, .filter input:focus-visible {
  border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px;
}
.ask-box input::placeholder, .convert-form input::placeholder { color: var(--muted); opacity: .85; }
button[type="submit"] {
  font: inherit; font-weight: 700; padding: .7rem 1.35rem; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
button[type="submit"]:hover { filter: brightness(1.08); }
.ask-box .chips { margin-top: 1rem; }
.ask-box.big {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 1.25rem; box-shadow: var(--shadow);
}
.ask-box.big input { font-size: 1.1rem; padding: .85rem 1.1rem; background: var(--bg); }
.ask-box.big button[type="submit"] { font-size: 1.05rem; padding: .85rem 1.6rem; }
.ask-cta, .ask-again { margin-top: 3.5rem; padding: 1.5rem; background: var(--accent-soft); border-radius: 20px; }
.ask-cta .ask-box input, .ask-again .ask-box input { background: var(--card); }
@media (max-width: 30rem) { .ask-row { flex-direction: column; } }

/* ---------------------------------------------------------------- home */
.hero { display: grid; gap: 2rem; align-items: center; margin-bottom: 1rem; }
@media (min-width: 60rem) { .hero { grid-template-columns: 1.15fr 1fr; gap: 3rem; } }
.hero h1 { font-size: clamp(2.4rem, 1.5rem + 3.6vw, 3.75rem); margin-top: 0; }
.home-section { margin-top: 3.5rem; }
.home-section h2 { margin-top: 0; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.steps li {
  counter-increment: step; position: relative; padding: 3.25rem 1.2rem 1.2rem; margin: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: .97rem;
}
.steps li::before {
  content: counter(step); position: absolute; top: 1rem; left: 1.2rem; width: 1.8rem; height: 1.8rem;
  display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  font-weight: 750; font-size: .95rem;
}
.steps strong { display: block; color: var(--fg); font-size: 1.05rem; margin-bottom: .3rem; }
.callout {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent);
  border-radius: var(--radius); padding: 1.5rem 1.5rem .6rem; max-width: 52rem;
}
.callout p { font-size: 1.08rem; }

/* ---------------------------------------------------------------- related */
.related { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.related h2 { margin-top: 1rem; font-size: 1.2rem; }
.related .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }

/* ---------------------------------------------------------------- diagrams (diagrams.py) */
.dg { display: block; width: 100%; height: auto; }
.dg-frame { stroke: var(--muted); fill: none; }
.dg-fill { fill: var(--line); }
.dg-accent { fill: var(--accent); }
.dg-accent-line { stroke: var(--accent); fill: none; }
.dg-text { fill: var(--fg); }
.dg-muted-text { fill: var(--muted); }
.diagram {
  margin: 1.75rem 0; padding: 1.25rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
@media (max-width: 30rem) { .diagram { padding: 1rem .85rem; } }
.diagram figcaption { margin-top: .75rem; color: var(--muted); font-size: .875rem; }
.range-fig .dg { max-width: 40rem; }
@media (max-width: 30rem) { .range-fig .dg-minor { display: none; } }
.sensor-fig .dg { max-width: 34rem; }
/* Angle-of-view wedges are tall: past this width their labels outgrow the page's own text. */
svg.dg[aria-label^="Horizontal angle"] { max-width: 26rem; margin-inline: auto; }
.iris-fig { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.iris-fig .dg { max-width: 150px; }
.fig-pair { display: grid; gap: 1rem; }
.fig-pair .diagram { margin: 0; }
@media (min-width: 40rem) { .fig-pair { grid-template-columns: 1fr 13rem; } }
.answer-figs { display: grid; gap: 1rem; margin: 1.5rem 0; }
.answer-figs .diagram { margin: 0; }

/* ---------------------------------------------------------------- converter */
.tool { margin: 0 0 2rem; padding: 1.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.tool h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.tool h3 { margin: 0 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.convert-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: .85rem; align-items: end; }
@media (max-width: 34rem) {
  .convert-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .convert-form label, .convert-form input, .convert-form select { min-width: 0; width: 100%; }
  .convert-form button { grid-column: 1 / -1; }
}
.convert-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.convert-form input, .convert-form select {
  font: inherit; font-size: 1rem; padding: .6rem .7rem; color: var(--fg);
  background: var(--bg); border: 1.5px solid var(--field); border-radius: 10px; min-width: 0; min-height: 44px;
}
.live { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.live-head { font-size: 1.1rem; }
.live-head strong { color: var(--accent); }
.live-grid { display: grid; gap: 1.5rem; }
@media (min-width: 46rem) { .live-grid { grid-template-columns: 1fr 1fr; } }
.live-list { list-style: none; margin: 0; padding: 0; font-size: .94rem; }
.live-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem .2rem; border-bottom: 1px solid var(--line); }
.live-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-list li.on { color: var(--accent); }
table.crop { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 1rem 0 1.5rem; }
table.crop th, table.crop td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.crop th { color: var(--muted); font-weight: 650; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
table.crop td:nth-child(2), table.crop td:nth-child(3) { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.crop td:nth-child(3) { font-weight: 700; }
@media (max-width: 34rem) { table.crop td:nth-child(4), table.crop th:nth-child(4) { display: none; } }

/* ---------------------------------------------------------------- gear */
.page-head { max-width: 68ch; }
.filter {
  display: grid; gap: .6rem; margin: 1.5rem 0 0; padding: 1rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* Sticky only where it leaves room for the list; on a phone it would cover a third of the screen. */
@media (min-width: 48rem) and (min-height: 40rem) { .filter { position: sticky; top: .5rem; z-index: 2; } }
.filter label { font-weight: 650; font-size: .9rem; }
.filter input { font: inherit; padding: .55rem .8rem; color: var(--fg); background: var(--bg); border: 1.5px solid var(--field); border-radius: 10px; min-height: 44px; }
.filter .chips { gap: .35rem; }
@media (max-width: 40rem) {
  /* One sideways-scrolling row per group keeps the filter short on a phone. */
  .filter .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem; }
  .filter .chips::-webkit-scrollbar { display: none; }
  .filter .chip { flex: none; }
}
.filter .chip { font-size: .85rem; padding: .3rem .8rem; }
.filter-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 40px; }
.filter-count { margin: 0; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gear-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr)); }
.gear-grid.small { grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); }
@media (max-width: 40rem) {
  /* Two cameras across on a phone: one per row made a list of 30 bodies ten screens long. */
  .gear-grid, .gear-grid.small { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .6rem; }
  .gear-card a { padding: .5rem .6rem .7rem; }
  .gear-card .gear-name { font-size: .95rem; }
}
.gear-card a {
  display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .75rem .85rem .9rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; color: var(--fg); text-decoration: none;
}
.gear-card a:hover { border-color: var(--accent); }
.thumb img { background: var(--bg); }
.gear-card .thumb img { width: 100%; aspect-ratio: 3 / 2; margin-bottom: .4rem; border-radius: 8px; }
.gear-name { font-weight: 650; line-height: 1.3; }
a:hover .gear-name { color: var(--accent); }
.gear-meta { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.gear-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.gear-row a {
  display: grid; grid-template-columns: 4.5rem 1fr auto; gap: .9rem; align-items: center; padding: .55rem .25rem;
  border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none;
}
.gear-row a:hover { background: var(--card); }
.gear-row .thumb img { width: 4.5rem; aspect-ratio: 3 / 2; border-radius: 6px; background: var(--card); border: 1px solid var(--line); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-eq { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 34rem) {
  .gear-row a { grid-template-columns: 3.5rem 1fr; }
  .gear-row .thumb img { width: 3.5rem; }
  .row-eq { grid-column: 2; text-align: left; margin-top: -.4rem; }
}
.gear-top { display: grid; gap: 1.5rem; margin-bottom: 1rem; }
@media (min-width: 52rem) { .gear-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2.25rem; align-items: start; } }
.gear-art { position: relative; }
.gear-art > img { aspect-ratio: 3 / 2; }
/* Decoration should not push the specs a whole screen down on a phone. */
@media (max-width: 40rem) { .gear-art > img { aspect-ratio: 2 / 1; object-fit: contain; } }
.kind-badge {
  display: inline-flex; align-items: center; gap: .4rem; margin-top: .75rem; padding: .25rem .75rem .25rem .35rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600;
}
.kind-icon { width: 26px; height: 26px; }
table.specs { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
table.specs th, table.specs td { text-align: left; vertical-align: top; padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
table.specs th { width: 38%; color: var(--muted); font-weight: 600; padding-right: 1rem; }
.gear-page section h2 { margin-top: 2.5rem; }
.gear-page ul:not([role]) { padding-left: 1.25rem; }
.gear-page ul:not([role]) li { margin: .4rem 0; }

/* ---------------------------------------------------------------- answers */
.kicker { margin: 0 0 .25rem; color: var(--muted); font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; }
.answer {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 1.4rem 1.5rem .5rem;
  box-shadow: var(--shadow); font-size: 1.07rem;
}
.answer ul, .answer ol { padding-left: 1.25rem; }
.answer li { margin: .35rem 0; }
.how { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .5rem; }
.sources h2 { font-size: 1rem; margin: 2rem 0 .75rem; color: var(--muted); }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
