/* ==========================================================================
   Douglas³ — The Thermodynamics of AI Creativity
   style.css — All styles for the site
   ========================================================================== */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* ---------- CUSTOM PROPERTIES ---------- */
:root {
  /* Colors */
  --color-bg: #0A0A0A;
  --color-bg-card: #141414;
  --color-bg-card-hover: #1a1a1a;
  --color-primary: #FFE500;
  --color-primary-dim: rgba(255, 229, 0, 0.15);
  --color-text: #F0F0F0;
  --color-text-muted: #888;
  --color-text-dim: #555;
  --color-border: #222;
  --color-highlight-bg: #FFE500;
  --color-highlight-text: #0A0A0A;

  /* Typography */
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Type scale (fluid) */
  --text-hero: clamp(2.5rem, 7vw, 5rem);
  --text-brand: clamp(1.5rem, 4vw, 2.5rem);
  --text-h2: clamp(1.75rem, 5vw, 3rem);
  --text-term: clamp(1.4rem, 4vw, 2.2rem);
  --text-h3: clamp(1.2rem, 3vw, 1.6rem);
  --text-body: clamp(0.95rem, 2.5vw, 1.1rem);
  --text-small: clamp(0.8rem, 2vw, 0.875rem);
  --text-xs: clamp(0.7rem, 1.5vw, 0.75rem);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  --space-2xl: 10rem;

  /* Layout */
  --max-width: 1200px;
  --content-padding: clamp(1.25rem, 5vw, 3rem);

  /* Animation */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 800ms;
}

/* ---------- BASE ---------- */
body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--color-text);
  background: var(--color-bg);
}

::selection {
  background: var(--color-primary);
  color: var(--color-bg);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: opacity var(--duration-fast);
}
a:hover { opacity: 0.8; }

/* ---------- SCROLL PROGRESS BAR ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--color-primary);
  z-index: 1000;
  transition: none;
}

/* ---------- DON'T PANIC OVERLAY ---------- */
.dont-panic {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: clamp(3rem, 12vw, 8rem);
  font-weight: 700;
  color: var(--color-primary);
  background: rgba(10, 10, 10, 0.92);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.dont-panic.visible {
  opacity: 1;
}

/* ---------- NAVIGATION ---------- */
.site-header {
  position: fixed;
  top: 3px;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--content-padding);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: transform var(--duration-normal) var(--ease-out);
}

.logo {
  font-family: var(--font-heading);
  font-size: var(--text-brand);
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
  cursor: pointer;
}
.logo sup {
  color: var(--color-primary);
  font-size: 0.6em;
  top: -0.4em;
}
.logo:hover { opacity: 1; }
.logo:hover sup { text-shadow: 0 0 12px rgba(255, 229, 0, 0.5); }

.main-nav {
  display: none;
  gap: var(--space-md);
}
.main-nav a {
  font-family: var(--font-heading);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--duration-fast);
}
.main-nav a:hover { color: var(--color-primary); opacity: 1; }

/* Hamburger */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 1001;
}

@media (min-width: 768px) {
  .main-nav { display: flex; }
  .menu-toggle { display: none; }
}
.menu-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: transform var(--duration-fast), opacity var(--duration-fast);
}
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 899;
  background: rgba(10, 10, 10, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.mobile-menu[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}
.mobile-menu nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  text-align: center;
}
.mobile-menu a {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--duration-fast);
}
.mobile-menu a:hover { color: var(--color-primary); opacity: 1; }

/* ---------- SECTION LAYOUT ---------- */
.section {
  position: relative;
  padding: var(--space-xl) 0;
}
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

/* Section heading with yellow highlight */
.section-heading {
  font-family: var(--font-heading);
  font-size: var(--text-h2);
  font-weight: 700;
  margin-bottom: var(--space-lg);
  letter-spacing: -0.02em;
}

/* Yellow highlight block (like the booklet) */
.highlight-block {
  display: inline;
  background: var(--color-primary);
  color: var(--color-highlight-text);
  padding: 0.05em 0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- HERO ---------- */
.section--hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
  filter: saturate(0.6);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 10, 0.4) 0%,
    rgba(10, 10, 10, 0.7) 50%,
    rgba(10, 10, 10, 1) 100%
  );
}

/* Hero particle canvas */
#hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: var(--content-padding);
}

/* Hero entrance animation */
.hero-entrance {
  opacity: 0;
  transform: translateY(28px);
  animation: heroEntrance 0.8s var(--ease-out) forwards;
  animation-delay: calc(0.3s + var(--entrance-order, 0) * 0.15s);
}
@keyframes heroEntrance {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-brand {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}
.hero-brand sup {
  color: var(--color-primary);
  font-size: 0.65em;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
}
.hero-title .highlight-block {
  display: inline-block;
  margin-bottom: 0.1em;
}

.hero-byline {
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.hero-event {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

.scroll-hint {
  position: absolute;
  bottom: var(--space-md);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  animation: float 2s ease-in-out infinite;
}
.scroll-hint-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.scroll-hint-arrow {
  font-size: 1.2rem;
  color: var(--color-primary);
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- FORWARD ---------- */
.section--forward {
  background: var(--color-primary);
  color: var(--color-bg);
}
.section--forward .section-heading { color: var(--color-bg); }
.section--forward .highlight-block {
  background: var(--color-bg);
  color: var(--color-primary);
}

.forward-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}
@media (min-width: 768px) {
  .forward-grid {
    grid-template-columns: 1fr 1.5fr;
    gap: var(--space-lg);
    align-items: start;
  }
}

.forward-image img {
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.forward-text p {
  margin-bottom: var(--space-sm);
  font-size: var(--text-body);
  line-height: 1.7;
}
.forward-text em { font-style: italic; }
.forward-text strong {
  font-weight: 600;
  background: rgba(10, 10, 10, 0.1);
  padding: 0.1em 0.2em;
}
.forward-sign-off {
  font-style: italic;
  opacity: 0.8;
  margin-top: var(--space-md) !important;
}

.forward-meta {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 2px solid rgba(10, 10, 10, 0.15);
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: rgba(10, 10, 10, 0.6);
}

/* ---------- INTRO SECTION ---------- */
.section--intro {
  padding: 0;
}

.intro-scroll-container {
  scroll-snap-type: y mandatory;
  overflow-y: auto;
  height: 100vh;
  height: 100dvh;
}

.intro-card {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.intro-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.55);
}
.intro-quote {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: var(--space-md) var(--content-padding);
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
  text-align: center;
}
/* Word reveal spans */
.intro-quote .word-span {
  display: inline-block;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  transition-delay: calc(var(--word-index, 0) * 0.06s);
}
.intro-card.revealed .word-span {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- NEOLOGISM CARDS ---------- */
.section--neologisms {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.term-card {
  margin-bottom: var(--space-md);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}
.term-card:hover {
  border-color: rgba(255, 229, 0, 0.3);
  background: var(--color-bg-card-hover);
}

.term-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.term-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}
.term-card:hover .term-card-image img {
  transform: scale(1.03);
}

.term-details summary { list-style: none; cursor: pointer; }
.term-details summary::-webkit-details-marker { display: none; }

.term-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 var(--space-sm);
  padding: var(--space-md);
  align-items: start;
}

.term-number {
  grid-row: 1 / 3;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--color-primary);
  opacity: 0.6;
  padding-top: 0.3em;
}

.term-header {
  grid-column: 2;
  grid-row: 1;
}

.term-name {
  font-family: var(--font-heading);
  font-size: var(--text-term);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  display: inline;
  background: var(--color-primary);
  color: var(--color-highlight-text);
  padding: 0.02em 0.2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.term-pronunciation {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin-top: 0.3em;
}

.term-teaser {
  grid-column: 2;
  grid-row: 2;
  font-size: var(--text-body);
  color: var(--color-text);
  margin-top: var(--space-xs);
  line-height: 1.5;
}

.term-toggle {
  grid-column: 3;
  grid-row: 1 / 3;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  position: relative;
}
.term-toggle::before,
.term-toggle::after {
  content: '';
  position: absolute;
  background: var(--color-text-muted);
  transition: transform var(--duration-normal) var(--ease-out);
}
.term-toggle::before {
  width: 14px;
  height: 2px;
}
.term-toggle::after {
  width: 2px;
  height: 14px;
}
details[open] .term-toggle::after {
  transform: rotate(90deg);
  opacity: 0;
}

.term-body {
  padding: 0 var(--space-md) var(--space-md);
  padding-left: calc(var(--space-md) + 2.5rem);
  animation: slideDown var(--duration-normal) var(--ease-out);
}
.term-body p {
  margin-bottom: var(--space-xs);
  line-height: 1.6;
  color: var(--color-text);
}
.term-body strong { color: var(--color-primary); font-weight: 600; }
.term-body em { font-style: italic; color: var(--color-text); }

.term-body h4 {
  font-family: var(--font-heading);
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sub-terms */
.sub-terms {
  display: grid;
  gap: var(--space-sm);
}
.sub-terms dt {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-body);
  color: var(--color-text);
}
.sub-terms dt .term-pronunciation {
  display: inline;
  font-size: var(--text-xs);
  margin-left: 0.5em;
}
.sub-terms dd {
  font-size: var(--text-body);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-xs);
}

/* Proverb card variant */
.term-card--proverb .term-body--proverb {
  padding-left: var(--space-md);
}
.proverb-block {
  margin-bottom: var(--space-md);
  padding-left: var(--space-md);
  border-left: 3px solid var(--color-primary);
}
.proverb-block p {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text) !important;
}
.proverb-block cite {
  display: block;
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-text-muted);
  font-style: normal;
}
.proverb-block--ai {
  border-color: var(--color-text-muted);
}
.proverb-block--ai p { color: var(--color-text-muted) !important; }

/* ---------- PULL QUOTES ---------- */
.pull-quote {
  padding: var(--space-2xl) var(--content-padding);
  text-align: center;
}
.pull-quote p {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  font-weight: 700;
  font-style: italic;
  color: var(--color-primary);
  line-height: 1.2;
  max-width: 800px;
  margin: 0 auto;
}
@media (min-width: 1024px) {
  .pull-quote {
    grid-column: 1 / -1;
  }
}

/* ---------- AFTERWORD ---------- */
.section--afterword {
  background: var(--color-primary);
  color: var(--color-bg);
}
.section--afterword .section-heading { color: var(--color-bg); }
.section--afterword .highlight-block {
  background: var(--color-bg);
  color: var(--color-primary);
}

.afterword-intro {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: 500;
  margin-bottom: var(--space-lg);
  font-style: italic;
}

.insights-list {
  list-style: none;
  counter-reset: insights;
  display: grid;
  gap: 0;
  margin-bottom: var(--space-lg);
}
.insight {
  counter-increment: insights;
  position: relative;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: clamp(4rem, 12vw, 8rem);
  padding-right: var(--content-padding);
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}
.insight::before {
  content: counter(insights);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: clamp(4rem, 15vw, 10rem);
  font-weight: 700;
  color: rgba(10, 10, 10, 0.1);
  line-height: 1;
}
.insights-list h3 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--color-bg);
}
.insights-list p {
  line-height: 1.7;
  color: rgba(10, 10, 10, 0.85);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  max-width: 600px;
}
/* Final insight: inverted colours for impact */
.insight--final {
  background: var(--color-bg);
  margin: 0 calc(-1 * var(--content-padding));
  padding-left: calc(var(--content-padding) + clamp(4rem, 12vw, 8rem));
  padding-right: calc(var(--content-padding) * 2);
}
.insight--final h3 {
  color: var(--color-primary);
  font-size: clamp(2rem, 6vw, 4rem);
}
.insight--final p {
  color: var(--color-text);
}
.insight--final::before {
  color: rgba(255, 229, 0, 0.1);
  left: var(--content-padding);
}

.afterword-closing {
  font-size: var(--text-body);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
  color: rgba(10, 10, 10, 0.85);
}
.afterword-sign-off {
  margin-top: var(--space-lg);
  font-family: var(--font-heading);
  font-size: var(--text-body);
}
.afterword-sign-off strong { color: var(--color-bg); }

/* ---------- ABOUT ---------- */
.section--about {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}
@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
  .about-bio { grid-column: 1 / -1; }
}

.about-bio h3,
.about-work h3,
.about-research h3 {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.about-role {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-primary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.about-bio p {
  line-height: 1.7;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.work-list {
  list-style: none;
  display: grid;
  gap: var(--space-sm);
}
.work-list li {
  padding: var(--space-sm);
  background: var(--color-bg-card);
  border-radius: 6px;
  border: 1px solid var(--color-border);
  font-size: var(--text-body);
  line-height: 1.6;
  color: var(--color-text-muted);
}
.work-list strong {
  color: var(--color-primary);
  font-weight: 600;
}

.research-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.research-list li {
  padding: 0.4em 0.8em;
  background: var(--color-primary-dim);
  border: 1px solid rgba(255, 229, 0, 0.2);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-primary);
}

/* ---------- FOOTER ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg) 0;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}
@media (min-width: 768px) {
  .footer-inner { grid-template-columns: auto 1fr auto; align-items: start; }
}

.logo--footer {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
}

.footer-credits,
.footer-links {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  line-height: 1.8;
}
.footer-credits strong { color: var(--color-text); }

@media (min-width: 768px) {
  .footer-links { text-align: right; }
}

/* ---------- DOUGLASES EASTER EGG ---------- */
.douglases-egg {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.douglases-egg[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}
.douglases-content {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: var(--space-lg);
  max-width: 420px;
  width: 90%;
  position: relative;
}
.douglases-content h3 {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.douglases-content h3 sup { color: var(--color-primary); }
.douglases-content > p {
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}
.douglases-content ul {
  list-style: none;
  display: grid;
  gap: var(--space-sm);
}
.douglases-content li {
  font-size: var(--text-body);
  color: var(--color-text-muted);
}
.douglases-content li strong {
  color: var(--color-primary);
  display: block;
  font-family: var(--font-heading);
  font-size: var(--text-h3);
}
.douglases-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.douglases-close:hover { color: var(--color-text); }

/* ---------- FLOATING TERM COUNTER ---------- */
.term-counter {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}
.term-counter.visible {
  opacity: 1;
}
.term-counter-current {
  color: var(--color-primary);
  font-weight: 700;
}
.term-counter-sep {
  color: var(--color-text-dim);
  margin: 0 0.2em;
}
.term-counter-total {
  color: var(--color-text-dim);
}
@media (max-width: 767px) {
  .term-counter { display: none; }
}

/* ---------- ANIMATED HIGHLIGHT EFFECT ---------- */
.reveal .highlight-block {
  background: linear-gradient(var(--color-primary), var(--color-primary)) no-repeat left bottom;
  background-size: 0% 100%;
  color: var(--color-highlight-text);
  transition: background-size 0.8s var(--ease-out);
}
.reveal.revealed .highlight-block {
  background-size: 100% 100%;
}
/* Inverted variant for forward/afterword */
.section--forward .reveal .highlight-block {
  background: linear-gradient(var(--color-bg), var(--color-bg)) no-repeat left bottom;
  background-size: 0% 100%;
  color: var(--color-primary);
}
.section--forward .reveal.revealed .highlight-block {
  background-size: 100% 100%;
}
.section--afterword .reveal .highlight-block {
  background: linear-gradient(var(--color-bg), var(--color-bg)) no-repeat left bottom;
  background-size: 0% 100%;
  color: var(--color-primary);
}
.section--afterword .reveal.revealed .highlight-block {
  background-size: 100% 100%;
}

/* ---------- SCROLL REVEAL ANIMATIONS ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger reveals for intro cards */
.intro-cards .reveal:nth-child(2) { transition-delay: 100ms; }
.intro-cards .reveal:nth-child(3) { transition-delay: 200ms; }
.intro-cards .reveal:nth-child(4) { transition-delay: 300ms; }

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

/* Skip link (added by JS) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--content-padding);
  background: var(--color-primary);
  color: var(--color-bg);
  padding: 0.5em 1em;
  z-index: 10000;
  font-family: var(--font-heading);
  font-weight: 600;
  border-radius: 0 0 4px 4px;
}
.skip-link:focus {
  top: 0;
}

/* ---------- CUSTOM CURSOR ---------- */
@media (hover: hover) and (pointer: fine) {
  body.cursor-active { cursor: none; }
  body.cursor-active a,
  body.cursor-active button,
  body.cursor-active summary,
  body.cursor-active [role="button"] { cursor: none; }
}
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background: var(--color-primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: width 0.2s var(--ease-out), height 0.2s var(--ease-out),
              background 0.2s var(--ease-out), border 0.2s var(--ease-out);
  display: none;
}
body.cursor-active .custom-cursor { display: block; }
.custom-cursor.cursor-hover {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 2px solid var(--color-primary);
}

/* ---------- HEADER HIDE ON SCROLL ---------- */
.site-header.header-hidden {
  transform: translateY(-100%);
}

/* ---------- NOISE TEXTURE OVERLAY ---------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---------- RESPONSIVE FINE-TUNING ---------- */
@media (max-width: 480px) {
  .term-summary {
    grid-template-columns: 1fr auto;
    gap: 0;
  }
  .term-number {
    grid-row: 1;
    grid-column: 1;
    margin-bottom: 0.3em;
  }
  .term-header {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .term-teaser {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .term-toggle {
    grid-column: 2;
    grid-row: 1;
  }
  .term-body {
    padding-left: var(--space-md);
  }
}

/* ---------- MAGAZINE LAYOUT (DESKTOP) ---------- */
@media (min-width: 1024px) {
  .section--neologisms .section-inner {
    max-width: 1100px;
  }
  .term-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: transparent;
    border: none;
    border-radius: 0;
    gap: 0;
    margin-bottom: var(--space-xl);
  }
  .term-card:hover {
    background: transparent;
    border-color: transparent;
  }
  .term-card-image {
    aspect-ratio: auto;
    min-height: 300px;
    border-radius: 8px;
    overflow: hidden;
  }
  .term-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .term-summary {
    padding: var(--space-lg);
  }
  .term-body {
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
  }
  /* Alternate: even cards have text LEFT, image RIGHT */
  .term-card:nth-child(even) {
    direction: rtl;
  }
  .term-card:nth-child(even) > * {
    direction: ltr;
  }
  /* Proverb card stays full width */
  .term-card--proverb {
    grid-template-columns: 1fr;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- IMAGE DUOTONE TREATMENT ---------- */
.term-card-image {
  position: relative;
}
.term-card-image img {
  filter: contrast(1.05) saturate(0.85);
}
.term-card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 229, 0, 0.06);
  mix-blend-mode: multiply;
  pointer-events: none;
}
