/* ---------- Fonts ---------- */
/* The Fraunces @font-face rule lives in layouts/base.njk, so its URL can carry
   the same content-hash version as the font preload. */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
::selection { background: var(--accent); color: var(--accent-ink); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Theme tokens ---------- */
:root {
  --bg: #f7f7fa;
  --surface: #ffffff;
  --surface-alt: #eef0f6;
  --ink: #192639;
  --ink-soft: #55617a;
  --border: #dde1ea;
  --accent: #4059c4;
  --accent-2: #7c5cef;
  --accent-ink: #ffffff;
  --accent-soft: #e8edfb;
  --accent-gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --warn-bg: #fff4e5;
  --warn-border: #f0b959;
  --warn-ink: #6b4a06;
  --max-width: 1120px;
  --shadow-color: 25, 38, 57;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --surface: #161d2c;
    --surface-alt: #1e2637;
    --ink: #eef1f7;
    --ink-soft: #aab3c5;
    --border: #2c3548;
    --accent: #8ba0ee;
    --accent-2: #b09dfa;
    --accent-ink: #0f1420;
    --accent-soft: #22304f;
    --warn-bg: #3a2c10;
    --warn-border: #a97a1c;
    --warn-ink: #ffd98c;
    --shadow-color: 0, 0, 0;
  }
}

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(var(--shadow-color), 0.03);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand .mark {
  width: 1.9rem;
  height: 1.9rem;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 2px 5px rgba(var(--shadow-color), 0.18));
}
.main-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
}
.main-nav a {
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 0.2rem;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
  transition: right 0.18s ease;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--accent);
}
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after {
  right: 0;
}
.nav-toggle {
  display: none;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-alt); }
.nav-toggle span {
  display: block;
  width: 1.35rem;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
  .main-nav ul { gap: 0.6rem 0.9rem; font-size: 0.88rem; }

  /* Collapse into a hamburger dropdown only once JS has confirmed the
     toggle button will actually work (see nav-toggle.js) - otherwise a
     no-JS visitor on mobile would have no way to open the nav at all. */
  .js-nav .nav-toggle { display: flex; }
  .js-nav .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(var(--shadow-color), 0.14);
    transition: max-height 0.25s ease;
    visibility: hidden;
    pointer-events: none;
  }
  .js-nav .main-nav.is-open { max-height: 70vh; overflow-y: auto; visibility: visible; pointer-events: auto; }
  .js-nav .main-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    font-size: 0.95rem;
  }
  .js-nav .main-nav a {
    display: block;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
  }
  .js-nav .main-nav a::after { display: none; }
}

main { min-height: 60vh; scroll-margin-top: 6.5rem; }
main:focus { outline: none; }
h1, h2 { scroll-margin-top: 6.5rem; }

.site-footer {
  position: relative;
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 4rem;
  padding: 2.5rem 0 2rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0.85;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2rem;
}
.footer-grid h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 0 0 0.75rem;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.45rem; }
.footer-grid a { color: var(--ink-soft); text-decoration: none; }
.footer-grid a:hover { color: var(--accent); }
.footer-grid .footer-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.footer-grid .footer-link:hover { color: var(--accent); text-decoration: underline; }
.footer-base {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 1.25rem 0 0;
}
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 0.35rem; color: var(--border); }

/* ---------- Hero ---------- */
.hero-band {
  position: relative;
  overflow: hidden;
  contain: paint;
  background-image:
    radial-gradient(38rem 26rem at -6rem -8rem, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(34rem 24rem at 110% 115%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%);
  background-repeat: no-repeat;
}
.hero {
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
  padding-bottom: clamp(1.5rem, 4vw, 3.5rem);
}
.hero-panel {
  position: relative;
  min-height: clamp(27rem, 43vw, 32rem);
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: #f2f4f8;
  box-shadow: 0 30px 70px -36px rgba(var(--shadow-color), 0.46), 0 1px 0 rgba(var(--shadow-color), 0.04);
}
.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: min(56%, 39rem);
  padding: clamp(2rem, 5vw, 4.5rem);
  color: #192639;
}
.hero-kicker,
.section-kicker {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: #4059c4;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 11ch;
  margin: 0 0 1rem;
  font-size: clamp(2.7rem, 5.4vw, 4.9rem);
  line-height: 0.97;
  letter-spacing: -0.04em;
}
.hero h1 span { display: block; color: #4059c4; }
.hero p {
  max-width: 32rem;
  margin: 0;
  color: #45536a;
  font-size: clamp(1rem, 1.7vw, 1.14rem);
  line-height: 1.6;
}
.hero-actions { display: flex; gap: 0.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.hero .btn-secondary { color: #192639; background: rgba(255, 255, 255, 0.88); border-color: #d6dbe5; }

.page-intro { padding: 2.5rem 0 1rem; }
.page-intro h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin: 0.5rem 0 0.75rem; }
.page-intro .lede { color: var(--ink-soft); font-size: 1.08rem; max-width: 46rem; }
.artist-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: 0.03em;
  margin-bottom: 1rem;
  box-shadow: 0 10px 22px -10px rgba(64, 89, 196, 0.55);
}
.artist-avatar-sm {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: color-mix(in srgb, var(--cat, var(--accent)) 62%, var(--ink));
  background: color-mix(in srgb, var(--cat, var(--accent)) 12%, var(--surface));
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.35rem;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  background: var(--accent-gradient);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -10px rgba(64, 89, 196, 0.55);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px rgba(64, 89, 196, 0.6); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 22px -14px rgba(var(--shadow-color), 0.4); }

/* ---------- Grids & cards ---------- */
.section { padding: clamp(3rem, 6vw, 4.5rem) 0; }
.section-featured { padding-top: clamp(2.75rem, 5vw, 4rem); }
.section-alt {
  background-color: var(--surface-alt);
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-head-intro { align-items: end; }
.section-head-intro .section-kicker { margin-bottom: 0.45rem; }
.section-head h2 { font-size: 1.5rem; margin: 0; position: relative; padding-left: 0.9rem; }
.section-head-intro h2 { font-size: clamp(1.65rem, 3vw, 2.2rem); }
.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  width: 4px;
  border-radius: 4px;
  background: var(--accent-gradient);
}
.section-head .see-all { font-size: 0.9rem; font-weight: 700; text-decoration: none; }
.section-head .see-all:hover { text-decoration: underline; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}
.guided-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1.25rem;
  margin: 0;
  padding: 0 0 0 1.6rem;
}
.guided-list li { padding-left: 0.35rem; }
.guided-list li::marker { color: var(--accent); font-size: 1.15rem; font-weight: 800; }
.guided-list .card { height: 100%; }
.start-next { margin: 3rem 0 1rem; padding: 1.5rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.start-next h2 { margin: 0 0 0.5rem; font-size: 1.35rem; }
.start-next p { margin: 0; color: var(--ink-soft); }
.featured-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: color-mix(in srgb, var(--cat, var(--accent)) 55%, var(--border));
  transform: translateY(-4px);
  box-shadow: 0 16px 28px -14px color-mix(in srgb, var(--cat, var(--accent)) 45%, rgba(25, 38, 57, 0.55));
}
.card h3 { margin: 0; font-size: 1.05rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }
.card:not(.card-category) p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.card-thumb {
  width: calc(100% + 2.5rem);
  max-width: none;
  margin: -1.25rem -1.25rem 0.25rem;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
  background: var(--surface-alt);
  transition: transform 0.35s ease;
}
.card:hover .card-thumb { transform: scale(1.05); }
.card-demo-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: color-mix(in srgb, var(--cat, var(--accent)) 62%, var(--ink));
  background:
    radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--cat, var(--accent)) 24%, transparent), transparent 38%),
    linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--cat, var(--accent)) 14%, var(--surface-alt)));
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.demo-thumb-icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 1.2rem;
  background: color-mix(in srgb, var(--cat, var(--accent)) 14%, var(--surface));
  box-shadow: 0 12px 28px -18px rgba(var(--shadow-color), 0.6);
}
.demo-thumb-icon svg { width: 2.2rem; height: 2.2rem; }
.card .tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--cat, var(--accent)) 62%, var(--ink));
  background: color-mix(in srgb, var(--cat, var(--accent)) 14%, var(--surface));
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.35rem;
  color: color-mix(in srgb, var(--cat, var(--accent)) 62%, var(--ink));
  font-size: 0.82rem;
  font-weight: 800;
}
.card-link span { transition: transform 0.15s ease; }
.card:hover .card-link span { transform: translateX(3px); }

/* Category cards (homepage "Explore by category") */
.category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}
.card-category {
  min-height: 11rem;
  gap: 0.75rem;
  padding: 1rem;
}
.card-category h3 { padding-right: 1.1rem; }
.card-category p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 0.35rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.category-card-copy { display: block; }
.category-arrow {
  position: absolute;
  top: 1.15rem;
  right: 1rem;
  color: color-mix(in srgb, var(--cat, var(--accent)) 62%, var(--ink));
  font-weight: 800;
  transition: transform 0.15s ease;
}
.card-category:hover .category-arrow { transform: translateX(3px); }
.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 10px;
  color: color-mix(in srgb, var(--cat, var(--accent)) 65%, var(--ink));
  background: color-mix(in srgb, var(--cat, var(--accent)) 15%, var(--surface));
  margin-bottom: 0.15rem;
  transition: transform 0.2s ease, background 0.2s ease;
}
.category-icon svg { width: 1.4rem; height: 1.4rem; }
.card-category:hover .category-icon {
  background: color-mix(in srgb, var(--cat, var(--accent)) 70%, var(--ink));
  color: var(--accent-ink);
  transform: scale(1.06) rotate(-4deg);
}

.category-hero {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--cat, var(--accent)) 8%, var(--surface-alt));
  border: 1px solid color-mix(in srgb, var(--cat, var(--accent)) 20%, var(--border));
  border-radius: 16px;
  padding: 2rem;
  margin: 1.5rem 0 2.5rem;
}
.category-hero::after {
  content: "";
  position: absolute;
  top: -3rem;
  right: -3rem;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cat, var(--accent)) 25%, transparent);
  filter: blur(8px);
  z-index: 0;
}
.category-hero > * { position: relative; z-index: 1; }
.category-hero .category-icon-lg {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 12px;
  margin-bottom: 0.85rem;
}
.category-hero .category-icon-lg svg { width: 1.9rem; height: 1.9rem; }
.category-hero h1 { margin: 0.4rem 0 0.75rem; }
.category-hero p { color: var(--ink-soft); max-width: 48rem; margin: 0; font-size: 1.05rem; }

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 2rem;
}
.category-pill {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--surface);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.category-pill:hover, .category-pill[aria-current="page"] {
  border-color: var(--cat, var(--accent));
  color: color-mix(in srgb, var(--cat, var(--accent)) 62%, var(--ink));
  background: color-mix(in srgb, var(--cat, var(--accent)) 10%, var(--surface));
}

/* ---------- Library filtering ---------- */
.library-tools {
  display: none;
  grid-template-columns: minmax(16rem, 1fr) auto auto;
  gap: 1rem;
  align-items: end;
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.js-library .library-tools { display: grid; }
.library-search { display: grid; gap: 0.35rem; }
.library-search span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.library-search input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
.library-search input::placeholder { color: var(--ink-soft); opacity: 0.8; }
.library-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0 0.35rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.library-toggle input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.library-count { margin: 0 0 0.65rem; color: var(--ink-soft); font-size: 0.88rem; white-space: nowrap; }
.library-empty {
  margin: 1.5rem 0 0;
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--ink-soft);
  text-align: center;
}
.illusion-card[hidden] { display: none; }

/* ---------- Article content ---------- */
.article {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}
.article h2 { margin-top: 2.2rem; font-size: 1.4rem; }
.article h3 { margin-top: 1.6rem; font-size: 1.15rem; }
.article p { margin: 1rem 0; }
.article ul, .article ol { padding-left: 1.4rem; }
.article blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
}
.page-intro .meta-row,
.article .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0.75rem 0 1.5rem;
}

.byline a { color: inherit; font-weight: 600; }
.byline-author { display: inline-flex; align-items: center; gap: 0.5rem; }
.byline-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.author-photo {
  display: block;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  margin: 0 0 1.5rem;
}
.references {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.references h2 { margin-top: 0; font-size: 1.15rem; color: var(--ink); }
.references ol { padding-left: 1.4rem; }
.references li { margin: 0.45rem 0; overflow-wrap: anywhere; }

.illusion-page .page-intro,
.illusion-page .article,
.illusion-page .meta-panel,
.illusion-page > .wrap > p {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
}
.illusion-page .page-intro { padding-top: 2.25rem; }
.illusion-page .related-panel { margin-left: auto; margin-right: auto; }

/* ---------- Illusion demo stage ---------- */
.demo-stage {
  position: relative;
  background: linear-gradient(180deg, var(--surface-alt), var(--surface));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.25rem;
  margin: 1.75rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 20px 40px -28px rgba(var(--shadow-color), 0.4);
}
.illusion-page > .wrap > .demo-stage {
  max-width: 58rem;
  margin: 1.75rem auto 2.75rem;
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}
.illusion-page > .wrap > .demo-stage > svg {
  width: min(100%, 23rem);
  height: auto;
}
.demo-stage::before {
  content: "";
  position: absolute;
  top: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--accent-gradient);
  opacity: 0.7;
}
.demo-stage figcaption,
.demo-caption {
  font-size: 0.88rem;
  color: var(--ink-soft);
  text-align: center;
  max-width: 34rem;
}
.demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}
.demo-controls label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.demo-photo {
  width: 100%;
  max-width: 26rem;
  max-height: 26rem;
  object-fit: contain;
  border-radius: 12px;
  background: var(--surface);
}
.demo-placeholder {
  width: 100%;
  max-width: 26rem;
  aspect-ratio: 4 / 3;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 1.5rem;
  background: var(--surface);
}

/* ---------- Match-the-size measurement tests (js/match-test.js) ---------- */
.mt-test > svg { width: min(100%, 24rem); height: auto; }
.mt-test [hidden] { display: none; }
.mt-progress { margin: 0; font-weight: 700; color: var(--ink); text-align: center; }
.mt-controls { flex-direction: column; width: 100%; }
.mt-controls label { text-align: center; }
.mt-range { width: min(100%, 22rem); accent-color: var(--accent); }
.mt-results { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; width: 100%; }
.mt-headline { margin: 0; font-size: 1.15rem; font-weight: 700; text-align: center; max-width: 34rem; }
.mt-chart { width: min(100%, 24rem); }
.mt-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.mt-table { width: min(100%, 30rem); font-size: 0.88rem; color: var(--ink-soft); }
.mt-table summary { cursor: pointer; text-align: center; font-weight: 600; }
.mt-table table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.mt-table th, .mt-table td { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border); }
.mt-table th { color: var(--ink); }
.mt-share { display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.82rem; color: var(--ink-soft); max-width: 34rem; }
.mt-share input { accent-color: var(--accent); }
.mt-crowd:empty { display: none; }

/* ---------- Visitor polls (js/poll.js) ---------- */
.poll {
  max-width: 46rem;
  margin: -1rem auto 2.75rem;
  padding: 1.25rem 1.5rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.poll [hidden] { display: none; }
.poll-title { font-size: 1.1rem; margin: 0 0 0.75rem; }
.poll fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.poll legend { font-weight: 600; margin-bottom: 0.5rem; padding: 0; }
.poll-optional { font-weight: 400; color: var(--ink-soft); }
.poll-option { display: flex; gap: 0.6rem; align-items: center; padding: 0.3rem 0; cursor: pointer; }
.poll-option input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
.poll-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.poll-note { font-size: 0.85rem; color: var(--ink-soft); margin: 0.75rem 0 0; }
.poll-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.poll-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 0.75rem; align-items: center; }
.poll-bar-label { grid-column: 1 / -1; font-size: 0.92rem; }
.poll-bar-row.is-mine .poll-bar-label { font-weight: 700; }
.poll-you { font-weight: 400; color: var(--ink-soft); }
.poll-bar-track { height: 0.75rem; border-radius: 4px; background: var(--surface-alt); overflow: hidden; }
.poll-bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.poll-bar-value { font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; min-width: 5.5rem; text-align: right; }
.poll-table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.poll-table caption { text-align: left; color: var(--ink-soft); margin-bottom: 0.4rem; }
.poll-table th, .poll-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); text-align: right; }
.poll-table th[scope="row"], .poll-table thead th:first-child { text-align: left; }
@media (max-width: 640px) { .poll { padding: 1rem; margin-top: -1.25rem; } }

/* ---------- Notices ---------- */
.notice {
  position: relative;
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 10px;
  padding: 1rem 1.25rem 1rem 3rem;
  font-size: 0.92rem;
  margin: 1.75rem 0;
}
.notice::before {
  content: "⚠";
  position: absolute;
  left: 1.1rem;
  top: 1rem;
  font-size: 1.1rem;
  line-height: 1;
}
.notice strong { display: block; margin-bottom: 0.25rem; }

/* ---------- Related & meta panels ---------- */
.related-panel {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding-top: 2rem;
}
.related-panel h2 { font-size: 1.25rem; }
.meta-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
  box-shadow: 0 12px 28px -22px rgba(var(--shadow-color), 0.5);
}
.meta-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; }
.meta-panel dt { color: var(--ink-soft); font-weight: 600; }
.meta-panel dd { margin: 0; }

/* ---------- Cookie consent ---------- */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0,0,0,0.12);
  padding: 1rem 1.25rem;
  display: none;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
}
.cookie-banner.is-visible { display: block; }
.cookie-banner .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}
.cookie-banner p { margin: 0; font-size: 0.88rem; color: var(--ink-soft); max-width: 42rem; }
.cookie-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.cookie-actions button {
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.cookie-actions button.accept { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Utility ---------- */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }

@media (max-width: 960px) {
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .hero { padding-top: 1rem; padding-bottom: 1.5rem; }
  .hero-panel { min-height: 0; display: flex; flex-direction: column; align-items: stretch; }
  .hero-image {
    position: relative;
    order: 2;
    aspect-ratio: 16 / 9;
    object-position: 72% center;
  }
  .hero-copy { width: 100%; padding: 2rem 1.5rem 1.5rem; }
  .hero h1 { max-width: 10ch; font-size: clamp(2.6rem, 13vw, 4rem); }
  .hero p { max-width: 30rem; }
  .hero-actions { margin-top: 1.5rem; }
  .featured-grid {
    display: flex;
    width: calc(100% + 1.25rem);
    padding-right: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }
  .featured-grid .card {
    flex: 0 0 min(82vw, 23rem);
    scroll-snap-align: start;
  }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-category { min-height: 10rem; }
  .library-tools { grid-template-columns: 1fr; align-items: stretch; }
  .library-count { margin: 0; }
  .illusion-page > .wrap > .demo-stage { border-radius: 12px; padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 520px) {
  .section { padding: 2.75rem 0; }
  .section-head { align-items: flex-end; }
  .section-head .see-all { font-size: 0.82rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .category-grid { gap: 0.7rem; }
  .card-category { min-height: 0; padding: 0.9rem; }
  .card-category p { display: none; }
  .category-icon { width: 2.5rem; height: 2.5rem; }
  .category-arrow { top: 1rem; right: 0.85rem; }
  .cookie-banner { padding: 0.85rem 1rem; }
  .cookie-banner .wrap { gap: 0.75rem; }
  .cookie-banner p { font-size: 0.8rem; line-height: 1.45; }
  .cookie-actions { width: 100%; }
  .cookie-actions button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
