/* PiFinder Builds. Dark observatory page in the red of the PiFinder screen.
   "Night" mode turns every colour red, for use at the telescope. */

@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url("fonts/martian-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto Mono"; src: url("fonts/roboto-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Roboto Mono"; src: url("fonts/roboto-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: block; }

:root {
  --bg: #0b0707;
  --bg-2: #130b0a;
  --panel: rgba(30, 17, 15, 0.62);
  --panel-solid: #1a0f0e;
  --line: #2c1a18;
  --line-2: #4a2621;
  --text: #f2e6e1;
  --muted: #ab918a;
  --faint: #6e5650;
  --red: #ff4232;
  --red-2: #ff7b68;
  --red-deep: #4d110b;
  --amber: #f2b54b;
  --green: #82d69d;
  --violet: #c7a7ff;
  --glow: rgba(255, 66, 50, 0.35);

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --stamp: 8.5rem;
  color-scheme: dark;
}

/* Night: red light only. No white, no green, no blue. */
:root[data-mode="night"] {
  --bg: #000;
  --bg-2: #070000;
  --panel: rgba(22, 2, 0, 0.7);
  --panel-solid: #0d0100;
  --line: #2a0703;
  --line-2: #4a0d06;
  --text: #ff4a36;
  --muted: #b8301f;
  --faint: #741c11;
  --red: #ff3a24;
  --red-2: #ff5a42;
  --red-deep: #3a0803;
  --amber: #e8341f;
  --green: #e8341f;
  --violet: #e8341f;
  --glow: rgba(255, 40, 20, 0.25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s, color 0.4s;
}

a { color: var(--red-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
code, pre { font-family: var(--mono); font-size: 0.78em; }
code { color: var(--text); background: rgba(255, 255, 255, 0.04); padding: 0.1em 0.35em; border-radius: 3px; }
:root[data-mode="night"] code { background: rgba(255, 40, 20, 0.08); }
em { font-style: italic; }
::selection { background: var(--red); color: var(--bg); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* --- Sky -------------------------------------------------------------------- */

.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 85% -10%, rgba(255, 60, 40, 0.16), transparent 70%),
    radial-gradient(ellipse 60% 40% at 0% 110%, rgba(120, 20, 10, 0.18), transparent 70%),
    var(--bg);
}
.sky::before, .sky::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255, 235, 225, 0.7), transparent 60%),
    radial-gradient(1px 1px at 140px 90px, rgba(255, 235, 225, 0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 230px 170px, rgba(255, 220, 210, 0.8), transparent 60%),
    radial-gradient(1px 1px at 300px 40px, rgba(255, 235, 225, 0.45), transparent 60%),
    radial-gradient(1px 1px at 90px 220px, rgba(255, 235, 225, 0.55), transparent 60%),
    radial-gradient(1px 1px at 380px 260px, rgba(255, 235, 225, 0.4), transparent 60%);
  background-size: 410px 290px;
  opacity: 0.55;
}
.sky::after {
  background-size: 670px 530px;
  background-position: 120px 60px;
  opacity: 0.35;
  animation: twinkle 7s ease-in-out infinite alternate;
}
:root[data-mode="night"] .sky::before, :root[data-mode="night"] .sky::after { filter: sepia(1) saturate(8) hue-rotate(-30deg); opacity: 0.25; }

@keyframes twinkle { from { opacity: 0.15; } to { opacity: 0.45; } }

/* --- Hero ------------------------------------------------------------------- */

.hero { padding: 56px 0 40px; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 860px) { .hero-grid { grid-template-columns: 1.35fr 0.65fr; gap: 56px; } .hero { padding: 88px 0 64px; } }

.eyebrow {
  margin: 0 0 18px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.eyebrow a { color: var(--red); text-decoration: none; }
.eyebrow span { color: var(--faint); margin: 0 0.4em; }

h1 {
  margin: 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(3.4rem, 10vw, 7rem); line-height: 0.9; letter-spacing: -0.02em;
}
h1 em { color: var(--red); text-shadow: 0 0 40px var(--glow); }

.lede { margin: 26px 0 0; max-width: 34em; color: var(--muted); font-size: 1.06rem; }

.latest { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 32px 0 0; }
.latest dt { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.latest dd { margin: 4px 0 0; font-family: var(--mono); font-size: 0.82rem; }
.latest dd a { text-decoration: none; color: var(--text); }
.latest dd a:hover { color: var(--red); }
.latest dd .rel { display: block; font-size: 0.9em; }

/* The PiFinder screen. The canvas is 128 x 128 like the real OLED. */
.device { margin: 0; justify-self: center; width: min(320px, 78vw); }
.bezel {
  position: relative; padding: 18px; border-radius: 22px;
  background: linear-gradient(155deg, #241716, #0e0808 60%);
  border: 1px solid #3a2522;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -10px 30px rgba(0, 0, 0, 0.6), 0 30px 80px -20px rgba(0, 0, 0, 0.9), 0 0 120px -30px var(--glow);
}
:root[data-mode="night"] .bezel { background: linear-gradient(155deg, #140302, #050000 60%); border-color: #2a0603; }
#oled {
  display: block; width: 100%; height: auto; aspect-ratio: 1;
  image-rendering: pixelated; background: #000; border-radius: 4px;
  filter: drop-shadow(0 0 6px rgba(255, 40, 20, 0.45));
}
.glare {
  position: absolute; inset: 18px; border-radius: 4px; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), transparent 38%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
}
.device figcaption { margin-top: 14px; text-align: center; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.device figcaption span { color: var(--red); }

/* --- Section bar ------------------------------------------------------------ */

.bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; padding: 16px 12px; white-space: nowrap;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; transition: color 0.2s;
}
.tabs a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform 0.3s;
  box-shadow: 0 0 12px var(--glow);
}
.tabs a:hover, .tabs a.active { color: var(--text); }
.tabs a.active::after { transform: scaleX(1); }
.count { margin-left: 6px; color: var(--red); }

.night {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.night:hover { color: var(--text); border-color: var(--red); }
.night-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); transition: background 0.2s, box-shadow 0.2s; }
.night[aria-pressed="true"] { color: var(--red); border-color: var(--red); background: var(--red-deep); }
.night[aria-pressed="true"] .night-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }

/* --- Sections --------------------------------------------------------------- */

.status { margin: 28px 0 0; padding: 12px 16px; font-family: var(--mono); font-size: 0.74rem; color: var(--muted); border-left: 2px solid var(--line-2); }
.status.warn { border-left-color: var(--amber); }
.status.error, .error { color: var(--red); }

.channel { padding-top: 72px; }
.channel-head { display: flex; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.channel-no { font-family: var(--mono); font-size: 0.72rem; color: var(--red); letter-spacing: 0.1em; }
.channel h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; letter-spacing: -0.01em; }
.explain { margin: 16px 0 28px; max-width: 46em; color: var(--muted); }
.empty { margin: 0; padding: 20px 22px; border: 1px dashed var(--line-2); border-radius: 6px; color: var(--muted); }

/* --- Build log -------------------------------------------------------------- */

.list { position: relative; }
.list[data-channel]::before {
  content: ""; position: absolute; top: 6px; bottom: 6px; left: var(--stamp); width: 1px;
  background: linear-gradient(var(--line-2), var(--line) 85%, transparent);
}
.list[data-channel]:has(> .empty)::before { display: none; }

.card {
  position: relative; display: grid; grid-template-columns: var(--stamp) 1fr;
  scroll-margin-top: 80px;
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(min(var(--i, 0), 12) * 45ms);
}
.card.gone { opacity: 0.55; }

.stamp { padding: 18px 24px 0 0; text-align: right; font-family: var(--mono); color: var(--muted); }
.stamp .day { display: block; font-family: var(--serif); font-size: 2.5rem; line-height: 0.9; color: var(--text); }
.stamp .mon { display: block; margin-top: 6px; font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--red); }
.stamp .yr, .stamp .tm { display: block; font-size: 0.64rem; color: var(--faint); }
.stamp .none { font-size: 0.64rem; color: var(--faint); }

.card-body {
  position: relative; min-width: 0; margin: 6px 0; padding: 16px 20px 8px 28px;
  border-radius: 0 8px 8px 0; transition: background 0.25s;
}
.card-body::before {
  content: ""; position: absolute; left: -5px; top: 26px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--line-2); transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.card:hover .card-body { background: var(--panel); }
.card:hover .card-body::before, .card:target .card-body::before { border-color: var(--red); background: var(--red); box-shadow: 0 0 12px var(--red); }
.card.release .card-body::before { border-color: var(--red); }
.card:target .card-body { background: var(--panel); box-shadow: inset 2px 0 0 var(--red); }

.card header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.card h3 {
  flex-basis: 100%; margin: 8px 0 0; padding-right: 28px;
  font-family: var(--sans); font-weight: 700; font-size: 1.14rem; line-height: 1.3; letter-spacing: -0.005em;
}
.anchor { position: absolute; top: 16px; right: 16px; font-family: var(--mono); font-size: 0.8rem; color: var(--faint); text-decoration: none; opacity: 0; transition: opacity 0.2s; }
.card:hover .anchor, .anchor:focus { opacity: 1; }

.kind, .pill {
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); line-height: 1.4;
}
.kind.release { background: var(--red); border-color: var(--red); color: var(--bg); }
.kind.pr { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.kind.trunk { color: var(--text); }
.pill.open { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.pill.merged { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 40%, transparent); }

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 5px 18px; margin: 14px 0 0; font-size: 0.9rem; }
.meta dt { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding-top: 0.35em; }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.device-label {
  font-family: "Roboto Mono", var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--red); background: #000; padding: 2px 8px; border-radius: 3px;
  box-shadow: 0 0 0 1px var(--red-deep), 0 0 14px -4px var(--glow);
  line-height: 1.9; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.rel { color: var(--faint); }

.summary { margin: 14px 0 6px; max-width: 46em; color: var(--text); opacity: 0.88; }

.section { border-top: 1px solid var(--line); margin-top: 10px; }
.section > summary {
  cursor: pointer; padding: 11px 0; list-style: none; display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
  transition: color 0.2s;
}
.section > summary::-webkit-details-marker { display: none; }
.section > summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 3px;
  border: 1px solid var(--line-2); color: var(--red); font-size: 0.8rem; letter-spacing: 0;
}
.section[open] > summary::before { content: "−"; }
.section > summary:hover { color: var(--text); }
.section > :not(summary) { margin-bottom: 14px; animation: rise 0.35s ease both; }

.markdown { overflow-wrap: anywhere; font-size: 0.95rem; }
.markdown h1, .markdown h2, .markdown h3 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; line-height: 1.15; margin: 22px 0 6px; }
.markdown img { max-width: 100%; height: auto; border-radius: 4px; }
:root[data-mode="night"] .markdown img { filter: grayscale(1) sepia(1) saturate(6) hue-rotate(-40deg) brightness(0.55); }
.markdown pre, .plain { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); padding: 12px 14px; border-radius: 6px; overflow-x: auto; white-space: pre-wrap; }
.markdown table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 0.9em; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 4px 10px; }
.markdown blockquote { margin: 0; padding-left: 14px; border-left: 2px solid var(--red); color: var(--muted); }
.markdown li { margin: 3px 0; }

.commits { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.9rem; }
.commits li { display: grid; grid-template-columns: 5.6em 1fr; gap: 0 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.commits li:last-child { border-bottom: 0; }
.sha { font-family: var(--mono); font-size: 0.72rem; text-decoration: none; padding-top: 3px; }
.commits .msg { overflow-wrap: anywhere; }
.commits .who, .commits .body { grid-column: 2; }
.who { color: var(--faint); font-family: var(--mono); font-size: 0.66rem; }
.commits .body summary { cursor: pointer; color: var(--faint); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; }
.commits .body pre { white-space: pre-wrap; margin: 6px 0 0; color: var(--muted); }
.note { color: var(--muted); font-size: 0.88em; }

.tech { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 0.86rem; margin: 0; }
.tech dt { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding-top: 0.3em; }
.tech dd { margin: 0; overflow-wrap: anywhere; }

.pending { margin: 20px 0 0 var(--stamp); padding: 18px 22px; border: 1px dashed var(--line-2); border-radius: 8px; }
.pending h3 { margin: 0 0 4px; font-size: 1rem; }
.pending p { margin: 0 0 10px; color: var(--muted); }
.pending ul { margin: 0; padding-left: 18px; }
.pending .who { display: block; }

/* --- SD card images --------------------------------------------------------- */

.images { list-style: none; padding: 0; margin: 0; }
.recommended {
  position: relative; overflow: hidden; padding: 28px 28px 22px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--red) 55%, transparent);
  background:
    radial-gradient(ellipse 60% 90% at 100% 0%, color-mix(in srgb, var(--red) 16%, transparent), transparent 70%),
    var(--panel-solid);
  box-shadow: 0 0 60px -20px var(--glow);
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.recommended .rec-label { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--red); }
.recommended .rec-title { margin: 6px 0 2px; font-family: var(--serif); font-size: clamp(2.6rem, 7vw, 4rem); line-height: 1; }
.recommended .rec-note { margin: 0 0 18px; color: var(--muted); }
.recommended .image { padding: 0; }
.recommended .image-title, .recommended .image-main .kind { display: none; }

.images.all { margin-top: 18px; border-top: 1px solid var(--line); }
.images.all .image { padding: 14px 4px; border-bottom: 1px solid var(--line); animation: rise 0.5s ease both; animation-delay: calc(min(var(--i, 0), 12) * 35ms); }
.image { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; align-items: center; }
.image-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.image-title { font-family: var(--mono); font-size: 0.86rem; text-decoration: none; color: var(--text); }
.image-title:hover { color: var(--red); }
.image-meta { grid-column: 1; font-size: 0.86rem; color: var(--muted); }
.image-get { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; }
.image-get a:not(.button) { color: var(--muted); }
.image-get a:not(.button):hover { color: var(--red); }
.button {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 9px 16px; border-radius: 4px;
  background: var(--red); color: var(--bg); text-decoration: none; white-space: nowrap;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  transition: box-shadow 0.2s, transform 0.2s;
}
.button:hover { color: var(--bg); box-shadow: 0 0 24px var(--glow); transform: translateY(-1px); }
.button span { opacity: 0.7; letter-spacing: 0.04em; }

/* --- Footer ----------------------------------------------------------------- */

.foot { margin-top: 96px; padding-top: 28px; padding-bottom: 56px; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.86rem; }
.foot a { color: var(--muted); }
.clear-skies { margin: 22px 0 0; font-family: var(--serif); font-style: italic; font-size: 1.8rem; color: var(--red); }

/* --- Motion ----------------------------------------------------------------- */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hero-text > * { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero-text > :nth-child(2) { animation-delay: 0.08s; }
.hero-text > :nth-child(3) { animation-delay: 0.18s; }
.hero-text > :nth-child(4) { animation-delay: 0.28s; }
.device { animation: rise 1s 0.2s cubic-bezier(0.2, 0.7, 0.2, 1) both; }

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

/* --- Narrow screens --------------------------------------------------------- */

@media (max-width: 640px) {
  :root { --stamp: 0px; }
  body { font-size: 16px; }
  .list[data-channel]::before { left: 0; }
  .card { grid-template-columns: 1fr; }
  .stamp { display: flex; align-items: baseline; gap: 8px; padding: 18px 0 0 22px; text-align: left; }
  .stamp .day { font-size: 1.6rem; }
  .stamp .mon, .stamp .yr, .stamp .tm { display: inline; margin: 0; }
  .card-body { padding: 4px 4px 8px 22px; margin-top: 0; }
  .card-body::before { top: -18px; }
  .meta, .tech { grid-template-columns: 1fr; gap: 0; }
  .meta dt, .tech dt { margin-top: 8px; }
  .pending { margin-left: 0; }
  .image { grid-template-columns: 1fr; }
  .image-get { grid-column: 1; grid-row: auto; flex-wrap: wrap; margin-top: 8px; }
  .recommended { padding: 22px 18px 18px; }
}
