/* ============================================================
   kitaikuyo.love — 喜多郁代 同人画集
   底色是纸，头尾是她的红。画框跟着每张图的比例走，不裁不拉伸。
   ============================================================ */

:root {
  --red: #c9352c;
  --red-deep: #a92b24;
  --red-ink: #8f2620;
  --cream: #fdf8f0;
  --paper: #f7f4ed;
  --paper-deep: #efe9dc;
  --ink: #1c1a17;
  --muted: #8b8377;
  --line: rgba(28, 26, 23, 0.14);
  --line-soft: rgba(28, 26, 23, 0.08);
  --serif: "Didot", "Bodoni 72", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic",
    "Noto Sans CJK JP", "Meiryo", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --ease: cubic-bezier(0.22, 0.68, 0.16, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

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

/* 纸张颗粒 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

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

/* ---------------- header ---------------- */

.top {
  background: var(--red);
  color: var(--cream);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.top__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(15px, 1.55vw, 22px) clamp(16px, 4vw, 56px);
}

.top__brand {
  display: grid;
  gap: 7px;
  margin: 0;
  font-weight: 400;
}

.top__jp {
  font-family: var(--serif);
  font-size: clamp(24px, 4.5vw, 36px);
  letter-spacing: 0.09em;
  line-height: 1;
  white-space: nowrap;
}

.top__en,
.top__note [lang="en"] {
  font-family: var(--mono);
  font-size: clamp(9px, 1.2vw, 11px);
  letter-spacing: 0.2em;
  line-height: 1.2;
  white-space: nowrap;
}

.top__note {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: clamp(12px, 2vw, 24px);
  border-left: 1px solid rgba(253, 248, 240, 0.48);
  font-size: clamp(11px, 1.5vw, 13px);
  letter-spacing: 0.08em;
  line-height: 1.35;
}

/* ---------------- viewer ---------------- */

.page {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: clamp(8px, 1.6vw, 22px);
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(18px, 3.4vw, 40px) clamp(16px, 4vw, 56px) 0;
  flex: 1 0 auto;
}

.rail {
  display: flex;
  align-items: center;
  gap: 14px;
  writing-mode: vertical-rl;
  padding-top: 2px;
  color: var(--muted);
  border-right: 1px solid var(--line-soft);
}

.rail__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

.rail__text {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  white-space: nowrap;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(300px, 64vh, 700px);
  padding: 0 54px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.frame {
  position: relative;
  flex: 0 0 auto;
  width: 58%;
  height: 100%;
  max-width: 100%;
  background: var(--paper-deep);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 18px 44px -18px rgba(28, 26, 23, 0.42),
    0 2px 10px rgba(28, 26, 23, 0.06);
  transition: width 0.55s var(--ease), height 0.55s var(--ease);
  will-change: width, height;
}

.frame__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
  -webkit-user-drag: none;
}

.frame__img.is-front { opacity: 1; }

.frame__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(28, 26, 23, 0.06);
}

/* 左右翻页 */
.nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-top: -21px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s;
}

.nav svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav:hover {
  color: var(--cream);
  background: var(--red);
  border-color: var(--red);
}

.nav:active { transform: scale(0.94); }

.nav--prev { left: 0; }
.nav--next { right: 0; }

/* ---------------- 信息栏 ---------------- */

.ledger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 12px 2px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ledger__credit {
  display: flex;
  align-items: baseline;
  flex: 1;
  gap: 9px;
  min-width: 0;
  margin: 0;
}

.ledger__by {
  flex: 0 0 auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--red);
  white-space: nowrap;
}

.ledger__by [lang="en"] {
  margin-left: 3px;
  font-family: var(--mono);
}

.ledger__artist {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.3;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.ledger__artist:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}

.ledger__src {
  flex: 0 0 auto;
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: color 0.2s, border-color 0.2s;
}

.ledger__src:hover {
  color: var(--red);
  border-color: var(--red);
}

.ledger__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
}

.ctl {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.ctl svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.ctl__play { display: none; fill: currentColor; stroke: none; }

.ctl.is-paused .ctl__pause { display: none; }
.ctl.is-paused .ctl__play { display: block; }

.ctl:hover {
  color: var(--cream);
  background: var(--red);
  border-color: var(--red);
}

/* 进度 */
.progress {
  position: relative;
  height: 2px;
  overflow: hidden;
  background: rgba(201, 53, 44, 0.14);
}

.progress__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
}

.progress__fill.is-running {
  animation: fill 5s linear forwards;
}

.progress__fill.is-paused { animation-play-state: paused; }

@keyframes fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* ---------------- 胶片条 ---------------- */

.film {
  position: relative;
  margin-top: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.film::-webkit-scrollbar { display: none; }

.film__track {
  display: flex;
  gap: 7px;
  padding: 3px 1px 8px;
}

.thumb {
  flex: 0 0 auto;
  width: 72px;
  height: 50px;
  padding: 0;
  background: var(--paper-deep);
  border: 1px solid var(--line-soft);
  opacity: 0.5;
  transition: opacity 0.25s, border-color 0.25s, transform 0.25s;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb:hover { opacity: 0.85; }

.thumb.is-active {
  opacity: 1;
  border-color: var(--red);
  transform: translateY(-2px);
}

.hint__keys,
.hint [lang="en"] { display: block; }

.hint__touch { display: none; }

@media (hover: none) {
  .hint__keys { display: none; }
  .hint__touch { display: block; }
}

.hint {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  color: var(--muted);
  text-align: center;
}

/* ---------------- footer ---------------- */

.foot {
  margin-top: clamp(32px, 5vw, 64px);
  padding: clamp(34px, 5vw, 64px) clamp(18px, 4vw, 56px) 26px;
  color: var(--cream);
  background: var(--red);
}

.foot__mark {
  padding-bottom: 22px;
  font-family: var(--serif);
  font-size: clamp(28px, 5.6vw, 58px);
  line-height: 1;
  letter-spacing: 0.015em;
  white-space: nowrap;
  border-bottom: 1px solid rgba(253, 248, 240, 0.3);
}

.foot__domain {
  color: rgba(253, 248, 240, 0.52);
}

.foot__note {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.75;
}

.foot__note p { margin: 0; }

.foot__note [lang="zh-Hans"] {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

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

@media (max-width: 980px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
}

@media (max-width: 860px) {
  .stage { height: clamp(280px, 54vh, 520px); padding: 0 44px; }
  .nav { width: 36px; height: 36px; margin-top: -18px; }
}

@media (max-width: 680px) {
  .stage { height: clamp(260px, 50vh, 460px); padding: 0 6px; }
  .nav { display: none; }
  .ledger {
    gap: 12px;
    padding: 10px 0;
  }
  .ledger__artist { font-size: 14px; }
  .thumb { width: 58px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .progress__fill.is-running { animation: none; }
}
