/* Spiced Kopi — shared visual system for the /v2 review pages.
   Newsprint world: warm paper, espresso ink, hairline rules, lime spent only on live
   action. Standalone by design so these review builds never inherit the old landing. */

:root {
  color-scheme: light;

  --paper: #f4ead8;
  --paper-lift: #fbf4e7;
  --ink: #18110d;
  --ink-soft: #4a3a2c;
  --espresso: #2b1d14;

  --rule: rgba(24, 17, 13, .16);
  --rule-strong: rgba(24, 17, 13, .36);

  --lime: #8bdc3f;
  --lime-ink: #1d310f;
  --teal: #0b6159;
  --turmeric: #8a5a12;
  --chilli: #a5301f;

  --display: "Iowan Old Style", "Charter", "Hoefler Text", Georgia, serif;
  --sans: "Avenir Next", Avenir, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --sheet: 1180px;
  --ease: cubic-bezier(.22, .8, .28, 1);
}

/* Retro reading mode: the same page printed in black ink on newsprint. Set by an
   inline head script before first paint, so there is no flash of colour. */
html[data-mode="retro"] {
  /* The stock does not change in Retro — only the ink and the colour do. */
  --paper: #f4ead8;
  --paper-lift: #fbf4e7;
  --ink: #111;
  --ink-soft: #3b3b3b;
  --espresso: #141414;
  --rule: rgba(0, 0, 0, .2);
  --rule-strong: rgba(0, 0, 0, .5);
  --lime: #111;
  --lime-ink: #f4ead8;
  --teal: #111;
  --turmeric: #111;
  --chilli: #111;
}

html[data-mode="retro"] img { filter: grayscale(1) contrast(1.06); }
html[data-mode="retro"] .waveform.is-playing i { background: #f4ead8; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--lime); color: var(--lime-ink); }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 3px;
}

img { max-width: 100%; }

a { color: inherit; }

/* Component display values must never beat the hidden attribute. */
[hidden] { display: none !important; }

.sheet {
  width: min(100% - 44px, var(--sheet));
  margin-inline: auto;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  transition: top .18s var(--ease);
}

.skip:focus { top: 12px; }

/* One mug was set down on the paper. It sits in the same corner of every page,
   prints through the stock like ink, and never intercepts a pointer. */
body::before {
  content: "";
  position: fixed;
  left: -112px;
  bottom: -190px;
  z-index: 0;
  width: 420px;
  aspect-ratio: 4 / 3;
  background: url("/v2/coffee-ring-clipart.png?v=4") center / contain no-repeat;
  mix-blend-mode: multiply;
  opacity: .78;
  transform: rotate(-7deg);
  pointer-events: none;
}

/* Content sits above the stain. Keeping the ring at z-index 0 with real content
   raised above it is deliberate: a negative z-index plus mix-blend-mode is dropped
   by some browsers, and the stain then disappears entirely. */
.masthead,
main,
.footer {
  position: relative;
  z-index: 1;
}

/* ---------- Masthead ---------- */

.masthead { border-bottom: 2px solid var(--ink); }

.masthead__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 20px;
  padding: 18px 0 14px;
}

.mark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.03em;
  text-decoration: none;
}

.mark span {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.masthead__editions,
.masthead__date {
  margin: 0;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.masthead__editions { margin-left: auto; }

.masthead__open {
  margin-left: auto;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.masthead__open:hover { color: var(--teal); }

.masthead__account {
  font-size: .82rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.masthead__account:hover { color: var(--teal); }

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .18s var(--ease), border-color .18s var(--ease);
}

.mode-toggle:hover { background: rgba(24, 17, 13, .05); border-color: var(--ink); }

.mode-toggle svg { display: block; }

.mode-toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.mode-toggle[aria-pressed="true"]:hover { background: #000; }

/* ---------- Shared type and controls ---------- */

h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.85rem, 3.6vw, 2.85rem);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .93rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform .18s var(--ease), border-color .18s var(--ease),
    background-color .18s var(--ease), color .18s var(--ease);
}

.button:hover { transform: translateY(-1px); border-color: var(--ink); }

.button--primary {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--lime-ink);
}

.button--primary:hover { border-color: var(--lime); filter: brightness(1.04); }

.button--onDark {
  border-color: rgba(244, 234, 216, .42);
  color: #f4ead8;
}

.button--onDark:hover { border-color: #f4ead8; background: rgba(244, 234, 216, .08); }

.play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .87rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s var(--ease), border-color .18s var(--ease),
    color .18s var(--ease), transform .18s var(--ease);
}

.play:hover { background: rgba(24, 17, 13, .05); }
.play:active { transform: scale(.985); }
.play:disabled { opacity: .45; cursor: not-allowed; }
.play:disabled:hover { background: transparent; transform: none; }

.play[aria-pressed="true"] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--lime-ink);
}

.play .icon-pause { display: none; }
.play[aria-pressed="true"] .icon-play { display: none; }
.play[aria-pressed="true"] .icon-pause { display: inline; }

/* ---------- Footer ---------- */

.footer { border-top: 2px solid var(--ink); background: var(--paper); }

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px 28px;
  padding: 26px 0 46px;
}

.footer__brand {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.footer nav { display: flex; flex-wrap: wrap; gap: 18px; }

.footer a {
  color: var(--ink-soft);
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
}

.footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

.footer__note {
  flex-basis: 100%;
  margin: 0;
  color: var(--ink-soft);
  font-size: .76rem;
}

/* ---------- Base responsive ---------- */

@media (max-width: 900px) {
  .masthead__editions,
  .masthead__date { display: none; }
  .masthead__open { margin-left: auto; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .sheet { width: min(100% - 32px, var(--sheet)); }
  .mark span { display: none; }
  /* The reader link is redundant once you are on the reader, and it is what pushes
     the masthead onto a second line at phone widths. */
  .masthead__open { display: none; }
  .masthead__account { margin-left: auto; }
  .footer__inner { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
