/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --card: #ffffff;
  --text: #1a1d23;
  --text-muted: #5b6270;
  --accent: #3453d6;
  --accent-ink: #ffffff;
  --cta-primary: #3d5afe;
  --cta-primary-ink: #ffffff;
  --proof-text: #4b5563;
  --border: #e2e4ea;
  --tag-bg: #eef0fb;
  --tag-text: #3453d6;
  --warn-bg: #fff4e0;
  --warn-text: #8a5a00;
  --eyebrow-bg: #eef0fb;
  --tag-neutral-bg: #e2e4ea;
  /* The one border color reserved for things a visitor can actually click -
     see the "clickable vs static" rule above the Buttons section below. */
  --border-interactive: color-mix(in srgb, var(--accent) 45%, var(--border));
  --shadow: 0 1px 2px rgba(20, 24, 40, 0.04), 0 8px 24px rgba(20, 24, 40, 0.05);
  --radius: 14px;
  --max-width: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

/* Dark theme is opt-in only, via the .theme-toggle button (see the Theme
   toggle section below) - light is always what a first-time visitor sees,
   regardless of OS-level dark mode. A tiny inline script in each page's
   <head> re-applies a returning visitor's saved choice before first paint. */
:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #15181f;
  --card: #171a22;
  --text: #e7e9ee;
  --text-muted: #9aa1b1;
  --accent: #7c93ff;
  --accent-ink: #0f1115;
  --cta-primary: #7c93ff;
  --cta-primary-ink: #0f1115;
  --proof-text: var(--text-muted);
  --border: #262b36;
  --tag-bg: #1c2036;
  --tag-text: #a7b3ff;
  --warn-bg: #2b2410;
  --warn-text: #e2b458;
  /* Same neutral gray as the "from GitHub" tag pill (--tag-neutral-bg) so
     every highlight chip (item meta lines, semester cards, breadcrumb) reads
     as one consistent gray in dark mode. */
  --eyebrow-bg: var(--tag-neutral-bg);
  --tag-neutral-bg: #2e3444;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Smooths the light/dark theme switch (see the Theme toggle section below)
   into a brief fade instead of an instant color snap. Lower specificity
   than any class selector, so elements with their own transition (.btn,
   .card, etc.) keep that one untouched. */
* {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Backstop, not the fix: individual elements should never need to rely on
     this, but it guarantees no future addition can create a scrollable page
     even if something upstream slips past every other rule below. */
  overflow-x: hidden;
  /* Guards against a long unbroken string (a pasted URL, a long word)
     forcing the page wider than the viewport. */
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* One consistent, visible focus style for every interactive element
   (keyboard focus only - doesn't show on a plain mouse click). */
:focus-visible {
  outline: 2px solid var(--cta-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

p { text-align: left; }

code, .mono { font-family: var(--font-mono); }

img { max-width: 100%; display: block; }
iframe, video, embed, object { max-width: 100%; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Nav ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-nav .container {
  display: flex;
  align-items: center;
  min-height: 64px;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.site-nav .brand {
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  /* Pushes everything after it (theme toggle, hamburger, nav links) to the
     right edge as one cluster, whichever of them happen to be visible at
     the current viewport width - see the .theme-toggle comment below. */
  margin-right: auto;
}
.site-nav .brand:hover { text-decoration: none; }

/* ===== Theme toggle =====
   Always visible next to the hamburger/nav-links (never tucked inside the
   collapsible mobile menu) so it's easy to find on any screen size. Same
   accent-tinted "this is clickable" border as every other button (see the
   clickable-vs-static rule in the Buttons section). Sized 44x44 - the
   minimum comfortable touch target - so it stays that way on mobile too. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-interactive);
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle-icon { width: 20px; height: 20px; }
.theme-toggle-icon-sun { display: none; }
.theme-toggle-icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle-icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle-icon-moon { display: none; }

.site-nav .links {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.site-nav .links a,
.site-nav .links button.chatbot-nav-link {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  /* Persistent (not hover-only) tinted border, so these read as tappable
     tabs at rest - see the clickable-vs-static rule in the Buttons section. */
  border: 1px solid var(--border-interactive);
  background: var(--bg-alt);
  cursor: pointer;
  font-family: var(--font);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.site-nav .links a:active,
.site-nav .links button.chatbot-nav-link:active { transform: translateY(1px); }

.site-nav .links button.chatbot-nav-link {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 420px) {
  .site-nav .brand { font-size: 0.92rem; }
  .site-nav .links a,
  .site-nav .links button.chatbot-nav-link { padding: 6px 10px; font-size: 0.85rem; }
}

.site-nav .links a:hover,
.site-nav .links button.chatbot-nav-link:hover { color: var(--text); text-decoration: none; background: var(--card); border-color: var(--accent); }
.site-nav .links a.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

@media (max-width: 700px) {
  .nav-toggle { display: inline-flex; }
  .site-nav .links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-bottom: 8px;
  }
  .site-nav.nav-open .links { display: flex; }
  .site-nav .links a,
  .site-nav .links button.chatbot-nav-link {
    width: 100%;
    text-align: left;
    border-radius: 8px;
  }
}

.breadcrumb { padding-top: 18px; }
.breadcrumb-chip {
  display: inline-block;
  color: var(--text);
  background: var(--eyebrow-bg);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 4px;
}
.breadcrumb-chip a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.breadcrumb-chip a:hover { color: var(--accent); }

/* ===== Hero (Home page) ===== */
.hero {
  /* Longhand on purpose: a shorthand "padding: 64px 0 48px" here would
     zero out the left/right padding .container already sets, leaving
     hero content (including the CTA buttons) flush against the screen
     edges on mobile with no margin at all. */
  padding-top: 64px;
  padding-bottom: 48px;
  text-align: center;
}

.hero .hero-photo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  margin: 0 auto 28px;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.hero h1 {
  font-size: clamp(2rem, 4.6vw, 3rem);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.hero .tagline {
  color: var(--text-muted);
  font-size: clamp(1.1rem, 2.4vw, 1.25rem);
  max-width: clamp(340px, 62vw, 720px);
  margin: 0 auto 32px;
  text-align: center;
}
/* The role line gets a second, heavier typeface (a slab-serif paired
   against the site's sans-serif body) so it reads as the headline it is,
   instead of blending into the muted paragraph text around it. */
.hero .tagline .role-line {
  display: block;
  font-family: "Roboto Slab", Georgia, "Times New Roman", serif;
  font-weight: 700;
  color: var(--text);
  font-size: 1.15em;
  margin-bottom: 4px;
}

/* Quick credibility proof, directly below the role line: a short,
   factual line or two before asking the visitor to pick a path. */
.proof-row {
  list-style: none;
  margin: 24px auto 32px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: clamp(340px, 70vw, 720px);
}
.proof-row li {
  font-size: 17px;
  color: var(--proof-text);
  line-height: 1.4;
}

.hero-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 0 auto 36px;
  text-align: center;
}

.hero-info h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.hero-info .contact-line { margin: 0; text-align: center; font-size: 1.05rem; }
.hero-info .contact-line .dot { color: var(--text-muted); margin: 0 8px; }
.hero-info .external-links { justify-content: center; }

.hero-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  .hero-buttons { flex-direction: column; align-items: stretch; gap: 24px; }
}

/* ===== Buttons =====
   Sitewide rule - clickable vs. static: var(--border-interactive) (an
   accent-tinted border) is the ONE signal reserved for anything a visitor
   can actually click or tap - buttons, nav tabs, link-styled controls -
   and it's visible at rest, not only on :hover, because touch devices never
   see a hover state. Deepens to solid var(--accent) on hover/focus/active.
   Purely informational containers (cards, semester/course blocks, tags,
   badges) must keep the neutral var(--border) and never borrow the accent
   tint, so border color alone tells a mobile user what's tappable. Apply
   this to any new clickable control added to the site. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid var(--border-interactive);
  color: var(--text);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--cta-primary);
  color: var(--cta-primary-ink);
  border-color: var(--cta-primary);
}
.btn-primary:hover { color: var(--cta-primary-ink); opacity: 0.9; }

.btn-secondary {
  background: var(--card);
  color: var(--cta-primary);
  border: 1px solid var(--cta-primary);
}
.btn-secondary:hover { text-decoration: none; color: var(--cta-primary); opacity: 0.85; }

/* One dominant CTA per screen: primary/secondary pairs get a fixed,
   matching height so the hierarchy reads clearly at a glance. Excludes
   the floating chatbot launcher, which keeps its own compact sizing. */
.btn-primary:not(.chatbot-launcher), .btn-secondary:not(.chatbot-launcher) {
  height: 56px;
  padding: 0 28px;
}
@media (max-width: 700px) {
  .btn-primary:not(.chatbot-launcher), .btn-secondary:not(.chatbot-launcher) { height: 52px; padding: 0 24px; }
}

/* min-height keeps every small button at the 44px touch-target minimum on
   mobile even though the text/padding alone would compute shorter. */
.btn-sm { padding: 6px 14px; font-size: 0.85rem; min-height: 44px; }

.btn-icon { padding: 8px 16px; min-width: 44px; min-height: 44px; justify-content: center; }
.btn-logo { width: 22px; height: 22px; border-radius: 6px; display: block; object-fit: contain; }
.btn-logo-boxed { background: #fff; padding: 2px; }
.btn-logo-wordmark { width: auto; height: 16px; border-radius: 0; }

/* Bigger variant for social icon buttons that need to stand out more than a
   typical icon button - the homepage's 4 social links and the Professional
   page's LinkedIn/GitHub pair. Well past the 44x44 minimum touch target on
   its own, so it stays comfortable on mobile without any extra media query. */
.btn-icon-lg { padding: 14px; min-width: 60px; min-height: 60px; justify-content: center; }
.btn-icon-lg .btn-logo { width: 32px; height: 32px; }

/* ===== Page header ===== */
.page-header {
  padding-top: 40px;
  padding-bottom: 8px;
}
.page-header h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin: 0 0 12px; letter-spacing: -0.01em; }
.page-header p.lead { color: var(--text-muted); max-width: clamp(340px, 68vw, 860px); font-size: 1.05rem; }

.page-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-top > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}
.page-header-top .header-social-links {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 4px;
}

section { padding: 28px 0; }

/* Professional index page: make the gap between the card grid and the
   resume box match the grid's own row gap, instead of double section
   padding stacking to a much larger gap than between the rows above it. */
.grid-section { padding-bottom: 18px; }
.resume-section { padding-top: 0; }

/* ===== Grid / cards ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

/* a.card is a whole tile that navigates somewhere on click, so it gets the
   interactive border like any other button (see the Buttons section rule). */
a.card { color: var(--text); display: block; border-color: var(--border-interactive); }
a.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }

.card h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.card p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

/* Resume feature box */
.resume-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.resume-box embed, .resume-box object {
  width: 100%;
  height: 480px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
}
.resume-box .resume-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .resume-box .resume-actions { flex-direction: column; align-items: stretch; gap: 24px; }
}

.external-links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ===== Tags / badges ===== */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0 6px 6px 0;
}

/* Descriptive, non-clickable tags (what I collect/play/listen to, hobby
   interests, and per-project tech-used tags) get a neutral black-or-white-
   on-gray scheme instead of the blue used for "from GitHub" and other real
   links, so they don't read as clickable. */
#collecting .tag-row .tag,
#playing .tag-row .tag,
#listening .tag-row .tag,
#card-games .tag-row .tag,
#cooking .tag-row .tag,
.project .tag-row .tag,
.skill-name .tag {
  background: var(--tag-neutral-bg);
  color: var(--text);
}
.tag-row { margin-top: 10px; }

.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-text);
  margin-left: 8px;
  vertical-align: middle;
}

/* ===== Org logos ===== */
.org-logo {
  max-height: 48px;
  max-width: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-bottom: 12px;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
}
.crest-logo {
  max-height: 88px;
  max-width: 88px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-bottom: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid var(--border);
}

/* ===== Timeline (Work Experience) ===== */
.timeline { position: relative; }
.entry {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 84px;
}
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.entry-head h2 { margin: 0; font-size: 1.2rem; }
.entry-head .dates { color: var(--text-muted); font-size: 0.88rem; white-space: nowrap; }
.entry .org,
.item-block .org {
  display: inline-block;
  color: var(--text);
  background: var(--eyebrow-bg);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.entry .blurb { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 14px; max-width: 68ch; }
.entry ul.bullets { margin: 0; padding-left: 20px; }
.entry ul.bullets li { margin-bottom: 8px; }
.entry .related { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); font-size: 0.88rem; color: var(--text-muted); }

/* highlight when landed on via anchor link */
:target {
  animation: highlight 1.8s ease-out;
}
@keyframes highlight {
  0% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: var(--shadow); }
}

/* ===== Skills page ===== */
.skill-category { margin-bottom: 36px; }
.skill-category h2 {
  font-size: 1.1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.skill-item:last-child { border-bottom: none; }
.skill-name { font-weight: 700; }
.skill-item .used-in { color: var(--text-muted); font-size: 0.92rem; margin-top: 3px; }
.skill-item .used-in a {
  display: inline-block;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--tag-text);
  background: var(--tag-bg);
  text-decoration: underline;
  text-underline-offset: 2px;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.skill-item .used-in a:hover { color: var(--accent); }
.new-skill-note {
  background: var(--bg-alt);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.88rem;
  margin: 0 0 24px;
}
.new-skill-note a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Projects ===== */
.project {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  scroll-margin-top: 84px;
}
.project h2 { margin: 0 0 4px; font-size: 1.2rem; display: flex; align-items: center; flex-wrap: wrap; }
.project .desc { color: var(--text-muted); margin: 8px 0 12px; max-width: 68ch; }
.project .figure, .entry .figure { margin: 14px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-alt); }
.project .figure img, .entry .figure img { width: 100%; }
.project .figure figcaption, .entry .figure figcaption { font-size: 0.82rem; color: var(--text-muted); padding: 10px 14px; }
.project .caveat { font-size: 0.82rem; color: var(--text-muted); font-style: italic; margin-top: 10px; }

/* ===== Simple two-column list (Education / Awards) ===== */
.item-block {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  scroll-margin-top: 84px;
}
.item-block h2 { margin: 0 0 4px; font-size: 1.1rem; }
.item-block .meta {
  display: inline-block;
  color: var(--text);
  background: var(--eyebrow-bg);
  font-size: 0.9rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.item-block > p { max-width: 68ch; }

.restaurant-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.restaurant-head .food-icon { width: 32px; height: 32px; flex-shrink: 0; }
.restaurant-head h2 { margin: 0; }

/* ===== Coursework (Education page) ===== */
.semester-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin: 16px 0 4px;
}
.semester-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-alt);
  scroll-margin-top: 84px;
}
.semester-card h3 {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--eyebrow-bg);
  padding: 2px 8px;
  border-radius: 4px;
}
.semester-card ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.semester-card li { margin-bottom: 4px; }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 32px 0 116px;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ===== Movie poster grid ===== */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 900px) { .poster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.poster-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.poster-card .poster-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 10px 0;
}
.poster-card .poster-img-wrap {
  aspect-ratio: 2 / 3;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}
.poster-card img { width: 100%; height: 100%; object-fit: contain; }
.poster-card h3 { font-size: 0.92rem; margin: 10px 10px 12px; line-height: 1.3; }

/* ===== Artist grid (music page) ===== */
.artist-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin: 16px 0;
}
@media (max-width: 700px) { .artist-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 420px) { .artist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.artist-card { text-align: center; }
.artist-card img {
  width: 150px;
  height: 150px;
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  margin: 0 auto 8px;
}
.artist-card .artist-name { font-size: 0.85rem; font-weight: 600; }

/* ===== Music embeds ===== */
.music-embed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 8px 0;
}
@media (max-width: 700px) { .music-embed-grid { grid-template-columns: minmax(0, 1fr); } }
.music-embed-grid iframe {
  width: 100%;
  height: 450px;
  border-radius: 12px;
  overflow: hidden;
  border: none;
}

/* Favorite-characters carousel: reuses .artist-card, plus a caption line
   under the name for the "Favorite X character" descriptor. */
.artist-card .character-caption { color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; }

/* ===== Channel banner (Movie Bros Show) ===== */
.channel-banner {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: block;
}

/* ===== Photo blocks (collecting / volunteer) ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0;
}
@media (max-width: 560px) { .photo-grid { grid-template-columns: minmax(0, 1fr); } }

.photo-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .photo-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .photo-grid.cols-3 { grid-template-columns: minmax(0, 1fr); } }

.photo-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .photo-grid.cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .photo-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .photo-grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }
.photo-block {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
}
.photo-block img { width: 100%; display: block; }
.photo-block figcaption { font-size: 0.82rem; color: var(--text-muted); padding: 10px 14px; }

/* ===== Photo carousel (galleries with more than 3 photos) - shows exactly
   one item at a time, Prev/Next page through, no wraparound. ===== */
.photo-carousel { margin: 14px 0; }
.photo-carousel-track {
  display: flex;
  overflow-x: auto;
  overflow-anchor: none;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.photo-carousel-track::-webkit-scrollbar { height: 7px; }
.photo-carousel-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.photo-carousel-track::-webkit-scrollbar-track { background: transparent; }
/* Slides are the track's direct children - usually a .photo-block figure,
   but sometimes an <a> wrapping one (linked video thumbnails etc.), or a
   .poster-card / .artist-card / iframe for the non-photo galleries. Each
   slide fills the full track width so only one is ever in view - IMPORTANT:
   never give the slide itself (the flex item) a max-width/width smaller
   than 100%, even to visually center a smaller card - flexbox clamps the
   used main size to max-width *after* flexing, so that silently shrinks the
   slide's real scroll-snap footprint and breaks one-page-per-click paging.
   Center smaller content by constraining a non-flex-item child instead. */
.photo-carousel-track > * {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
}
.photo-carousel-track .photo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.photo-carousel-track .photo-block figcaption { width: 100%; }
.photo-carousel-track .photo-block img { max-width: 100%; max-height: 420px; object-fit: contain; }
@media (max-width: 560px) {
  .photo-carousel-track .photo-block img { max-height: 320px; }
}

/* Posters: .poster-card itself is the flex item (must stay 100% wide - see
   note above), so the visible card frame moves to .poster-img-wrap, a
   normal block child that centers/caps correctly with plain auto-margins. */
.photo-carousel-track.track-posters .poster-card { background: none; border: none; box-shadow: none; }
.photo-carousel-track.track-posters .poster-img-wrap {
  max-width: 340px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.photo-carousel-track.track-posters h3 { max-width: 340px; margin: 10px auto 12px; text-align: center; }
.photo-carousel-track.track-posters .poster-rank { max-width: 340px; margin: 0 auto; text-align: center; }

/* Artists: the avatar is already a fixed pixel size, so text-align: center
   (already on .artist-card) centers it within the full-width slide with no
   extra sizing needed. */
.photo-carousel-track.track-artists .artist-card img { width: 220px; height: 220px; }

/* Favorite characters carousel: same layout as track-artists, just a bigger
   photo since these are full character portraits, not headshots. */
.photo-carousel-track.track-characters .artist-card img { width: 260px; height: 260px; }

.photo-carousel-track.track-embeds iframe { width: 100%; height: 460px; border: none; }

/* Diagrams: plot/chart exports (white-background PNGs) get the same bordered
   card treatment as .project .figure, since they'd otherwise float bare on
   the page background - especially jarring in dark mode. */
.photo-carousel-track.track-diagrams .photo-block img {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  padding: 8px;
}
@media (max-width: 560px) {
  .photo-carousel-track.track-posters .poster-img-wrap,
  .photo-carousel-track.track-posters h3,
  .photo-carousel-track.track-posters .poster-rank { max-width: 240px; }
  .photo-carousel-track.track-artists .artist-card img { width: 160px; height: 160px; }
  .photo-carousel-track.track-characters .artist-card img { width: 190px; height: 190px; }
  .photo-carousel-track.track-embeds iframe { height: 300px; }
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.carousel-controls-nav { display: flex; align-items: center; gap: 10px; }
.carousel-counter { font-size: 0.85rem; color: var(--text-muted); min-width: 50px; text-align: center; }
.carousel-btn { background: var(--card); cursor: pointer; font-family: inherit; }
.carousel-btn:disabled { opacity: 0.4; cursor: default; border-color: var(--border); }
.carousel-btn:disabled:hover { border-color: var(--border); color: var(--text); }
.carousel-maximize-btn { padding: 6px 11px; font-size: 1rem; line-height: 1; min-width: 44px; justify-content: center; }

/* ===== Maximized carousel - click the maximize button to fill the screen,
   click again (or Escape) to return to the normal page layout. ===== */
.photo-carousel.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 300;
  margin: 0;
  padding: 64px 24px 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.photo-carousel.is-maximized .photo-carousel-track .photo-block img { max-height: min(72vh, 760px); }
.photo-carousel.is-maximized .photo-carousel-track.track-posters .poster-img-wrap,
.photo-carousel.is-maximized .photo-carousel-track.track-posters h3 { max-width: min(46vw, 440px); }
.photo-carousel.is-maximized .photo-carousel-track.track-artists .artist-card img { width: 280px; height: 280px; }
.photo-carousel.is-maximized .photo-carousel-track.track-characters .artist-card img { width: 320px; height: 320px; }
.photo-carousel.is-maximized .photo-carousel-track.track-artists .artist-card .artist-name { font-size: 1.2rem; margin-top: 8px; }
.photo-carousel.is-maximized .photo-carousel-track.track-artists .artist-card .character-caption { font-size: 0.95rem; }
.photo-carousel.is-maximized .photo-carousel-track.track-embeds iframe { height: min(70vh, 640px); }
@media (max-width: 560px) {
  .photo-carousel.is-maximized { padding: 56px 16px 16px; }
  .photo-carousel.is-maximized .photo-carousel-track.track-posters .poster-img-wrap,
  .photo-carousel.is-maximized .photo-carousel-track.track-posters h3 { max-width: 260px; }
  .photo-carousel.is-maximized .photo-carousel-track.track-artists .artist-card img { width: 190px; height: 190px; }
  .photo-carousel.is-maximized .photo-carousel-track.track-characters .artist-card img { width: 220px; height: 220px; }
}

/* ===== Chatbot widget ===== */
.chatbot-launcher {
  position: fixed;
  right: 20px;
  bottom: 48px;
  z-index: 200;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: opacity 0.2s ease;
}

/* On short mobile viewports a hero/resume CTA row can land in the same
   fixed bottom-right region as the launcher; step it out of the way
   instead of letting the two overlap and compete for the same tap. */
@media (max-width: 700px) {
  .chatbot-launcher.chatbot-launcher-yield {
    opacity: 0;
    pointer-events: none;
  }
}

.chatbot-panel {
  position: fixed;
  right: 20px;
  bottom: 116px;
  z-index: 200;
  width: 380px;
  max-width: calc(100vw - 40px);
  max-height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chatbot-panel[hidden] { display: none; }

.chatbot-panel.is-maximized {
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  width: auto;
  max-width: none;
  max-height: none;
}
@media (max-width: 480px) {
  .chatbot-panel.is-maximized { top: 10px; left: 10px; right: 10px; bottom: 10px; }
}

.chatbot-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chatbot-panel-header h2 { margin: 0; font-size: 0.98rem; }
.chatbot-panel-header p { margin: 2px 0 0; font-size: 0.78rem; color: var(--text-muted); }
.chatbot-panel-header-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.chatbot-close {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.chatbot-close:hover { color: var(--text); background: var(--bg-alt); }

.chatbot-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot-message { font-size: 0.9rem; line-height: 1.5; max-width: 92%; }
.chatbot-message p { margin: 0; text-align: left; }

.chatbot-answer > * { margin: 0; text-align: left; }
.chatbot-answer > * + * { margin-top: 8px; }
.chatbot-answer ul,
.chatbot-answer ol { padding-left: 20px; }
.chatbot-answer li + li { margin-top: 2px; }
.chatbot-answer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chatbot-answer code {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

.chatbot-message-user {
  align-self: flex-end;
  background: var(--tag-bg);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px 12px 2px 12px;
}

.chatbot-message-assistant {
  align-self: flex-start;
  background: var(--bg-alt);
  padding: 10px 12px;
  border-radius: 12px 12px 12px 2px;
}

.chatbot-message-assistant.chatbot-pending { color: var(--text-muted); }
.chatbot-message-assistant.chatbot-error { color: var(--warn-text); background: var(--warn-bg); }

.chatbot-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chatbot-sources a.tag { text-decoration: underline; text-underline-offset: 2px; border: 1px solid var(--border-interactive); }
.chatbot-sources a.tag:hover { border-color: var(--accent); }

.chatbot-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
.chatbot-input:focus { border-color: var(--accent); }

.chatbot-send {
  border: none;
  cursor: pointer;
}
.chatbot-send:disabled { opacity: 0.5; cursor: default; }

.chatbot-panel-footer {
  padding: 8px 16px 12px;
  flex-shrink: 0;
  text-align: center;
}
.chatbot-privacy-link {
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chatbot-privacy-link:hover { opacity: 0.8; }

@media (max-width: 480px) {
  /* Reserve clear space at the very bottom of every page so the fixed
     chat launcher never sits on top of the footer or last section. */
  body { padding-bottom: 96px; }

  .chatbot-panel {
    right: 12px;
    left: 12px;
    bottom: 92px;
    width: auto;
    max-width: none;
  }
  .chatbot-launcher {
    right: 24px;
    bottom: 24px;
    width: 160px;
    padding-left: 14px;
    padding-right: 14px;
    white-space: nowrap;
    justify-content: center;
  }
}
