/* Shared look: a station board at night. GitHub services are the trains.
   Rule: the signal colour is information (delays), never decoration. */
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("/fonts/cond-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/plex-400.woff2") format("woff2"); }

:root {
  --wall: #18191b;
  --tile: #26282b;
  --seam: #111213;
  --line: #2b2d31;
  --chalk: #edece8;
  --dim: #8b8e93;
  --signal: #ff8a4c;
  --flap-text: #edece8;
  --board: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "IBM Plex Sans", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--wall);
  color: var(--chalk);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}
.wrap {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

header.wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: 1.75rem 0;
  font-family: var(--board);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
}
header a { color: inherit; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; }
/* The logo: one flap tile, orange, with an exclamation mark. */
.logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.15em;
  height: 1.45em;
  border-radius: 3px;
  background: var(--signal);
  color: var(--wall);
  font-size: 1.05em;
}
.logo::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: color-mix(in srgb, var(--wall) 45%, transparent);
}
header nav { display: flex; gap: 1.25rem; margin-left: auto; }
header nav a { color: var(--dim); }
header nav a:hover { color: var(--chalk); }
header nav a[aria-current="page"] { color: var(--chalk); box-shadow: inset 0 -1.5px var(--chalk); }
.clock { color: var(--dim); font-variant-numeric: tabular-nums; }

main.wrap { flex: 1; padding-block: 4rem 5rem; display: grid; gap: 4rem; align-content: start; }

/* Split-flap tiles */
.flap { display: flex; flex-wrap: wrap; gap: 0.12em 0.5em; font-family: var(--board); font-weight: 600; text-transform: uppercase; }
.word { display: flex; gap: 0.06em; }
.c {
  position: relative;
  perspective: 3em;
  width: 0.64em;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
  color: var(--flap-text);
  background: var(--tile);
  border-radius: 0.08em;
}
.c::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--seam);
}
/* The old top half folding down over the new character. */
.c::before {
  content: attr(data-prev);
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 50%;
  overflow: hidden;
  background: var(--tile);
  border-radius: 0.08em 0.08em 0 0;
  transform-origin: 50% 100%;
  transform: rotateX(-90deg);
  opacity: 0;
  backface-visibility: hidden;
}
.c.fa::before { animation: fold-a 75ms ease-in forwards; }
.c.fb::before { animation: fold-b 75ms ease-in forwards; }
@keyframes fold-a { 0% { transform: rotateX(0); opacity: 1; } 99% { opacity: 1; } 100% { transform: rotateX(-90deg); opacity: 0; } }
@keyframes fold-b { 0% { transform: rotateX(0); opacity: 1; } 99% { opacity: 1; } 100% { transform: rotateX(-90deg); opacity: 0; } }
.c.blank { background: color-mix(in srgb, var(--tile) 55%, var(--wall)); }
.line .flap { flex-wrap: nowrap; gap: 0.06em; }
.late .c { color: var(--signal); }

.scramble { position: relative; }
.scramble .ghost { color: transparent; }
.scramble .live { position: absolute; inset: 0; }

.kicker { margin: 0 0 0.75rem; color: var(--dim); font-size: 0.875rem; }

/* Secondary text buttons (sound, toggles). */
.quiet {
  background: transparent;
  color: var(--dim);
  box-shadow: inset 0 0 0 1.5px var(--tile);
  font-size: 0.875rem;
  padding: 0.35rem 0.7rem;
}
.quiet:hover { background: color-mix(in srgb, var(--chalk) 10%, var(--wall)); color: var(--chalk); }
.quiet[aria-pressed="true"] { color: var(--chalk); box-shadow: inset 0 0 0 1.5px var(--chalk); }

h1.flap { margin: 0; font-size: clamp(1.9rem, 7.2vw, 4rem); }
.lede { margin: 1.25rem 0 0; color: var(--dim); max-width: 40rem; }
.lede strong { color: var(--chalk); font-weight: 400; font-variant-numeric: tabular-nums; }
.lede a { color: inherit; text-underline-offset: 0.2em; text-decoration-color: var(--line); }
.lede a:hover { color: var(--chalk); text-decoration-color: currentColor; }

button {
  font: 600 1rem var(--board);
  letter-spacing: 0.04em;
  color: var(--wall);
  background: var(--chalk);
  border: 0;
  border-radius: 3px;
  padding: 0.55rem 1rem;
  cursor: pointer;
}
button:hover { background: color-mix(in srgb, var(--chalk) 82%, var(--wall)); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--chalk); outline-offset: 3px; }
kbd { font: inherit; border: 1px solid var(--line); border-radius: 3px; padding: 0 0.35em; }

footer.wrap { padding-block: 1.5rem 2rem; color: var(--dim); font-size: 0.8125rem; }
footer a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .c::before { display: none; }
}

@media (max-width: 30rem) {
  .hint { display: none; }
  header.wrap { flex-wrap: wrap; gap: 0.5rem 1.25rem; }
  header nav { margin-left: 0; order: 3; width: 100%; }
  .clock { margin-left: auto; }
  main.wrap { padding-block: 2.5rem 3.5rem; gap: 3rem; }
}
