/* =========================================================================
   styles.css — "sheet / section / page" zoom concept
   ========================================================================= */

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

:root {
  --bg:        #0c0c0d;
  --bg-2:      #131315;
  --bg-3:      #17171a;
  --ink:       #f2f2ef;
  --ink-2:     #a1a19c;
  --ink-3:     #5e5e5b;
  --line:      #232327;
  --line-2:    #333338;
  --block:     #242427;
  --block-2:   #2e2e33;
  --frame:     #f2f2ef;

  --ease:      cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --dur:       560ms;

  --pad:       clamp(18px, 5vw, 46px);
  --bar-h:     96px;
  --peek:      clamp(16px, 6vw, 74px);   /* how much of the neighbour page shows */
  --pg-gap:    clamp(8px, 1.6vw, 16px);

  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
          monospace;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body { overflow: hidden; height: 100vh; height: 100dvh; }

button { font: inherit; color: inherit; }

::selection { background: #3a3a41; color: #fff; }

/* scrollbars (desktop) */
.layer-scroll::-webkit-scrollbar,
.pg::-webkit-scrollbar { width: 10px; height: 10px; }
.layer-scroll::-webkit-scrollbar-thumb,
.pg::-webkit-scrollbar-thumb { background: #26262b; border-radius: 8px; }
.layer-scroll::-webkit-scrollbar-track,
.pg::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}
.layer-host { position: absolute; inset: 0; }

/* =========================================================================
   LEVEL 1 — SHEET
   ========================================================================= */
.sheet { position: absolute; inset: 0; overflow: hidden; touch-action: none; }

.sheet-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--pad) + 12px) var(--pad) calc(var(--bar-h) + 16px);
  overflow: hidden;
}

.hero { flex: none; max-width: 780px; }

.hero-name {
  margin: 0 0 7px;
  font-size: clamp(22px, 4.6vw, 28px);
  font-weight: 700;
  letter-spacing: -.02em;
}

.hero-role {
  margin: 0 0 clamp(22px, 4vw, 34px);
  font-family: var(--mono);
  font-size: clamp(11px, 2.6vw, 12.5px);
  color: var(--ink-3);
  letter-spacing: .01em;
}
.hero-role .dot { opacity: .6; }
.clock { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.hero-tagline {
  margin: 0;
  max-width: 26ch;
  font-size: clamp(22px, 5.1vw, 34px);
  line-height: 1.18;
  font-weight: 500;
  letter-spacing: -.028em;
}

/* nav labels + columns share one grid rhythm */
.sheet-nav,
.sheet-grid {
  display: grid;
  grid-template-columns: repeat(var(--column-count, 5), minmax(0, 1fr));
  gap: clamp(7px, 2.1vw, 22px);
}

.sheet-nav { flex: none; margin: clamp(24px, 5vw, 40px) 0 13px; }

.sheet-label {
  padding: 0 0 7px;
  background: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  color: var(--ink-3);
  font-size: clamp(10px, 2.55vw, 15px);
  letter-spacing: -.01em;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: color .25s var(--ease-soft), border-color .25s var(--ease-soft);
}
.sheet-label:hover { color: var(--ink-2); }
.sheet-label.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.sheet-grid { flex: 1; min-height: 0; }

.col {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  opacity: .62;
  transition: opacity .35s var(--ease-soft);
}
.col.is-focus { opacity: 1; }
.col:focus-visible { outline: 1.5px solid var(--line-2); outline-offset: 6px; }

.sk { background: var(--block); border-radius: 3px; transition: background .35s var(--ease-soft); }
.sk.line { height: 5px; width: 100%; }
.sk.block { width: 100%; }
.sk.card { display: flex; flex-direction: column; gap: 7px; }
.sk.card .sk.bar { height: 6px; width: 68%; background: var(--block-2); border-radius: 3px; }
.sk.card .sk.block { background: var(--block-2); }
.col.is-focus .sk { background: #323237; }
.col.is-focus .sk.card .sk.bar { background: #3a3a40; }
.col.is-focus .sk.card .sk.block { background: #3a3a40; }

/* the lens frame — grows to whatever you are zooming into */
.lens {
  position: absolute;
  left: 0; top: 0;
  width: 0; height: 0;
  border: 1.5px solid var(--frame);
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: transform .34s var(--ease),
              width .34s var(--ease),
              height .34s var(--ease),
              opacity .3s var(--ease-soft);
}
.lens.is-on { opacity: 1; }

/* =========================================================================
   OVERLAY LAYERS (section / page)
   ========================================================================= */
.layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  visibility: hidden;
  transform-origin: 0 0;
  backface-visibility: hidden;
}
.layer.is-active { visibility: visible; }
.layer-section { z-index: 20; }
.layer-page { z-index: 30; }

.layer.is-zooming { outline: 1.5px solid rgba(242, 242, 239, .9); outline-offset: -1px; border-radius: 3px; }

.layer .layer-scroll,
.layer .pager { opacity: 0; transition: opacity .4s var(--ease-soft); }
.layer.is-ready .layer-scroll,
.layer.is-ready .pager { opacity: 1; }

.layer-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--pad) + 10px) var(--pad) calc(var(--bar-h) + 46px);
}

/* ---- section head ---- */
.sec-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 30px;
  padding: 6px 10px 6px 6px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: color .2s var(--ease-soft), background .2s var(--ease-soft);
}
.sec-back:hover { color: var(--ink); background: var(--bg-2); }

.sec-head { max-width: 780px; margin: 0 auto; }
.sec-title {
  margin: 0 0 10px;
  font-size: clamp(32px, 8vw, 52px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -.03em;
}
.sec-kicker {
  margin: 0 0 clamp(24px, 4vw, 38px);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---- article cards ---- */
.cards { max-width: 780px; margin: 0 auto; }

.card {
  display: flex;
  flex-direction: column;
  min-height: 196px;
  margin-bottom: 12px;
  padding: 22px 22px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  outline: none;
  transition: border-color .28s var(--ease-soft),
              background .28s var(--ease-soft),
              transform .28s var(--ease);
}
.card:hover,
.card:focus-visible { border-color: var(--line-2); background: var(--bg-3); }
.card:focus-visible { box-shadow: 0 0 0 1.5px var(--line-2); }
.card:active { transform: scale(.994); }

.card-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.card-title {
  margin: 12px 0 9px;
  font-size: clamp(19px, 4.6vw, 25px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -.02em;
}
.card-sum {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-top: auto;
  padding-top: 22px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.card-tags { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-mins { flex: none; }

/* =========================================================================
   LEVEL 3 — PAGE (horizontal scroll-snap reader)
   ========================================================================= */
.pager { position: absolute; inset: 0; }

.back {
  display: inline-block;
  margin-bottom: 30px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12.5px;
  text-decoration: none;
  transition: color .2s var(--ease-soft);
}
.back:hover { color: var(--ink); }

.pg-meta {
  margin-bottom: 13px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}
.pg-title {
  margin: 0 0 20px;
  font-size: clamp(27px, 7.2vw, 42px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.pg-tags {
  margin: -4px 0 22px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

.pg-body { color: #e7e7e3; font-size: 18px; line-height: 1.6; }
.pg-body p { margin: 0 0 1.15em; }
.pg-body h2 {
  margin: 1.9em 0 .6em;
  font-size: 1.34em;
  letter-spacing: -.015em;
  color: var(--ink);
}
.pg-body h3 { margin: 1.6em 0 .5em; font-size: 1.1em; }
.pg-body ul, .pg-body ol { margin: 0 0 1.2em; padding-left: 1.25em; }
.pg-body li { margin: .4em 0; }
.pg-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-2);
  transition: text-decoration-color .2s;
}
.pg-body a:hover { text-decoration-color: var(--ink); }
.pg-body code {
  padding: .12em .38em;
  background: #19191c;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: .82em;
}
.pg-body pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  background: #141417;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: #cfcfca;
}
.pg-body pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.pg-body blockquote {
  margin: 1.5em 0;
  padding-left: 20px;
  border-left: 2px solid var(--line-2);
  color: var(--ink-2);
  font-style: italic;
}
.pg-body table { width: 100%; margin: 1.5em 0; border-collapse: collapse; font-size: 15px; }
.pg-body th, .pg-body td { padding: 9px 11px; border: 1px solid var(--line); text-align: left; }
.pg-body th { color: var(--ink-2); font-weight: 500; }
.pg-body figure { margin: 1.6em 0; }
.pg-body .img-ph {
  display: grid;
  place-items: center;
  height: 190px;
  background: #141417;
  border: 1px dashed var(--line-2);
  border-radius: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}
.pg-body figcaption { margin-top: 9px; font-size: 13px; color: var(--ink-3); }

.pg-end {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

/* prev / next page chevrons */
.pg-nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  margin-top: -19px;
  background: rgba(12, 12, 13, .72);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
  opacity: .42;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity .2s, border-color .2s;
}
.pg-nav:hover { opacity: 1; border-color: var(--ink-3); }
.pg-nav.prev { left: 12px; }
.pg-nav.next { right: 12px; }
.pager.single .pg-nav { display: none; }

/* =========================================================================
   LENS BAR
   ========================================================================= */
.lensbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  padding: 13px var(--pad) calc(11px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 48px;
}

.scale-tabs { display: flex; gap: 20px; flex: 1; min-width: 0; }
.tab {
  padding: 4px 0;
  background: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  color: var(--ink-3);
  font-size: 14.5px;
  letter-spacing: -.01em;
  cursor: pointer;
  transition: color .22s var(--ease-soft), border-color .22s var(--ease-soft);
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.bar-context {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.minimap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  flex: none;
  min-width: 64px;
  height: 36px;
  padding: 6px 9px;
  background: #101012;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.mm {
  position: relative;
  width: 5px;
  overflow: hidden;
  background: #34343a;
  border-radius: 1.5px;
  transition: height .3s var(--ease-soft), background .25s var(--ease-soft), box-shadow .2s;
}
/* the white fill grows with how far down the open page you have read */
.mm > i {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 0;
  background: var(--ink);
  border-radius: 1.5px;
  transition: height .12s linear;
}
.mm.is-on {
  background: #4a4a52;
  box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 2.5px var(--ink-3);
}
.minimap.dense { gap: 3px; padding-inline: 7px; }
.minimap.dense .mm { width: 4px; }

.bar-label { min-width: 0; }
.bar-label strong {
  display: block;
  max-width: 56vw;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-label span {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

.zoombar { display: flex; gap: 12px; flex: none; }
.zbtn {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .2s, background .2s, opacity .2s;
}
.zbtn:hover:not(:disabled) { border-color: var(--ink-3); background: #151518; }
.zbtn:disabled { opacity: .25; cursor: default; }

.hint {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  min-height: 17px;
  transition: opacity .3s var(--ease-soft);
}

/* switch the bar between "tabs" (sheet) and "lens readout" (section/page) */
.app[data-level="sheet"] .bar-context { display: none; }
.app:not([data-level="sheet"]) .scale-tabs { display: none; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 600px) {
  .pg-nav { display: none; }
  .bar-row { gap: 12px; }
  .zoombar { gap: 9px; }
  .zbtn { width: 42px; height: 42px; font-size: 18px; }
  .bar-label strong { max-width: 46vw; font-size: 13px; }
  .sec-title { letter-spacing: -.025em; }
}

@media (min-width: 1100px) {
  .sheet-inner { padding-top: calc(var(--pad) + 26px); }
}

/* =========================================================================
   REDUCED MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .pager-track { scroll-behavior: auto; }
  .pg-inner { transform: none !important; }
}

/* The host must not intercept overview clicks when every layer is hidden. */
.layer-host { pointer-events: none; }
.layer { pointer-events: auto; }

:root {
  --peek: clamp(12px, 3.1vw, 28px);
  --pg-gap: 16px;
  --rail: calc(var(--peek) + var(--pg-gap));
}

.layer .carousel-track { opacity: 0; transition: opacity .3s var(--ease-soft); }
.layer.is-ready .carousel-track { opacity: 1; }
.carousel-track {
  position: absolute;
  inset: 0 0 var(--bar-h);
  display: flex;
  gap: var(--pg-gap);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: auto;
  touch-action: pan-y;
  scrollbar-width: none;
  cursor: grab;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track::before, .carousel-track::after {
  content: "";
  flex: 0 0 var(--peek);
}
.carousel-track.is-dragging, .carousel-track.is-settling { scroll-snap-type: none; }
.carousel-track.is-dragging { cursor: grabbing; user-select: none; }
.sec-slide, .pg {
  position: relative;
  flex: 0 0 calc(100% - 2 * var(--rail));
  width: calc(100% - 2 * var(--rail));
  height: 100%;
  min-width: 0;
  overflow: hidden;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  touch-action: pan-y;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.layer-scroll, .pg-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.layer-scroll { padding: 54px 0 32px; }
.section-content { opacity: var(--content-opacity, 1); }
.sec-head { max-width: 780px; margin: 0 auto; transform: translate3d(var(--head-x, 0px), 0, 0); }
.sec-title { font-size: clamp(26px, 6.7vw, 52px); margin-bottom: 10px; }
.sec-kicker { margin: 0 0 20px; font-family: var(--sans); font-size: 13px; color: var(--ink-2); }
.sec-back { position: absolute; left: 0; top: 10px; margin: 0; min-height: 36px; padding: 6px 0; }
.cards { transform: translate3d(var(--body-x, 0px), 0, 0); }
.card {
  min-height: 232px;
  margin-bottom: 8px;
  padding: 20px 19px 18px;
  border: 1px solid transparent;
  border-radius: 0;
  background: #161618;
}
.card.is-selected, .card:focus-visible { border-color: var(--ink); }
.card-meta { font-family: var(--sans); font-size: 13px; color: var(--ink-2); }
.card-title { margin: 10px 0 12px; font-size: clamp(20px, 5.2vw, 28px); }
.card-sum { font-size: 15px; line-height: 1.5; }
.card-foot { font-family: var(--sans); font-size: 12px; color: var(--ink-2); }
.home-card { width: 100%; text-align: left; }
.home-arrow { margin-top: auto; font-size: 28px; }

/* Neighbors keep the same sheet geometry while their text resolves on entry. */
.peek-preview {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: var(--ghost-opacity, 0);
  pointer-events: none;
}
.section-preview { padding-top: 124px; }
.peek-card {
  height: var(--preview-height, 232px);
  margin-bottom: 8px;
  padding: 10px 0;
  background: #1b1b1e;
}
.peek-card i { display: block; height: 4px; margin: 0 0 8px; background: #36363a; }
.peek-card b { display: block; height: calc(100% - 12px); background: #39393d; }
.page-preview { padding-top: 54px; }
.page-preview .peek-card { height: 192px; }
.pg-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 28px clamp(0px, 2vw, 28px) 48px;
  transform: none;
  opacity: var(--content-opacity, 1);
  overflow-wrap: anywhere;
}
.pg-head { transform: translate3d(var(--head-x, 0px), 0, 0); }
.pg-body, .pg-end { transform: translate3d(var(--body-x, 0px), 0, 0); }
.back { min-height: 44px; margin-bottom: 16px; padding-top: 10px; }
.pg-title { font-size: clamp(27px, 7vw, 42px); text-wrap: pretty; }
.pg-body { font-size: 17px; }
.pg-body pre { touch-action: pan-x pan-y; overflow-wrap: normal; }
.table-scroll { overflow-x: auto; touch-action: pan-x pan-y; }
.pg-body table { min-width: 420px; }
.pg-scroll::-webkit-scrollbar { width: 4px; }
.pg-scroll::-webkit-scrollbar-thumb { background: var(--line-2); }
.pg-nav { width: 44px; height: 44px; margin-top: -22px; top: calc((100% - var(--bar-h)) / 2); }
.pg-nav.prev { left: 4px; }
.pg-nav.next { right: 4px; }
.pg-nav:disabled { visibility: hidden; }

.sheet-label { min-height: 44px; padding-top: 12px; }
.sheet-nav { margin-bottom: 6px; }
.minimap { cursor: pointer; min-height: 44px; height: 44px; }
.minimap:hover { border-color: var(--ink-3); }
.mm.is-on { box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px var(--ink); }
.bar-label { flex: 1; overflow: hidden; }
.bar-label strong { max-width: 100%; }
.bar-row { gap: 14px; }
.hint { font-size: 11px; }
.lensbar { padding-inline: max(var(--pad), env(safe-area-inset-left)); }

@media (max-width: 600px) {
  .sec-title { font-weight: 700; }
  .card-tags { display: none; }
  .card-foot { justify-content: flex-start; }
  .bar-context { gap: 12px; }
  .bar-row { gap: 10px; }
  .bar-label strong { max-width: 100%; font-size: 14px; }
  .bar-label span { font-family: var(--sans); font-size: 12px; white-space: nowrap; }
  .minimap { min-width: 64px; padding: 6px 7px; }
  .zoombar { gap: 10px; }
  .zbtn { width: 48px; height: 48px; font-size: 22px; }
  .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 350px) {
  :root { --pad: 14px; --pg-gap: 12px; }
  .bar-context { gap: 8px; }
  .bar-row { gap: 8px; }
  .minimap { min-width: 52px; gap: 3px; padding-inline: 5px; }
  .minimap.dense { gap: 2px; padding-inline: 5px; }
  .minimap.dense .mm { width: 3px; }
  .zoombar { gap: 8px; }
  .zbtn { width: 44px; height: 44px; }
  .sheet-label { font-size: 9px; }
}
@media (min-width: 601px) {
  .layer-scroll { padding-top: 72px; }
  .sec-back { left: max(0px, calc((100% - 780px) / 2)); top: 18px; }
  .section-preview { padding-top: 164px; }
}
@media (prefers-reduced-motion: reduce) {
  .sec-head, .cards, .pg-head, .pg-body, .pg-end { transform: none !important; }
}

/* Fixed page excerpts keep the section's sheet rhythm at phone sizes. */
.card { height: 232px; overflow: hidden; }
.card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; flex: none; }
.card-sum { flex: 1; min-height: 0; overflow: hidden; }
.card-foot { flex: none; padding-top: 16px; }
@media (max-width: 600px) {
  .layer-scroll, .pg-scroll { scrollbar-width: none; }
  .layer-scroll::-webkit-scrollbar, .pg-scroll::-webkit-scrollbar { display: none; }
}

/* Keep the controls clear of phone cutouts and compact landscape heights. */
.layer-scroll { padding-top: calc(54px + env(safe-area-inset-top)); }
.sec-back { top: calc(10px + env(safe-area-inset-top)); }
.section-preview { padding-top: calc(124px + env(safe-area-inset-top)); }
.pg-inner { padding-top: calc(28px + env(safe-area-inset-top)); }
.tab:disabled { opacity: .4; cursor: default; }
@media (min-width: 601px) {
  .layer-scroll { padding-top: calc(72px + env(safe-area-inset-top)); }
  .sec-back { top: calc(18px + env(safe-area-inset-top)); }
  .section-preview { padding-top: calc(164px + env(safe-area-inset-top)); }
}
@media (max-height: 500px) {
  .sheet-inner { padding-top: 14px; padding-bottom: calc(var(--bar-h) + 12px); }
  .hero-name { font-size: 20px; margin-bottom: 4px; }
  .hero-role { font-size: 10px; margin-bottom: 12px; }
  .hero-tagline { font-size: 23px; max-width: 36ch; }
  .sheet-nav { margin-top: 14px; }
  .lensbar { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .hint { display: none; }
}

.card-sum { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--summary-lines, 3); }

.card-sum { flex: none; max-height: calc(var(--summary-lines, 3) * 1.5em); }

/* At section scale the minimap is the actual overview grid in miniature. */
.minimap.is-sheet-map {
  display: block;
  width: 76px;
  min-width: 76px;
  height: 44px;
  padding: 6px;
}
.mini-sheet { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mini-sheet-lens { stroke: var(--frame); stroke-width: 1; }
@media (max-width: 350px) {
  .minimap.is-sheet-map { width: 68px; min-width: 68px; }
}
