/* FEI Art Learning Library (v3) -- shared styles.
   Visual Refresh (Part A), commit A2 of 2: topic cards and the topic
   page -- catalog index cards (call number, ruled title line, punched
   hole, library stamps), the topic page's bookmark ribbon, eyebrow
   section headings, museum-mat image resources and the quiet
   "CHECKED <MONTH YEAR>" date stamp. Commit A1 (tokens, global styles,
   the homepage) landed first; see assets/css/tokens.css for the brand
   palette and the WCAG AA contrast note.

   A handful of lower-traffic A1-owned rules (the topbar link, results
   meta/empty-state text, the search field shadow) still read through
   the --lib-* alias block below rather than the real token names --
   left as-is since they resolve to the same values either way and
   are out of this commit's own scope. */

:root {
  --lib-bg: var(--paper);
  --lib-card: var(--paper-card);
  --lib-ink: var(--ink);
  --lib-text-soft: var(--muted);
  --lib-text-mid: var(--text);
  --lib-line: var(--line);

  --lib-purple: var(--violet-text);
  --lib-gradient: var(--violet-text);
  --lib-gold: var(--mint-text);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-soft: var(--shadow-mat);
  --shadow-card: 0 6px 18px rgba(23, 24, 47, 0.06);

  --transition-fast: 0.15s ease;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--lib-bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}
body.lib-dot-texture { background-attachment: fixed; }

img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.lib-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Topbar ── */
.lib-topbar {
  padding: 18px var(--page-pad);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.lib-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  color: var(--ink);
}
.lib-topbar-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--lib-line);
  background: var(--lib-card);
}
.lib-topbar-link:hover { border-color: var(--ink); }

/* ── Intro / Header ── */
.lib-hero {
  padding: 40px var(--page-pad) 30px;
  text-align: center;
}
.lib-hero-eyebrow {
  margin-bottom: 10px;
}
.lib-hero-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}
@media (min-width: 640px) {
  .lib-hero-title { font-size: 38px; }
}
/* Double rule under the title block, like the heading of a card
   catalog drawer -- two 1px lines, 3px apart. */
.lib-hero-rule {
  width: 220px;
  margin: 0 auto 18px;
}
.lib-hero-rule span {
  display: block;
  height: 1px;
  background: var(--line);
}
.lib-hero-rule span + span { margin-top: 3px; }
.lib-hero-sub {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  max-width: 640px;
  margin: 0 auto 10px;
}
.lib-hero-line {
  font-size: 13.5px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Search ── */
.lib-search-section {
  padding: 8px var(--page-pad) 36px;
}
.lib-search-box {
  max-width: 760px;
  margin: 0 auto;
}
/* "Search the Library" label stays for screen readers only -- the
   Reading Room design is just the field, the icon and the hint line. */
.lib-search-label {
  display: block;
}
.lib-search-input-wrap {
  position: relative;
}
.lib-search-input-wrap::before {
  content: '';
  position: absolute;
  left: 20px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.2' y2='16.2'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.2' y2='16.2'/></svg>") center / contain no-repeat;
  pointer-events: none;
}
.lib-search-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 16px 20px 16px 50px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}
.lib-search-input:focus {
  border-color: var(--violet);
  outline: none;
}
.lib-search-hint {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}

.lib-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.lib-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.lib-chip-group-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 2px;
}
.lib-chip {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition-fast);
}
.lib-chip:hover { border-color: var(--violet); color: var(--violet-text); }
.lib-chip[aria-pressed="true"] {
  background: var(--violet-tint);
  border-color: var(--violet);
  color: var(--violet-text);
  font-weight: 700;
}

/* ── Results ── */
.lib-results {
  margin-top: 26px;
}
.lib-results-meta {
  font-size: 12.5px;
  color: var(--lib-text-soft);
  margin-bottom: 14px;
  text-align: center;
}
.lib-empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--lib-text-mid);
  font-size: 14px;
}

.lib-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .lib-grid.lib-grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .lib-grid.lib-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ── Topic card: catalog index card ── */
.lib-card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lib-card-callnumber {
  position: absolute;
  top: 14px; right: 16px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: var(--muted);
}
/* Library stamps: outlined, slightly rotated, like a librarian's
   date/category stamp on an index card. */
.lib-stamp {
  display: inline-flex;
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid currentColor;
  transform: rotate(-2deg);
  margin-right: 46px; /* keep clear of the call number */
}
.lib-stamp.stamp-mint { color: var(--mint-text); }
.lib-stamp.stamp-violet { color: var(--violet-text); }
.lib-card-soon {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.lib-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.lib-card-ruled-line {
  display: block;
  height: 1px;
  background: var(--line);
  margin: 2px 0 4px;
}
.lib-card-summary {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
}
.lib-card-action {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--violet-text);
  text-decoration: underline;
  margin-top: 4px;
}
.lib-card:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.lib-card-hole {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
}

/* ── Section heading ── */
.lib-section {
  padding: 30px var(--page-pad);
}
.lib-section-heading {
  text-align: center;
  margin-bottom: 20px;
}
.lib-section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.lib-section-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── The Shelves (Browse by Subject) ──
   Book spines standing on a shelf line. Colors come only from the
   brand family (--ink/--violet/--mint, their light tints, or
   --paper-card with an --ink outline); every pairing passes AA (see
   the contrast check referenced in tokens.css). On mobile the row
   scrolls horizontally inside itself -- the page never scrolls
   sideways -- with a visible "scroll for more" hint underneath. */
.lib-shelf-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 0 2px 6px;
}
.lib-shelf-line {
  height: 6px;
  background: var(--ink);
  border-radius: 2px;
  position: relative;
  margin-top: -6px;
}
.lib-shelf-line::before {
  content: '';
  position: absolute;
  top: -2px; left: 0; right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.5);
}
.lib-shelf-scroll-hint {
  display: none;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 10px;
}
@media (max-width: 639px) {
  .lib-shelf-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-padding: 0 20px;
  }
  .lib-shelf-scroll-hint { display: block; }
}
.lib-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  width: 72px;
  border: 1px solid var(--line);
  border-radius: 6px 6px 2px 2px;
  padding: 16px 4px 10px;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.lib-spine:hover,
.lib-spine:focus-visible {
  transform: translateY(-8px);
}
@media (prefers-reduced-motion: reduce) {
  .lib-spine:hover, .lib-spine:focus-visible { transform: none; }
}
.lib-spine-title {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  line-height: 1.3;
}
.lib-spine-count {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.lib-spine.spine-ink { background: var(--ink); color: #fff; }
.lib-spine.spine-violet { background: var(--violet); color: var(--ink); }
.lib-spine.spine-mint { background: var(--mint); color: var(--ink); }
.lib-spine.spine-violet-tint { background: var(--violet-tint); color: var(--ink); }
.lib-spine.spine-mint-tint { background: var(--mint-tint); color: var(--ink); }
.lib-spine.spine-outline { background: var(--paper-card); color: var(--ink); border: 1.5px solid var(--ink); }

/* ── Continue in Smart Class band (homepage) --
   the one dark area on the page, so it reads as "the next room." ── */
.lib-cta-section {
  padding: 50px var(--page-pad) 56px;
  text-align: center;
  background: var(--ink);
}
.lib-cta-box {
  max-width: 560px;
  margin: 0 auto;
}
.lib-cta-heading {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}
.lib-cta-text {
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 20px;
  color: #fff;
}
.lib-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 14.5px;
  min-height: 50px;
  padding: 0 26px;
  border-radius: var(--radius-pill);
  transition: transform 0.15s ease;
}
.lib-cta-btn:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .lib-cta-btn:hover { transform: none; } }

/* ── Topic page ── */
.lib-topic-header { padding: 34px var(--page-pad) 10px; position: relative; }
.lib-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 18px;
}
.lib-back-link:hover { color: var(--violet-text); }

/* Bookmark ribbon -- purely decorative, hangs from the top edge above
   the title. A rectangle with a V-notch cut into the bottom, made with
   two rotated squares rather than clip-path (simpler to keep crisp at
   this size). */
.lib-bookmark-ribbon {
  position: absolute;
  top: 0; left: var(--page-pad);
  width: 14px; height: 24px;
  background: var(--violet);
}
.lib-bookmark-ribbon::after {
  content: '';
  position: absolute;
  bottom: -7px; left: 0;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--paper);
}
.lib-topic-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--violet-text);
  margin-bottom: 8px;
}
.lib-topic-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.lib-topic-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.lib-topic-summary {
  font-size: 15px;
  color: var(--text);
  line-height: 1.6;
  max-width: 680px;
}

/* Optional "why no images" note (v3/COMPLIANCE.md data model) -- a
   quiet single line above the resource sections. */
.lib-image-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
.lib-image-note-icon {
  flex-shrink: 0;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, serif;
  line-height: 1;
}

.lib-key-concepts {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.lib-key-concepts li {
  font-size: 12.5px;
  font-weight: 600;
  background: var(--violet-tint);
  color: var(--violet-text);
  padding: 7px 12px;
  border-radius: var(--radius-pill);
}

.lib-try-it {
  background: var(--mint-tint);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
}
.lib-try-it strong { color: var(--ink); }

/* Resources -- images get the museum mat + plaque treatment (same
   pattern as .lib-museum-card): white mat, 1px --line border, soft
   shadow, an outlined Public Domain tag, title, meta and an
   underlined "View at museum" link. */
.lib-resource-image-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 640px) {
  .lib-resource-image-grid { grid-template-columns: 1fr 1fr; }
}
.lib-resource-image-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  box-shadow: var(--shadow-mat);
}
.lib-resource-image-card img {
  width: 100%; height: auto;
  border: 1px solid var(--line);
}
.lib-resource-image-body { padding: 10px 2px 2px; }
.lib-resource-pd-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid var(--mint-text);
  color: var(--mint-text);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.lib-resource-title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; color: var(--ink); }
.lib-resource-attribution {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.lib-resource-attribution a { color: var(--violet-text); font-weight: 700; text-decoration: underline; }
.lib-resource-view-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--violet-text);
  text-decoration: underline;
}
.lib-resource-note {
  font-size: 12px;
  color: var(--text);
  margin-top: 6px;
  line-height: 1.5;
}

.lib-resource-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lib-resource-row {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.lib-resource-row-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.lib-resource-publisher {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.lib-resource-open {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--violet-text);
  text-decoration: underline;
  white-space: nowrap;
}

/* Video references grid -- shown instead of a single video card when
   a topic has 2+ videos (see topic.js). */
.lib-video-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .lib-video-grid { grid-template-columns: 1fr 1fr; }
}
.lib-video-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.lib-video-poster {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--ink);
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
  width: 100%;
  margin-bottom: 10px;
}
.lib-video-poster-play {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--violet);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.lib-video-frame-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 10px;
}
.lib-video-frame-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.lib-video-publisher {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Smart Class box -- paper-card with a square-cornered 3px left
   border in --mint, the primary pill button inside. */
.lib-smartclass-box {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--mint);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 22px;
}
.lib-smartclass-box a.lib-smartclass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  min-height: 50px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  margin-top: 4px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.lib-smartclass-box a.lib-smartclass-btn:hover { background: var(--ink-soft); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .lib-smartclass-box a.lib-smartclass-btn:hover { transform: none; } }
.lib-smartclass-where {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}

/* Direct-match box (Section 1 "Learn this in Art GPS"): adds the
   course name + a one-line blurb above the existing button/where
   lines. Related-match keeps the plain box -- just the CTA line, no
   extra padding bump -- so it reads as the smaller card the spec
   calls for. */
.lib-smartclass-box-direct { padding: 26px 24px; }
.lib-smartclass-course {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.lib-smartclass-blurb {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 4px;
}
.lib-smartclass-box-related { padding: 16px 18px; }
.lib-smartclass-box-related .lib-smartclass-btn { margin-top: 0; }

/* Resources sub-sections (Learn from the Masters / Watch / Read / Try
   It Yourself) stacked under one "Resources" heading. */
.lib-resource-subsection { margin-bottom: 28px; }
.lib-resource-subsection:last-child { margin-bottom: 0; }

/* Date stamp -- a quiet "CHECKED <MONTH YEAR>" mark near the bottom
   of the topic page, like a librarian's due-date stamp. */
.lib-date-stamp {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 10px;
  transform: rotate(-2deg);
}

/* Museum collection */
/* Museum mat: white mat with padding, a 1px --line border and a soft
   shadow -- the same treatment as the homepage student-work frame,
   reused here and for topic-page image resources (see A2). */
.lib-museum-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  box-shadow: var(--shadow-mat);
}
.lib-museum-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
}
.lib-museum-card-body { padding: 10px 2px 2px; }
.lib-museum-pd-label {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid var(--mint-text);
  color: var(--mint-text);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.lib-museum-view-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--violet-text);
  text-decoration: underline;
}

.lib-footer {
  padding: 24px var(--page-pad) 40px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* ── Utility ── */
.lib-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
