/* ==========================================================================
   cicadatak.com — site styles (shared by every page)

   The visual language of a USGS topographic sheet: paper with grain, woodland
   tint, brown contours (every fifth one heavier, the index contour), a red
   1 km grid, condensed sans for labels, italic serif for names and captions,
   and the alternating black-and-white border of a printed sheet.

   Page-specific rules stay in that page's own <style>. Anything two pages
   need belongs here.
   ========================================================================== */

@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --paper: #F5F6F0;
  --white: #FFFFFF;
  --tint: #DCE8CE;          /* woodland */
  --contour: #B98E62;
  --contour-ix: #8E6238;    /* index contour */
  --ink: #1C201B;
  --ink-2: #454C43;
  --muted: #6A7266;
  --rule: #CDD3C5;
  --red: #B5372A;           /* grid, roads, the one accent */
  --blue: #2E6A93;          /* 2.4 GHz mesh */
  --amber-wash: #F6EBD3;    /* warnings */
  --night: #161A15;         /* the app's own dark screens */
  --night-2: #20251F;
  --on-night: #E9ECE4;
  --on-night-2: #BFC5BA;
  --red-on-night: #E8826C;  /* survey red, lifted for contrast on night */
  --cond: 'Sofia Sans Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --sans: 'Sofia Sans', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 44rem;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='.10'/%3E%3C/svg%3E");
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' opacity='.07'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; color: var(--ink); font: 400 18px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  background-color: var(--paper); background-image: var(--grain), var(--mottle);
}
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
:where(p, li, dd, td, figcaption, .prose) a:not([class]) {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--red);
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
:where(p, li, dd, td, figcaption, .prose) a:not([class]):hover { color: var(--red); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--red); outline-offset: 3px;
}
::selection { background: var(--tint); }
code, kbd, pre { font-family: var(--mono); font-size: 0.86em; }
:where(p, li, td, dd) code { padding: 1px 5px; background: var(--white); border: 1px solid var(--rule); border-radius: 2px; overflow-wrap: anywhere; }
pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--ink); color: #E9ECE4; border-radius: 2px; line-height: 1.5; font-size: 14.5px; }
pre code { padding: 0; background: none; border: 0; color: inherit; font-size: inherit; }
kbd { padding: 1px 6px; border: 1px solid var(--ink); border-bottom-width: 2px; border-radius: 3px; background: var(--white); font-size: 0.8em; }

/* ---------- layout ---------- */
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.wrap.narrow { max-width: calc(var(--measure) + 2 * var(--gutter)); }
.sec { padding-block: 96px; }
.sec + .sec { padding-top: 0; }
.sec.plate { background-color: var(--white); background-image: var(--grain); border-block: 1px solid var(--ink); }
.sec.tinted { background-color: var(--tint); background-image: var(--grain), var(--mottle); border-block: 1px solid var(--ink); }
.sec.plate + .sec, .sec.tinted + .sec, .sec.night + .sec, .sec + .sec.plate, .sec + .sec.tinted, .sec + .sec.night { padding-top: 96px; }
.zebra + .sec.plate, .zebra + .sec.tinted, .zebra + .sec.night { border-top: 0; }
/* two banded sections touching share one rule, not two */
.sec.plate + .sec.night, .sec.night + .sec.plate, .sec.tinted + .sec.night, .sec.night + .sec.tinted, .sec.plate + .sec.tinted, .sec.tinted + .sec.plate { border-top: 0; }
.zebra { height: 8px; border-block: 1px solid var(--ink); background: repeating-linear-gradient(90deg, var(--ink) 0 64px, var(--white) 64px 128px); }

/* ---------- type ---------- */
.tag { font: 700 13px/1.2 var(--cond); letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.deck { font: italic 400 clamp(1.25rem, 2vw, 1.6rem)/1.3 var(--serif); text-wrap: balance; }
.lead { font-size: 19px; color: var(--ink-2); max-width: var(--measure); }
.name, em.name { font: italic 400 1em/1.3 var(--serif); }
.head { display: flex; flex-direction: column; gap: 16px; max-width: var(--measure); margin-bottom: 48px; }
.head h2 { font: 800 clamp(2rem, 3.8vw, 3rem)/1.02 var(--cond); }
.head p:not([class]) { font-size: 19px; color: var(--ink-2); }
.fine { font-size: 15px; color: var(--muted); }

/* long-form text (guide, privacy, attribution) */
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 2.2em; font: 800 clamp(1.8rem, 3vw, 2.4rem)/1.05 var(--cond); }
.prose h3 { margin-top: 1.8em; font: 800 22px/1.15 var(--cond); }
.prose h4 { margin-top: 1.4em; font: 700 15px/1.2 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.prose h2 + *, .prose h3 + *, .prose h4 + * { margin-top: .6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--red); }

/* ---------- buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 22px; border: 1px solid var(--ink); border-radius: 2px;
  background: var(--ink); color: var(--paper); text-decoration: none; cursor: pointer;
  font: 700 17px/1 var(--cond); letter-spacing: .04em; text-transform: uppercase;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-sm { padding: 10px 16px; font-size: 15px; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; pointer-events: none; }
.textlink {
  display: inline-block; padding-bottom: 3px; border-bottom: 1.5px solid var(--ink); text-decoration: none;
  font: 700 17px/1 var(--cond); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.textlink:hover { color: var(--red); border-color: var(--red); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }

/* ---------- header ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background-color: var(--paper); background-image: var(--grain); border-bottom: 1px solid var(--ink); }
.nav { display: flex; align-items: center; gap: 28px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 22px/1 var(--cond); letter-spacing: .02em; }
.mark { width: 33px; height: 19px; flex: none; background: currentColor; -webkit-mask: url('/images/cicada-mark.svg') center / contain no-repeat; mask: url('/images/cicada-mark.svg') center / contain no-repeat; }
.links { display: flex; gap: 22px; margin-left: auto; }
.links a { text-decoration: none; font: 600 17px/1 var(--cond); letter-spacing: .03em; text-transform: uppercase; color: var(--ink-2); padding-block: 6px; border-bottom: 2px solid transparent; }
.links a:hover { color: var(--red); }
.links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
.menu { display: none; position: relative; margin-left: auto; }
.menu summary { list-style: none; cursor: pointer; padding: 9px 14px; border: 1px solid var(--ink); font: 700 15px/1 var(--cond); letter-spacing: .06em; text-transform: uppercase; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--ink); color: var(--paper); }
.menu nav { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; display: flex; flex-direction: column; background-color: var(--paper); background-image: var(--grain); border: 1px solid var(--ink); box-shadow: 0 10px 30px rgb(28 32 27 / .15); }
.menu nav a { padding: 13px 16px; text-decoration: none; border-bottom: 1px solid var(--rule); font: 700 17px/1 var(--cond); letter-spacing: .04em; text-transform: uppercase; }
.menu nav a:last-child { border-bottom: 0; }
.menu nav a[aria-current="page"] { color: var(--red); }

/* ---------- inner page head: copy beside a strip of map ---------- */
.page-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); border-bottom: 1px solid var(--ink); }
.page-head .copy {
  display: flex; flex-direction: column; gap: 18px; padding-block: 64px 56px;
  padding-left: max(var(--gutter), calc((100vw - 1200px) / 2 + var(--gutter)));
  padding-right: clamp(24px, 4vw, 56px);
}
.page-head h1 { font: 800 clamp(2.6rem, 5.4vw, 4.6rem)/0.96 var(--cond); letter-spacing: -0.01em; }
.page-head .lead { max-width: 36rem; }
.page-head .strip { position: relative; min-height: 300px; border-left: 1px solid var(--ink); }
.page-head .strip canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- photographs, framed like map insets ---------- */
figure { margin: 0; }
.frame { position: relative; border: 1px solid var(--ink); background: var(--white); padding: 6px; }
.frame > img { width: 100%; }
.frame.fill { padding: 0; }
.frame.fill > img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: cover; }
figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px; margin-top: 10px; font-size: 15px; color: var(--ink-2); }
figcaption em { font: italic 400 15.5px/1.35 var(--serif); }
.phone-shot { border-radius: 22px; border: 1px solid var(--ink); }

/* ---------- legend rows: name / status / text / link ---------- */
.rows { border-top: 2px solid var(--ink); }
.row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 11rem) minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 24px 0; border-bottom: 1px solid var(--rule); }
.row h3 { font: 800 26px/1.1 var(--cond); }
.row p { color: var(--ink-2); font-size: 17px; }
.status { font: 700 14px/1.2 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.status.live { color: var(--red); }

/* ---------- spec sheet (definition list) ---------- */
.sheetdata { margin: 0; border-top: 2px solid var(--ink); }
.sheetdata > div { display: grid; grid-template-columns: 10rem minmax(0, 1fr); gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.sheetdata dt { font: 700 14px/1.6 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sheetdata dd { margin: 0; font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-top: 2px solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 16.5px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; padding: 12px 14px 10px 0; font: 700 13.5px/1.2 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); vertical-align: bottom; }
table.data td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data td:first-child { font-weight: 600; }

/* ---------- callouts ---------- */
.note { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border: 1px solid var(--ink); background-color: var(--white); background-image: var(--grain); }
.note .tag { color: var(--ink); }
.note.warn { background-color: var(--amber-wash); }
.note.warn .tag { color: var(--red); }
.note p { font-size: 16.5px; color: var(--ink-2); }

/* ---------- numbered steps (only for real sequences) ---------- */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; border-top: 2px solid var(--ink); }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 20px; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.steps > li::before { content: counter(step); grid-row: 1 / span 3; font: 800 44px/0.9 var(--cond); color: var(--red); }
.steps > li h3 { font: 800 24px/1.15 var(--cond); }
.steps > li p { color: var(--ink-2); }
.steps > li > * + * { margin-top: 6px; }

/* ---------- FAQ ---------- */
.faq { border-top: 2px solid var(--ink); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; cursor: pointer; list-style: none; font: 800 21px/1.2 var(--cond); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; font: 700 24px/1 var(--cond); color: var(--red); }
.faq details[open] summary::after { content: '–'; }
.faq .answer { padding: 0 0 22px; color: var(--ink-2); max-width: var(--measure); }
.faq .answer > * + * { margin-top: .8em; }

/* ---------- table of contents chips ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.toc a { display: inline-block; padding: 8px 12px; border: 1px solid var(--ink); text-decoration: none; font: 700 15px/1 var(--cond); letter-spacing: .04em; text-transform: uppercase; background: var(--white); }
.toc a:hover { background: var(--ink); color: var(--paper); }

/* ---------- map line symbols (used in diagrams and legends) ---------- */
.c-halow { stroke: var(--ink); stroke-width: 3; fill: none; }
.c-mesh24 { stroke: var(--blue); stroke-width: 2.5; fill: none; }
.c-lora { stroke: var(--red); stroke-width: 2; stroke-dasharray: 9 7; fill: none; }
.c-wifi { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 1 6; stroke-linecap: round; fill: none; }
.c-node { fill: var(--white); stroke: var(--ink); stroke-width: 2.5; }
.c-core { fill: var(--red); }
.c-phone { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.c-label { font: 700 15px var(--cond); letter-spacing: .1em; text-transform: uppercase; fill: var(--ink); }
.c-dist { font: italic 400 16px var(--serif); fill: var(--ink-2); }
.c-red { font: italic 400 16px var(--serif); fill: var(--red); }
.c-blue { font: italic 400 16px var(--serif); fill: var(--blue); }
.c-ap { font: italic 400 15px var(--serif); fill: var(--muted); }

/* ---------- night band: the app's own dark screens, at most once per page ---------- */
.sec.night { background-color: var(--night); background-image: var(--grain); color: var(--on-night); border-block: 1px solid var(--ink); }
.sec.night h2, .sec.night h3, .sec.night h4, .sec.night .deck, .sec.night strong, .sec.night b { color: var(--paper); }
.sec.night .tag, .sec.night .status.live, .sec.night .steps > li::before, .sec.night .faq summary::after { color: var(--red-on-night); }
.sec.night p, .sec.night li, .sec.night dd, .sec.night td, .sec.night figcaption, .sec.night .lead, .sec.night .fine, .sec.night .status,
.sec.night .head p:not([class]), .sec.night .row p, .sec.night .steps > li p, .sec.night .note p, .sec.night .faq .answer { color: var(--on-night-2); }
.sec.night .prose li::marker { color: var(--red-on-night); }
.sec.night :where(p, li, dd, td, figcaption, .prose) a:not([class]) { color: var(--on-night); text-decoration-color: var(--red-on-night); }
.sec.night :where(p, li, dd, td, figcaption, .prose) a:not([class]):hover { color: var(--red-on-night); }
.sec.night .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.sec.night .btn:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.sec.night .btn-line { background: transparent; color: var(--paper); }
.sec.night .btn-line:hover { background: var(--paper); color: var(--ink); }
.sec.night .textlink { border-color: var(--on-night); }
.sec.night .textlink:hover { color: var(--red-on-night); border-color: var(--red-on-night); }
.sec.night .rows, .sec.night .sheetdata, .sec.night .steps, .sec.night .faq, .sec.night .table-wrap { border-top-color: var(--on-night); }
.sec.night .row, .sec.night .sheetdata > div, .sec.night .steps > li, .sec.night .faq details, .sec.night table.data td { border-bottom-color: rgb(233 236 228 / .16); }
.sec.night table.data th, .sec.night .sheetdata dt { color: var(--on-night-2); border-bottom-color: var(--on-night); }
.sec.night .note { background-color: var(--night-2); background-image: none; border-color: rgb(233 236 228 / .3); }
.sec.night :where(p, li, td, dd) code { background: var(--night-2); border-color: rgb(233 236 228 / .2); color: var(--on-night); }
.sec.night .phone-shot, .sec.night .frame { border-color: rgb(233 236 228 / .35); }
.sec.night .frame { background: var(--night-2); }

/* heading and big number on the left, the content on the right */
.night-split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 40px clamp(40px, 6vw, 96px); align-items: start; }
.night-split .head { margin-bottom: 32px; }
@media (max-width: 860px) { .night-split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- big number, set like a spot elevation: one real fact per page ---------- */
.bignum { display: flex; flex-direction: column; gap: 8px; }
.bignum strong { display: flex; align-items: flex-start; gap: .12em; font: 800 clamp(3.2rem, 7.5vw, 6.2rem)/0.9 var(--cond); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bignum strong::before { content: '\25B3'; flex: none; margin-top: .3em; font: 400 .3em/1 var(--sans); color: var(--red); }
.bignum span { max-width: 24rem; font: italic 400 18px/1.35 var(--serif); color: var(--ink-2); }
.sec.night .bignum strong { color: var(--paper); }
.sec.night .bignum strong::before { color: var(--red-on-night); }
.sec.night .bignum span { color: var(--on-night-2); }

/* ---------- page head with a picture instead of the map strip (product pages) ---------- */
.page-head .visual { position: relative; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 36px clamp(24px, 4vw, 48px); border-left: 1px solid var(--ink); background-color: var(--white); background-image: var(--grain); }
.page-head .visual.tinted { background-color: var(--tint); background-image: var(--grain), var(--mottle); }
.page-head .visual.night { background-color: var(--night); background-image: var(--grain); }
.page-head .visual img, .page-head .visual svg { display: block; max-width: 100%; height: auto; }
.page-head .visual > img { width: auto; max-height: 460px; }

/* ---------- footer, as a map collar ---------- */
.collar { padding-block: 28px 40px; }
.collar-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.collar p { font-size: 15px; color: var(--ink-2); }
.collar .about { margin-top: 12px; }
.collar nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.collar nav a { text-decoration: none; font: 600 16px/1.4 var(--cond); letter-spacing: .04em; text-transform: uppercase; }
.collar nav a:hover { color: var(--red); }
.collar .fine { font-size: 13.5px; color: var(--muted); text-align: right; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .links { display: none; }
  .menu { display: block; }
  .nav > .btn { display: none; }
}
@media (max-width: 1000px) {
  .page-head { grid-template-columns: minmax(0, 1fr); }
  .page-head .copy { padding: 48px var(--gutter) 40px; }
  .page-head .strip { min-height: 150px; border-left: 0; border-top: 1px solid var(--ink); }
  .page-head .visual { border-left: 0; border-top: 1px solid var(--ink); padding: 28px var(--gutter); }
  .row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; }
  .row > p { grid-column: 1 / -1; }
  .row > .textlink, .row > .btn { grid-row: 1; grid-column: 2; }
  .row > .status { grid-column: 1; }
  .collar-grid { grid-template-columns: minmax(0, 1fr); }
  .collar .fine { text-align: left; }
  .sec, .sec.plate + .sec, .sec.tinted + .sec, .sec.night + .sec, .sec + .sec.plate, .sec + .sec.tinted, .sec + .sec.night { padding-block: 72px; }
  .sec + .sec { padding-top: 0; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .sheetdata > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .steps > li { grid-template-columns: 44px minmax(0, 1fr); }
  .steps > li::before { font-size: 34px; }
  .phone-shot { border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
