/* DABDUINO site styles. No external fonts or scripts. */

/* The look of a radio receiver: the header and the hero are the front
   panel with a tuning scale. Only the scale uses the monospace font of the
   system, as the display of a receiver. Neutral backgrounds with a small
   cool tint. The amber of the logo dot marks the actions and the primary
   points: buttons, links, the needle and the scale marks. */
:root {
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --fg: #111418;
  --muted: #4B5360;
  --border: #D9DDE3;
  /* Marks of the scale line at the top of each section. */
  --tick: #B9C0C9;
  /* Text of links: the amber of the brand, darker for the light page.
     Contrast 5.3:1 on --bg, 5.7:1 on --card (WCAG AA). */
  --accent: #9E5300;
  --hover: #8C4B00;
  /* Areas and marks. Text on amber uses --on-brand (9.0:1). */
  --brand: #FF9F1C;
  --brand-hover: #FFB54D;
  --on-brand: #111418;
  /* The front panel (header and hero): white on the light page. Text on
     the panel uses --fg, --muted and --accent. */
  --panel: #FFFFFF;
  --panel-soft: #3A414B;
  --panel-tick: #9AA3AE;
  /* Height of the sticky header (60 px row + 1 px border). */
  --header-h: 61px;
  --radius: 4px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", "DejaVu Sans Mono",
    Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

/* Dark colors: from the system setting (automatic), or from the theme
   button (data-theme, see js/theme.js). The two blocks must stay equal. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --card: #171A1F;
    --fg: #ECEFF3;
    --muted: #A0A8B3;
    --border: #272B32;
    --tick: #3A414B;
    --accent: #FF9F1C;
    --hover: #FFB54D;
    /* The panel is darker than the page. Text 16.5:1, muted text 7.9:1,
       amber 9.3:1 on --panel. */
    --panel: #0B0D10;
    --panel-soft: #B8C0CA;
    --panel-tick: #5B6470;
  }
}
:root[data-theme="dark"] {
  --bg: #111317;
  --card: #171A1F;
  --fg: #ECEFF3;
  --muted: #A0A8B3;
  --border: #272B32;
  --tick: #3A414B;
  --accent: #FF9F1C;
  --hover: #FFB54D;
  --panel: #0B0D10;
  --panel-soft: #B8C0CA;
  --panel-tick: #5B6470;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

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

html {
  scroll-behavior: smooth;
  /* Keep a link target and a focused element clear of the sticky header. */
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--hover); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.6em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2rem); font-weight: 700; letter-spacing: -0.015em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

/* Chinese: a CJK font after the system font, and more space between the
   lines. */
html:lang(zh) body {
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}
html:lang(zh) body { line-height: 1.75; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
/* Text sections keep the left edge of .wrap, but limit the line length. */
.narrow > * { max-width: 760px; }

/* Header: the top of the front panel. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
/* The space between the items of the header comes from column-gap, not
   from margins. Thus an item that goes to a new row starts at the left
   edge of the row. */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* The header height comes from one token: --header-h includes the
     1 px border. */
  min-height: calc(var(--header-h) - 1px);
}
/* margin-right auto: the logo is at the left, all other items of the header
   are at the right, also on a page without navigation (404). */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--fg); }
.logo { display: block; width: 30px; height: 30px; }
.logo-ink { fill: none; stroke: var(--fg); stroke-width: 5; stroke-linecap: round; }
.logo-dot { fill: var(--brand); }
.wordmark { font-size: 1.25rem; font-weight: 800; letter-spacing: 0.04em; }
.nav { display: flex; gap: 22px; flex-wrap: nowrap; margin-right: 16px; }
.nav a { color: var(--panel-soft); font-size: 0.95rem; text-decoration: none; }
.nav a:hover { color: var(--accent); }
/* Theme button: CSS shows it only when js/theme.js has set data-js on
   <html>, before the first paint. The icon follows data-theme on <html>. */
.theme-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--panel-soft);
  cursor: pointer;
}
:root[data-js] .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--accent); border-color: var(--panel-tick); }
.theme-toggle .icon { display: none; }
:root:not([data-theme]) .theme-toggle .icon-auto,
:root[data-theme="light"] .theme-toggle .icon-light,
:root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }
/* Text for screen readers only: the new theme after a click. */
.theme-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Language switch: one link for each language, like the preset keys of a
   receiver. Plain links: it operates without JavaScript. */
.lang-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  height: 36px;
}
.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 0 4px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.lang-switch a:hover { color: var(--fg); }
.lang-switch a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--brand); }
.lang-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Hero: the display of the front panel. */
.hero {
  padding: 64px 0 40px;
  background: var(--panel);
}
.hero h1 { max-width: 20em; }
/* The status of the project, above the title: a signal lamp and a label. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgb(255 159 28 / 0.25);
  animation: lamp 2.4s ease-in-out infinite;
}
@keyframes lamp {
  50% { opacity: 0.35; }
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 38em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 28px; }
.button {
  display: inline-block;
  padding: 11px 18px;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  text-decoration: none;
}
.button:hover { background: var(--brand-hover); color: var(--on-brand); }
.link { font-weight: 600; text-decoration: none; }

/* The tuning scale: DAB Band III with the needle on block 12C. */
.tuner { margin: 48px 0 0; }
.tuner svg { display: block; width: 100%; height: auto; }
.tuner text { font-family: var(--mono); }
.tuner-band { fill: var(--muted); font-size: 15px; letter-spacing: 0.12em; }
.tuner-readout { fill: var(--fg); font-size: 22px; text-anchor: end; }
.tuner-channel { fill: var(--accent); font-weight: 700; }
.tuner-signal rect { fill: var(--brand); }
.tuner-signal .tuner-signal-off { fill: var(--border); }
.tuner-line { fill: none; stroke: var(--panel-tick); stroke-width: 1; }
.tuner-minor { fill: none; stroke: var(--panel-tick); stroke-width: 1; }
.tuner-major { fill: none; stroke: var(--panel-soft); stroke-width: 2; }
.tuner-label { fill: var(--muted); font-size: 15px; text-anchor: middle; }
.tuner-needle { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linecap: round; }
.tuner-needle-dot { fill: var(--brand); }

/* Sections: a scale line at the top, and a channel number above the
   heading. The number comes from CSS: it needs no translation. */
main { counter-reset: section; }
.section { padding: 72px 0; }
.section[id] {
  counter-increment: section;
  background: repeating-linear-gradient(to right, var(--tick) 0 1px, transparent 1px 16px)
    top left / 100% 8px no-repeat;
  border-top: 1px solid var(--border);
}
.section[id] h2::before {
  content: counter(section, decimal-leading-zero);
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}
.section h3 { margin-top: 1.6em; }

/* Cards are always one under the other. */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 24px;
}
.narrow > .cards { max-width: none; }
.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.card p { margin: 0; color: var(--muted); }
.card h3 { margin: 0 0 0.6em; }
/* Text that follows the cards needs a space above it. */
.cards + p { margin-top: 24px; }
/* A data table: the label on the left, the value on the right. */
.specs { margin: 0; }
.specs div {
  display: grid;
  grid-template-columns: min(13em, 40%) 1fr;
  gap: 4px 16px;
  padding: 9px 0;
  border-top: 1px dashed var(--border);
}
.specs dt {
  padding-top: 0.2em;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.specs dd { margin: 0; font-weight: 600; }
/* A technology name that build.py marks: no line break in the name. */
.nowrap { white-space: nowrap; }
/* A footnote: small text under a line. */
.footnote {
  margin: 32px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* The photo of the original DABDUINO, with its caption. */
.photo { margin: 24px 0; }
.narrow > .photo { max-width: none; }
.photo img {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.photo figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Lists: a short scale mark before each item. */
.bullets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}
.bullets li { position: relative; padding-left: 26px; }
.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 14px;
  height: 2px;
  background: var(--brand);
}

.contact-mail { margin-top: 24px; }

/* Footer */
.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* Narrow screens */
/* Breakpoints in em follow the default font size of the user. */
@media (max-width: 53.75em) {
  .hero { padding: 48px 0 32px; }
  .tuner { margin-top: 36px; }
}
@media (max-width: 60em) {
  /* Header in more than one row: logo; navigation, theme button and
     language switch; the switch goes to a third row when the second row
     has no space for it. The rows keep the order of the HTML (keyboard
     focus order). The header is not sticky. */
  html { scroll-padding-top: 16px; }
  .site-header { position: static; }
  .header-row { flex-wrap: wrap; row-gap: 6px; padding-top: 12px; padding-bottom: 10px; }
  .brand { flex: 1 1 100%; }
  .nav { flex: 1 1 auto; flex-wrap: wrap; gap: 4px 20px; margin-right: 0; }
  .theme-toggle { margin-left: auto; }
}
@media (max-width: 35em) {
  body { font-size: 16px; }
  /* Narrow screens: the navigation is the second row over the full
     width, in columns of one half of the width. The theme button and the
     language switch are the third row. Without the script, there is no
     theme button, and the switch uses the full third row. */
  /* wrap and min-width 0: with a large default font size, a link that is
     wider than its column makes its column wider, the links go to a new
     line, and the page does not scroll sideways. */
  .nav { flex: 1 1 100%; min-width: 0; gap: 4px 12px; }
  .nav a { flex: 0 0 calc((100% - 12px) / 2); }
  .theme-toggle { margin-left: 0; }
  .lang-switch { flex: 1 1 0; min-width: 0; }
  :root:not([data-js]) .lang-switch { flex: 1 1 100%; }
  .lang-switch a { flex: 1 1 0; min-width: 0; padding: 0; }
  .hero { padding: 36px 0 24px; }
  .lead { font-size: 1.05rem; }
  .actions { gap: 12px 20px; margin-top: 24px; }
  /* The scale keeps a minimum width, so that its labels stay legible. The
     right part with the needle and the readout stays in view. */
  .tuner { display: flex; justify-content: flex-end; margin-top: 28px; overflow: hidden; }
  .tuner svg { flex: none; width: 600px; }
  .section { padding: 48px 0; }
  .card { padding: 16px; }
  .footer-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .status::before { animation: none; }
}
