/* Mechanics and layout of the shared print sheet and inquiry dialog.
   Every draft sets the tokens below and may override any class. */
:root {
  --pd-bg: #fff; --pd-fg: #111; --pd-muted: #666; --pd-line: rgba(0,0,0,.14);
  --pd-accent: #b7321f; --pd-accent-fg: #fff; --pd-stage: transparent;
  --pd-display: Georgia, serif; --pd-text: system-ui, sans-serif;
  --pd-radius: 0px; --pd-title: clamp(1.9rem, 3.2vw, 3rem); --pd-title-w: 400;
}
html.pd-open { overflow: hidden; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pd {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; overscroll-behavior: contain;
  background: var(--pd-bg); color: var(--pd-fg); font-family: var(--pd-text);
  -webkit-overflow-scrolling: touch;
}
.pd:focus { outline: none; }
.pd a { color: inherit; }
.pd button { font: inherit; color: inherit; }
.pd-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 40px); background: var(--pd-bg); border-bottom: 1px solid var(--pd-line); font-size: .82rem;
}
.pd-close { text-underline-offset: 3px; min-height: 28px; display: inline-flex; align-items: center; }
.pd-close::before { content: "←"; margin-right: .5em; }
.pd-count { color: var(--pd-muted); white-space: nowrap; }
.pd-pn { display: flex; gap: 14px; }
.pd-pn a { text-decoration: none; padding: 4px 2px; }
.pd-pn a:hover { text-decoration: underline; }
.pd-body {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: clamp(24px, 5vw, 80px); padding: clamp(20px, 3vw, 44px) clamp(16px, 3vw, 40px) 80px;
  max-width: 1640px; margin: 0 auto;
}
.pd-figure { margin: 0; position: sticky; top: 72px; align-self: start; display: flex; flex-direction: column; align-items: center; }
.pd-stage {
  --room: calc(100dvh - 170px);
  position: relative; overflow: hidden; aspect-ratio: var(--ar); width: min(100%, calc(var(--room) * var(--ar)));
  background: var(--pd-stage); cursor: zoom-in; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  outline-offset: 3px;
}
.pd-stage.is-zoomed { cursor: grab; touch-action: none; }
.pd-stage.is-zoomed:active { cursor: grabbing; }
.pd-layer { position: absolute; inset: 0; transform-origin: 0 0; --z: 1; will-change: transform; }
.pd-img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.pd-dot {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; padding: 0; border-radius: 50%;
  border: 1px solid #fff; background: var(--pd-accent); color: var(--pd-accent-fg) !important;
  font-size: 11px !important; line-height: 1; cursor: pointer; opacity: 0; pointer-events: none;
  transform: scale(calc(1 / var(--z))); transition: opacity .25s, background .2s; box-shadow: 0 1px 6px rgba(0,0,0,.35);
}
.show-notes .pd-dot { opacity: 1; pointer-events: auto; }
.pd-dot.is-active { outline: 2px solid #fff; outline-offset: 2px; }
.pd-dot::after { content: ""; position: absolute; inset: -10px; }
.pd-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px; font-size: .84rem; line-height: 1.4;
  background: rgba(10,10,10,.86); color: #fff; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; pointer-events: none;
}
.pd-cap.is-on { opacity: 1; transform: none; }
.pd-tools { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 12px; font-size: .8rem; }
.pd-tools button {
  min-height: 36px; min-width: 36px; padding: 0 12px; background: transparent; border: 1px solid var(--pd-line);
  border-radius: var(--pd-radius); cursor: pointer;
}
.pd-tools button:hover { border-color: var(--pd-fg); }
.pd-tools [aria-pressed="true"] { background: var(--pd-fg); color: var(--pd-bg); border-color: var(--pd-fg); }
.pd-artist { margin: 0 0 .4em; font-size: .95rem; }
.pd-artist span { color: var(--pd-muted); margin-left: .35em; }
.pd-title { margin: 0 0 .4em; font: var(--pd-title-w) var(--pd-title)/1.08 var(--pd-display); letter-spacing: -.01em; text-wrap: balance; }
.pd-sub { margin: 0; color: var(--pd-muted); font-size: .9rem; line-height: 1.5; }
.pd-buy { margin: 28px 0 0; padding: 22px 0; border-top: 1px solid var(--pd-line); border-bottom: 1px solid var(--pd-line); }
.pd-price { margin: 0; font: 400 1.7rem/1.1 var(--pd-display); font-variant-numeric: tabular-nums lining-nums; }
.pd-curnote { margin: 6px 0 16px; font-size: .8rem; color: var(--pd-muted); }
.pd-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pd-cta button { min-height: 48px; padding: 0 14px; border-radius: var(--pd-radius); cursor: pointer; font-size: .9rem; transition: background .2s, color .2s, border-color .2s; }
.pd-primary { grid-column: 1 / -1; background: var(--pd-accent); color: var(--pd-accent-fg) !important; border: 1px solid var(--pd-accent); }
.pd-primary:hover { filter: brightness(1.08); }
.pd-secondary, .pd-tertiary { background: transparent; border: 1px solid var(--pd-line); }
.pd-secondary:hover, .pd-tertiary:hover { border-color: var(--pd-fg); }
.pd-info h2 { margin: 34px 0 12px; font-size: .78rem; font-weight: 500; letter-spacing: .04em; color: var(--pd-muted); }
.pd-notes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--pd-line); }
.pd-notes li { border-bottom: 1px solid var(--pd-line); }
.pd-note {
  display: grid; grid-template-columns: 26px 1fr; gap: 10px; width: 100%; padding: 12px 0; text-align: left;
  background: none; border: 0; cursor: pointer; font-size: .92rem;
}
.pd-note-n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem;
  border: 1px solid var(--pd-line); margin-top: 1px;
}
.pd-note:hover .pd-note-n, .pd-note.is-active .pd-note-n { background: var(--pd-accent); border-color: var(--pd-accent); color: var(--pd-accent-fg); }
.pd-note-b { display: block; }
.pd-note-l { font-weight: 500; }
.pd-note-jp { color: var(--pd-muted); margin-left: .6em; font-size: .85em; }
.pd-note-t { display: block; margin-top: 3px; color: var(--pd-muted); line-height: 1.45; font-size: .88rem; }
.pd-facts dl { margin: 0; border-top: 1px solid var(--pd-line); }
.pd-facts dl > div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--pd-line); font-size: .9rem; line-height: 1.45; }
.pd-facts dt { color: var(--pd-muted); }
.pd-facts dd { margin: 0; }
.pd-terms ul { margin: 0; padding: 0; list-style: none; font-size: .9rem; line-height: 1.5; }
.pd-terms li { padding: 7px 0; border-bottom: 1px solid var(--pd-line); }
.pd-terms li:first-child { border-top: 1px solid var(--pd-line); }

@media (max-width: 900px) {
  .pd-body { grid-template-columns: minmax(0, 1fr); padding-top: 14px; gap: 22px; }
  .pd-figure { position: static; }
  .pd-stage { --room: calc(100dvh - 190px); }
  .pd-count { display: none; }
}

/* Inquiry dialog */
.inq {
  border: 0; padding: 0; width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  background: var(--pd-bg); color: var(--pd-fg); font-family: var(--pd-text); border-radius: var(--pd-radius);
}
.inq::backdrop { background: rgba(0,0,0,.6); }
.inq-f { position: relative; display: grid; gap: 12px; padding: 28px clamp(18px, 4vw, 32px) 24px; }
.inq h2 { margin: 0; padding-right: 36px; font: var(--pd-title-w) 1.7rem/1.15 var(--pd-display); }
.inq-print { margin: 0; font-size: .9rem; }
.inq-b { margin: 0; color: var(--pd-muted); font-size: .92rem; line-height: 1.5; }
.inq label { display: grid; gap: 5px; font-size: .82rem; color: var(--pd-muted); }
.inq input, .inq textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; color: var(--pd-fg); background: transparent;
  border: 1px solid var(--pd-line); border-radius: var(--pd-radius); padding: 11px 12px;
}
.inq input:focus, .inq textarea:focus { outline: 2px solid var(--pd-accent); outline-offset: -1px; }
.inq-send { min-height: 48px; margin-top: 4px; background: var(--pd-accent); color: var(--pd-accent-fg); border: 0; font: inherit; border-radius: var(--pd-radius); cursor: pointer; }
.inq-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; background: none; border: 0; color: inherit; font-size: 1.5rem; cursor: pointer; }
.inq-proto { margin: 0; font-size: .76rem; color: var(--pd-muted); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .pd *, .inq * { transition: none !important; animation: none !important; }
}

/* Way back to the drafts homepage. Takes its look from the draft's tokens.
   A draft with its own bar along the bottom sets --draft-back-lift to clear it. */
.draft-back {
  position: fixed; right: 16px; bottom: calc(var(--draft-back-lift, 0px) + 16px); z-index: 40;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  background: var(--pd-bg); color: var(--pd-fg); border: 1px solid var(--pd-line); border-radius: var(--pd-radius);
  font: 400 .84rem/1.2 var(--pd-text); text-decoration: none; white-space: nowrap;
  box-shadow: 0 2px 14px rgba(0,0,0,.28);
}
.draft-back::before { content: "←"; margin-right: .5em; }
.draft-back:hover { border-color: var(--pd-fg); }
.pd .draft-back { bottom: 16px; }

/* Language switch: inherits the colour and size of the bar it sits in. */
.lang { display: inline-flex; align-items: center; gap: .75em; white-space: nowrap; }
.lang a { display: inline-block; padding: 6px 0; color: inherit; text-decoration: none; opacity: .62; transition: opacity .2s; }
.lang a[lang="ja"] { letter-spacing: .02em; }
.lang a:hover { opacity: 1; }
.lang a[aria-current="true"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
@media (max-width: 480px) {
  .pd-bar { gap: 10px; }
  .pd-pn { gap: 10px; }
}

/* Japanese: kanji and kana need room, no slant and no tight tracking.
   Each draft swaps its own Latin display and text fonts in html[lang="ja"]. */
html[lang="ja"] { line-break: strict; font-kerning: normal; }
html[lang="ja"] em { font-style: normal !important; }
html[lang="ja"] p { text-wrap: pretty; }
html[lang="ja"] :is(h1, h2, h3), html[lang="ja"] .pd-title {
  letter-spacing: .01em; line-height: 1.32; word-break: auto-phrase; text-wrap: balance; font-feature-settings: "palt";
}
html[lang="fr"] :is(h1, h2, h3) { text-wrap: balance; }
html[lang="ja"] .pd-note-t, html[lang="ja"] .pd-sub, html[lang="ja"] .inq-b { line-height: 1.75; }
