/* The grown-ups' library (index.html, js/library.js; parent-first plan, October 26, 2026). A parent page: brand Light
   or Dark from kt-appearance-v1 (js/brand-theme.js), colors only from the --yz-* roles in
   /shared/brand/yezbi-tokens.css, and Look C's shapes from css/yezbi-look.css (pills, 24px cards, 32px dialogs,
   18px fields). Loaded after yezbi-look.css. */

/* The other grown-up pages get these from css/styles.css, which this page doesn't load. */
.kt-library, .kt-library *, .kt-library *::before, .kt-library *::after { box-sizing: border-box; }
.kt-library { margin: 0; min-height: 100dvh; line-height: 1.5; background: var(--yz-background); color: var(--yz-text); font-family: var(--kt-font); }
.kt-library .kt-brand-bar { background: var(--yz-header-bg); border-bottom: 1px solid var(--yz-header-border); }
.kt-library [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kt-library a { color: var(--yz-primary); text-underline-offset: 3px; }
.kt-library a.btn-primary, .kt-library a.btn-secondary { text-decoration: none; }
.kt-library a.btn-primary { color: var(--yz-on-primary); }
.kt-library a.btn-secondary { color: var(--yz-text); }
.kt-library :is(a, button, input, select):focus-visible { outline: 3px solid var(--yz-focus); outline-offset: 2px; }

.lib-shell { width: min(1240px, 100% - 32px); margin: 0 auto; padding: 28px 0 56px; }
.lib-status { min-height: 1.4em; margin: 0 0 12px; color: var(--yz-muted); font-weight: 600; }
.lib-status:empty { display: none; }
.lib-sign-in:not(:empty) { display: flex; justify-content: center; padding: 16px 0; }
.lib-panel { max-width: 640px; padding: 24px; border-radius: var(--kt-r-card); background: var(--yz-surface); box-shadow: var(--kt-shadow); }
.lib-panel h1 { margin: 0 0 8px; font-size: 26px; }

.lib-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.lib-top h1 { margin: 0; font-size: clamp(26px, 4vw, 36px); line-height: 1.1; letter-spacing: -0.02em; }
.lib-intro { margin: 8px 0 0; max-width: 680px; color: var(--yz-muted); line-height: 1.55; }
.lib-top .btn-secondary { flex: none; }

.lib-kids { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }
.lib-kid { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 18px 4px 6px; border: 2px solid var(--yz-control-border); border-radius: var(--kt-r-pill); background: transparent; color: var(--yz-text); font: inherit; font-weight: 600; cursor: pointer; }
.lib-kid:hover { background: color-mix(in srgb, var(--yz-text) 6%, transparent); }
/* The chosen child: a 2px outline in the primary color and a check, with no fill, so every child's circle keeps 3:1 on
   the page itself (a soft-blue fill took royal blue to 3.0:1 in Dark). */
.lib-kid[aria-checked="true"] { padding-right: 14px; border: 2px solid var(--yz-primary); font-weight: 800; }
.lib-kid[aria-checked="true"]::after { content: "✓"; color: var(--yz-primary); font-weight: 800; }
.lib-kid .kt-kid-avatar { width: 36px; height: 36px; font-size: 16px; }

.lib-note { margin: 18px 0 0; padding: 14px 18px; border-left: 4px solid var(--yz-teal); border-radius: var(--kt-r-thumb); background: var(--yz-teal-soft); }
.lib-note p { margin: 0; line-height: 1.55; }

.lib-search { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.lib-search input { flex: 1 1 260px; min-width: 0; min-height: 48px; padding: 0 18px; border: 1px solid var(--yz-control-border); border-radius: var(--kt-r-field); background: var(--yz-surface); color: var(--yz-text); font: inherit; font-size: 16px; }
.lib-search input::placeholder { color: var(--yz-muted); }
.lib-search .btn-primary, .lib-search .btn-secondary { padding: 0 22px; font: inherit; font-weight: 700; cursor: pointer; }

.lib-topics { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; }
.lib-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--yz-control-border); border-radius: var(--kt-r-pill); background: transparent; color: var(--yz-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.lib-chip:hover { background: color-mix(in srgb, var(--yz-text) 6%, transparent); }

.lib-feature { margin: 24px 0 0; padding: 24px; border-radius: var(--kt-r-card); background: var(--yz-surface); box-shadow: var(--kt-shadow); }
.lib-feature h2 { margin: 4px 0 6px; font-size: 26px; }
.lib-feature p { margin: 0 0 14px; color: var(--yz-muted); line-height: 1.5; }
.lib-feature .lib-kicker { margin: 0; }

.lib-kicker { margin: 0 0 4px; color: var(--yz-emphasis); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lib-rail { margin: 32px 0 0; }
.lib-rail-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.lib-rail-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.lib-see-all { min-height: 40px !important; padding: 0 16px; font: inherit; font-size: 14px; cursor: pointer; }
.lib-row { display: grid; grid-auto-flow: column; grid-auto-columns: 264px; gap: 16px; overflow-x: auto; padding: 2px 2px 12px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.lib-row > * { scroll-snap-align: start; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; margin: 18px 0 0; }

.lib-card, .lib-theme-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 0; border-radius: var(--kt-r-card); background: var(--yz-surface); color: var(--yz-text); box-shadow: var(--kt-shadow); text-align: left; font: inherit; }
/* A theme card is a button, so it has a 3:1 edge like every other control. */
.lib-theme-card { padding: 0; border: 1px solid var(--yz-control-border); cursor: pointer; }
.lib-theme-card:hover, .lib-card:focus-within { box-shadow: 0 0 0 2px var(--yz-primary); }
.lib-card.is-focus { box-shadow: 0 0 0 3px var(--yz-primary); }
.lib-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; background: var(--yz-raised); }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-thumb-fallback { font-size: 44px; }
.lib-length { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--kt-r-pill); background: rgba(0, 0, 0, .78); color: #fff; font-size: 12px; font-weight: 700; }
.lib-card-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.lib-card-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; }
.lib-card-meta, .lib-card-age { margin: 0; color: var(--yz-muted); font-size: 13px; line-height: 1.4; }
.lib-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.lib-card-actions :is(.btn-primary, .btn-secondary) { min-height: 44px; padding: 0 16px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.lib-card-actions .lib-watch { flex: 1 1 100%; }

.lib-list { margin: 24px 0 0; }
.lib-back { min-height: 44px !important; padding: 0 18px; font: inherit; font-weight: 700; cursor: pointer; }
.lib-list .lib-kicker { margin-top: 18px; }
.lib-list h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); line-height: 1.15; }
.lib-list-detail { max-width: 760px; margin: 8px 0 0; color: var(--yz-muted); line-height: 1.55; }
.lib-list-detail:empty { display: none; }
.lib-list-status { margin: 10px 0 0; color: var(--yz-muted); font-size: 14px; font-weight: 600; }
.lib-loading { color: var(--yz-muted); }
.lib-error { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--kt-r-thumb); background: var(--yz-danger-soft); }
.lib-error p { margin: 0; flex: 1 1 220px; }
.lib-error .btn-secondary { padding: 0 18px; font: inherit; font-weight: 700; cursor: pointer; }

.lib-footer { width: min(1240px, 100% - 32px); margin: 0 auto; padding: 20px 0 40px; border-top: 1px solid var(--yz-border); }
.lib-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.lib-footer a { color: var(--yz-muted); }
.lib-draft { font-size: 12px; }

.lib-dialog { width: min(560px, 100% - 32px); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: var(--kt-r-dialog); background: var(--yz-surface); color: var(--yz-text); box-shadow: var(--kt-shadow-raised); }
.lib-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.lib-dialog-sheet { position: relative; margin: 0; padding: 28px 24px 24px; }
.lib-dialog h2 { margin: 0 44px 10px 0; font-size: 22px; line-height: 1.25; }
.lib-dialog p { line-height: 1.55; }
.lib-dialog-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 0; border-radius: var(--kt-r-pill); background: transparent; color: var(--yz-text); font-size: 26px; line-height: 1; cursor: pointer; }
.lib-dialog-close:hover { background: color-mix(in srgb, var(--yz-text) 8%, transparent); }
.lib-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.lib-facts div { padding: 10px 12px; border-radius: var(--kt-r-thumb); background: var(--yz-raised); }
.lib-facts dt { color: var(--yz-muted); font-size: 12px; font-weight: 700; }
.lib-facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.lib-info-line { margin: 8px 0 0; color: var(--yz-muted); font-size: 14px; }
.lib-talk { margin: 16px 0 0; padding: 12px 14px; border-radius: var(--kt-r-thumb); background: var(--yz-success-soft); }
.lib-talk p:last-child { margin: 0; }
.lib-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.lib-dialog-actions :is(.btn-primary, .btn-secondary) { padding: 0 20px; font: inherit; font-weight: 700; cursor: pointer; }
.lib-choices { margin: 12px 0; padding: 0; border: 0; }
.lib-choices legend { margin-bottom: 8px; font-weight: 700; }
.lib-choices label { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; cursor: pointer; }
.lib-choices input { margin-top: 4px; }
.lib-choices strong { display: block; }
.lib-field { display: grid; gap: 6px; margin: 8px 0; font-weight: 700; }
.lib-field select { min-height: 48px; padding: 0 14px; border: 1px solid var(--yz-control-border); border-radius: var(--kt-r-field); background: var(--yz-surface); color: var(--yz-text); font: inherit; font-weight: 400; }
.lib-hint { margin: 8px 0 0; color: var(--yz-muted); font-size: 14px; }
.lib-dialog-status { min-height: 1.4em; margin: 8px 0 0; font-weight: 600; }

@media (max-width: 640px) {
  .lib-shell { padding-top: 18px; }
  .lib-top { flex-direction: column; }
  .lib-row { grid-auto-columns: min(78vw, 300px); }
  .lib-grid { grid-template-columns: 1fr; }
  .lib-facts { grid-template-columns: 1fr; }
  .lib-dialog-sheet { padding: 24px 16px 18px; }
  .lib-dialog-actions > * { flex: 1 1 100%; }
}
