/* Tokens, typography and layout are taken from the portfolio at
   Richard-Portfolio/src/assets/style.css so the two sites read as one hand.
   Everything below the "additions" rule is new, and only what this site needs
   that a text-only portfolio did not: figures wider than the reading column,
   the atlas list, and the map colours. */

:root {
  --bg: #15120f;
  --bg-soft: #1f1915;
  --text: #f2ede6;
  --muted: #c3b8aa;
  --border: #3a2f27;
  --link-hover: #ded5c8;
  --focus: #81a5ff;

  /* Consumed by the inlined SVGs. Page furniture only -- line colours are the
     agencies' own and are drawn literally, never themed. */
  --map-bg: transparent;
  --map-station-fill: #f2ede6;
  --map-station-stroke: #15120f;
  --map-label: #f2ede6;

  --measure: 600px;
  --fig-wide: 960px;
}

:root[data-theme="sepia"] {
  --bg: #f7efe1;
  --bg-soft: #f0e2cf;
  --text: #2d241d;
  --muted: #655748;
  --border: #cab9a2;
  --link-hover: #1f1812;
  --focus: #4068cf;

  --map-station-fill: #f7efe1;
  --map-station-stroke: #2d241d;
  --map-label: #2d241d;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
  line-height: 1.72;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--link-hover);
}

a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  width: min(var(--measure), calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header {
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.site-nav a {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch .slider {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  display: inline-block;
  position: relative;
}

.theme-switch .slider::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--text);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.16s ease;
}

.theme-switch input:checked + .slider::after {
  transform: translateX(16px);
}

main {
  flex: 1;
  padding: 2.6rem 0 3.2rem;
}

section {
  margin-bottom: 2.9rem;
}

h1,
h2,
h3 {
  line-height: 1.3;
  margin: 0 0 0.7rem;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.3rem);
}

h2 {
  font-size: clamp(1.25rem, 2.7vw, 1.45rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.03rem;
  margin-bottom: 0.4rem;
}

p,
li {
  color: var(--text);
}

p {
  margin: 0 0 1rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
}

.meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0 0 0.3rem;
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.list li {
  padding: 0.25rem 0;
}

.list li + li {
  margin-top: 1.15rem;
}

.list article p {
  margin: 0.35rem 0 0;
}

.site-footer {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.2rem 0 2.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* The author's name should read as the credit it is, not as one more link in
   the row. */
.site-footer .byline a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.essay-header {
  margin-bottom: 1.4rem;
}

/* --- additions for this site ------------------------------------------- */

/* Prose keeps the portfolio's 600px measure. Figures break out of it, because
   a map squeezed into a reading column is not a map you can read. */
.figure {
  width: min(var(--fig-wide), calc(100vw - 2rem));
  margin: 2.2rem auto 2.6rem;
}

.figure--full {
  width: calc(100vw - 2rem);
  max-width: 1500px;
}

.figure svg {
  width: 100%;
  height: auto;
  display: block;
}

.figure figcaption {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  margin-top: 0.7rem;
  width: min(var(--measure), 100%);
}

.compare {
  display: grid;
  gap: 1.6rem 2rem;
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

/* Both maps get the same height box and letterbox inside it. Left to their own
   aspect ratios in a two-column grid, the tall geographic network dwarfs the
   wide schematic one and the comparison stops being a comparison. */
.compare svg {
  height: clamp(200px, 32vh, 360px);
  width: 100%;
}

.compare > div > p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  margin: 0.8rem 0 0;
  min-height: 2.6em;
}

.compare strong {
  color: var(--text);
}

@media (max-width: 720px) {
  .compare {
    grid-template-columns: 1fr;
  }
}

/* A quiet rule between essay sections, standing in for the portfolio's
   generous vertical rhythm at this longer length. */
.rule {
  border: 0;
  border-top: 1px solid var(--border);
  width: 3rem;
  margin: 3.2rem auto;
}

blockquote {
  margin: 1.6rem 0;
  padding-left: 1.1rem;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Entries keep their text in the reading column and let only the map break
   out, so every heading on the page shares one left edge. */
.atlas {
  list-style: none;
  padding: 0;
  margin: 2.4rem 0 0;
}

.atlas > li + li {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.atlas > li > .wrap + .wrap {
  margin-top: 0.9rem;
}

.atlas h2 {
  margin-bottom: 0.2rem;
}

.atlas .thumb {
  display: block;
  width: min(var(--fig-wide), calc(100vw - 2rem));
  margin: 1.2rem auto 0;
}

/* Capped so an entry stays scannable at a glance; the running map is where you
   go to actually read a network. */
.atlas .thumb svg {
  width: 100%;
  height: auto;
  max-height: 44vh;
  display: block;
}

.caveats {
  color: var(--muted);
  font-size: 0.86rem;
  padding-left: 1.1rem;
  margin: 0.6rem 0 0;
}

.pipeline {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0 0;
  border-top: 1px solid var(--border);
}

.pipeline li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
}

.pipeline code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--text);
}

.pipeline p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

@media (max-width: 560px) {
  .pipeline li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

.credits h3 {
  margin-top: 1.6rem;
}

.credits p {
  color: var(--muted);
  font-size: 0.94rem;
}

.credits h3 + p {
  margin-top: 0;
}

@media (max-width: 900px) {
  /* Embedded maps fit the width rather than panning. A thumbnail's job is the
     shape of a network at a glance -- panning made the atlas open on an empty
     corner of New York -- and the running map, one tap away, is where
     exploring belongs. This also keeps the page from becoming 21 nested
     scroll areas. */
  .figure--full > svg,
  .atlas .thumb svg {
    width: 100%;
    height: auto;
    max-height: 70vh;
  }

  .compare svg {
    height: auto;
    max-height: 34vh;
  }
}

/* Both platforms ask for a 44px target. Scoped to touch so the desktop
   layout keeps its density. */
@media (pointer: coarse) {
  .brand,
  .site-nav a,
  .site-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Navigation that happens to sit inside a caption or a meta line: grow the
     hit area with padding and pull it back with a negative margin, so the
     target reaches 44px without changing where the text sits.
     Deliberately NOT applied to links inside prose -- a paragraph of credits
     would end up with overlapping targets, and the guideline is about
     controls, not about words in a sentence. */
  figcaption a,
  .meta a {
    display: inline-block;
    padding-block: 0.7rem;
    margin-block: -0.7rem;
  }

  .theme-switch .slider {
    width: 46px;
    height: 28px;
  }

  .theme-switch .slider::after {
    width: 22px;
    height: 22px;
  }

  .theme-switch input:checked + .slider::after {
    transform: translateX(18px);
  }
}

@media (max-width: 640px) {
  html,
  body {
    font-size: 17px;
  }

  /* Keeps "Legible Cities" on one line beside the nav at 360px. */
  .brand {
    font-size: 0.95rem;
  }

  .site-nav {
    gap: 0.7rem;
  }

  main {
    padding-top: 2rem;
  }

  section {
    margin-bottom: 2.3rem;
  }
}
