/* =========================================================
   mbrd - the privacy page

   After fonts.css and tokens.css only. pv- prefix. The page wears the reader's
   look (privacy.html carries the pre-paint restore), so the tokens do most of
   the work at every level and in the dark; the two tier blocks at the bottom
   add what tokens cannot say, and are patch.css's own, read against it.
   ========================================================= */

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.62;
  text-wrap: pretty;
  /* Containing block for the grain; min-height covers short pages. */
  position: relative;
  min-height: 100vh;
  background-attachment: scroll;
}

/* Paper grain. Absolute so the texture scrolls with the page. */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("../img/paper-grain.webp");
  background-repeat: repeat;
  background-size: 512px 512px;
  mix-blend-mode: multiply;
  opacity: calc(0.8 * var(--grain));
}
/* In the dark, turned over as base.css turns #grain. */
:root[data-scheme="dark"] body::before {
  filter: invert(1);
  mix-blend-mode: screen;
  opacity: calc(0.6 * var(--grain));
}

/* Stacking context above the grain. */
.pv {
  position: relative;
  z-index: 1;
}

/* The measure, matching the changelog's 880. */
.pv-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(48px, 9vw, 96px) clamp(18px, 5vw, 40px) 96px;
}

/* ---------------------------------------------------------
   The way back
   --------------------------------------------------------- */

/* Sticky pill. Opaque to prevent content scrolling through it.
   Larger than /patch's pill: this is the only control on the page. */
.pv-back {
  position: sticky;
  top: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 0 clamp(26px, 4vw, 40px);
  padding: 10px 18px 10px 14px;
  border: var(--hairline) solid var(--rule-2);
  border-radius: var(--radius-pill);
  background: var(--paper-card);
  box-shadow: var(--shadow-1);
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: var(--t-body);
  font-style: var(--display-italic);
  letter-spacing: calc(0.04em * var(--ls-scale));
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              translate var(--dur-fast) var(--ease);
}
.pv-back:hover {
  color: var(--accent-deep);
  border-color: var(--accent-text);
}
/* Towards the board - only where hover is real, or a tap leaves it stuck. */
@media (hover: hover) {
  .pv-back:hover { translate: -2px 0; }
}
/* Body face: the display italic leans the arrow the wrong way. */
.pv-arrow {
  font-family: var(--font-body);
  font-style: normal;
}

/* ---------------------------------------------------------
   The head
   --------------------------------------------------------- */

.pv-head { margin-bottom: clamp(38px, 7vw, 70px); }

/* Matches the changelog's title height. */
.pv-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(var(--t-display), 8vw, calc(var(--t-display) * 2.1));
  font-weight: var(--display-weight);
  /* Tracking that follows the clamp; must match .pn-title in patch.css. */
  letter-spacing: calc(clamp(-0.02em, 0.03em - 0.09vw, 0.01em) * var(--ls-scale));
  line-height: 1.04;
  color: var(--ink);
}

.pv-lede {
  margin: 14px 0 0;
  max-width: 48ch;
  font-size: calc(var(--t-body) * 1.06);
  color: var(--ink-2);
}

/* Three absences and a date, divided by hairlines like the sidebar. */
.pv-tally {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  margin: 22px 0 0;
  font-family: var(--font-display);
  font-size: var(--t-tiny);
  font-style: var(--display-italic);
  letter-spacing: calc(0.2em * var(--ls-scale));
  text-transform: uppercase;
  color: var(--ink-3);
}
.pv-tally span + span {
  padding-left: 14px;
  border-left: var(--hairline) solid var(--rule);
}

/* ---------------------------------------------------------
   The spine — one continuous border-right across touching margin cells
   --------------------------------------------------------- */

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

.pv-sec {
  display: grid;
  /* Wider than the changelog's 74px: subjects, not version numbers. */
  grid-template-columns: 116px minmax(0, 1fr);
  column-gap: clamp(18px, 3vw, 34px);
}

.pv-margin {
  position: relative;
  padding: 0 14px 0 0;
  border-right: var(--hairline) solid var(--rule);
  text-align: right;
}

/* Sits on the spine line via the negative right offset. */
.pv-mark {
  position: absolute;
  top: 0.72em;
  right: -4px;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--accent);
}

/* Margin label: reads as a note beside the plate, not a heading above it. */
.pv-count {
  display: block;
  padding-top: 0.34em;
  font-family: var(--font-display);
  font-size: var(--t-tiny);
  font-style: var(--display-italic);
  letter-spacing: calc(0.08em * var(--ls-scale));
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------------------------------------------------------
   The plates
   --------------------------------------------------------- */

.pv-plate {
  margin: 0 0 clamp(20px, 3.4vw, 34px);
  padding: clamp(22px, 3.6vw, 34px) clamp(22px, 3.6vw, 36px);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-card);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-base) var(--ease),
              translate var(--dur-base) var(--ease-back);
}

/* Hover lift via --lift-hover; no-ops at Harsh where the token is 0. */
@media (hover: hover) {
  .pv-plate:hover {
    translate: 0 var(--lift-hover);
    box-shadow: var(--shadow-2);
  }
}

.pv-plate p { margin: 0; }
/* A paragraph break you can see - one line's worth would be a gap in the prose. */
.pv-plate p + p { margin-top: 0.75em; }

/* Prevents the spine from dangling below the last plate. */
.pv-sec:last-child .pv-plate { margin-bottom: 0; }

/* ---------------------------------------------------------
   Links, code and the foot
   --------------------------------------------------------- */

/* Scoped to containers, not `.pv a`, to avoid overriding .pv-back's colour. */
.pv-plate a, .pv-foot a {
  color: var(--accent-text);
  text-decoration-color: color-mix(in srgb, var(--accent-text) 45%, transparent);
  text-underline-offset: 2px;
}
.pv-plate a:hover, .pv-foot a:hover { color: var(--accent-deep); }
.pv-plate a:focus-visible, .pv-foot a:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
/* Keeps the pill's own border-radius. */
.pv-back:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.pv-plate code {
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--ink);
}

.pv-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: clamp(34px, 6vw, 60px);
  padding-top: 20px;
  border-top: var(--hairline) solid var(--rule);
  font-family: var(--font-display);
  font-size: var(--t-tiny);
  font-style: var(--display-italic);
  letter-spacing: calc(0.1em * var(--ls-scale));
  color: var(--ink-3);
}

/* =========================================================
   0: Softish - the scrapbook

   patch.css's, section for section: the plate is the hint cards' notepaper
   (ghosts.css), square and taped at the corner; the tape hangs off the row because the plate's punched-edge mask
   would perforate anything inside it.
   ========================================================= */

:root[data-whimsy="0"] .pv-plate {
  position: relative;
  border: 0;
  box-shadow: var(--shadow-2);
  background:
    repeating-linear-gradient(180deg,
      transparent 0 21px,
      color-mix(in srgb, #6f86a8 17%, transparent) 21px 22px),
    linear-gradient(90deg,
      transparent 0 26px,
      color-mix(in srgb, #b4544a 42%, transparent) 26px 27px,
      transparent 27px),
    var(--paper-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding-left: 44px;
  -webkit-mask-image: radial-gradient(circle 6px at 0 11px, transparent 6px, #000 6.5px);
  mask-image: radial-gradient(circle 6px at 0 11px, transparent 6px, #000 6.5px);
  -webkit-mask-size: 100% 22px;
  mask-size: 100% 22px;
  -webkit-mask-repeat: repeat-y;
  mask-repeat: repeat-y;
}

:root[data-whimsy="0"] .pv-sec { position: relative; }
:root[data-whimsy="0"] .pv-sec::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: -10px;
  right: 46px;
  width: 92px;
  height: 26px;
  rotate: -3.5deg;
  pointer-events: none;
  background:
    repeating-linear-gradient(90deg,
      color-mix(in srgb, #a8814a 7%, transparent) 0 2px, transparent 2px 6px),
    linear-gradient(180deg,
      color-mix(in srgb, #e8cf9c 78%, transparent),
      color-mix(in srgb, #dcc08a 72%, transparent));
  clip-path: polygon(
    3% 0, 97% 4%, 100% 22%, 96% 41%, 100% 62%, 97% 82%, 99% 100%,
    2% 96%, 0 78%, 4% 58%, 0 38%, 3% 19%
  );
  box-shadow: 0 1px 2px color-mix(in srgb, var(--shade) 18%, transparent);
}
/* Past the wider margin here (116px against the changelog's 74). */
:root[data-whimsy="0"] .pv-sec:nth-child(even)::after {
  right: auto;
  left: 160px;
  rotate: 3deg;
}

/* The title marked up in the scrapbook's highlighter, as the changelog marks
   each release's name. */
:root[data-whimsy="0"] .pv-title {
  display: inline;
  background-image: linear-gradient(to bottom,
    transparent 62%, var(--highlight) 62%, var(--highlight) 92%, transparent 92%);
  box-decoration-break: clone;
}

:root[data-whimsy="0"] .pv-mark {
  width: 9px;
  height: 9px;
  right: -5px;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--shade) 34%, transparent);
}

/* =========================================================
   2: Harsh - the spec sheet

   The plates stop being objects: a rule above and nothing else, the margin
   labels set as data, and the spine a scale with a tick across it.
   ========================================================= */

:root[data-whimsy="2"] .pv-plate {
  padding: 22px 0 0;
  border: 0;
  border-top: var(--hairline) solid var(--rule-2);
  background: none;
  box-shadow: none;
}
:root[data-whimsy="2"] .pv-count {
  font-family: var(--font-mono);
  font-style: normal;
  letter-spacing: 0;
}
:root[data-whimsy="2"] .pv-margin { border-right-color: var(--ink); }
:root[data-whimsy="2"] .pv-mark {
  top: 0.85em;
  right: -5px;
  width: 11px;
  height: 2px;
}

/* ---------------------------------------------------------
   Narrow — margin and label hidden on phones
   --------------------------------------------------------- */

@media (max-width: 640px) {
  .pv-sec { grid-template-columns: minmax(0, 1fr); }
  .pv-margin { display: none; }
  .pv-plate { padding: 20px; }
  :root[data-whimsy="0"] .pv-plate { padding-left: 44px; }
  :root[data-whimsy="0"] .pv-sec:nth-child(even)::after { left: 40px; }
  :root[data-whimsy="2"] .pv-plate { padding: 22px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pv-plate, .pv-back { transition: none; }
  @media (hover: hover) {
    .pv-plate:hover { translate: none; }
    .pv-back:hover { translate: none; }
  }
}

/* Fallback for WebKit below 16.2, which lacks color-mix() - patch.css's block
   for the same plate and tape, and the two should be changed together. */
@supports not (color: color-mix(in srgb, red, blue)) {
  .pv-plate a, .pv-foot a { text-decoration-color: rgb(var(--accent-c) / 45%); }

  :root[data-whimsy="0"] .pv-plate {
    background:
      repeating-linear-gradient(180deg,
        transparent 0 21px,
        rgb(111 134 168 / 17%) 21px 22px),
      linear-gradient(90deg,
        transparent 0 26px,
        rgb(180 84 74 / 42%) 26px 27px,
        transparent 27px),
      var(--paper-card);
  }
  :root[data-whimsy="0"] .pv-sec::after {
    background:
      repeating-linear-gradient(90deg,
        rgb(168 129 74 / 7%) 0 2px, transparent 2px 6px),
      linear-gradient(180deg,
        rgb(232 207 156 / 78%),
        rgb(220 192 138 / 72%));
    box-shadow: 0 1px 2px rgb(var(--ink-c) / 18%);
  }
  :root[data-whimsy="0"] .pv-mark {
    box-shadow: 0 1px 3px rgb(var(--ink-c) / 34%);
  }
}
