/* 민들레 문학동산 — additions to site.css (no inline styles: CSP style-src 'self').
   Colours come only from tokens.css (one light palette, ADR-0016 decision 10).
   Loaded by the garden, the work page and the home page (work cards).
   Shared rules (a.tab, .tab[aria-current], .garden-more, .empty-state) live in site.css. */

/* Genre colours: Genre.color_key → --c-<key> (tokens.css). */
[data-gc="poem"]{--gc:var(--c-poem)}
[data-gc="novel"]{--gc:var(--c-novel)}
[data-gc="verse"]{--gc:var(--c-verse)}
[data-gc="essay"]{--gc:var(--c-essay)}
[data-gc="etc"]{--gc:var(--c-etc)}

/* ── Garden toolbar: genre tabs + one segmented 연도 control (select | 보기) ── */
.year-filter{display:flex;flex-wrap:wrap;gap:10px;align-items:center;min-width:0}
.year-filter label{font-weight:600}
/* Below ~300px the select shrinks rather than pushing 보기 off the screen (RD-15). */
.year-seg{display:inline-flex;align-items:stretch;min-width:0;max-width:100%}
.year-seg select{border-radius:999px 0 0 999px;min-height:var(--target-min);min-width:0;flex:0 1 auto}
.year-seg .btn{border:1.5px solid var(--line-strong);border-left:0;border-radius:0 999px 999px 0;padding-inline:14px 18px;background:var(--surface);color:var(--ink)}
@media (hover:hover) and (pointer:fine){.year-seg .btn:hover{border-color:var(--ink)}}
.field-error{flex-basis:100%}  /* message style: site.css */
.garden-count{margin:0}
.garden-count>span:not(.visually-hidden){display:block;margin-bottom:18px}
#garden-results{transition:opacity .15s ease-out}
#garden-results.htmx-request{opacity:.6}
.empty-links,.garden-more{display:flex;flex-wrap:wrap;gap:12px 28px}
/* 보기 while htmx loads: aria-disabled (never `disabled`, which would drop keyboard focus)
   and a busy label, the same width as the idle one so nothing beside it moves (KS-08). */
.year-seg .btn{min-inline-size:calc(4em + 32px);flex:none}
.year-seg .btn[aria-disabled="true"]{color:var(--muted);cursor:progress}
/* "→ more" links: a 44px row to tap, the yellow underline only under the words (MP-14). */
a.more.lit-more{min-height:var(--target-min);border-bottom:0;padding-bottom:0}
.lit-more>span{border-bottom:2px solid var(--yellow);padding-bottom:2px}

.award-year{margin-bottom:48px}
.award-year-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 14px;margin:8px 0 18px}
.award-year-head h2{font-family:var(--mono);font-size:2.4rem;font-weight:600;font-variant-numeric:tabular-nums}

/* ── Work card: the title link stretches over the card (A-056, like home .tile) ── */
.work{isolation:isolate;transition:transform .2s cubic-bezier(.23,1,.32,1),box-shadow .2s cubic-bezier(.23,1,.32,1)}
.work::before{z-index:-1;transition:transform .2s cubic-bezier(.23,1,.32,1)}
.work h3{position:static}
.work .stretch{text-decoration:none;color:inherit}
.work .stretch::after{content:"";position:absolute;inset:0;border-radius:inherit;z-index:1}
.work .stretch:focus-visible{outline:none;box-shadow:none}
.work .stretch:focus-visible::after{outline:3px solid var(--focus);outline-offset:-4px}
/* Hover lifts only for a fine pointer (a tap must not leave a card raised). */
.work:hover{transform:none;box-shadow:none}
.work:hover::before{transform:none}
@media (hover:hover) and (pointer:fine){
  .work:hover{transform:translateY(-3px);box-shadow:0 26px 50px -30px var(--shadow)}
  .work:hover::before{transform:scale(1.15)}
}
.work:active{transform:scale(.99);transition-duration:.12s}
@media (prefers-reduced-motion:reduce){
  .work,.work::before,#garden-results{transition:none}
  .work:hover,.work:active,.work:hover::before{transform:none}
}
:root[data-motion="off"] .work:hover,:root[data-motion="off"] .work:active,:root[data-motion="off"] .work:hover::before{transform:none}

/* ── Work reader ── */
.work-chips{display:flex;gap:6px;margin-top:22px;flex-wrap:wrap;position:relative}
.work-chips .chip:first-child{background:color-mix(in srgb,var(--surface) 30%,transparent)}
/* Breadcrumb stays one line: a long title is cut visually (its full text is the h1). */
.work-crumb ol{flex-wrap:nowrap;min-width:0}
.work-crumb li{flex:none;white-space:nowrap}
.work-crumb li:last-child{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
.reader h1{text-wrap:balance}
/* Body text: Korean line breaking (klreq §7.1.1–7.1.4) and WCAG 1.4.12 resilience —
   no fixed heights or clipping, spacing in em/lh so user spacing overrides reflow. */
.reader .body{white-space:normal;line-break:strict;word-break:keep-all;overflow-wrap:anywhere;text-align:start;hanging-punctuation:allow-end}
.reader .body p{margin:0}
.reader .body p+p{margin-top:2.15em;margin-top:1lh} /* one blank line, as the prototype's pre-line */
/* Poem/verse (richtext lineated): one block per source line with a hanging indent, so a line
   that wraps continues indented and is never read as a new verse line (RD-07). */
.reader .body .ln{display:block;padding-inline-start:1em;text-indent:-1em}
/* Its weight is the --prose-weight token (tokens.css, RD-08): 300, or 400 where thin strokes
   cost legibility. */
.reader .body p.tts-reading{background:var(--yellow-soft);text-decoration:underline;text-decoration-color:var(--yellow);text-decoration-thickness:2px;text-underline-offset:.3em;box-decoration-break:clone;-webkit-box-decoration-break:clone}
.review{margin-top:48px;max-width:40em}
.review h2{font-family:var(--sans);font-size:.8rem;color:var(--muted);margin-bottom:6px;letter-spacing:.06em}
.review p+p{margin-top:.8em}
/* Reader layout (KS-09, MP-03). DOM order: tools (소리로 듣기, recording) → article → aside.
   Narrow: one column in that order. Wide: the article spans both rows on the left; the tools
   sit in the side column's first row and the rest of the aside below them. */
.reader-tools{display:grid;gap:14px;align-content:start;min-width:0}
html:not(.js) .reader-tools:not(:has(.audio)){display:none} /* nothing to show without JS */
.reader aside{position:static}
.reader aside .box{min-width:0}
@media (min-width:981px){
  .reader{grid-template-rows:auto 1fr;grid-template-areas:"text tools" "text side";row-gap:14px}
  .reader>article{grid-area:text}
  .reader>.reader-tools{grid-area:tools}
  .reader>aside{grid-area:side}
  /* Only the first box follows the reader; a whole sticky aside can outgrow the screen
     at large text sizes and hide its own end. */
  .reader>aside>.box:first-child{position:sticky;top:110px;z-index:2}
}
@media (max-width:980px){
  .reader{row-gap:32px}
  .reader>aside{margin-top:24px}
}
/* After the text: 이어서 읽기 (RD-16) and 주소 복사·공유 (RD-17, JS only). */
.after-read{margin-top:48px;max-width:40em;display:grid;gap:18px;justify-items:start}
.next-reads{display:grid;gap:8px;width:100%}
.next-reads ul{display:grid;gap:4px}
.next-reads a{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;min-height:var(--target-min);padding-block:10px;text-decoration:none;border-top:1px solid var(--line)}
.next-reads li:last-child a{border-bottom:1px solid var(--line)}
.next-k{font-size:.82rem;color:var(--muted);flex-basis:100%}
.next-t{font-weight:600;overflow-wrap:anywhere}
@media (hover:hover) and (pointer:fine){.next-reads a:hover .next-t{text-decoration:underline;text-decoration-color:var(--yellow);text-decoration-thickness:3px}}
.share{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;margin:0}
html:not(.js) .share,.share[hidden]{display:none}
.share-field{position:fixed;top:0;left:-9999px;opacity:0;font-size:16px} /* copy fallback: never zooms iOS */
.author-bio p{color:var(--ink-2);overflow-wrap:anywhere}
.author-bio p+p{margin-top:.6em}
.same-genre{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.same-genre a{text-decoration:none;font-weight:600;display:inline-flex;align-items:center;min-height:var(--target-min)}
.same-genre a:hover{text-decoration:underline;text-decoration-color:var(--yellow);text-decoration-thickness:3px}

/* ── 소리로 듣기 (JS only: html.js; literature.js enables it once a Korean voice is found) ── */
html:not(.js) .tts{display:none}
.tts[hidden],.tts [hidden]{display:none}
/* One control row above the text on a phone (RD-01): spacing by margins, so an empty
   status line or a closed panel adds no gap. */
.tts.box{gap:0}
.tts>*+*{margin-top:10px}
.tts>.tts-status:empty{margin-top:0}
.tts-bar{display:flex;align-items:center;gap:8px}
/* No layout shift (MP-03): the "on" controls and the "off" sentence share one grid cell;
   the hidden one keeps its space (visibility only), so the row is as tall at first paint
   as after the voice check, whatever the outcome. */
.tts-slot{display:grid;flex:1 1 auto;min-width:0}
.tts-slot>*{grid-area:1/1;min-width:0}
.tts-on{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px}
.tts-off{margin:0;align-self:center}
.tts .tts-on[hidden]{display:flex;visibility:hidden}
.tts .tts-off[hidden]{display:block;visibility:hidden}
.tts #tts-play{flex:1 1 auto;padding-inline:16px}
.tts-more{flex:none}
.tts-notes{display:grid;gap:6px}
.tts-notes p{margin:0}
.tts-row{display:flex;flex-wrap:wrap;gap:6px}
.tts-row .btn{flex:1 1 auto}
.tts .btn[aria-disabled="true"]{background:var(--yellow-soft);border-color:var(--yellow-soft);color:var(--yellow-ink);cursor:default;transform:none}
.tts .btn[aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:var(--bg);box-shadow:inset 0 0 0 2px var(--bg)}
.tts-rate{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-weight:600;font-size:.92rem}
/* 16px or more: iOS Safari zooms the page when a smaller form control gets focus. */
.tts-rate select{font-size:max(1rem,16px)}
/* Narrow screens: the select keeps its accessible name, the words go visually. */
@media (max-width:980px){
  .tts .tts-rate-t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  /* Play, speed and 안내 fit one row at 390px: tighter insets, same 44px height. The UI
     font is the system Korean sans (RD-06), so the row must fit the widest of them:
     Malgun Gothic (Windows) sets "▶ 소리로 듣기" about 12% wider than Apple SD Gothic Neo or
     Noto Sans CJK. Measured at 390px in Chromium with Malgun Gothic (2026-10-05): play
     139.6 + 8 + speed 106 + 8 + 안내 60.8 = 322.4px in a 316px bar, so the row wrapped;
     with these insets 312.4px, 3.6px to spare. */
  .tts-on{column-gap:8px}
  .tts #tts-play{padding-inline:12px}
  .tts .tts-rate select{padding-inline:12px 24px}
  .tts .tts-more{padding-inline:12px}
}
/* Wide screens: the box is in the side column, so nothing in the text can move. The
   explanations stay open there (no 안내 toggle), and a box with only the "off" sentence
   need not keep the controls' height. */
@media (min-width:981px){
  .tts .tts-on[hidden]{display:none}
  .tts .tts-more{display:none}
  .tts .tts-notes[hidden]{display:grid}
}
.audio .btn{justify-self:start}

/* Reading progress (JS enhancement; hidden without JS). */
.read-progress{position:fixed;left:0;top:0;width:100%;height:4px;z-index:100;border:0;background:transparent;appearance:none;-webkit-appearance:none;color:var(--yellow)}
.read-progress::-webkit-progress-bar{background:transparent}
.read-progress::-webkit-progress-value{background:var(--yellow)}
.read-progress::-moz-progress-bar{background:var(--yellow)}
.read-progress[hidden]{display:none}

@media (forced-colors:active){
  .reader .body p.tts-reading{forced-color-adjust:none;background:Highlight;color:HighlightText}
  .work::before{display:none}
  .tts .btn[aria-disabled="true"]{color:GrayText;border-color:GrayText}
}
/* Phones: the 심사평 label and 이어서 읽기's kind at the site's 15px floor for information
   (site.css, ADR-0017 decision 13). */
@media (max-width:640px){.review h2,.next-k{font-size:.9375rem}}
