:root {
  --ink: #2F3033;
  --red: #bb2026;
  --red-dark: #9a1a1f;
  --bg: #f4f4f5;
  --card: #ffffff;
  --line: #e1e1e4;
  --muted: #6b6c72;
  --navy: #1c2759;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(47, 48, 51, .08), 0 4px 14px rgba(47, 48, 51, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--red); }
:focus-visible { outline: 3px solid #f2a5a8; outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- Banner ---------- */
.banner { background: var(--navy); }
.banner img {
  display: block;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 84px;
  max-height: 170px;
  object-fit: cover;
  object-position: 45% center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1.5px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }

/* ---------- Top bar (handouts page) ---------- */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 1160px; margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: .01em; }
.topbar h1 span { color: #ff8a8f; }
.search { flex: 1 1 260px; position: relative; order: 3; }
.search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 1.1rem; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: .65rem 2.4rem .65rem 2.5rem; border-radius: 8px; border: 0;
  font: inherit; background: #fff; color: var(--ink);
}
.search button {
  position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; font-size: 1.4rem; line-height: 1; color: var(--muted);
  cursor: pointer; padding: .2rem .55rem;
}
.top-actions { margin-left: auto; display: flex; gap: .5rem; }
@media (min-width: 820px) {
  .search { order: 0; flex: 0 1 460px; margin-left: 1.25rem; }
  .top-actions { margin-left: auto; }
}

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-title { margin: .25rem 0 .25rem; font-size: 1.6rem; line-height: 1.25; }
.page-sub { margin: 0 0 1.25rem; color: var(--muted); }
.section-title {
  margin: 2rem 0 .75rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
}

/* ---------- Strand cards ---------- */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: .6rem; padding: 1.1rem 1.15rem 1rem;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--navy); text-decoration: none; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(47, 48, 51, .1), 0 10px 24px rgba(47, 48, 51, .12); }
.card-code {
  align-self: flex-start; background: var(--ink); color: #fff; font-weight: 700; font-size: .8rem;
  letter-spacing: .06em; padding: .15rem .55rem; border-radius: 5px;
}
.card-title { font-weight: 650; font-size: 1.02rem; line-height: 1.35; flex: 1; }
.card-meta { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .86rem; }
.card-meta .go { color: var(--red); font-weight: 700; }

/* ---------- Featured card (posters) ---------- */
.feature {
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap;
  margin-bottom: 1.5rem; padding: 1.5rem 1.6rem; border-radius: var(--radius);
  background: linear-gradient(110deg, var(--navy) 0%, #2a3a7c 100%); color: #fff; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.feature:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(28, 39, 89, .35); }
.feature-text { display: flex; flex-direction: column; gap: .2rem; }
.feature-kicker { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #ffb3b6; }
.feature-title { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.feature-sub { color: #d6daee; }

/* ---------- Strand page ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .92rem; margin-bottom: .6rem; }
.crumbs a { font-weight: 600; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { color: var(--muted); }
.strand-head { display: flex; gap: .85rem; align-items: flex-start; margin-bottom: 1.25rem; }
.strand-head .card-code { font-size: .95rem; padding: .3rem .7rem; margin-top: .2rem; }

.sessions { display: grid; gap: .65rem; }
details.session { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 4px solid var(--line); }
details.session[open] { border-left-color: var(--red); }
details.session > summary {
  list-style: none; cursor: pointer; padding: .95rem 1.1rem; display: flex; gap: .8rem; align-items: center;
  font-weight: 600; line-height: 1.35;
}
details.session > summary::-webkit-details-marker { display: none; }
details.session > summary::before {
  content: ""; flex: none; width: .5rem; height: .5rem; border-right: 2.5px solid var(--red); border-bottom: 2.5px solid var(--red);
  transform: rotate(-45deg); transition: transform .15s ease; margin-right: .15rem;
}
details.session[open] > summary::before { transform: rotate(45deg); }
.session-name { flex: 1; }
.badge { flex: none; font-size: .78rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; background: #fbe9ea; color: var(--red-dark); }
.badge.zero { background: #eeeef0; color: var(--muted); }

.files { list-style: none; margin: 0; padding: 0 1.1rem .5rem; }
.file { display: flex; gap: .85rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--line); }
.file-icon { flex: none; width: 2.2rem; height: 2.7rem; color: var(--red); }
.file-main { flex: 1; min-width: 0; }
.file-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.file-title:hover { color: var(--red); text-decoration: underline; }
.file-meta { color: var(--muted); font-size: .84rem; margin-top: .1rem; }
.file-actions { display: flex; gap: .4rem; flex: none; }
.file-actions .btn { padding: .45rem .8rem; font-size: .88rem; }
.empty-note { padding: .2rem 0 1rem; color: var(--muted); font-style: italic; }
@media (max-width: 600px) {
  .file { flex-wrap: wrap; }
  .file-actions { width: 100%; padding-left: 3.05rem; }
  .file-actions .btn { flex: 1; }
}

/* ---------- Search results ---------- */
.result-group { margin-bottom: 1.4rem; }
.result-path { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.result-path strong { color: var(--ink); }
.result-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: .1rem 1.1rem; }
.result-box .file:first-child { border-top: 0; }
mark { background: #ffe58f; color: inherit; border-radius: 2px; padding: 0 .1em; }

.notice { background: #fff; border-radius: var(--radius); padding: 2rem 1.25rem; text-align: center; box-shadow: var(--shadow); color: var(--muted); }
.notice strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: .3rem; }
.spinner { width: 2rem; height: 2rem; margin: 3rem auto; border: 4px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Login ---------- */
.login-wrap { flex: 1; display: grid; place-items: start center; padding: 2rem 1rem 3rem; }
.login-card { width: 100%; max-width: 440px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); border-top: 5px solid var(--red); padding: 1.8rem 1.6rem 1.6rem; }
.login-card h1 { margin: 0 0 .3rem; font-size: 1.5rem; }
.login-card p.lead { margin: 0 0 1.4rem; color: var(--muted); }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.field input {
  width: 100%; padding: .75rem .85rem; font: inherit; border: 1.5px solid #cfcfd4; border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus { border-color: var(--red); outline: 3px solid #f6c9cb; }
.field input.pin { letter-spacing: .2em; text-transform: uppercase; font-weight: 600; }
.field small { display: block; margin-top: .3rem; color: var(--muted); font-size: .82rem; }
.error { background: #fdecec; color: #8c1519; border: 1px solid #f4b9bb; border-radius: 8px; padding: .65rem .85rem; margin-bottom: 1rem; font-size: .94rem; }
.login-card .btn-primary { width: 100%; padding: .85rem 1rem; font-size: 1.02rem; }
.login-help { margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--line); text-align: center; font-size: .92rem; color: var(--muted); }

/* ---------- Footer ---------- */
footer { background: var(--ink); color: #d7d7da; margin-top: auto; }
.footer-inner { max-width: 1160px; margin: 0 auto; padding: 1.8rem 1rem; display: grid; gap: 1.2rem; grid-template-columns: 1fr; font-size: .92rem; }
@media (min-width: 760px) { .footer-inner { grid-template-columns: 1.4fr 1fr 1fr; } }
footer h2 { margin: 0 0 .4rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: #fff; }
footer a { color: #ff9ea2; }
footer p { margin: 0 0 .25rem; }
.footer-brand { font-size: 1.15rem; font-weight: 700; color: #fff; letter-spacing: .01em; }
.footer-brand span { color: #ff8a8f; }
.copyright { border-top: 1px solid rgba(255, 255, 255, .14); text-align: center; padding: .9rem 1rem; font-size: .84rem; color: #a9aaae; }

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