/* base.css — shared tokens, labels, popup sheet. Colours are proposals taken from the
   reference collage (not a brand spec). */
@font-face {
  font-family: "Bodoni Moda";
  src: url("../assets/fonts/BodoniModa-900-latin.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

:root {
  --paper: #f3efdf;
  --white: #fffefa;
  --ink: #191815;
  --blue: #143f77;
  --yellow: #ece780;
  --pink: #e7adc3;
  --mint: #b8dab7;
  --rust: #d7794d;
  --grid: rgba(20, 63, 119, 0.09);
  --serif-en: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --serif-ja: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans-ja: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  --hover-ms: 160ms;
  --hover-scale: 1.035;
  --enter-ms: 180ms;
  --exit-ms: 140ms;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
html.is-locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans-ja);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; }
a { color: var(--blue); }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── cut-out typographic label (image used as a mask so ink colour can change) ── */
.ink {
  display: block;
  background-color: currentColor;
  -webkit-mask: var(--m) center / 100% 100% no-repeat;
  mask: var(--m) center / 100% 100% no-repeat;
}
.stack { display: flex; flex-direction: column; align-items: center; gap: 0.06em; width: 100%; }
.stack .ink { max-width: 100%; }
.hw { pointer-events: none; }
/* size a label from its original PSB height so About / SHIN-(E)-ROKU keep their relation */
.scaled .ink { width: auto !important; height: max(var(--min, 15px), calc(var(--h) * var(--k, 0.17) * 1px)); }

/* ── menu buttons: client asked for "slightly bigger + colour change" only ── */
.lbl {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--hover-ms) ease-out,
    color var(--hover-ms) ease-out;
}
@media (hover: hover) {
  .lbl:hover { transform: scale(var(--hover-scale)); color: var(--blue); }
}
.lbl:focus-visible {
  transform: scale(var(--hover-scale));
  color: var(--blue);
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
.lbl:active { transform: scale(0.99); transition-duration: 100ms; }

/* ── event facts (shared markup; each variant positions it) ── */
.event { position: relative; }
.event .hw { width: auto; }
.event-dates { margin: 0; font-family: var(--serif-en); font-weight: 900; letter-spacing: 0.02em; }
.event-venue { margin: 0; font-family: var(--serif-ja); }
.event-note {
  display: inline-block;
  margin: 0.4em 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--blue);
  border-bottom: 1px solid currentColor;
}

/* ── footer copyright (original cut-out) ── */
.copy { display: flex; align-items: center; gap: 0.4em; margin: 0; }
.copy-c { width: 1.3em; height: auto; }
.copy-t { width: min(22em, 80vw); height: auto; }

/* ── popup sheet ── */
.sheet {
  /* full-viewport transparent layer: a click on it (outside the paper) closes */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  border: 0;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
}
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgba(243, 239, 223, 0.72); }
.sheet-paper {
  position: relative;
  width: min(900px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--ink);
  /* torn-paper silhouette, not a rounded card */
  clip-path: polygon(0 0.6%, 6% 0, 19% 0.8%, 34% 0.1%, 51% 0.9%, 68% 0, 83% 0.7%, 100% 0.2%, 99.6% 30%, 100% 62%, 99.5% 100%, 81% 99.3%, 63% 100%, 44% 99.2%, 27% 100%, 9% 99.4%, 0 100%, 0.4% 70%, 0 36%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-color: var(--white);
}
.sheet.is-in .sheet-paper { animation: sheet-in var(--enter-ms) ease-out both; }
.sheet.is-out .sheet-paper { animation: sheet-out var(--exit-ms) ease-in both; }
.sheet.is-in::backdrop { animation: fade-in var(--enter-ms) ease-out both; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheet-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border: 1.5px solid var(--ink);
  background: var(--yellow);
  font-family: var(--sans-ja);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--hover-ms) ease-out, color var(--hover-ms) ease-out, border-color var(--hover-ms) ease-out;
}
.sheet-close span[aria-hidden] { font-size: 22px; line-height: 1; }
@media (hover: hover) { .sheet-close:hover { transform: scale(var(--hover-scale)); color: var(--blue); border-color: var(--blue); } }
.sheet-close:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.sheet-content {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 28px clamp(18px, 4vw, 48px) 40px;
  outline: none;
}
.pop-head { padding-right: 96px; margin-bottom: 20px; }
.pop-title { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pop-title .stack { width: min(440px, 100%); align-items: flex-start; }
.pop-title .stack .ink { margin: 0; }
.pop-ja { font-family: var(--serif-ja); font-size: 18px; font-weight: 600; color: var(--blue); }
.pop-body { font-size: 16px; }
.pop-split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(16px, 3vw, 36px); align-items: start; }
.pop-cover { width: 100%; height: auto; }
.pop-body p { text-wrap: pretty; }
/* a long card scrolls under the book cover, which stays in view (side by side, and only where the cover fits the screen) */
@media (min-width: 641px) and (min-height: 640px) { .pop-split > .pop-cover { position: sticky; top: 0; } }
.pop-text { max-width: 40em; }
.pop-name { margin: 0 0 12px; font-family: var(--serif-en); font-weight: 900; font-size: 26px; line-height: 1.2; }
.pop-name span { display: block; font-family: var(--serif-ja); font-weight: 600; font-size: 15px; color: var(--blue); }
.pop-hw { width: min(320px, 80%); margin: 0 0 12px; }
.pop-table { border-collapse: collapse; width: 100%; margin: 0 0 16px; }
.pop-table th, .pop-table td { text-align: left; vertical-align: top; padding: 9px 0; border-bottom: 1px solid rgba(25, 24, 21, 0.18); }
.pop-table th { width: 7em; font-weight: 600; font-family: var(--serif-ja); }
.pop-table td .pending { margin: 0; }
.pending { color: #5f5b52; }
.nw { white-space: nowrap; }
.ib { display: inline-block; word-break: keep-all; }
.pop-note { margin: 0 0 12px; font-size: 14px; color: var(--blue); }
.pop-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.pop-links a { display: inline-flex; min-height: 44px; align-items: center; }
.pop-cta {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 18px;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
}
.pop-cta.is-off { background: transparent; color: #5f5b52; padding: 0; border-bottom: 1px dashed currentColor; min-height: 0; }
/* credits-like blocks: a small heading, then names / lines */
.pop-sub { margin: 26px 0 8px; font-family: var(--serif-en); font-weight: 900; font-size: 15px; line-height: 1.4; letter-spacing: 0.03em; color: var(--blue); }
.pop-text > .pop-sub:first-child { margin-top: 0; }
.pop-role { margin: 0 0 14px; font-family: var(--serif-ja); font-weight: 600; font-size: 14px; }
.pop-names { list-style: none; margin: 0; padding: 0; columns: 2 12em; column-gap: 24px; font-size: 14px; line-height: 1.8; letter-spacing: 0.02em; }
.pop-names li { break-inside: avoid; }
/* a long run of names: wraps between names only, the slash staying at the end of a line */
.pop-names.is-flow { columns: auto; }
.pop-names.is-flow li { display: inline-block; margin-right: 0.4em; white-space: nowrap; }
.pop-names.is-flow li:not(:last-child)::after { content: " /"; color: #5f5b52; }
.pop-tracks { list-style: none; margin: 0 0 10px; padding: 0; font-family: var(--serif-en); font-size: 15px; line-height: 1.8; }
.pop-lines { margin: 0; font-size: 14px; line-height: 1.8; }
.pop-index { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.pop-index .lbl { --k: 0.17; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; min-height: 44px; text-align: left; }
.pop-index .stack { width: auto; align-items: flex-start; }
.pop-index .hw { height: 22px; width: auto; }

@media (max-width: 640px) {
  .sheet { align-items: flex-end; }
  .sheet-paper { max-height: calc(100dvh - 24px); }
  .pop-split { grid-template-columns: 1fr; }
  .pop-split .pop-cover { width: min(260px, 70%); }
  .pop-head { padding-right: 84px; }
}

/* ── prototype switcher (review only) ── */
.proto {
  position: fixed;
  left: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  border: 1px solid var(--ink);
  background: var(--white);
  font-size: 12px;
  line-height: 1;
}
.proto a, .proto span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 10px; color: var(--ink); text-decoration: none; }
.proto a + a, .proto a + span, .proto span + a { border-left: 1px solid var(--ink); }
.proto [aria-current] { background: var(--ink); color: var(--white); }
.proto a:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }

@media (prefers-reduced-motion: reduce) {
  :root { --hover-scale: 1; }
  .lbl, .sheet-close { transition: color var(--hover-ms) linear; }
  .lbl:active { transform: none; }
  .sheet.is-in .sheet-paper, .sheet.is-out .sheet-paper, .sheet.is-in::backdrop { animation: none; }
}
