/* ──────────────────────────────────────────────────────────────────────────
   The folio's pages: bookshelf, gear, app stack and places (reached from
   under the dog-ear), Resources (from the nav), and Career, which has its own
   career.css. The name is from when the first four sat behind a "More" toggle
   in the nav; that row is gone.

   Kept out of styles.css for the reason photos.css and intro.css are: it only
   ever adds to the sheet and never touches it.
   ────────────────────────────────────────────────────────────────────────── */

/* ══ The page ══════════════════════════════════════════════════════════════
   The fourth surface a section can open onto, and the plainest: a title and
   a list, in the sheet's own face, on the same grid cell the writing spread
   uses, and exactly as wide as the masthead above it: the title, the list and
   the rule over them share one left and one right edge. Its own scroller, like `.page-scroll` — `html, body { overflow:
   hidden }` is untouched and the sheet still cannot move.

   ⚠️ `:not([hidden])` carries the `display` for the reason `.spread` does. */
.folio:not([hidden]) {
  --folio-measure: 960px;
  display: block;
  min-height: 0;
  opacity: 0;
  transition: opacity 380ms ease;
}
.folio.is-in { opacity: 1; }

.folio-scroll {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  /* Clear the dog-ear so the last row never ends under the corner. */
  padding-bottom: clamp(36px, 6vh, 72px);
  /* The column is capped by PADDING, not a max-width, so the scroller stays the
     folio's full width and the wheel works anywhere on the sheet — the same
     reason `.page-scroll` does it (styles.css). */
  padding-inline: max(0px, calc((100% - var(--folio-measure)) / 2));
  scrollbar-width: none;
}
.folio-scroll::-webkit-scrollbar { display: none; }

.folio-head { margin-bottom: clamp(18px, 3vh, 30px); }

/* Content swaps by fading, not cutting — a page moving to another page in the
   same surface (gear → bookshelf) never passes through the home sheet. */
.folio-body {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 320ms ease, transform 320ms cubic-bezier(0.2, 0.6, 0.2, 1);
}
.folio-body.is-in { opacity: 1; transform: none; }

/* ── The list ──────────────────────────────────────────────────────────────
   Ruled rows, the way the writing index is ruled: a hairline above each, and
   none below the last. Columns only as far as the width allows. */
.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  column-gap: clamp(22px, 3.4vw, 52px);
}

.entry {
  border-top: 1px solid var(--rule);
}
@media (prefers-reduced-motion: no-preference) {
  .folio-body.is-in .entry {
    animation: settle 520ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
    animation-delay: calc(min(var(--i), 18) * 35ms);
  }
}

.entry-in {
  display: flex;
  align-items: center;
  gap: clamp(14px, 1.8vw, 20px);
  padding: 14px 0;
  color: inherit;
  text-decoration: none;
}
.entry-in--top { align-items: flex-start; }

.entry-text { min-width: 0; display: block; }

.entry-name {
  display: block;
  font-size: clamp(0.62rem, 1vw, 0.78rem);
  line-height: 1.6;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  width: fit-content;
  transition: border-color 200ms ease;
}
a.entry-in:hover .entry-name,
a.entry-in:focus-visible .entry-name { border-bottom-color: var(--rule); }
a.entry-in:focus-visible { outline: none; }

.entry-detail {
  display: block;
  margin-top: 2px;
  font-size: clamp(0.56rem, 0.9vw, 0.68rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ── Marks beside the text ─────────────────────────────────────────────────
   Small, and set on the sheet rather than on cards: a hairline, no shadow —
   the same rule photos.css holds its plates to. */
.entry-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
}
.entry-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* ⚠️ The gear shots are a mixed set: product photographs on white, cut-out
   PNGs with transparency, a few on black. Set straight on grey paper they are
   a scatter of bright rectangles and holes, so every one sits on the same
   light tile — a plate, the way a photograph is pasted onto the sheet. */
.entry-mark--gear {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  padding: 4px;
  box-sizing: border-box;
}
/* An app icon is already a rounded square; give it the OS's own proportions. */
.entry-mark--app img {
  width: 100%;
  height: 100%;
  border-radius: 22%;
  box-shadow: 0 0 0 1px var(--rule);
}

/* ── Years ─────────────────────────────────────────────────────────────────
   One band per year read, stacked with no gap and alternating between the
   plain paper and a faint wash of ink, so the rows are told apart by tone and
   not by a rule. Derived from --ink, so the one declaration is right in both
   themes.

   ⚠️ Bands are the folio's own width — they do not bleed past the title and the
   header rule the way a zebra table would. The covers inside are inset by the
   band's padding instead. */
.years { display: block; }

.year {
  padding: clamp(14px, 1.8vw, 24px);
  border-radius: 6px;
}
.year:nth-child(odd) { background: color-mix(in srgb, var(--ink) 5%, transparent); }

.year-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(12px, 1.6vw, 20px);
}
.year-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  letter-spacing: 0.16em;
  -webkit-text-stroke: 0.035em currentColor;
}
/* The chevron is a mark, not a word: same hairline weight as the nav's, and
   pulled in so the "<" and the year read as one unit. */
.year-label .ico { width: 1.15em; height: 1.15em; stroke-width: 1.6; margin-left: -0.35em; }
.year-count {
  font-size: clamp(0.56rem, 0.9vw, 0.68rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ── The shelf ─────────────────────────────────────────────────────────────
   Covers only: eight to a row on a wide sheet, six on a laptop, and fewer as it
   narrows. Bottom-aligned, so the odd square one sits on the same line as the
   rest, the way books stand on a shelf. A hairline, no shadow — the rule
   photos.css holds its plates to. */
.shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: clamp(14px, 1.8vw, 24px) clamp(12px, 1.6vw, 22px);
}
@media (max-width: 1100px) { .shelf { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 760px)  { .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.book {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--rule);
  /* Held until the image lands, so a slow cover is a pale slot, not a gap. */
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .folio-body.is-in .shelf-item {
    animation: settle 520ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
    animation-delay: calc(min(var(--i), 24) * 25ms);
  }
}

/* ── Resources: the board ──────────────────────────────────────────────────
   A masonry of pictures at their own ratios with only a name under each, and
   the rest held back for the detail. The dealing into columns is js/more.js
   (row order, shortest column first); this only draws them. Wider than the
   other More pages: a board wants the width a list doesn't. */
.folio-scroll--board { --folio-measure: 1320px; }

.rfilter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: clamp(18px, 3vh, 30px);
}
.rfilter-chip {
  appearance: none;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  padding: 7px 12px 6px;
  border-radius: 8px;
  font-size: clamp(0.56rem, 0.9vw, 0.68rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 200ms ease, background-color 200ms ease;
}
.rfilter-chip:hover { color: var(--ink); }
.rfilter-chip:focus-visible { color: var(--ink); outline: none; box-shadow: 0 0 0 1px var(--rule); }
.rfilter-chip.is-on {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 9%, transparent);
}

.rboard {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.rcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.rcard {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.rcard:focus-visible { outline: none; }

.rcard-img {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--rule);
  transition: transform 260ms cubic-bezier(0.22, 0.75, 0.18, 1), box-shadow 200ms ease;
}
.rcard-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 360ms ease;
}
.rcard-img img.is-in { opacity: 1; }
.rcard:hover .rcard-img { transform: translateY(-2px); }
.rcard:focus-visible .rcard-img,
.rcard.is-open .rcard-img { box-shadow: 0 0 0 2px var(--ink); }

.rcard-name {
  display: block;
  padding: 8px 2px 0;
  font-size: clamp(0.56rem, 0.9vw, 0.66rem);
  line-height: 1.5;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 200ms ease;
}
.rcard:hover .rcard-name,
.rcard.is-open .rcard-name { color: var(--ink); }

/* No picture: the words are the card, on the same white the detail uses. */
.rcard-text {
  display: block;
  padding: 16px 16px 18px;
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--rule);
  transition: transform 260ms cubic-bezier(0.22, 0.75, 0.18, 1), box-shadow 200ms ease;
}
.rcard--text:hover .rcard-text { transform: translateY(-2px); }
.rcard--text:focus-visible .rcard-text,
.rcard--text.is-open .rcard-text { box-shadow: 0 0 0 2px var(--ink); }
.rcard-title {
  display: block;
  font-size: clamp(0.62rem, 1vw, 0.76rem);
  line-height: 1.5;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
}
.rcard-note {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 8px;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: no-preference) {
  .folio-body.is-in .rcard {
    animation: settle 520ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
    animation-delay: calc(min(var(--i), 24) * 30ms);
  }
}

/* ── Resources: the detail ─────────────────────────────────────────────────
   A modal: one card centred over a wash of the frame, picture left and words
   right, stacked under 640px. On the folio rather than in the scroller, and
   `position: fixed`, so it covers the masthead too. (A side panel that slid in
   from the right like the writing page was built alongside it and dropped.) */
.rdetail {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 56px);
  background: color-mix(in srgb, var(--frame) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 240ms ease;
}
.rdetail[hidden] { display: none; }
.rdetail.is-open { opacity: 1; }

.rdetail-card {
  position: relative;
  box-sizing: border-box;
  width: min(1120px, 100%);
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(20px, 3vw, 40px);
  padding: 18px clamp(18px, 2.6vw, 32px) 28px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 0 0 1px var(--rule), 0 18px 48px rgba(0, 0, 0, 0.16);
  overflow-y: auto;
  scrollbar-width: none;
  transform: translateY(10px) scale(0.985);
  transition: transform 320ms cubic-bezier(0.22, 0.75, 0.18, 1);
}
.rdetail-card::-webkit-scrollbar { display: none; }
.rdetail.is-open .rdetail-card { transform: none; }
.rdetail-bar { grid-column: 1 / -1; }
.rdetail-media { grid-row: 2; }
.rdetail-media img { max-height: calc(100vh - 2 * clamp(16px, 4vw, 56px) - 90px); object-fit: contain; }
.rdetail-info { grid-row: 2; align-self: start; }
.rdetail-media[hidden] + .rdetail-info { grid-column: 1 / -1; max-width: 560px; }

.rdetail-bar {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin: 0 -8px 12px 0;
}
.rdetail-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 200ms ease, background-color 200ms ease;
}
.rdetail-btn .ico { width: 18px; height: 18px; }
.rdetail-btn:hover,
.rdetail-btn:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  outline: none;
}
.rdetail-close { margin-left: 6px; }

.rdetail-media { margin: 0; }
.rdetail-media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--rule);
}

.rdetail-cat,
.rdetail-by {
  margin: 0;
  font-size: clamp(0.56rem, 0.9vw, 0.66rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.rdetail-title {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  line-height: 1.35;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  -webkit-text-stroke: var(--heading-stroke, 0.035em) currentColor;
}
.rdetail-note {
  margin: 14px 0 0;
  font-size: clamp(0.92rem, 1.1vw, 1rem);
  line-height: 1.75;
  color: var(--ink);
}
.rdetail-by { margin-top: 16px; }

.rdetail-visit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 10px 14px 9px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(0.58rem, 0.9vw, 0.68rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background-color 200ms ease;
}
.rdetail-visit .ico { width: 15px; height: 15px; }
.rdetail-visit:hover,
.rdetail-visit:focus-visible { background: color-mix(in srgb, var(--ink) 14%, transparent); outline: none; }

@media (max-width: 640px) {
  .rboard, .rcol { gap: 10px; }
  .rdetail { padding: 12px; }
  .rdetail-card { display: block; padding: 12px 16px 24px; }
  .rdetail-media { margin-bottom: 20px; }
  .rdetail-media img { max-height: 55vh; }
}

@media (prefers-reduced-motion: reduce) {
  .rdetail,
  .rdetail-card { transition: none; }
}

/* ── Places ────────────────────────────────────────────────────────────────
   One plate: the map, on a hairline. The scroller becomes a column so the
   map takes whatever height the title leaves it. */
.folio-scroll--map {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.folio-scroll--map .folio-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.map {
  position: relative;
  flex: 1;
  min-height: 260px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--rule);
  overflow: hidden;
  opacity: 0;
  transition: opacity 400ms ease;
}
.map.is-in { opacity: 1; }

.map-note {
  margin: 0;
  padding-top: 14px;
  font-size: clamp(0.56rem, 0.9vw, 0.68rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* When the map can't load (no token, blocked script), the places are a list
   instead — the page should never be a blank plate. */
.folio-scroll--map .entries { overflow-y: auto; scrollbar-width: none; }

/* Mapbox's own chrome, brought into the sheet's voice. */
.map .mapboxgl-ctrl-group {
  background: var(--card);
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--rule);
}
.map .mapboxgl-ctrl-group button + button { border-top-color: var(--rule); }
.map .mapboxgl-ctrl button .mapboxgl-ctrl-icon { filter: none; }
@media (prefers-color-scheme: dark) {
  .map .mapboxgl-ctrl button .mapboxgl-ctrl-icon { filter: invert(1); }
}
.map .mapboxgl-ctrl-attrib { background: transparent; color: var(--ink-soft); }
.map .mapboxgl-ctrl-attrib a { color: inherit; }

.map .mapboxgl-popup-content {
  padding: 14px 16px 16px;
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--rule), 0 8px 24px rgba(0, 0, 0, 0.14);
  font-family: inherit;
}
.map .mapboxgl-popup-close-button { color: var(--ink-soft); font-size: 18px; }
.map .mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.map .mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
.map .mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip { border-bottom-color: var(--card); }
.map .mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.map .mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.map .mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip { border-top-color: var(--card); }
.map .mapboxgl-popup-anchor-left .mapboxgl-popup-tip { border-right-color: var(--card); }
.map .mapboxgl-popup-anchor-right .mapboxgl-popup-tip { border-left-color: var(--card); }

.pop-name {
  margin: 0;
  padding-right: 14px;
  font-size: 0.78rem;
  line-height: 1.6;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.pop-meta {
  margin: 2px 0 0;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.pop-desc {
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.pop-photos {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
}
.pop-photos img {
  height: 76px;
  width: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--rule);
}

/* ── Narrow screens ────────────────────────────────────────────────────────
   Marks shrink a touch; the list is one column already (auto-fill), so
   nothing else has to change. */
@media (max-width: 640px) {
  .entry-mark { width: 48px; height: 48px; }
}
