.library-page { background: #f3f1ee; }
.site-header nav a[aria-current="page"] { color: var(--white); }
.back-link { display: inline-flex; margin-bottom: 34px; color: var(--muted); font-size: 13px; font-weight: 700; text-underline-offset: 4px; }
.library-hero { padding: 54px 0 48px; }
.library-hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 8vw; align-items: end; }
.library-hero h1 { margin: 0; font-size: clamp(3rem, 6.2vw, 5.7rem); line-height: .96; letter-spacing: -.064em; font-weight: 680; }
.library-hero h1 em { color: var(--orange); font-style: normal; }
.library-intro { padding-top: 18px; border-top: 2px solid var(--ink); }
.library-intro > p:first-child { margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.6; }
.library-intro .review-note { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.library-intro .review-note strong { color: var(--ink); }

.library-workspace { padding-bottom: 110px; }
.search-panel { position: sticky; top: 0; z-index: 12; width: 100vw; margin-left: calc(50% - 50vw); padding: 26px max(24px, calc((100vw - 1180px) / 2)); background: #171717; color: white; box-shadow: 0 12px 28px rgba(13,16,20,.12); }
.search-panel > label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 780; letter-spacing: .12em; text-transform: uppercase; color: #d4cec8; }
.library-search-control { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; border-bottom: 2px solid #706a65; }
.library-search-control:focus-within { border-color: var(--orange); }
.library-search-control svg { width: 20px; height: 20px; fill: none; stroke: var(--orange); stroke-width: 1.8; }
.library-search-control input { width: 100%; border: 0; outline: 0; padding: 10px 8px 13px; background: transparent; color: white; font-size: clamp(1.1rem, 2vw, 1.35rem); }
.library-search-control input::placeholder { color: #8f8a85; }
.library-search-control button { border: 0; padding: 8px 0 8px 18px; background: transparent; color: #aaa49f; cursor: pointer; font-size: 12px; font-weight: 700; }
.library-search-control button:hover, .library-search-control button:focus-visible { color: white; }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.filter-chip { border: 1px solid #4e4a47; background: transparent; color: #c6c0ba; padding: 7px 10px; cursor: pointer; font-size: 11px; font-weight: 720; letter-spacing: .02em; }
.filter-chip:hover { border-color: #88817b; color: white; }
.filter-chip.active { border-color: var(--orange); background: var(--orange); color: white; }
.filter-chip span { margin-left: 6px; color: inherit; opacity: .72; font-family: ui-monospace, monospace; }

.result-bar { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.result-bar p { margin: 0; color: var(--muted); font-size: 13px; }
.result-bar p strong { color: var(--ink); }
.view-actions { display: flex; gap: 15px; }
.view-actions button { padding: 4px 0; border: 0; border-bottom: 1px solid #b9b2ac; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.view-actions button:hover { color: var(--ink); border-color: var(--ink); }

.library-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 45px; padding-top: 38px; }
.library-guide { align-self: start; position: sticky; top: 182px; }
.library-guide ol { margin: 15px 0 28px; padding-left: 22px; color: var(--muted); font-size: 13px; }
.library-guide li { padding: 5px 0 5px 6px; }
.guide-note { padding: 18px; background: #e7e2dd; border-left: 3px solid var(--orange); }
.guide-note p { margin: 10px 0 0; color: #5d5752; font-size: 12px; }

.answer-list { border-top: 1px solid var(--ink); }
.answer-card { scroll-margin-top: 185px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.48); }
.answer-card[open] { background: white; box-shadow: 0 8px 28px rgba(13,16,20,.055); }
.answer-card summary { position: relative; list-style: none; display: grid; grid-template-columns: 44px minmax(0,1fr) 32px; gap: 14px; align-items: start; padding: 22px 20px 22px 14px; cursor: pointer; }
.answer-card summary::-webkit-details-marker { display: none; }
.answer-card summary:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.answer-index { padding-top: 4px; color: #8b847e; font: 700 10px/1 ui-monospace, monospace; }
.answer-heading { min-width: 0; }
.answer-heading h3 { margin: 0; font-size: clamp(1.12rem, 2vw, 1.35rem); line-height: 1.25; letter-spacing: -.022em; font-weight: 680; }
.answer-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.answer-meta span { color: var(--orange-dark); font-size: 10px; font-weight: 790; letter-spacing: .08em; text-transform: uppercase; }
.answer-meta span + span::before { content: "·"; margin-right: 7px; color: #aaa39d; }
.answer-toggle { position: relative; width: 28px; height: 28px; border: 1px solid #cbc5bf; }
.answer-toggle::before, .answer-toggle::after { content: ""; position: absolute; top: 13px; left: 7px; width: 12px; height: 1px; background: var(--ink); }
.answer-toggle::after { transform: rotate(90deg); transition: transform .15s ease; }
.answer-card[open] .answer-toggle { border-color: var(--orange); background: var(--orange); }
.answer-card[open] .answer-toggle::before, .answer-card[open] .answer-toggle::after { background: white; }
.answer-card[open] .answer-toggle::after { transform: none; }
.answer-body { padding: 0 64px 26px 72px; }
.answer-body > p { max-width: 800px; margin: 0; color: #49443f; font-size: 15px; line-height: 1.68; }
.answer-callout { margin-top: 18px; padding: 13px 15px; border-left: 2px solid var(--orange); background: #f3eee9; color: #4c4641; font-size: 13px; }
.answer-callout strong { color: var(--ink); }
.source-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.source-row > span { color: var(--muted); font-size: 10px; font-weight: 780; letter-spacing: .11em; text-transform: uppercase; }
.source-row a { color: var(--ink); font-size: 12px; font-weight: 720; text-underline-offset: 4px; }
.source-row a::after { content: " ↗"; color: var(--orange); }
.search-mark { background: #ffdfbe; color: inherit; padding: 0 1px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.empty-state { margin-left: 290px; padding: 75px 0 0; }
.empty-state > span { color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.empty-state h2 { max-width: 620px; margin: 14px 0 10px; font-size: 2.2rem; line-height: 1.08; letter-spacing: -.04em; }
.empty-state p { color: var(--muted); }
.empty-state button { margin-top: 10px; border: 0; background: var(--ink); color: white; padding: 12px 15px; cursor: pointer; font-size: 13px; font-weight: 720; }

.library-invitation { margin-bottom: 90px; padding: 48px 52px; background: var(--orange); color: white; display: flex; justify-content: space-between; align-items: end; gap: 65px; }
.library-invitation .kicker { color: #4b1808; }
.library-invitation h2 { max-width: 720px; margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.03; letter-spacing: -.045em; }
.library-invitation p:not(.kicker) { max-width: 670px; margin: 16px 0 0; color: #54200d; }
.library-invitation > a { flex: 0 0 auto; padding: 14px 17px; background: var(--ink); color: white; text-decoration: none; font-size: 13px; font-weight: 750; }

@media (max-width: 980px) {
  .library-hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .library-intro { max-width: 620px; }
  .search-panel { padding-inline: 24px; }
  .library-layout { grid-template-columns: 1fr; gap: 20px; }
  .library-guide { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
  .library-guide ol { margin-bottom: 0; }
  .empty-state { margin-left: 0; }
}

@media (max-width: 720px) {
  .library-hero { padding: 38px 0 34px; }
  .back-link { margin-bottom: 28px; }
  .library-hero h1 { font-size: clamp(2.8rem, 14vw, 4.3rem); }
  .search-panel { padding: 20px 15px; }
  .filter-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .filter-chip { flex: 0 0 auto; }
  .result-bar { align-items: flex-start; flex-direction: column; padding: 16px 0; }
  .library-layout { padding-top: 24px; }
  .library-guide { display: block; }
  .library-guide ol { margin-bottom: 24px; }
  .answer-card { scroll-margin-top: 200px; }
  .answer-card summary { grid-template-columns: 30px minmax(0,1fr) 28px; gap: 8px; padding: 18px 8px 18px 4px; }
  .answer-body { padding: 0 12px 22px 42px; }
  .answer-body > p { font-size: 14px; }
  .library-invitation { margin-bottom: 65px; padding: 34px 24px; align-items: flex-start; flex-direction: column; gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .answer-toggle::after { transition: none; }
}
