/* ---------- themes ---------- */
:root {
  --bg: #ffffff;
  --surface: #f3f5f9;
  --ink: #16213e;
  --muted: #5c6782;
  --line: #dfe3ec;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --band: #16213e;
  --band-ink: #ffffff;
  --band-muted: #b7c0d8;
  --head: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --head-weight: 800;
  --head-case: none;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Work Sans", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h1, h2, h3 { font-family: var(--head); font-weight: var(--head-weight); letter-spacing: -.01em; line-height: 1.1; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font: 800 14px/1 "Archivo", sans-serif; letter-spacing: .04em;
}
.brand-name { font-family: var(--head); font-weight: var(--head-weight); font-size: 20px; }
.topnav { display: flex; gap: 18px; font-weight: 500; }
.topnav a { text-decoration: none; color: var(--muted); }
.topnav a:hover, .topnav a.on { color: var(--ink); }
.search { margin-left: auto; flex: 1 1 240px; max-width: 340px; }
.search input, .hero-search input {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px;
}
.search input:focus, .hero-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.crumbs { padding-top: 16px; font-size: 14px; color: var(--muted); }
.crumbs:empty { display: none; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs .sep { margin: 0 8px; }

main { padding-bottom: 72px; outline: none; }
.page-head { padding: 20px 0 8px; }
.page-head h1 { font-size: clamp(30px, 5vw, 46px); margin: 6px 0; text-transform: var(--head-case); }
.eyebrow { font: 600 13px/1 "Work Sans", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0; }
.sub { color: var(--muted); margin: 0 0 24px; }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 24px; margin: 0; }
.section-head a { color: var(--accent); text-decoration: none; font-weight: 600; white-space: nowrap; }

/* ---------- hero ---------- */
.hero { background: var(--band); color: var(--band-ink); }
.hero .wrap { padding-top: 48px; padding-bottom: 48px; }
.hero h1 { font-size: clamp(34px, 6vw, 60px); margin: 0 0 10px; max-width: 14ch; }
.hero p { color: var(--band-muted); margin: 0 0 22px; font-size: 18px; }
.hero-search { display: flex; gap: 8px; max-width: 520px; }
.hero-search input { background: var(--bg); border-color: transparent; padding: 14px 18px; font-size: 17px; }
.btn {
  font: 600 16px "Work Sans", sans-serif; border: 0; border-radius: 999px; padding: 0 22px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-grid; place-items: center;
}
.stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 26px; }
.stats strong { display: block; font-family: var(--head); font-weight: var(--head-weight); font-size: 30px; line-height: 1; }
.stats span { color: var(--band-muted); font-size: 14px; }

/* ---------- video cards ---------- */
.cards { display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 200px); gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.strip > * { scroll-snap-align: start; }
.card { text-decoration: none; display: block; }
.thumb {
  position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--radius);
  background: var(--tile, var(--surface));
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb .initials {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 54px/1 var(--head); color: rgba(0, 0, 0, .35);
}
.thumb .badge {
  position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 600;
}
.card-name { font-weight: 600; margin: 10px 0 0; line-height: 1.25; }
.card-meta { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.card:hover .card-name { color: var(--accent); }

/* ---------- tiles (states, schools, years) ---------- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tile {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; height: 100%;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface); text-decoration: none;
  border: 1px solid transparent; transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile-name { font-weight: 600; line-height: 1.25; overflow-wrap: break-word; }
.tile-town { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.count { flex: none; min-width: 34px; padding: 2px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 13px; text-align: center; }
.tiles.big .tile { padding: 18px; }
.tiles.big { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.tiles.big .tile-name { font-family: var(--head); font-weight: var(--head-weight); font-size: 20px; }
.tiles.years { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.tiles.years .tile { flex-direction: column; align-items: flex-start; }
.tiles.years .tile-name { font-family: var(--head); font-weight: var(--head-weight); font-size: 28px; }
.letter { font-size: 22px; margin: 28px 0 10px; color: var(--accent); }

/* ---------- class page / famous page portraits ---------- */
.class { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-items: start; }
.portrait {
  margin: 0; scroll-margin-top: 90px; padding: 12px; border-radius: calc(var(--radius) + 6px);
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.portrait:target, .portrait.focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.frame {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0;
  border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--tile, var(--surface)); color: inherit;
}
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .initials { position: absolute; inset: 0; display: grid; place-items: center; font: 700 72px/1 var(--head); color: rgba(0, 0, 0, .35); }
.frame .play {
  position: absolute; right: 12px; bottom: 12px;
  width: 56px; height: 56px; border-radius: 50%; background: rgba(0, 0, 0, .6);
  display: grid; place-items: center; transition: background .15s;
}
.frame .play::after { content: ""; margin-left: 5px; border-left: 20px solid #fff; border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.frame:hover .play { background: var(--accent); }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.frame.playing { cursor: default; aspect-ratio: 9 / 16; }
.frame.playing.ig { aspect-ratio: 4 / 7; background: #fff; }
.frame.empty { cursor: default; }
.frame .soon { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: rgba(0, 0, 0, .5); font-size: 14px; }
.portrait figcaption { padding: 12px 4px 2px; }
.portrait-name { font-size: 21px; margin: 0; }
.portrait-note { color: var(--accent); font-weight: 500; margin: 4px 0 0; }
.portrait-meta { color: var(--muted); font-size: 14px; margin: 3px 0 0; }
.portrait-meta a { color: inherit; }
.portrait-links { margin: 8px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 14px; min-width: 0; }
.portrait-links a { color: var(--muted); }
.portrait-links a:hover { color: var(--accent); }

/* ---------- search ---------- */
.result-group { margin-top: 30px; }
.result-group h2 { font: 600 13px/1 "Work Sans", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 10px; margin: 0 0 14px; }
.none { color: var(--muted); margin: 0; }

/* ---------- footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); }
.footer-inner { padding-top: 32px; padding-bottom: 40px; display: grid; gap: 14px; }
.footer p { margin: 0; }
.footer-title { font-family: var(--head); font-weight: var(--head-weight); font-size: 20px; }

@media (max-width: 640px) {
  .topnav { order: 3; width: 100%; }
  .search { order: 4; max-width: none; margin-left: 0; }
  .hero .wrap { padding-top: 32px; padding-bottom: 32px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 18px 12px; }
  .thumb .initials { font-size: 40px; }
}

/* ---------- social bar ---------- */
.socialbar { background: var(--band); color: var(--band-ink); font-size: 14px; }
.socialbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
.socials { display: flex; align-items: center; gap: 4px; }
.socials span { color: var(--band-muted); margin-right: 6px; }
.socials a { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--band-ink); transition: background .15s; }
.socials a:hover { background: rgba(255, 255, 255, .15); }
.socials svg { width: 18px; height: 18px; fill: currentColor; }
.bar-actions { display: flex; gap: 8px; align-items: center; }
.bar-actions a { text-decoration: none; font-weight: 600; padding: 5px 14px; border-radius: 999px; }
.bar-actions .tip { background: var(--accent); color: var(--accent-ink); }
.bar-actions .donate { color: var(--band-ink); border: 1px solid currentColor; opacity: .85; }
.bar-actions .donate:hover { opacity: 1; }
.donate-box { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; margin-top: 44px; display: flex; gap: 14px 30px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.donate-box h2 { font-size: 20px; margin: 0 0 4px; }
.donate-box p { margin: 0; color: var(--muted); }
.donate-box address { font-style: normal; font-weight: 600; }

/* ---------- cover photo hero ---------- */
.hero { background: #f7eeee url("assets/cover.jpg") center / cover no-repeat; color: var(--ink); }
.hero .wrap { padding-top: 56px; padding-bottom: 56px; }
.hero-card {
  max-width: 560px; padding: 28px 30px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .86); box-shadow: 0 10px 30px rgba(22, 33, 62, .12);
  backdrop-filter: blur(3px);
}
.hero h1 { color: var(--ink); max-width: none; margin: 0; }
.hero .tagline { color: var(--accent); font-weight: 600; font-size: 19px; margin: 6px 0 22px; }
.hero-search input { background: #fff; border: 1px solid var(--line); }
.stats span { color: var(--muted); }
.badge.sold { background: var(--accent); left: auto; right: 8px; }
.sold-tag { display: inline-block; margin: 6px 0 0; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
@media (max-width: 640px) { .hero-card { padding: 20px; } }

/* ---------- email link in footer ---------- */
.footer a.email { color: #1a66d6; text-decoration: underline; }

/* ---------- automatic dark mode (follows the phone/computer setting) ---------- */
@media (prefers-color-scheme: dark) {
  html {
    color-scheme: dark;
    --bg: #12151d;
    --surface: #1c2130;
    --ink: #eef0f6;
    --muted: #a3abc2;
    --line: #2a3142;
    --accent: #ef4058;
    --accent-ink: #ffffff;
    --band: #0b0e15;
    --band-ink: #eef0f6;
    --band-muted: #a3abc2;
  }
  html .hero { background-image: linear-gradient(rgba(10, 12, 18, .45), rgba(10, 12, 18, .45)), url("assets/cover.jpg"); }
  html .hero-card { background: rgba(18, 21, 29, .86); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
  html .hero-search input { background: var(--surface); border-color: var(--line); }
  html .thumb, html .frame { background: color-mix(in srgb, var(--tile) 22%, #1c2130); }
  html .thumb .initials, html .frame .initials { color: rgba(255, 255, 255, .35); }
  html .frame .soon { color: rgba(255, 255, 255, .55); }
  html .frame.playing.ig { background: #fff; }
  html .footer a.email { color: #7fb0ff; }
}
.grade-tag { display: inline-block; margin: 6px 0 0; padding: 2px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink); }
.toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 22px; }
.toggle a { padding: 7px 16px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.toggle a.on { background: var(--accent); color: var(--accent-ink); }

/* back button + breadcrumb row */
.crumbs { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.back {
  font: 600 14px "Work Sans", sans-serif; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.back:hover { border-color: var(--accent); color: var(--accent); }
/* home page has its own big search box, so hide the one in the top bar there */
body.is-home .topbar .search { display: none; }
/* smaller cards on the Notable individuals page */
.cards.compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
.cards.compact .thumb { aspect-ratio: 1 / 1; }
.cards.compact .thumb .initials { font-size: 36px; }
.cards.compact .card-name { font-size: 15px; }
.cards.compact .card-meta { font-size: 13px; }
@media (max-width: 640px) { .cards.compact { grid-template-columns: repeat(3, 1fr); gap: 14px 10px; } }

/* green "For sale" tags */
.badge.sale { top: 8px; bottom: auto; left: 8px; background: #1f8a4c; }
.sale-tag { display: inline-block; margin: 6px 0 0; padding: 2px 10px; border-radius: 999px; background: #1f8a4c; color: #fff; font-size: 13px; font-weight: 600; }
.tiles.years .sale-tag { font-size: 12px; margin-top: 8px; }
.page-head .sale-tag { margin: 4px 0 8px; font-size: 14px; }

/* logo + name + tagline in the top bar */
.brand-logo { height: 46px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tagline { color: var(--accent); font-weight: 600; font-size: 14px; margin-top: 3px; }
.hero-title { font-size: 22px; margin: 0 0 16px; }
@media (max-width: 640px) {
  .brand-logo { height: 38px; }
  .brand-name { font-size: 18px; }
  .brand-tagline { font-size: 13px; }
}

/* tip jar sits with the social icons, a little apart */
.socials a.tip { width: auto; height: auto; margin-left: 14px; padding: 5px 14px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.socials a.tip:hover { background: var(--accent); filter: brightness(1.1); }
.donate-box a.email { color: #1a66d6; text-decoration: underline; }
@media (prefers-color-scheme: dark) { html .donate-box a.email { color: #7fb0ff; } }
@media (max-width: 640px) { .bar-actions a { font-size: 13px; padding: 5px 10px; } }
.hero-card { max-width: 620px; }
@media (max-width: 640px) {
  .bar-actions { width: 100%; }
  .bar-actions a { flex: 1; text-align: center; }
}
@media (max-width: 640px) { .bar-actions { gap: 6px; } .bar-actions a { font-size: 12px; padding: 5px 8px; white-space: nowrap; } }

/* a celebrity's own page: smaller book cards so several fit on screen */
.class.compact { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.class.compact .frame:not(.playing) { aspect-ratio: 1 / 1; }
.class.compact .frame .initials { font-size: 48px; }
.class.compact .portrait-name { font-size: 17px; }
.class.compact .portrait:has(.playing) { grid-column: 1 / -1; max-width: 420px; }
@media (max-width: 640px) {
  .class.compact { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .class.compact .portrait { padding: 8px; }
  .class.compact .frame .initials { font-size: 34px; }
  .class.compact .frame .play { width: 40px; height: 40px; right: 8px; bottom: 8px; }
  .class.compact .frame .play::after { border-left-width: 14px; border-top-width: 9px; border-bottom-width: 9px; margin-left: 4px; }
  .class.compact .frame .soon { font-size: 12px; bottom: 8px; padding: 0 6px; }
  .class.compact .portrait-name { font-size: 15px; }
  .class.compact .portrait-note, .class.compact .portrait-meta, .class.compact .portrait-links { font-size: 13px; }
}
/* on a celebrity's page the name and description are already in the heading */
.class.small .portrait-name, .class.small .portrait-note { display: none; }
.class.small .portrait-meta { color: var(--ink); font-weight: 600; margin-top: 6px; }
.class.compact .frame .play ~ .soon { display: none; }
/* keep real thumbnails inside their boxes (YouTube images are wider than the card) */
.cards > *, .class > *, .strip > *, .tiles > * { min-width: 0; }
.thumb img, .frame img { position: absolute !important; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- custom pictures on tiles and page headers ---------- */
.tile { position: relative; }
.tile-img { flex: none; width: 52px; height: 52px; border-radius: calc(var(--radius) - 2px); overflow: hidden; position: relative; margin-right: 4px; }
.tile-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tiles.years .tile-img { width: 100%; height: auto; aspect-ratio: 4 / 5; margin: 0 0 8px; }
.head-img { position: relative; width: 140px; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: var(--surface); margin-bottom: 12px; border: 1px solid var(--line); }
.head-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.head-img span:not(.cam) { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 8px; font-size: 13px; color: var(--muted); }

/* ---------- admin / editor ---------- */
.admin-link { color: var(--muted); font-size: 13px; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.login { display: grid; gap: 14px; max-width: 360px; }
.login label { display: grid; gap: 6px; font-weight: 600; }
.login input { font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.login .btn { padding: 12px 22px; justify-self: start; }
.login-error { color: var(--accent); min-height: 1.5em; margin: 0; }
.cam {
  position: absolute; top: 6px; right: 6px; z-index: 5; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px; cursor: pointer;
  background: rgba(255, 255, 255, .95); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.tile > .cam { top: -8px; right: -8px; width: 32px; height: 32px; font-size: 15px; }
.sheet-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none; }
.sheet { background: var(--bg); color: var(--ink); width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 18px 18px 24px; display: grid; gap: 12px; }
.sheet-title { font-weight: 700; margin: 0; }
.sheet-preview { aspect-ratio: 4 / 5; max-height: 42vh; border-radius: 12px; overflow: hidden; background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.sheet-preview img { width: 100%; height: 100%; object-fit: contain; }
.sheet-opt { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 2px 4px; }
.sheet-opt input { width: 18px; height: 18px; margin: 0; }
.sheet-buttons { display: grid; gap: 8px; }
.sheet-buttons[hidden] { display: none; }
.sheet-buttons .btn { padding: 14px; font-size: 16px; text-align: center; }
.sheet-msg { margin: 0; color: var(--accent); min-height: 1.2em; }
.sheet-close { background: none; border: 0; color: var(--muted); font: inherit; padding: 6px; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); max-width: 90vw; text-align: center; }

/* a playing video in a compact grid takes the full row so it's big enough to watch */
.class.compact .portrait:has(.playing) { max-width: 520px; justify-self: center; width: 100%; }
@media (max-width: 640px) { .portrait { scroll-margin-top: 175px; } }
.frame.external .soon { color: #fff; background: rgba(0, 0, 0, .65); left: 50%; right: auto; transform: translateX(-50%); bottom: 10px; padding: 6px 12px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.frame.external:hover .soon { background: var(--accent); }
@media (max-width: 640px) { .class.compact .frame.external .soon { font-size: 12px; padding: 5px 9px; } }
@media (max-width: 640px) { .class.compact .wide-only { display: none; } }

/* ---------- celebrity collage (2+ books) ---------- */
.collage { position: absolute; inset: 0; display: grid; gap: 2px; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; background: var(--bg); }
.collage.n2 { grid-template-rows: 1fr; }
.collage.n3 .cell:first-child { grid-row: span 2; }
.collage .cell { position: relative; overflow: hidden; background: var(--tile, var(--surface)); }
.collage .cell .initials { font-size: 22px; }
.collage .cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.collage .cell-year { position: absolute; left: 4px; bottom: 4px; z-index: 2; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; }
.collage .cell.more { display: grid; place-items: center; background: var(--ink); color: var(--bg); font: 700 26px/1 var(--head); }
.cards.compact .collage .cell .initials { font-size: 18px; }
.cards.compact .collage .cell-year { font-size: 10px; padding: 0 5px; left: 3px; bottom: 3px; } .cards.compact .collage .cell.more { font-size: 20px; }

/* school logos: show the whole logo on white instead of cropping */
img.logo { object-fit: contain !important; background: #fff; padding: 6%; }

/* state outline drawings */
.state-shape { background: var(--surface); border: 0; }
.state-shape img { object-fit: contain !important; padding: 8%; }
.tile .state-shape { background: transparent; }
div.head-img.state-shape, span.head-img.state-shape { display: block; width: 120px; aspect-ratio: 1 / 1; }
.credits { font-size: 11px; color: var(--muted); opacity: .8; }
.tile .tile-name { flex: 1; min-width: 0; } .tile .state-shape { width: 46px; height: 46px; }

/* enlarge a photo (no-video entries, school/book/celebrity header photos) */
.frame.empty:has(img), .head-img:not(.state-shape):has(img) { cursor: zoom-in; }
.viewer { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .88); display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.viewer[hidden] { display: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; background: #fff; }
.viewer-close { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .9); font-size: 20px; cursor: pointer; }
body.viewing { overflow: hidden; }

/* year page: small school picture in the breadcrumb row; blank book-cover slots */
.crumb-img { display: inline-block; vertical-align: middle; position: relative; width: 30px; height: 30px; margin-right: 7px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.crumb-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
span > .crumb-img { cursor: zoom-in; }
.tile-img.blank { display: grid; place-items: center; background: var(--surface); border: 1px dashed var(--line); }
.tile-img.blank span { font-size: 12px; color: var(--muted); text-align: center; padding: 6px; }
.head-img:not(:has(img)) { border-style: dashed; }
.portrait, .portrait figcaption { min-width: 0; }

/* admin: book status panel on a year page */
.book-panel { margin: 4px 0 22px; padding: 14px 16px; border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--surface); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; max-width: 640px; }
.book-panel-title { flex-basis: 100%; margin: 0; font-weight: 700; }
.book-panel-title span { font-weight: 400; color: var(--muted); font-size: 13px; }
.bp-row { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.bp-row input[type="checkbox"] { width: 20px; height: 20px; }
.bp-row input[type="number"] { width: 64px; padding: 6px 8px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #fff); color: var(--ink); }
.book-panel .btn { padding: 8px 20px; }
.bp-msg { font-size: 14px; color: var(--muted); }
.bp-pic { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.bp-pic .btn { padding: 8px 14px; cursor: pointer; }
.bp-pic-prev img { display: block; width: 72px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.bp-hint { font-size: 13px; color: var(--muted); flex-basis: 100%; }
.book-panel input[name="year"] { padding: 6px 8px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #fff); color: var(--ink); }
.add-book { margin: 0 0 18px; }
.add-book > summary { display: inline-block; list-style: none; padding: 10px 20px; cursor: pointer; }
.add-book > summary::-webkit-details-marker { display: none; }
.add-book[open] > summary { margin-bottom: 10px; }
/* Admin: Add books page */
.add-books-btn { display: inline-block; margin: 0 0 12px; padding: 10px 20px; }
.ab-row { position: relative; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; padding: 12px 40px 12px 12px; margin: 0 0 12px;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--surface); max-width: 900px; }
.ab-num { font-weight: 700; min-width: 18px; padding-top: 9px; }
.ab-field { position: relative; display: flex; flex-direction: column; gap: 6px; flex: 1 1 200px; min-width: 0; }
.ab-yearf { flex: 0 0 90px; }
.ab-wrap { position: relative; display: block; }
.ab-row input[type="text"], .ab-row input:not([type]) { width: 100%; box-sizing: border-box; padding: 9px 10px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #fff); color: var(--ink); }
.ab-row input:disabled { opacity: .45; }
.ab-row.is-new .ab-school { border-color: #2e7d32; }
.ab-school { padding-right: 112px !important; }
.ab-addschool { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; border-radius: 6px; padding: 5px 8px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; background: transparent; color: #2e7d32; }
.ab-addschool.loud { background: #2e7d32; color: #fff; }
.ab-sug { position: absolute; z-index: 20; top: 42px; left: 0; right: 0; margin: 0; padding: 4px 0; list-style: none; max-height: 280px; overflow: auto;
  background: var(--bg, #fff); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.ab-sug li { padding: 9px 12px; cursor: pointer; }
.ab-sug li:hover { background: var(--surface); }
.ab-cam { font-size: 26px; line-height: 40px; cursor: pointer; }
.ab-cam.off { opacity: .3; cursor: not-allowed; filter: grayscale(1); }
.ab-prev img { display: block; width: 40px; height: 50px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; }
.ab-remove { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.ab-msg { flex-basis: 100%; margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ab-msg:empty { display: none; }
.ab-msg .err { color: #c62828; font-weight: 700; }
.ab-msg .ok { color: var(--muted); }
.ab-msg .btn { padding: 6px 14px; }
.ab-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ab-actions .btn { padding: 10px 20px; }
.ab-actions .btn:disabled { opacity: .5; cursor: not-allowed; }
.ab-status { font-weight: 700; }
@media (max-width: 600px) { .ab-field:not(.ab-yearf) { flex-basis: calc(100% - 30px); } }
/* Admin: Add video page + famous option */
.admin-adds { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.admin-adds .add-books-btn { margin: 0; }
.av-form { flex-direction: row; padding-right: 12px; }
.av-lab { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.av-lab input, .av-lab select { padding: 9px 10px; font: inherit; font-size: 16px; font-weight: 400; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #fff); color: var(--ink); }
.av-links { flex-basis: 100%; display: grid; gap: 8px; }
.av-link { display: grid; grid-template-columns: 84px 1fr 18px; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.av-link input { width: 100%; box-sizing: border-box; padding: 9px 10px; font: inherit; font-size: 16px; font-weight: 400; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #fff); color: var(--ink); min-width: 0; }
.av-link input:disabled { opacity: .45; }
.av-ok { font-style: normal; font-weight: 700; color: #2e7d32; }
.av-famous { flex-basis: 100%; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.av-famous input { width: 20px; height: 20px; }
.av-famous:has(input:disabled) { opacity: .45; }
.av-note, .ab-celeb input { flex-basis: 100%; box-sizing: border-box; padding: 9px 10px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg, #fff); color: var(--ink); }
.ab-celeb { flex-basis: 100%; display: grid; gap: 8px; }
.ab-fmsg { font-size: 14px; color: var(--muted); }
.ab-fmsg:empty { display: none; }
.av-title { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.av-note-star, .av-note-warn, .av-note-info { max-width: 900px; margin: 0 0 10px; padding: 10px 14px; border-radius: var(--radius); font-size: 15px; }
.av-note-star { background: #fff4cc; color: #5a4300; border: 1px solid #f0d36b; }
.av-note-warn { background: #fde7e9; color: #8a1020; border: 1px solid #f3b6be; }
.av-note-info { background: var(--surface); color: var(--muted); }
.av-note-star .btn { margin-left: 6px; padding: 5px 12px; }
.av-preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; max-width: 900px; margin: 8px 0 14px; }
.av-fields { display: grid; gap: 12px; align-content: start; }
.av-linklist { margin: 0; font-size: 14px; color: #2e7d32; font-weight: 700; }
.av-card .class { display: block; pointer-events: none; }
@media (max-width: 600px) { .av-preview { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av-note-star { background: #3a3110; color: #ffe08a; border-color: #6b5a1c; }
  :root:not([data-theme="light"]) .av-note-warn { background: #3a1419; color: #ffb3bd; border-color: #6b2a33; } }
.av-card .portrait { max-width: 280px; }
