/* ---------------------------------------------------------------------------
   Naïve Weekly
   --------------------------------------------------------------------------- */

:root {
  --black: #000;
  --white: #fff;
  --ground: #e4d9c4; /* earthy dirt — the streets are the page itself */
  --accent: rgb(255, 178, 0);
  --border: 1px solid var(--black);
  --pad: 40px;
  --nav-height: 120px;

  /* Sun shadow — offset/length set from the time of day by JS */
  --shadow-x: 4px;
  --shadow-y: 5px;
  --shadow-blur: 4px;
  --shadow-alpha: 0.22;
}

.sun-shadow {
  filter: drop-shadow(var(--shadow-x) var(--shadow-y) var(--shadow-blur) rgba(0, 0, 0, var(--shadow-alpha)));
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: var(--pad) var(--pad) calc(var(--nav-height) + var(--pad));
  font-family: Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.25;
  color: var(--black);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  /* full-bleed wide images use 100vw; clip any resulting horizontal overflow */
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* --- Sun position label ---------------------------------------------------- */

.sun-label {
  position: fixed;
  right: var(--pad);
  /* aligned to the nav's bottom baseline */
  bottom: var(--pad);
  font-size: 13px;
  line-height: 1;
  color: #000;
  z-index: 15;
  pointer-events: none;
}

/* the sun label stays home — hidden on the individual detail pages */
.page--site .sun-label,
.page--article .sun-label,
.page--book .sun-label,
.page--person .sun-label,
.page--place .sun-label {
  display: none;
}

/* --- Corner illustration (link home) -------------------------------------- */

.corner {
  position: fixed;
  left: var(--pad);
  /* vertically centered against the 128px-tall nav */
  bottom: calc(var(--pad) + 36px);
  width: 56px;
  height: 56px;
  z-index: 15;
}

.corner__fig,
.corner__shadow {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left bottom;
}

/* Shadow = a mirrored, skewed, stretched, blurred copy cast on the floor.
   Sun direction/length come from --sun-skew / --sun-scaleY, set by JS. */
.corner__shadow {
  transform-origin: left bottom;
  transform: scaleY(var(--sun-scaleY)) skewX(var(--sun-skew));
  filter: brightness(0) blur(1.6px);
  opacity: var(--shadow-alpha);
}

.corner:hover .corner__fig {
  opacity: 0.6;
}

/* Bigger buoy on the homepage */
.page--home .corner {
  width: 110px;
  height: 110px;
}

/* --- Bottom section nav ---------------------------------------------------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--pad);
  display: flex;
  justify-content: center;
  z-index: 30; /* the house sits above everything else on the page */
}

.nav__plan {
  position: relative;
  display: inline-block;
}

/* Door — on every detail page it replaces the floor plan and leads back to
   the parent section */
.nav__door { display: none; }

.page--site .nav__plan,
.page--article .nav__plan,
.page--book .nav__plan,
.page--person .nav__plan,
.page--place .nav__plan { display: none; }

.page--site .nav__door,
.page--article .nav__door,
.page--book .nav__door,
.page--person .nav__door,
.page--place .nav__door {
  display: block;
  position: fixed;
  left: var(--pad);
  bottom: var(--pad);
  width: 34px;
  height: 50px;
  padding: 0;
  border: 1px solid #000;
  background: none;
  cursor: pointer;
  z-index: 21;
  /* hinged on the left — it swings open slightly in perspective on hover */
  transform-origin: left center;
  transition: transform 0.35s ease;
}

.nav__door:hover {
  transform: perspective(240px) rotateY(-26deg);
}

/* doorknob on the right side */
.nav__door::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 5px;
  width: 6px;
  height: 6px;
  transform: translateY(-50%);
  border: 1px solid #000;
  border-radius: 50%;
}

.nav__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible; /* let the walker break out of the floor plan */
  pointer-events: none;
}

.nav__walker__shadow {
  fill: #000;
  stroke: #000;
  stroke-width: 1.4;
  opacity: calc(var(--shadow-alpha) * 0.22);
  filter: blur(2.4px);
}

/* glowing orb visitors: one blurred circle (see #orb-blur), pulsing on each
   orb's own rhythm (duration/delay set inline per orb) */
.nav__walker .orb__body { opacity: 0.9; }

/* note: no transform-origin here — it would re-origin the walker's SVG
   transform around the overlay's viewBox centre and fling the orb off-canvas
   (the pulse only animates opacity, so it needs no origin) */
.nav__walker .fig {
  animation-name: orb-pulse;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

@keyframes orb-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .nav__walker .fig { animation: none; }
}

.nav__grid {
  display: grid;
  grid-template-columns: repeat(4, 84px);
  grid-template-rows: 84px 44px;
  /* walls are drawn by the SVG overlay so the hover fill shows through openings */
  background: var(--ground); /* the house floor matches the page ground */
}

.nav__cell {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  background: transparent;
}

.nav__cell:hover {
  text-decoration: none;
  /* per-section room colour set in the Panel, falling back to the accent */
  background: var(--room, var(--accent));
}

.nav__cell.is-active {
  font-weight: bold;
}

.nav__cell--sites  { grid-column: 1; grid-row: 1 / span 2; }
.nav__cell--books  { grid-column: 2; grid-row: 1; }
.nav__cell--people { grid-column: 3; grid-row: 1; }
.nav__cell--places { grid-column: 4; grid-row: 1 / span 2; }
.nav__home         { grid-column: 2 / span 2; grid-row: 2; }

/* (Outer doors are opened by the people passing through — handled in JS.) */

/* --- Home ----------------------------------------------------------------- */

/* the view toggle is its own block in the top-right of the neighbourhood grid */
.home-tools {
  grid-column: -2 / -1;
  grid-row: 1;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: transparent;
}

.view-toggle {
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  padding: 0;
  width: 100%;
  height: 100%;
}

/* in list view the toggle sits above the list as a "Neighborhood" button */
.grid.is-list .home-tools {
  display: flex;
  justify-content: flex-end;
  border: none;
  background: none;
  margin: 0 0 1em;
  padding: 0;
}

.grid.is-list .view-toggle {
  border: var(--border);
  background: transparent;
  padding: 6px 14px;
  width: auto;
  height: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  grid-auto-rows: 172px;
  grid-auto-flow: dense;
  gap: 42px; /* streets running between the blocks */
  position: relative;
}

/* A garden of flowers grows in the gaps, behind the blocks */
.garden {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* a drawn wildflower / grass tuft; the svg origin (stem base) sits on the
   planted point via the negative margins */
.flower {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: -12px 0 0 -8px;
  transition: transform 0.3s ease;
  will-change: transform;
}

.flower svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* white dashed centre line down every street (the grey page is the asphalt) */
.road {
  position: absolute;
}
.road--v {
  width: 3px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(to bottom, var(--white) 0 7px, transparent 7px 18px);
}
.road--h {
  height: 3px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(to right, var(--white) 0 7px, transparent 7px 18px);
}

.navflower {
  transition: transform 0.3s ease;
}

/* boulders scattered between the ruins */
.rock {
  position: absolute;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
}

/* the rock layer floats above the blocks, so boulders can sit on top of the
   coloured ones (they still avoid walls and text when placed) */
.garden--rocks {
  z-index: 2;
}

.card {
  position: relative;
  z-index: 1;
  display: block;
  /* walls are drawn by the .ruin SVG (1px lines with openings), not a border */
  border: none;
  /* uncoloured blocks sit flush in their cell; coloured blocks are padded below */
  padding: 0;
  color: var(--black);
  background: transparent;
  overflow: visible;
}

/* ruin walls: 1px black lines around each box, with gaps where walls fell */
.ruin {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.grid.is-list .ruin {
  display: none;
}

/* Varied block sizes → a neighbourhood of different buildings */
.card--w { grid-column: span 2; }
.card--t { grid-row: span 2; }
.card--l { grid-column: span 2; grid-row: span 2; }
/* smaller blocks that leave more garden/road around them */
.card--compact { margin: 6px 12px; }

.card__blurb {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: "Times New Roman", Times, serif;
  font-size: 19px;
  line-height: 1.2;
}

.card:hover {
  text-decoration: none;
}

/* hovering anywhere on a ruin (rocks and flowers included — they don't catch
   the pointer) underlines its title */
.card:hover .card__blurb {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* coloured blocks have no border (and no door — handled in JS), and keep
   their inner padding so the text isn't flush against the fill */
.card--color {
  border: none;
  padding: 12px 14px;
}

/* pink text on the green block */
.card--green {
  color: rgb(251, 219, 235);
}

/* an orange rolling down a street (Oranges season) */
.orange {
  position: absolute;
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: #ffa64d;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}

/* an empty plot in the garden — wildflowers, rocks, a ruin */
.plot {
  position: absolute;
  pointer-events: none;
}
.plot svg {
  display: block;
  width: 100%;
  height: 100%;
}

.card__media {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.card__blurb,
.card__date {
  position: relative;
  z-index: 1;
}

.card__date {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 1;
}

/* uncoloured blocks sit flush: the date loses its padding too, matching the
   flush title (coloured blocks keep the 14px/12px inset) */
.card:not(.card--color) .card__date {
  left: 0;
  bottom: 0;
}

.card--image {
  color: var(--white);
}

.card--image .card__blurb,
.card--image .card__date {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* List view toggle */
.grid.is-list {
  display: block;
  /* the body's --pad provides the list's left/right padding; pull the top
     up a little so there's less dead space above the button */
  margin: calc(-0.5 * var(--pad)) 0 0;
  padding: 0;
}

/* the neighbourhood (garden, roads, flowers) never shows behind the list */
.grid.is-list .garden {
  display: none;
}

.grid.is-list .card {
  aspect-ratio: auto;
  min-height: 0;
  border: none; /* the divider is a ruin-style SVG line (.list-divider) */
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.grid.is-list .card__media {
  display: none;
}

.grid.is-list .card {
  color: var(--black);
  background: transparent; /* rows stay see-through; only neighbourhood boxes are filled */
}

.grid.is-list .card__date {
  position: static;
  white-space: nowrap;
}

/* ruin-style divider between list rows (built by JS in list view) */
.list-divider {
  display: none;
}

.grid.is-list .list-divider {
  display: block;
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 4px;
  overflow: visible;
  pointer-events: none;
}

/* --- Sites ---------------------------------------------------------------- */

.sites {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}

.site-chip {
  display: inline-flex;
  align-items: center;
  border: var(--border);
  padding: 8px 12px;
  background: transparent;
  position: relative;
}

/* --- Books ---------------------------------------------------------------- */

.shelf {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  border-bottom: var(--border);
  min-height: 320px;
  padding: 0 2px;
}

.book {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  border: var(--border);
  width: 46px;
  min-height: 200px;
  margin-bottom: -1px; /* sit the spines onto the shelf line */
  padding: 14px 12px;
  display: flex;
  align-items: flex-start;
  background: var(--white);
  color: var(--black);
}

.book:hover {
  text-decoration: none;
}

/* a spine that toggles a list of articles is a button — strip its chrome */
button.book {
  font: inherit;
  cursor: pointer;
  appearance: none;
}

/* article lists revealed beneath the shelf for multi-article books */
.book-articles {
  list-style: none;
  max-width: 520px;
  margin: 24px auto 0;
  padding: 14px 20px;
  border: var(--border);
  background: var(--ground);
}

.book-articles__title {
  font-style: italic;
  margin-bottom: 8px;
}

.book-articles li a {
  text-decoration: underline;
}

/* --- People --------------------------------------------------------------- */

.alphabet {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  margin-bottom: 60px;
  font-size: 18px;
}

.alphabet button {
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  padding: 0;
  /* grid-centre so the glyph sits dead-centre in the circle (more reliable
     than flex for a single centred child) */
  display: inline-grid;
  place-items: center;
}

.alphabet button:disabled {
  opacity: 0.25;
  cursor: default;
}

.alphabet button.is-active {
  background: var(--accent);
}

/* stack + up/down arrows, centred together */
.deck {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  margin: 0 auto 30px;
}

.deck-arrows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.deck-arrow {
  width: 30px;
  height: 30px;
  border: var(--border);
  background: transparent;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.deck-arrow:hover {
  background: var(--accent);
}

.people-stack {
  position: relative;
  width: 340px;
  min-height: 200px;
}

.person-card {
  background: var(--ground);
}

.people-stack .person-card {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.person-table,
.place-table,
.info-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

/* people cards sit directly on the page ground, no white fill */
.person-table {
  background: transparent;
}

.person-table th,
.person-table td,
.place-table th,
.place-table td,
.info-table th,
.info-table td {
  border: var(--border);
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}

.person-table th,
.place-table th,
.info-table th {
  font-style: italic;
  font-weight: normal;
  width: 33%;
  white-space: nowrap;
}

.person-table a,
.place-table a,
.info-table a {
  text-decoration: underline;
}

/* --- Article (entry detail page) ----------------------------------------- */

.article {
  max-width: 520px;
  margin: 0 auto;
  padding-top: 9vh;
}

.article__title {
  font-size: inherit;
  font-weight: bold;
  margin: 0 0 2.4em;
}

.article__meta {
  position: fixed;
  top: var(--pad);
  right: var(--pad);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  color: var(--black);
  z-index: 20;
}

.article__meta a {
  color: var(--black);
  text-decoration: underline;
}

.article__body p {
  margin: 0 0 1em;
}

.article__body h1,
.article__body h2,
.article__body h3 {
  font-size: inherit;
  font-weight: bold;
  margin: 1.6em 0 0.5em;
}

.article__body a {
  text-decoration: underline;
}

.article__body ul,
.article__body ol {
  margin: 0 0 1em 1.2em;
}

.article__body blockquote {
  margin: 1.6em 0;
  padding-left: 14px;
  border-left: 2px solid var(--black);
}

.article__body blockquote cite,
.fig figcaption cite {
  font-style: italic;
}

/* media figures */
.fig {
  margin: 1.8em 0;
}

.fig img,
.fig video {
  display: block;
  width: 100%;
}

.fig audio {
  display: block;
  width: 100%;
}

.fig figcaption {
  font-size: 13px;
  color: #666;
  margin-top: 0.5em;
}

.embed {
  position: relative;
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* wide media breaks out of the text column: flush to the viewport's left/right
   edges, capped at a max-width and centred once the screen is wider than that */
.fig--wide {
  width: 100vw;
  max-width: 1400px;
  margin-left: 50%;
  transform: translateX(-50%);
}

.fig--wide figcaption {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Library card (detail-page sidebar) ---------------------------------- */

/* Narrow: a ground-coloured card between the title and the body. Wide: the
   article becomes a two-column grid and the card sits beside the body,
   top-aligned with the first line of content. */
.library-card {
  max-width: 340px;
  margin: 0 auto 2.4em;
}

/* the "more" row + button only appear on mobile (below the sidebar breakpoint) */
.info-table__more { display: none; }

.info-table__more-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Mobile/tablet: two columns — metadata | tools. The metadata column shows
   the first four rows, then a "more" toggle reveals the rest. */
@media (max-width: 1159px) {
  .library-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 116px;
    gap: 14px;
    align-items: start;
    max-width: 520px;
  }

  /* table-layout:fixed makes the tables respect their grid track width
     instead of expanding to their content (which overflowed the row) */
  .library-card .info-table { width: 100%; table-layout: fixed; }
  .library-card .info-table td { overflow-wrap: anywhere; }

  .info-table--meta .info-table__extra { display: none; }
  .info-table--meta.is-expanded .info-table__extra { display: table-row; }
  .info-table__more { display: table-row; }
  .info-table--meta.is-expanded .info-table__more { display: none; }
}

@media (max-width: 600px) {
  .library-card { max-width: none; }
}

.info-table {
  background: var(--ground);
}

/* single column: label + value share each cell, small and dense (colophon size) */
.info-table td {
  padding: 5px 8px;
  font-size: 13px;
  line-height: 1.3;
  width: auto;
  white-space: normal;
}

.info-table__label {
  font-weight: bold;
  margin-right: 2px;
}

/* previous / next table at the foot of an article — same styling as the aside */
.article-nav {
  margin: 3em auto 0;
}

/* sidebar tools table — a second info-table below the metadata, with a gap */
.library-card__tools {
  margin-top: 10px;
}

/* the tools sit in table cells as plain text buttons */
.font-opt,
.hl-toggle,
.print-btn {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

/* font options: the current typeface is underlined; hovering underlines too */
.font-opt.is-active,
.font-opt:hover,
.print-btn:hover {
  text-decoration: underline;
}

.hl-toggle__name {
  text-decoration: none;
}

.hl-toggle:hover .hl-toggle__name {
  text-decoration: underline;
}

/* editor highlights in the article body (toggled off from the sidebar) */
.article__body .hl {
  background: var(--accent);
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

:root[data-hl="off"] .article__body .hl {
  background: transparent;
  padding: 0;
}

/* article body swaps between Arial and Times New Roman via the toggle */
.article__body {
  font-family: Arial, Helvetica, sans-serif;
}

:root[data-font="serif"] .article__body {
  font-family: "Times New Roman", Times, serif;
  font-size: 19px;
  line-height: 1.45;
}

.library-card .info-table th {
  text-transform: lowercase;
}

/* Wide: the article column stays centred on the page; the card hangs in its
   left margin and the tools (font, highlights, print) in its right margin.
   Both sit in the flow right before the body, so with no `top` set their
   absolute position IS the body's first line — they always start exactly
   where the content starts. */
@media (min-width: 1160px) {
  .article {
    position: relative;
  }

  .article .library-card {
    position: absolute;
    right: calc(100% + 30px);
    width: 250px;
    max-width: none;
    margin: 0;
  }
}

/* the body's first element carries no top margin, so the content's first
   line meets the aside's top edge */
.article__body > :first-child {
  margin-top: 0;
}

/* Site detail page: its own layout — a centred column, no sidebar, metadata
   listed inline under small headers */
.site-page {
  max-width: 520px;
  margin: 0 auto;
  padding-top: 9vh;
}

/* screenshots section: a bold little header above the slideshow */
.site-shots__head {
  font-size: inherit;
  font-weight: bold;
  margin: 2.4em 0 0.8em;
}

/* slideshow — a little screen that scrolls left/right like a bus-stop poster */
.slideshow__frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: var(--border);
  background: var(--ground);
}

.slideshow__track {
  display: flex;
  flex-direction: row;
  height: 100%;
  transition: transform 0.6s linear;
}

.slide {
  flex: 0 0 100%;
  height: 100%;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: alias;
}

/* keep the arrow glyphs as text, never emoji (iOS) */
.slideshow__prev,
.slideshow__next {
  font-variant-emoji: text;
}

.slideshow__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
}

.slideshow__prev,
.slideshow__next {
  width: 28px;
  height: 28px;
  padding: 0;
  border: var(--border);
  background: transparent;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.slideshow__prev:hover,
.slideshow__next:hover {
  background: var(--accent);
}

.slideshow__caption {
  color: #666;
}

.slideshow__caption a {
  text-decoration: underline;
}

.site-info {
  margin: 2.8em 0 0;
}

.site-info dt {
  font-weight: bold;
  margin-top: 1.2em;
}

.site-info dd {
  margin: 0.15em 0 0;
}

.site-info dd a {
  text-decoration: underline;
}

/* Site detail page (legacy info table) */
.detail {
  max-width: 480px;
  margin: 40px auto 0;
}

/* Places table sits below the map */
.place-table {
  max-width: 960px;
  margin: 40px auto 0;
}

.shuffle {
  display: block;
  margin: 0 auto;
  border: var(--border);
  background: transparent;
  font: inherit;
  padding: 10px 26px;
  cursor: pointer;
}

.shuffle:hover {
  background: var(--accent);
}

/* --- Places (MapLibre map) ------------------------------------------------- */

/* full-bleed: break out of the body padding to fill the viewport width, and
   run the map the full height of the first screen */
.places-map-wrap {
  position: relative;
  margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 0;
  border: none;
}

.places-map {
  width: 100%;
  height: 100vh;
  min-height: 420px;
  background: var(--ground); /* shows through when the earth layer is hidden */
}

/* toggle to hide the map tiles (earth) while keeping the place labels */
.map-toggle {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  z-index: 5;
  border: var(--border);
  background: var(--ground);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

.map-toggle:hover {
  background: var(--accent);
}

/* MapLibre zoom (+/-) styled like the map toggle — square, bordered, no shadow */
.places-map .maplibregl-ctrl-group {
  border: var(--border);
  border-radius: 0;
  box-shadow: none;
  background: var(--ground);
}

.places-map .maplibregl-ctrl-group button {
  width: 28px;
  height: 28px;
  background: var(--ground);
}

.places-map .maplibregl-ctrl-group button + button {
  border-top: var(--border);
}

.places-map .maplibregl-ctrl-group button:hover {
  background: var(--accent);
}

/* recolour the +/- glyphs to black */
.places-map .maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.places-map .maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  filter: none;
}

/* space markers: a dot with the venue name always visible beside it */
.place-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.place-marker__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: var(--border);
  flex: 0 0 auto;
}

.place-marker__name {
  font-size: 13px;
  color: var(--black);
  background: var(--ground);
  padding: 1px 5px;
  border: var(--border);
}

/* popup overlay styled like the rest of the site */
.place-popup .maplibregl-popup-content {
  border: var(--border);
  border-radius: 0;
  background: var(--ground);
  padding: 12px 14px;
  box-shadow: var(--shadow-x) var(--shadow-y) var(--shadow-blur) rgba(0, 0, 0, 0.18);
  font-family: inherit;
}

.place-popup .maplibregl-popup-tip {
  display: none;
}

/* hide the bottom-right control cluster (attribution) */
.maplibregl-ctrl-bottom-right {
  display: none;
}

.place-popup__title {
  font-weight: bold;
  text-decoration: none;
}

.place-popup__title:hover {
  text-decoration: underline;
}

.place-popup__table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
}

.place-popup__table th,
.place-popup__table td {
  border: 1px solid #000;
  padding: 3px 6px;
  text-align: left;
  vertical-align: top;
}

.place-popup__table th {
  font-style: italic;
  font-weight: normal;
  white-space: nowrap;
  width: 1%;
}

.place-popup__blurb {
  margin: 6px 0;
}

.place-popup__link {
  text-decoration: underline;
}

/* --- Ocean page ------------------------------------------------------------ */

.ocean-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.ocean-scene svg {
  display: block;
  width: 100%;
  height: 100%;
}

.page--sea {
  overflow: hidden; /* the scene fills the viewport; nothing scrolls */
}

/* ocean sound toggle, top-right corner */
.sound-toggle {
  position: fixed;
  top: var(--pad);
  right: var(--pad);
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  z-index: 31;
}

.sound-toggle:hover {
  text-decoration: underline;
}

/* back to the hills — bottom-right of the sea, above the sun label */
.hills-link {
  position: fixed;
  bottom: calc(var(--pad) + 20px);
  right: var(--pad);
  font-size: 13px;
  line-height: 1;
  color: #000;
  text-decoration: none;
  z-index: 31;
}

.hills-link:hover {
  text-decoration: underline;
}

/* --- Home footer: newsletter + colophon ----------------------------------- */

/* the 1px padding prevents margin-collapse with the sections inside, so the
   below-the-fold JS measurement stays exact */
.page-foot {
  padding-top: 1px;
}

.newsletter,
.colophon {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  scroll-margin-top: 60px;
}

.newsletter {
  margin-top: 24vh;
  margin-bottom: 24vh;
}

.colophon {
  margin-top: 24vh;
  margin-bottom: 28vh;
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
}

.colophon p {
  margin: 5px 0;
}

.colophon a {
  text-decoration: underline;
}

/* full-width black divider between each line */
.colophon-div {
  width: 100%;
  height: 0;
  margin: 5px 0;
  border: 0;
  border-top: 1px solid #000;
}

.newsletter__intro {
  margin: 0 0 1.4em;
}

.newsletter__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.newsletter__field {
  width: 100%;
  border: var(--border);
  background: transparent;
  font: inherit;
  padding: 10px 12px;
}

.newsletter__note {
  resize: vertical;
}

.newsletter__submit {
  border: var(--border);
  background: transparent;
  font: inherit;
  padding: 10px 26px;
  cursor: pointer;
}

.newsletter__submit:hover {
  background: var(--accent);
}

.newsletter__msg {
  margin: 4px 0 0;
  font-style: italic;
}

/* fixed jump-links, styled like the sun label but mirrored to the bottom-left
   (the sun label sits bottom-right) */
.foot-jump {
  position: fixed;
  left: var(--pad);
  bottom: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  line-height: 1;
  /* above the full-width .nav band (z 30), which otherwise swallows clicks */
  z-index: 31;
}

.foot-jump a {
  color: #000;
  text-decoration: none;
  width: fit-content; /* only the text is the hit target, not the full row */
}

.foot-jump a:hover {
  text-decoration: underline;
}

/* "Visit the sea" — bottom-right, just above the sun-direction label */
.sea-link {
  position: fixed;
  right: var(--pad);
  bottom: calc(var(--pad) + 20px);
  font-size: 13px;
  line-height: 1;
  color: #000;
  text-decoration: none;
  /* above the full-width .nav band (z 30) so it stays clickable */
  z-index: 31;
}

.sea-link:hover {
  text-decoration: underline;
}

/* hidden on the sea itself and on the detail pages (like the sun label) */
.page--sea .sea-link,
.page--site .sea-link,
.page--article .sea-link,
.page--book .sea-link,
.page--person .sea-link,
.page--place .sea-link {
  display: none;
}

/* --- Utility -------------------------------------------------------------- */

.empty {
  color: #999;
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  :root {
    --pad: 20px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .people-stack {
    width: 100%;
  }
  .corner {
    width: 40px;
    height: 40px;
    bottom: calc(var(--pad) + 44px);
  }
}
