/* ==========================================================================
   Projecting Much - page styles
   Lived in a <style> block in the template until a mobile regression hid
   in it for hours. Tokens only, so both themes come free.
   ========================================================================== */

/* Projecting Much - page styles. Tokens only; both themes come free. */

  /* Scrolly: the stage exists only once JS runs; without it the prose
     reads as plain sections at full opacity. */
  .pm-scrolly .scrolly__graphic { display: none; }
  .pm-scrolly.pm-scrolly--on .scrolly__graphic { display: flex; }
  .pm-scrolly .scrolly__step { opacity: 1; }
  .pm-scrolly.pm-scrolly--on .scrolly__step { opacity: 0.15; }
  .pm-scrolly.pm-scrolly--on .scrolly__step.is-active { opacity: 1; }
  /* The story globes sit straight on the page - no frame, so the map is
     the object rather than a picture of one. */
  .pm-scrolly-stage {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    height: min(74vh, 620px);
  }
  /* Zoomed steps fill the canvas edge to edge, which reads as a hard
     rectangle once the frame is gone. A soft vignette lets the map bleed
     into the page instead. */
  .pm-scrolly-stage canvas {
    display: block;
    -webkit-mask-image: radial-gradient(ellipse 88% 88% at 50% 50%, #000 38%, transparent 96%);
    mask-image: radial-gradient(ellipse 88% 88% at 50% 50%, #000 38%, transparent 96%);
  }
  .scrolly__step-content .pm-fig { margin-top: var(--space-sm); }
  .scrolly__step-content .pm-fig img { max-height: 200px; width: auto; }
  @media (max-width: 768px) {
    .pm-scrolly-stage { height: 38vh; height: 38dvh; }
    /* Narrow screens stack the sticky map ON TOP of the scrolling steps
       rather than beside them, so the graphic has to be opaque - without
       this the ghosted inactive steps read straight through the map. */
    .pm-scrolly .scrolly__graphic {
      background: var(--color-bg);
      padding-bottom: var(--space-sm);
      box-shadow: 0 10px 14px -10px rgba(0, 0, 0, 0.28);
    }
    /* The map fills its height on a phone, so the vignette never reaches
       the bottom edge and it cuts off hard. Fade the last strip out. */
    .pm-scrolly-stage canvas {
      -webkit-mask-image:
        radial-gradient(ellipse 96% 96% at 50% 50%, #000 55%, transparent 100%),
        linear-gradient(to bottom, #000 78%, transparent 100%);
      mask-image:
        radial-gradient(ellipse 96% 96% at 50% 50%, #000 55%, transparent 100%),
        linear-gradient(to bottom, #000 78%, transparent 100%);
      -webkit-mask-composite: source-in;
      mask-composite: intersect;
    }
  }
  .pm-subtitle {
    font-family: var(--font-display);
    font-size: var(--text-body);
    color: var(--color-text-secondary);
    margin: calc(-1 * var(--space-md)) 0 var(--space-lg);
    font-style: italic;
  }
  .pm-panel {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    /* Hug the map instead of stranding it in a wide void. */
    max-width: 780px;
    margin-inline: auto;
  }
  .pm-fs-shell .pm-panel { max-width: none; }
  .pm-stage { height: 460px; touch-action: none; }
  .pm-stage canvas:focus-visible {
    outline: 2px solid var(--color-accent-text);
    outline-offset: -2px;
  }
  .pm-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    align-items: center;
    padding: var(--space-sm);
    border-top: 1px solid var(--color-border);
  }
  .pm-toolbar .pm-spacer { flex: 1; }
  .pm-btn {
    font: inherit;
    font-size: var(--text-small);
    padding: 0.35em 0.8em;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
  }
  .pm-btn:hover { border-color: var(--color-accent-text); color: var(--color-accent-text); }
  .pm-btn:focus-visible { outline: 2px solid var(--color-accent-text); outline-offset: 2px; }
  .pm-inset {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 2;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 4px 4px 2px;
    pointer-events: none;
  }
  .pm-inset canvas { display: block; width: 150px; height: 75px; }
  .pm-inset__label {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    color: var(--color-text-faint);
    padding-top: 2px;
    text-align: center;
  }
  @media (max-width: 560px) {
    .pm-inset { display: none; }
  }
  /* Inline glossary terms */
  .pm-term {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: help;
    border-bottom: 1px dotted var(--color-accent-text);
  }
  .pm-term:hover, .pm-term:focus-visible { color: var(--color-accent-text); }
  .pm-term:focus-visible { outline: 2px solid var(--color-accent-text); outline-offset: 2px; }
  .pm-term__sr {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }
  .pm-termpop {
    position: absolute;
    z-index: 60;
    max-width: min(34ch, 82vw);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-small);
    line-height: 1.45;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(10, 16, 14, 0.18);
  }
  .pm-qa {
    border-top: 1px solid var(--color-border);
    padding: var(--space-xs) 0;
  }
  .pm-qa:last-of-type { border-bottom: 1px solid var(--color-border); }
  .pm-qa > summary {
    cursor: pointer;
    padding: var(--space-xs) 0;
    font-weight: 600;
    list-style: none;
  }
  .pm-qa > summary::-webkit-details-marker { display: none; }
  .pm-qa > summary::before { content: "+\00a0"; color: var(--color-accent-text); }
  .pm-qa[open] > summary::before { content: "\2013\00a0"; }
  .pm-qa > summary:focus-visible { outline: 2px solid var(--color-accent-text); outline-offset: 2px; }
  .pm-qa > p { margin: 0 0 var(--space-sm); max-width: 62ch; }
  .pm-methods {
    margin: auto;
    max-width: min(70ch, 92vw);
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    padding: var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
  }
  .pm-methods::backdrop { background: rgba(10, 16, 14, 0.55); }
  .pm-methods__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
  }
  .pm-methods__head h2 { margin: 0; font-size: 1.3rem; }
  .pm-reading {
    padding-left: 1.2em;
    max-width: 72ch;
  }
  .pm-reading li { margin-bottom: var(--space-sm); }
  .pm-modes { display: inline-flex; gap: 0; }
  .pm-modes .pm-btn { border-radius: 0; margin-left: -1px; }
  .pm-modes .pm-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
  .pm-modes .pm-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
  .pm-modes .pm-btn[aria-pressed="true"] {
    background: var(--color-accent-text);
    border-color: var(--color-accent-text);
    color: var(--color-surface);
  }
  .pm-select {
    font: inherit;
    font-size: var(--text-small);
    padding: 0.32em 0.6em;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);
    max-width: 15em;
  }
  .pm-select:focus-visible { outline: 2px solid var(--color-accent-text); outline-offset: 2px; }
  .pm-fs-controls {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-top: 1px solid var(--color-border);
  }
  .pm-caption {
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    padding: var(--space-xs) var(--space-sm);
  }
  .pm-caption strong { color: var(--color-text-primary); font-weight: 600; }

  /* Gallery */
  .pm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
  }
  .pm-card {
    margin: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface);
  }
  .pm-card__map { height: 170px; }
  .pm-card__map canvas { width: 100%; height: 100%; display: block; }
  .pm-card figcaption { padding: var(--space-sm); }
  .pm-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-xs);
  }
  .pm-card__name { font-weight: 600; }
  .pm-card__expand {
    font: inherit;
    font-size: var(--text-micro);
    background: none;
    border: none;
    color: var(--color-accent-text);
    cursor: pointer;
    padding: 0.2em 0.3em;
  }
  .pm-card__expand:hover { text-decoration: underline; }
  .pm-card__expand:focus-visible { outline: 2px solid var(--color-accent-text); }
  .pm-card__meta {
    font-size: var(--text-micro);
    color: var(--color-text-secondary);
    margin-top: 2px;
  }
  .pm-card__note {
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    margin: var(--space-xs) 0 0;
    line-height: 1.5;
  }

  /* The fun ones: fewer, wider cards so the longer story has room to be
     read rather than skimmed. The tint and dashed rule mark the group
     without a colored edge rail. */
  .pm-group-intro {
    color: var(--color-text-secondary);
    max-width: 60ch;
    margin-top: var(--space-xs);
  }
  .pm-grid--fun {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
  .pm-card--fun {
    background: color-mix(in srgb, var(--color-accent-text) 4%, var(--color-bg));
  }
  .pm-card__story {
    font-size: var(--text-small);
    color: var(--color-text-primary);
    margin: var(--space-xs) 0 0;
    padding-top: var(--space-xs);
    border-top: 1px dashed var(--color-border);
    line-height: 1.6;
  }

  /* Fullscreen takeover */
  body.pm-fs-open { overflow: hidden; }
  .pm-fs-shell {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
  }
  .pm-fs-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
  }
  .pm-fs-title { font-weight: 600; }
  .pm-fs-exit {
    font: inherit;
    font-size: var(--text-small);
    padding: 0.4em 0.9em;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);
    cursor: pointer;
  }
  .pm-fs-exit:hover { border-color: var(--color-accent-text); color: var(--color-accent-text); }
  .pm-fs-exit:focus-visible { outline: 2px solid var(--color-accent-text); outline-offset: 2px; }
  .pm-fs-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: none;
    border-radius: 0;
  }
  .pm-fs-panel .pm-stage { flex: 1; min-height: 0; height: auto; }
  .pm-fs-panel [data-pm-fullscreen] { display: none; }
  .pm-fs-explore { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .pm-fs-explore__map { flex: 1; min-height: 0; }
  .pm-fs-explore__note {
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--text-small);
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
  }

  /* Benchmark tooltip */
  .pm-tip-credit { color: var(--color-text-secondary); font-size: 0.9em; }
  .pm-tip {
    position: absolute;
    max-width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-micro);
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  }

  /* Archival figures */
  .pm-fig { margin: var(--space-lg) 0 0; }
  .pm-fig img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
  }
  .pm-fig figcaption {
    font-size: var(--text-micro);
    color: var(--color-text-secondary);
    margin-top: var(--space-xs);
  }
  /* Portrait photo in a two-column figrow would otherwise run twice the
     height of the prose beside it. */
  .pm-fig--portrait img { max-height: 520px; width: auto; }
  .pm-figrow {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    align-items: start;
  }

  @media (max-width: 640px) {
    .pm-stage { height: 340px; }
    .pm-figrow { grid-template-columns: 1fr; }
    .pm-card__map { height: 150px; }
  }

/* ══ The Waterman easter egg ══
   Highlighter, not a banner: the tint hugs the words and wraps with them,
   so it reads as something scrawled over the line rather than a callout
   box. Sharp edges, accent tint, and the link stays legible on top. */
.pm-fs-explore__egg {
  margin-top: var(--space-xs);
}
.pm-fs-explore__egg mark {
  background: color-mix(in srgb, var(--color-accent-text) 24%, transparent);
  color: inherit;
  padding: 0.18em 0.36em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.pm-fs-explore__egg mark a {
  color: inherit;
  text-decoration-thickness: 2px;
}
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .pm-fs-explore__egg mark { background: rgba(78, 174, 147, 0.24); }
}

/* ── The geoid's degree-band slider ─────────────────────────────────
   Lives in the benchmark toolbar, shown only in Geoid mode. The output
   sits next to the track rather than under it so the number is readable
   while dragging with a thumb over the control. */
.pm-degree {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-meta);
  font-size: var(--text-micro);
  color: var(--color-text-secondary);
}
.pm-degree[hidden] { display: none; }
.pm-degree label { white-space: nowrap; }
.pm-degree input[type="range"] {
  width: 132px;
  accent-color: var(--color-accent-text);
}
.pm-degree input[type="range"]:focus-visible {
  outline: 2px solid var(--color-accent-text);
  outline-offset: 3px;
}
.pm-degree output {
  min-width: 8ch;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
}
.pm-degree-note {
  /* Sits inside the panel, directly under the toolbar, so the
     explanation lines up with the control it explains rather than with
     the prose column - which is inset differently. */
  padding: var(--space-sm) 0 var(--space-xs);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-xs);
  max-width: 62ch;
}
.pm-degree-note p {
  font-size: var(--text-small);
  line-height: 1.5;
  margin: 0;
}
.pm-degree-note__lead { color: var(--color-text-secondary); }
/* The band line changes on every drag. Reserving its height stops the
   paragraph below it jumping around under the slider. */
.pm-degree-note__band {
  color: var(--color-text-primary);
  margin-top: var(--space-xs) !important;
  min-height: 3em;
}
.pm-degree-note[hidden] { display: none; }

@media (max-width: 560px) {
  .pm-degree { width: 100%; }
  .pm-degree input[type="range"] { flex: 1; width: auto; }
}
