/* ============================================================
   the Year of the ○○ — 索引 + 单幅展页
   1. tokens   2. reset   3. wash   4. bar   5. index
   6. deck     7. dots    8. colophon  9. motion  10. responsive
   11. a11y    12. print
   ============================================================ */

/* ---------- 1. tokens ------------------------------------- */

@property --accent     { syntax: "<color>"; inherits: true; initial-value: #C44365; }
@property --accent-ink { syntax: "<color>"; inherits: true; initial-value: #A8274E; }
@property --wash       { syntax: "<color>"; inherits: true; initial-value: #F1EFEA; }

:root {
  --paper: #FBFAF7;
  --paper-index: #F1EFEA;

  --ink: #191820;
  --ink-soft: #544F5C;
  --ink-faint: #6E6876;

  --rule: rgba(25, 24, 32, .14);
  --rule-soft: rgba(25, 24, 32, .08);

  --serif: "Palatino Linotype", Palatino, "Iowan Old Style", "Book Antiqua", Georgia, serif;
  --cjk: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", STSong, SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial,
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .55s;

  --bar-h: 60px;
  --dots-h: 58px;
  --pad-x: clamp(20px, 4.6vw, 72px);
  --pv-pad: clamp(18px, 3.4vh, 44px);

  --accent: #C44365;
  --accent-ink: #A8274E;
  --wash: #F1EFEA;

  transition: --accent .95s var(--ease), --accent-ink .95s var(--ease), --wash .95s var(--ease);

  color-scheme: light;
}

/* ---------- 2. reset -------------------------------------- */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, p, figure, dl, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

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

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; top: 8px; left: 8px; z-index: 90;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: 13px; letter-spacing: .04em;
  transform: translateY(-160%);
  transition: transform .3s var(--ease);
}
.skip:focus-visible { transform: translateY(0); }

/* ---------- 3. wash（一整片不动的背景色场，只换色） ---------- */

.wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--wash);
  transition: background-color .95s var(--ease);
}
.wash::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(78% 54% at 50% 36%,
    color-mix(in srgb, var(--paper) 26%, transparent) 0%,
    color-mix(in srgb, var(--paper) 7%, transparent) 42%,
    transparent 74%);
}
.wash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 78% at 50% 126%,
    color-mix(in srgb, var(--accent-ink) 10%, transparent) 0%,
    transparent 66%);
}

/* ---------- 4. bar ---------------------------------------- */

.bar {
  flex: 0 0 auto;
  height: var(--bar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding-inline: var(--pad-x);
  position: relative;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 60%, transparent);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
}

.bar__left, .bar__right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.bar__left { justify-self: start; }
.bar__right { justify-self: end; }

.brand {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 12.5px; letter-spacing: .02em;
  min-width: 0; overflow: hidden;
  white-space: nowrap;
}
.brand > span { overflow: hidden; text-overflow: ellipsis; }
.brand span[lang="ja"] { font-weight: 600; }
.brand__sep { color: var(--ink-faint); }
.brand span[lang="en"] {
  font-family: var(--serif);
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft);
}

.back {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: 0 0 auto;
  height: 30px; padding-inline: 12px 14px;
  border: 1px solid var(--rule); border-radius: 999px;
  font-size: 12px; letter-spacing: .04em; color: var(--ink-soft);
  transition: border-color .2s, color .2s, background-color .2s;
}
.back span { font-size: 15px; line-height: 1; margin-top: -1px; }
.back:hover { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 32%, transparent); }
.back[hidden] { display: none; }

.bar__pos {
  display: none;
  align-items: baseline; gap: 8px;
  font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
  justify-self: center; white-space: nowrap;
}
.bar__pos b {
  font-family: var(--serif); font-size: 15px; letter-spacing: .06em;
  color: var(--ink); font-weight: 400;
}

.bar__link {
  font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.bar__link:hover { color: var(--ink); border-color: var(--accent); }

.bar__steps { display: none; gap: 6px; }
.step {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  transition: color .2s, border-color .2s, background-color .2s, transform .2s;
}
.step span { font-size: 19px; line-height: 1; margin-top: -2px; }
.step:hover:not(:disabled) {
  color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent);
  background: color-mix(in srgb, var(--paper) 55%, transparent);
}
.step:active:not(:disabled) { transform: scale(.94); }
.step:disabled { opacity: .3; cursor: default; }

body[data-mode="plate"] .bar__pos { display: flex; }
body[data-mode="plate"] .bar__steps { display: flex; }
body[data-mode="index"] .bar__link,
body[data-mode="colophon"] .bar__link { display: none; }

/* ---------- 5. index -------------------------------------- */

main { flex: 1 1 auto; position: relative; min-height: 0; }

.index, .deck, .colophon {
  position: absolute;
  inset: 0;
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility .5s;
}

.index {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 22px);
  padding: clamp(14px, 2.6vh, 34px) var(--pad-x) clamp(10px, 1.8vh, 20px);
}

.index__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap; }

.index__title {
  font-family: var(--serif);
  font-size: clamp(26px, 3.2vw, 44px);
  font-weight: 400; line-height: 1;
  letter-spacing: -.012em;
}
.index__title .oo { color: var(--accent-ink); letter-spacing: -.06em; }

.index__lead {
  font-size: 12.5px; line-height: 1.85;
  color: var(--ink-soft);
  max-width: 34em;
}

.index__hint {
  font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  padding-bottom: 3px;
}

.grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(8px, 1.1vw, 18px);
}

.card {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  border-radius: 3px;
  transition: transform .35s var(--ease);
}
.card__shot {
  flex: 1 1 auto; min-height: 0;
  overflow: hidden; border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
  box-shadow: 0 1px 2px rgba(25, 24, 32, .06), 0 10px 26px -18px rgba(25, 24, 32, .5);
  transition: box-shadow .35s var(--ease);
}
.card__shot img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 20%;
  transition: transform .6s var(--ease), filter .35s;
  filter: saturate(.92);
}
.card:hover { transform: translateY(-3px); }
.card:hover .card__shot { box-shadow: 0 2px 4px rgba(25, 24, 32, .07), 0 18px 38px -20px rgba(25, 24, 32, .55); }
.card:hover .card__shot img { transform: scale(1.035); filter: saturate(1.02); }

.card__foot {
  display: flex; align-items: baseline; gap: 7px;
  padding-top: 8px;
  font-size: 11px; color: var(--ink-soft);
  white-space: nowrap;
}
.card__no {
  font-family: var(--serif); font-size: 10.5px;
  letter-spacing: .1em; color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.card__cn { font-family: var(--cjk); font-size: 13px; color: var(--ink); }
.card__en {
  font-family: var(--serif); font-size: 11.5px;
  letter-spacing: .02em; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis;
}
.card__chip {
  margin-inline-start: auto;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  transition: box-shadow .3s;
}
.card:hover .card__chip { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent); }

.index__foot {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-top: clamp(6px, 1vh, 12px);
  border-top: 1px solid var(--rule-soft);
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint);
}
.index__links { display: flex; gap: 18px; }
.index__links a {
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color .2s, border-color .2s;
}
.index__links a span { margin-inline-start: 3px; font-size: 9px; }
.index__links a:hover { color: var(--accent-ink); border-color: var(--accent-ink); }

/* ---------- 6. deck --------------------------------------- */

.deck { opacity: 0; visibility: hidden; pointer-events: none; }

.pv {
  max-width: 1680px;
  margin-inline: auto;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 5vw, 96px);
  padding: var(--pv-pad) var(--pad-x) calc(var(--dots-h) + var(--pv-pad) * .5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.pv.is-on { opacity: 1; visibility: visible; pointer-events: auto; }
.pv:nth-of-type(even) { flex-direction: row-reverse; }

.pv__media { flex: 0 0 auto; }
.pv__media img {
  max-width: 100%;
  max-height: calc(100dvh - var(--bar-h) - var(--dots-h) - var(--pv-pad) * 1.5);
  width: auto; height: auto;
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(25, 24, 32, .08), 0 26px 60px -34px rgba(25, 24, 32, .62);
}

.pv__label {
  flex: 0 1 auto;
  width: clamp(230px, 27vw, 392px);
  display: flex; flex-direction: column; gap: 0;
}

.pv__no {
  display: flex; align-items: baseline; gap: 7px;
  font-size: 9.5px; letter-spacing: .26em; text-transform: uppercase;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  margin-bottom: clamp(10px, 2vh, 26px);
}
.pv__no b { font-family: var(--serif); font-size: 13px; letter-spacing: .1em; color: var(--ink); font-weight: 400; }

.pv__kicker {
  font-size: 9.5px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 8px;
}

.pv__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 5.2vw, 76px);
  line-height: .96; letter-spacing: -.02em;
  margin-bottom: clamp(12px, 2.2vh, 26px);
}

.pv__cn {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: clamp(12px, 2.2vh, 22px);
  margin-bottom: clamp(12px, 2.2vh, 22px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 16%, transparent);
  font-size: 12px; color: var(--ink-soft);
}
.pv__cn b { font-family: var(--cjk); font-size: 26px; font-weight: 400; line-height: 1; color: var(--accent-ink); }
.pv__cn .zhi { font-family: var(--cjk); font-size: 13px; color: var(--ink-soft); }
.pv__cn .lat { font-style: italic; font-size: 11.5px; color: var(--ink-soft); letter-spacing: .02em; }

.pv__note { font-size: 13px; line-height: 1.85; color: var(--ink-soft); max-width: 26em; }

.pv__sw {
  display: flex; gap: 18px; flex-wrap: wrap;
  margin-top: clamp(14px, 2.4vh, 28px);
  font-size: 10px; letter-spacing: .1em; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.pv__sw li { display: flex; align-items: center; gap: 7px; }
.pv__sw i {
  width: 13px; height: 13px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(25, 24, 32, .22);
}
.pv__sw em { font-style: normal; color: var(--ink-soft); font-size: 9px; letter-spacing: .16em; }

/* ---------- 7. dots --------------------------------------- */

.dots {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--dots-h);
  display: none;
  align-items: center; justify-content: center;
  gap: clamp(6px, .9vw, 12px);
  z-index: 30;
}
body[data-mode="plate"] .dots { display: flex; }

.dot {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.dot i {
  width: 5px; height: 5px; border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 32%, transparent);
  transition: width .3s var(--ease), background-color .3s, box-shadow .3s;
}
.dot:hover i { background: color-mix(in srgb, var(--ink) 62%, transparent); }
.dot[aria-current="true"] i {
  width: 20px; border-radius: 999px;
  background: var(--accent);
}

/* ---------- 8. colophon ----------------------------------- */

.colophon {
  display: grid; place-items: center;
  padding: var(--pad-x);
  opacity: 0; visibility: hidden; pointer-events: none;
}
.colophon.is-on { opacity: 1; visibility: visible; pointer-events: auto; }
.colophon__body { max-width: 46em; display: flex; flex-direction: column; gap: 14px; }
.colophon__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(26px, 3vw, 40px); line-height: 1;
  margin-bottom: 6px;
}
.colophon__body p { font-size: 13px; line-height: 1.9; color: var(--ink-soft); max-width: 40em; }
.colophon__body b { color: var(--ink); }
.colophon__back { margin-top: 8px; }
.linkish {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.linkish:hover { color: var(--ink); border-color: var(--accent-ink); }

/* ---------- 9. motion ------------------------------------- */

body[data-mode="index"] .deck,
body[data-mode="index"] .colophon,
body[data-mode="index"] .dots { opacity: 0; visibility: hidden; pointer-events: none; }

body[data-mode="plate"] .index,
body[data-mode="colophon"] .index { opacity: 0; visibility: hidden; pointer-events: none; }

body[data-mode="plate"] .deck { opacity: 1; visibility: visible; pointer-events: auto; }

body[data-mode="colophon"] .deck,
body[data-mode="colophon"] .dots { opacity: 0; visibility: hidden; pointer-events: none; }

body[data-mode="plate"] .colophon,
body[data-mode="index"] .deck { transform: translateY(0); }

/* ---------- 10. responsive -------------------------------- */

@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pv__label { width: clamp(210px, 30vw, 300px); }
  .index__lead { display: none; }
}

@media (max-width: 900px) {
  .brand span[lang="en"], .brand__sep { display: none; }
}

@media (max-width: 760px) {
  :root { --bar-h: 54px; --dots-h: 50px; --pad-x: 20px; }

  body[data-mode="plate"] .brand { display: none; }
  .bar__left, .bar__right { gap: 10px; }
  .bar__pos { gap: 6px; letter-spacing: .12em; }
  .bar__link { letter-spacing: .1em; }
  .step { width: 30px; height: 30px; }

  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .brand span[lang="en"], .brand__sep { display: none; }

  .pv {
    flex-direction: column;
    justify-content: center;
    gap: clamp(14px, 2.4vh, 26px);
    padding-bottom: calc(var(--dots-h) + 18px);
  }
  .pv:nth-of-type(even) { flex-direction: column; }
  .pv__media img { max-height: calc(100dvh - var(--bar-h) - var(--dots-h) - 260px); }
  .pv__label { width: min(100%, 420px); }
  .pv__title { font-size: clamp(30px, 9vw, 46px); }
  .pv__no { margin-bottom: 10px; }
  .pv__cn { padding-bottom: 10px; margin-bottom: 10px; }
  .pv__note { font-size: 12.5px; line-height: 1.75; }
  .pv__sw { margin-top: 12px; }

  .index__hint { display: none; }
  .index__foot { font-size: 9.5px; letter-spacing: .06em; }
}

@media (max-width: 460px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card__en { display: none; }
  .index__foot p:first-child { display: none; }
}

@media (max-height: 620px) and (min-width: 761px) {
  .pv__note { display: none; }
  .pv__cn { padding-bottom: 10px; margin-bottom: 10px; }
}

/* ---------- 11. a11y -------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  :root { --dur: .001s; transition: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .card:hover { transform: none; }
  .card:hover .card__shot img { transform: none; }
}

@media (prefers-contrast: more) {
  :root { --ink-soft: #332F3A; --ink-faint: #454049; --rule: rgba(25, 24, 32, .4); }
  .card__shot { box-shadow: 0 0 0 1px rgba(25, 24, 32, .35); }
}

/* ---------- 12. print ------------------------------------- */

@media print {
  @page { size: A4; margin: 15mm; }

  html, body { height: auto; overflow: visible; background: #fff; display: block; }
  .wash, .bar, .dots, .index, .colophon, .skip { display: none !important; }

  main { display: block; }
  .deck { position: static; opacity: 1 !important; visibility: visible !important; display: block; }

  .pv {
    position: static;
    display: grid;
    grid-template-columns: 74mm 1fr;
    align-items: start;
    gap: 12mm;
    padding: 0;
    opacity: 1 !important;
    visibility: visible !important;
    break-inside: avoid;
    break-after: page;
  }
  .pv:nth-of-type(even) { display: grid; grid-template-columns: 74mm 1fr; }
  .pv__media img {
    max-height: none; width: 74mm; height: auto;
    box-shadow: none; border-radius: 0;
  }
  .pv__label { width: auto; }
  .pv__title { font-size: 26pt; }
  .pv__sw { display: none; }
}
