/*
 * Panreon's site: its own look (epics/panreon, step 3), in Massimo Vignelli's register, the New York City
 * Transit Authority Graphics Standards Manual of 1970: one grotesk, size and weight as the whole
 * hierarchy, a strict grid, rules as the only drawing, black and white with greys and one blue. Nothing
 * of the app's look.
 *
 * Every colour is a light-dark(day, night) pair, so the used colour scheme alone switches the page: the
 * OS's, or the toggle's choice, which theme.js puts on <html> as data-theme before the first paint.
 */

/* Inter, from the site's own files: @fontsource-variable/inter 5.3.0's wght variable files for the latin
 * and latin-ext subsets (latin-ext for the imprint's Czech: ě, š, č, ř, ž, ů), as its wght.css and
 * wght-italic.css write them. Under the SIL Open Font License, /fonts/OFL.txt. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter Variable";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-wght-italic.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The app's metrics-matched fallback (web/app/app.css): Arial sized and placed as Inter is, so the page
 * doesn't move when the face arrives. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Liberation Sans");
  size-adjust: 107.12%;
  ascent-override: 90.44%;
  descent-override: 22.52%;
  line-gap-override: 0%;
}

:root {
  color-scheme: light dark;
  /* Black and white, inverted by night. */
  --page: light-dark(#ffffff, #000000);
  --text: light-dark(#000000, #ffffff);
  /* Two greys, inverted with them: the muted text (5.74:1 on white, 6.25:1 on black) and the hairlines. */
  --muted: light-dark(#666666, #8c8c8c);
  --line: light-dark(#d4d4d4, #383838);
  /* The one colour, the OP-1's key blue, two steps of one hue (OKLCH 260): 5.70:1 on white, 6.65:1 on black. */
  --blue: light-dark(#095fdc, #4d8ffc);
  --face: "Inter Variable", "Inter Fallback", Helvetica, Arial, sans-serif;
  /* Three sizes on a 16px root: the display (32px at 390 to 48px at 1280), the text (16px), the labels (12px). */
  --display: clamp(2rem, 1.5625rem + 1.8vw, 3rem);
  --small: 0.75rem;
  /* The margin: 16px at 390, 64px at 1280. */
  --gutter: clamp(1rem, -0.3145rem + 5.393vw, 4rem);
  /* The measure: at most 65 characters of prose a line. Inter's "0" is 0.63em wide, so 65ch would be
   * 656px and lines of up to 89 characters; 28em is 448px, its longest line 62 (29em would be 66). */
  --measure: 28em;
}

:root[data-theme="day"] {
  color-scheme: light;
}

:root[data-theme="night"] {
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--face);
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 400;
}

h1,
h2,
p,
ul,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

p {
  text-wrap: pretty;
}

::selection {
  background: var(--blue);
  color: var(--page);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* A link: its words in the text's colour, underlined in the blue, the underline thickening on hover. */
a {
  color: var(--text);
  text-decoration-line: underline;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

a:hover {
  text-decoration-thickness: 4px;
}

/* Identifiers in Inter too: a number's figures one width each (not a date's: Inter's tabular hyphen is
 * wider); a cookie's name in bold, the word the eye looks for in its row. */
code,
.id {
  font-family: inherit;
  font-size: 1em;
}

.id {
  font-variant-numeric: tabular-nums;
}

code {
  font-weight: 700;
}

/* The small size: labels only, in capitals, spaced. */
.letterhead,
.top nav a,
.theme button,
.kind,
dt,
.tag,
.todo,
.foot {
  font-size: var(--small);
  line-height: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The page's column: 16px from the edges at 390, 64px at 1280, at most 1152px wide. */
.wrap {
  width: min(calc(100% - 2 * var(--gutter)), 72rem);
  margin-inline: auto;
}

/* The first row: the name, the two pages and, once the script runs, the toggle in the corner. */
.top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name theme" "nav nav";
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 1.5rem;
}

.letterhead {
  grid-area: name;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  font-weight: 700;
  text-decoration-line: none;
}

/* The name links home: underlined only when pointed at. */
.letterhead:hover {
  text-decoration-line: underline;
}

.top nav {
  grid-area: nav;
  justify-self: start;
}

.top nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
}

.top nav a {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
}

/* The open page: bold, its underline at its full weight. */
.top nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration-thickness: 4px;
}

/* Two keys, Day and Night, sharing an edge: the lit one filled in the blue, the other a hairline. */
.theme {
  grid-area: theme;
  justify-self: end;
}

.theme:not([hidden]) {
  display: inline-flex;
}

.theme button {
  appearance: none;
  margin: 0;
  min-height: 1.5rem;
  padding: 0 0.625rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-weight: 400;
  cursor: pointer;
}

.theme button + button {
  margin-left: -1px;
}

.theme button:hover {
  border-color: var(--text);
  position: relative;
}

.theme button[aria-pressed="true"] {
  position: relative;
  border-color: var(--blue);
  background: var(--blue);
  color: var(--page);
}

/* The page's name at the display size, on its heavy rule, as the manual sets a station's name. */
.title {
  display: grid;
  gap: 0.5rem;
  padding: 3rem 0 1rem;
  border-bottom: 4px solid var(--blue);
}

.kind,
dt {
  color: var(--muted);
}

h1 {
  font-size: var(--display);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

/* The grid: one column on a phone; from 768px, a label column (the section's heading) and the text's. */
main > section,
.lede {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem 2rem;
  padding-block: 2rem 2.5rem;
}

/* Sections a hairline apart; none straight under the heavy rule. */
main > section + section {
  border-top: 1px solid var(--line);
}

.lede + section {
  border-top: 1px solid var(--line);
}

@media (min-width: 48rem) {
  .top {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
    grid-template-areas: "name nav";
    column-gap: 2rem;
  }

  .theme {
    grid-area: nav;
  }

  main > section,
  .lede {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
    padding-block: 2.5rem 3rem;
  }

  main > section > h2 {
    grid-column: 1;
  }

  main > section > .content,
  .lede > * {
    grid-column: 2;
  }
}

/* A section's heading: the text's size in bold, set apart by the rule above it and the space. */
h2 {
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 700;
}

/* The text column. */
.content,
.lede > p {
  max-width: var(--measure);
}

.content {
  display: grid;
  gap: 1rem;
  align-content: start;
}

/* The quieter step: a fact's explanation, and the note under a list. */
.muted,
.note {
  color: var(--muted);
}

/* A flag left for the owner (Draft, TODO), as a label in bold, in the text's colour. */
.tag,
.todo {
  font-weight: 700;
  color: var(--text);
}

/* Facts: a label in small capitals and its value, stacked on a phone, side by side from 640px; a long
 * label stays above its value (.stacked). */
.facts {
  display: grid;
  gap: 1rem;
}

.facts > div {
  display: grid;
  gap: 0.125rem;
}

@media (min-width: 40rem) {
  .facts:not(.stacked) > div {
    grid-template-columns: 7rem minmax(0, 1fr);
    column-gap: 1rem;
    align-items: baseline;
  }
}

dd {
  overflow-wrap: anywhere;
}

/* A list's entries: what, in bold, then its facts. */
.entries {
  display: grid;
  gap: 2rem;
}

.entries > li {
  display: grid;
  gap: 0.5rem;
}

.what {
  font-weight: 700;
}

/* The Trivo lockup, inline, in the text's colour. */
.lockup {
  display: block;
  color: var(--text);
}

/* The footer: one line of labels, flush left, under a hairline. */
.foot {
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
