/* Shared styles: newsprint tokens, site bar, sign-in gate, the bookshelf home page and image issues.
   Article pages (Vol.3 on) add assets/pages.css. */
:root {
  color-scheme: light;
  --paper: #EFEBE2;          /* newsprint */
  --paper-hi: #F7F4ED;
  --ink: #141311;
  --ink-soft: #5C5850;
  --rule: #141311;
  --hair: #B9B3A6;
  --red: #C8262C;            /* the one accent: labels, active states */
  --shelf: #1C1B19;          /* home background */
  --font-display: 'Anton', 'Noto Sans TC', Impact, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-serif: 'Noto Serif TC', 'Songti TC', serif;
  --font-body: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, sans-serif;
  /* fine paper grain, tiled */
  --grain: 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='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root:lang(ja) { --font-serif: 'Noto Serif JP', 'Hiragino Mincho ProN', serif; --font-body: 'Noto Sans JP', 'Hiragino Sans', system-ui, sans-serif; }
:root:lang(ko) { --font-serif: 'Noto Serif KR', 'AppleMyungjo', serif; --font-body: 'Noto Sans KR', 'Apple SD Gothic Neo', system-ui, sans-serif; }
:root:lang(en) { --font-serif: 'Noto Serif', Georgia, serif; }

* { box-sizing: border-box; }
html { scroll-padding-top: 80px; }
body {
  margin: 0; padding: 0 0 env(safe-area-inset-bottom, 0px);
  background: var(--paper) var(--grain); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; line-height: 1.5;
}
img { max-width: 100%; }
a { color: inherit; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--ink); color: var(--paper); padding-inline: 16px; }
.bar-inner { max-width: 1080px; margin: 0 auto; padding-block: 10px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.brand { display: flex; flex-direction: column; gap: 1px; min-width: 0; text-decoration: none; color: inherit; }
.brand-mark { font-family: var(--font-mono); font-weight: 600; font-size: 11px; letter-spacing: 0.16em; color: #A8A397; }
.brand-title { font-weight: 700; font-size: 16px; line-height: 1.3; }
a.brand:hover .brand-mark { color: var(--paper); }
a.brand:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }
.langs { display: flex; gap: 2px; border: 1px solid #4A4740; padding: 3px; border-radius: 999px; }
.langs button { font: inherit; font-size: 13px; font-weight: 700; color: #A8A397; background: transparent; border: 0; border-radius: 999px; padding: 6px 12px; min-height: 34px; cursor: pointer; }
.langs button:hover { color: var(--paper); }
.langs button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.langs button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.langs button:lang(ja) { font-family: 'Noto Sans JP', system-ui, sans-serif; }
.langs button:lang(ko) { font-family: 'Noto Sans KR', system-ui, sans-serif; }

/* ---------- page column ---------- */
.feed { max-width: 1080px; margin: 0 auto; padding: 28px 16px 56px; display: flex; flex-direction: column; gap: 24px; }
.feed.wide, .bar-inner.wide { max-width: 880px; }
.backrow { display: flex; justify-content: center; padding-top: 8px; }
.backlink { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 22px; border: 1.5px solid var(--ink); border-radius: 999px; font-family: var(--font-mono); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-decoration: none; }
.backlink:hover { background: var(--ink); color: var(--paper); }
.backlink:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- sign-in gate ---------- */
.gate { margin: 10vh auto 0; max-width: 460px; width: 100%; border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 22px 0 26px; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.gate-mark { font-family: var(--font-mono); font-weight: 600; font-size: 12px; letter-spacing: 0.16em; color: var(--ink-soft); }
.gate-text { margin: 0; font-family: var(--font-serif); font-size: 18px; line-height: 1.7; }
.gate-btn { font: inherit; font-weight: 700; font-size: 15px; min-height: 46px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--ink); color: var(--paper); cursor: pointer; }
.gate-btn::before { content: "☞ "; }
.gate-btn:hover { background: var(--red); }
.gate-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
body.home .gate { border-color: var(--paper); color: var(--paper); }
body.home .gate-mark { color: #A8A397; }
body.home .gate-btn { background: var(--paper); color: var(--ink); }
body.home .gate-btn:hover { background: var(--red); color: var(--paper); }

/* ---------- home: issues as spines on a shelf ---------- */
body.home { background: var(--shelf) var(--grain); color: var(--paper); }
.shelf-wrap { max-width: 1080px; margin: 0 auto; padding: 28px 16px 40px; }
.empty { color: #A8A397; text-align: center; padding: 48px 0; }
.shelf { list-style: none; margin: 0; padding: 40px 0 0; display: flex; align-items: stretch; height: clamp(520px, 74vh, 760px); }
.shelf > li { position: relative; flex: 1 1 0; min-width: 0; margin-left: -10px; transition: flex-grow .25s ease; }
.shelf > li:first-child { margin-left: 0; flex: 1.1 1 0; }
.shelf > li:hover, .shelf > li:focus-within { flex-grow: 1.7; }
.spine {
  position: relative; height: 100%; display: flex; flex-direction: column;
  background: var(--sp) var(--grain); color: var(--sp-ink);
  border-radius: 2px 6px 6px 2px; text-decoration: none;
  box-shadow: -8px 0 18px rgba(0, 0, 0, 0.35), inset 1px 0 0 rgba(255, 255, 255, 0.18);
}
/* the folder tab sticking out above each spine, staggered like a filing drawer */
.spine::before {
  content: attr(data-tab); position: absolute; left: var(--tab-x, 14px); top: -30px; height: 30px; padding: 0 14px;
  display: flex; align-items: center; background: inherit; color: inherit; border-radius: 8px 8px 0 0;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; white-space: nowrap;
}
a.spine:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.spine-text { flex: 1; min-height: 0; display: flex; gap: 14px; padding: 22px 18px 16px; }
.spine-v { writing-mode: vertical-rl; text-orientation: mixed; margin: 0; }
.spine-vol { font-family: var(--font-display); font-weight: 400; font-size: clamp(40px, 5.2vw, 64px); line-height: 1; letter-spacing: 0.02em; }
.spine-title { font-family: var(--font-serif); font-weight: 900; font-size: clamp(16px, 1.7vw, 21px); line-height: 1.35; inline-size: 100%; flex-shrink: 0; }  /* fixed column height so long titles wrap into extra columns instead of spilling */
.spine-meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; opacity: .75; }
.spine-img { position: relative; height: 34%; min-height: 120px; margin: 0 12px 12px; overflow: hidden; border-radius: 2px; background: rgba(0, 0, 0, 0.2); }
.spine-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; filter: grayscale(1) contrast(1.05); transition: filter .25s ease; }
.shelf > li:hover .spine-img img { filter: grayscale(0.15); }
.spine-label { position: absolute; left: -6px; top: 14px; z-index: 2; background: var(--red); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: 0.06em; padding: 6px 10px 10px; clip-path: polygon(0 0, 100% 0, 100% 100%, 22% 82%, 0 100%); }
/* the title spine: GRID DAILY_01–05 */
.spine.title { --sp: #7E8170; --sp-ink: #1F211A; }
.spine.title .spine-text { flex-direction: column; justify-content: space-between; }
.spine-big { font-family: var(--font-display); font-size: clamp(54px, 7.4vw, 96px); line-height: 0.92; letter-spacing: 0.01em; writing-mode: vertical-rl; transform: rotate(180deg); align-self: flex-start; margin: 0; }
.spine-note { font-family: var(--font-mono); font-size: 11px; line-height: 1.6; letter-spacing: 0.06em; }
.spine.ghost { background: transparent; border: 1.5px dashed #57534A; color: #8C877B; box-shadow: none; }
.spine.ghost::before { background: var(--shelf); border: 1.5px dashed #57534A; border-bottom: 0; }
.shelf-base { height: 14px; background: #0E0D0C; border-top: 2px solid #3A3833; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }
.shelf-foot { display: flex; justify-content: space-between; gap: 16px; padding-top: 14px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; color: #8C877B; }
:lang(ko) .spine-title { word-break: keep-all; }
@media (prefers-reduced-motion: reduce) { .shelf > li, .spine-img img { transition: none; } }

/* small screens: books lie flat, one per row */
@media (max-width: 680px) {
  .shelf { flex-direction: column; height: auto; padding-top: 30px; gap: 34px; }
  .shelf > li, .shelf > li:first-child { margin-left: 0; flex: none; }
  .spine { flex-direction: row; min-height: 150px; }
  .spine-text { padding: 18px 16px; flex-direction: column; gap: 6px; }
  .spine-v { writing-mode: horizontal-tb; }
  .spine-title { inline-size: auto; }
  .spine-vol { font-size: 44px; }
  .spine-title { font-size: 18px; }
  .spine-img { height: auto; width: 38%; min-height: 0; margin: 10px 10px 10px 0; }
  .spine.title { min-height: 0; }
  .spine-big { writing-mode: horizontal-tb; transform: none; font-size: 15vw; }
  .spine.ghost { min-height: 80px; }
  .spine-label { top: -30px; left: auto; right: 12px; height: 30px; padding: 0 12px; display: flex; align-items: center; clip-path: none; border-radius: 8px 8px 0 0; }
}

/* ---------- image issues (Vol.1, Vol.2) ---------- */
.np-mini { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 10px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.np-mini b { font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: 0.01em; }
.np-mini span { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; color: var(--ink-soft); }
.np-mini h1 { flex-basis: 100%; margin: 4px 0 0; font-family: var(--font-serif); font-weight: 900; font-size: clamp(22px, 3.4vw, 34px); line-height: 1.3; }
.sheet { margin: 0; background: var(--paper-hi); border: 1px solid var(--ink); padding: 8px; }
.sheet img { display: block; width: 100%; height: auto; }
.sheet figcaption { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--ink-soft); padding: 8px 2px 0; }
.fallback { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--hair); color: var(--ink-soft); font-size: 14px; }
.fallback::before { content: "☞ "; }
.spine-note { white-space: pre-line; }
