/* ========================================
   PORTFOLIO — Wuthering Heights gothic romance aesthetic
   Warm parchment tones, deep burgundy accents, IM Fell French Canon + EB Garamond
   ======================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette — dark green-black & mossy chartreuse */
  --bg:        #0a1210;
  --bg-raised: #0a1210;
  --bg-card:   #0f1a17;
  --bg-hover:  #162320;
  --border:    #2a3d38;
  --text:      #e0ddd8;
  --text-dim:  #a89e94;
  --text-muted:#7a7068;
  --accent:    #c4b8a8;
  --accent-2:  #c4b8a8;
  --accent-3:  #c4b8a8;
  --accent-4:  #d6cabb;
  --accent-red:#c4b8a8;

  /* Typography */
  --font-display: 'IM Fell French Canon', serif;
  --font-body: 'EB Garamond', 'Georgia', 'Times New Roman', serif;

  /* Spacing */
  --container: 1120px;
  --gap: 24px;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

/* Subtle Carrara marble parallax texture — toned down so paintings carry the visual weight */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.15;
  background-image:
    /* Fine veining layer */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='800'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.04' numOctaves='5' seed='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.06' intercept='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)' fill='%23857b6f'/%3E%3C/svg%3E"),
    /* Broad vein layer */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='1200'%3E%3Cfilter id='v'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.015' numOctaves='3' seed='8'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.045' intercept='0'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23v)' fill='%236e645a'/%3E%3C/svg%3E");
  background-size: 800px 800px, 1200px 1200px;
}

/* Ensure all content sits above the marble texture */
body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--accent);
}

img {
  display: block;
  max-width: 100%;
}

/* ---------- Container ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: none;
}

/* Soft gradient fade below nav — no harsh line */
.nav::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 24px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.02), transparent);
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 28px;
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.nav-links a:hover,
.nav-links a.active {
  color: #fff;
}

/* Reading page — white nav over dark hero, matching home page */
body:has(.reading-hero) .nav-logo {
  color: #fff;
}
body:has(.reading-hero) .nav-links a {
  color: rgba(255, 255, 255, 0.7);
}
body:has(.reading-hero) .nav-links a:hover,
body:has(.reading-hero) .nav-links a.active {
  color: #fff;
}
body:has(.reading-hero) .nav-toggle-bar {
  background: #fff;
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
}

.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 1.5px;
  background: #fff;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

/* Animate to X when open */
.nav-toggle.open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-toggle.open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ---------- Accent ---------- */
.accent {
  color: var(--accent);
}

/* ---------- Tag ---------- */
.tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  font-style: italic;
  padding: 5px 16px;
  border-radius: 4px;
  background: rgba(122, 154, 58, 0.1);
  backdrop-filter: blur(4px);
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

/* ========================================
   HERO
   ======================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
  padding-bottom: 80px;
}

/* Full-bleed painting background */
.hero-painting {
  position: absolute;
  inset: 0;
  background: url('../images/still life.jpeg') center 40%/cover no-repeat;
  background-attachment: fixed;
  transition: opacity 0.6s ease;
  z-index: 0;
}

/* Subtle full-bleed darkening overlay for legibility */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.34);
}

/* Grid background — disabled */
.hero-grid-bg {
  display: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
}

/* Decorative white border box */
.hero-box {
  border: 1px solid #fff;
  padding: 40px 44px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
  color: #fff;
}

.hero-bio {
  font-family: var(--font-body);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  max-width: 560px;
  margin-bottom: 28px;
}

.hero-meta {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tag {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  padding: 5px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.14em;
  z-index: 2;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  animation: scrollBounce 2.4s ease-in-out infinite;
}

.scroll-line {
  width: 2px;
  height: 56px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 1), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* ========================================
   SECTIONS — Shared
   ======================================== */
.section {
  padding: 80px 0;
  position: relative;
}

.section-alt {
  background: var(--bg-raised);
}

.section-header {
  margin-bottom: 48px;
}

.section-label {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
}

.section-subtitle {
  font-family: var(--font-body);
  color: var(--text-dim);
  font-size: 17px;
  font-style: italic;
  max-width: 520px;
}

/* ========================================
   ART INTERLUDES — full-bleed painting breaks
   ======================================== */
.art-interlude {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.art-interlude img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 60vh;
  object-fit: cover;
}

/* ---------- Subsections ---------- */
.subsection {
  margin-bottom: 48px;
}

.subsection:last-child {
  margin-bottom: 0;
}

.subsection-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

/* ========================================
   AUDIO
   ======================================== */
.audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--gap);
}

.audio-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s;
}
.audio-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.audio-embed {
  width: 100%;
  aspect-ratio: 3 / 1;
  position: relative;
  overflow: hidden;
}

.audio-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.audio-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  padding: 20px;
}

/* Waveform — sharp bars, animate on hover only */
.waveform {
  display: flex;
  align-items: end;
  gap: 1.5px;
  height: 48px;
  width: 100%;
  padding: 0 12px;
}

.waveform span {
  display: block;
  flex: 1;
  max-width: 4px;
  min-width: 1px;
  border-radius: 0.5px;
  background: var(--accent);
  opacity: 0.35;
  transform-origin: bottom;
  transition: height 0.08s ease, transform 0.15s ease, opacity 0.15s ease;
}

/* Play button for audio waveform cards */
.audio-link {
  text-decoration: none;
  display: block;
}

.waveform-play {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-right: 12px;
}

.waveform-play svg {
  width: 14px;
  height: 14px;
  margin-left: 2px;
}

.audio-card:hover .waveform-play {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.audio-placeholder:has(.waveform-play) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.waveform span:nth-child(1)  { height: 20%; }
.waveform span:nth-child(2)  { height: 45%; }
.waveform span:nth-child(3)  { height: 70%; }
.waveform span:nth-child(4)  { height: 50%; }
.waveform span:nth-child(5)  { height: 90%; }
.waveform span:nth-child(6)  { height: 60%; }
.waveform span:nth-child(7)  { height: 80%; }
.waveform span:nth-child(8)  { height: 40%; }
.waveform span:nth-child(9)  { height: 65%; }
.waveform span:nth-child(10) { height: 95%; }
.waveform span:nth-child(11) { height: 55%; }
.waveform span:nth-child(12) { height: 75%; }
.waveform span:nth-child(13) { height: 35%; }
.waveform span:nth-child(14) { height: 85%; }
.waveform span:nth-child(15) { height: 50%; }
.waveform span:nth-child(16) { height: 70%; }
.waveform span:nth-child(17) { height: 40%; }
.waveform span:nth-child(18) { height: 60%; }
.waveform span:nth-child(19) { height: 30%; }
.waveform span:nth-child(20) { height: 50%; }
.waveform span:nth-child(21) { height: 45%; }
.waveform span:nth-child(22) { height: 80%; }
.waveform span:nth-child(23) { height: 55%; }
.waveform span:nth-child(24) { height: 90%; }
.waveform span:nth-child(25) { height: 35%; }
.waveform span:nth-child(26) { height: 70%; }
.waveform span:nth-child(27) { height: 50%; }
.waveform span:nth-child(28) { height: 85%; }
.waveform span:nth-child(29) { height: 40%; }
.waveform span:nth-child(30) { height: 65%; }
.waveform span:nth-child(31) { height: 75%; }
.waveform span:nth-child(32) { height: 45%; }
.waveform span:nth-child(33) { height: 90%; }
.waveform span:nth-child(34) { height: 60%; }
.waveform span:nth-child(35) { height: 80%; }
.waveform span:nth-child(36) { height: 30%; }
.waveform span:nth-child(37) { height: 55%; }
.waveform span:nth-child(38) { height: 70%; }
.waveform span:nth-child(39) { height: 40%; }
.waveform span:nth-child(40) { height: 60%; }
.waveform span:nth-child(41) { height: 55%; }
.waveform span:nth-child(42) { height: 75%; }
.waveform span:nth-child(43) { height: 35%; }
.waveform span:nth-child(44) { height: 85%; }
.waveform span:nth-child(45) { height: 50%; }
.waveform span:nth-child(46) { height: 65%; }
.waveform span:nth-child(47) { height: 40%; }
.waveform span:nth-child(48) { height: 90%; }
.waveform span:nth-child(49) { height: 55%; }
.waveform span:nth-child(50) { height: 70%; }
.waveform span:nth-child(51) { height: 45%; }
.waveform span:nth-child(52) { height: 80%; }
.waveform span:nth-child(53) { height: 30%; }
.waveform span:nth-child(54) { height: 65%; }
.waveform span:nth-child(55) { height: 55%; }
.waveform span:nth-child(56) { height: 75%; }
.waveform span:nth-child(57) { height: 40%; }
.waveform span:nth-child(58) { height: 85%; }
.waveform span:nth-child(59) { height: 50%; }
.waveform span:nth-child(60) { height: 60%; }

/* Animate only on card hover */
.audio-card:hover .waveform span {
  opacity: 1;
  animation: waveformBounce 0.8s ease-in-out infinite;
}

.audio-card:hover .waveform span:nth-child(1)  { animation-delay: 0.00s; }
.audio-card:hover .waveform span:nth-child(2)  { animation-delay: 0.04s; }
.audio-card:hover .waveform span:nth-child(3)  { animation-delay: 0.08s; }
.audio-card:hover .waveform span:nth-child(4)  { animation-delay: 0.12s; }
.audio-card:hover .waveform span:nth-child(5)  { animation-delay: 0.16s; }
.audio-card:hover .waveform span:nth-child(6)  { animation-delay: 0.20s; }
.audio-card:hover .waveform span:nth-child(7)  { animation-delay: 0.24s; }
.audio-card:hover .waveform span:nth-child(8)  { animation-delay: 0.28s; }
.audio-card:hover .waveform span:nth-child(9)  { animation-delay: 0.32s; }
.audio-card:hover .waveform span:nth-child(10) { animation-delay: 0.36s; }
.audio-card:hover .waveform span:nth-child(11) { animation-delay: 0.40s; }
.audio-card:hover .waveform span:nth-child(12) { animation-delay: 0.44s; }
.audio-card:hover .waveform span:nth-child(13) { animation-delay: 0.48s; }
.audio-card:hover .waveform span:nth-child(14) { animation-delay: 0.52s; }
.audio-card:hover .waveform span:nth-child(15) { animation-delay: 0.56s; }
.audio-card:hover .waveform span:nth-child(16) { animation-delay: 0.60s; }
.audio-card:hover .waveform span:nth-child(17) { animation-delay: 0.64s; }
.audio-card:hover .waveform span:nth-child(18) { animation-delay: 0.68s; }
.audio-card:hover .waveform span:nth-child(19) { animation-delay: 0.72s; }
.audio-card:hover .waveform span:nth-child(20) { animation-delay: 0.76s; }
.audio-card:hover .waveform span:nth-child(21) { animation-delay: 0.80s; }
.audio-card:hover .waveform span:nth-child(22) { animation-delay: 0.84s; }
.audio-card:hover .waveform span:nth-child(23) { animation-delay: 0.88s; }
.audio-card:hover .waveform span:nth-child(24) { animation-delay: 0.92s; }
.audio-card:hover .waveform span:nth-child(25) { animation-delay: 0.96s; }
.audio-card:hover .waveform span:nth-child(26) { animation-delay: 1.00s; }
.audio-card:hover .waveform span:nth-child(27) { animation-delay: 1.04s; }
.audio-card:hover .waveform span:nth-child(28) { animation-delay: 1.08s; }
.audio-card:hover .waveform span:nth-child(29) { animation-delay: 1.12s; }
.audio-card:hover .waveform span:nth-child(30) { animation-delay: 1.16s; }
.audio-card:hover .waveform span:nth-child(31) { animation-delay: 1.20s; }
.audio-card:hover .waveform span:nth-child(32) { animation-delay: 1.24s; }
.audio-card:hover .waveform span:nth-child(33) { animation-delay: 1.28s; }
.audio-card:hover .waveform span:nth-child(34) { animation-delay: 1.32s; }
.audio-card:hover .waveform span:nth-child(35) { animation-delay: 1.36s; }
.audio-card:hover .waveform span:nth-child(36) { animation-delay: 1.40s; }
.audio-card:hover .waveform span:nth-child(37) { animation-delay: 1.44s; }
.audio-card:hover .waveform span:nth-child(38) { animation-delay: 1.48s; }
.audio-card:hover .waveform span:nth-child(39) { animation-delay: 1.52s; }
.audio-card:hover .waveform span:nth-child(40) { animation-delay: 1.56s; }
.audio-card:hover .waveform span:nth-child(41) { animation-delay: 1.60s; }
.audio-card:hover .waveform span:nth-child(42) { animation-delay: 1.64s; }
.audio-card:hover .waveform span:nth-child(43) { animation-delay: 1.68s; }
.audio-card:hover .waveform span:nth-child(44) { animation-delay: 1.72s; }
.audio-card:hover .waveform span:nth-child(45) { animation-delay: 1.76s; }
.audio-card:hover .waveform span:nth-child(46) { animation-delay: 1.80s; }
.audio-card:hover .waveform span:nth-child(47) { animation-delay: 1.84s; }
.audio-card:hover .waveform span:nth-child(48) { animation-delay: 1.88s; }
.audio-card:hover .waveform span:nth-child(49) { animation-delay: 1.92s; }
.audio-card:hover .waveform span:nth-child(50) { animation-delay: 1.96s; }
.audio-card:hover .waveform span:nth-child(51) { animation-delay: 2.00s; }
.audio-card:hover .waveform span:nth-child(52) { animation-delay: 2.04s; }
.audio-card:hover .waveform span:nth-child(53) { animation-delay: 2.08s; }
.audio-card:hover .waveform span:nth-child(54) { animation-delay: 2.12s; }
.audio-card:hover .waveform span:nth-child(55) { animation-delay: 2.16s; }
.audio-card:hover .waveform span:nth-child(56) { animation-delay: 2.20s; }
.audio-card:hover .waveform span:nth-child(57) { animation-delay: 2.24s; }
.audio-card:hover .waveform span:nth-child(58) { animation-delay: 2.28s; }
.audio-card:hover .waveform span:nth-child(59) { animation-delay: 2.32s; }
.audio-card:hover .waveform span:nth-child(60) { animation-delay: 2.36s; }

@keyframes waveformBounce {
  0%, 100% { transform: scaleY(0.3); }
  50%      { transform: scaleY(1.2); }
}

/* SoundCloud-style custom player */
.audio-player {
  position: relative;
}
.player-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
}
.player-play {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 2px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.player-play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}
.player-play .icon-pause {
  display: none;
}
.player-play.playing .icon-play {
  display: none;
}
.player-play.playing .icon-pause {
  display: block;
}
.player-play:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.05);
}
.player-play .icon-play svg {
  margin-left: 2px;
}

.player-waveform {
  flex: 1;
  cursor: pointer;
  min-width: 0;
}
.player-waveform .waveform {
  height: 48px;
}

/* Disable hover-bounce on player waveform while playing — progress drives opacity instead */
.audio-player.is-playing:hover .waveform span {
  animation: none;
}
.audio-player .waveform span {
  opacity: 0.2;
  transition: height 0.08s ease, opacity 0.1s;
}
.audio-player .waveform span.played {
  opacity: 1;
}
.audio-player.is-playing .waveform span {
  opacity: 0.85;
}
.audio-player.is-playing .waveform span.played {
  opacity: 1;
}

.player-time {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

.audio-info {
  padding: 16px 20px;
}

.audio-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.audio-meta {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}

/* ========================================
   MEDIA — Feed layout with tags
   ======================================== */

/* Featured row: 2 video cards with thumbnails */
.media-featured-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  margin-bottom: 32px;
}

.media-featured-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s, opacity 0.35s ease;
}
.media-featured-card:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

.media-featured-card .video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-hover);
}

.media-featured-card .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.media-featured-content {
  padding: 24px 28px;
}

.media-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.media-date {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}

.media-featured-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
  line-height: 1.3;
  color: var(--text);
}

.media-featured-card .media-card-excerpt {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* Video thumbnail + play button */
.video-thumb {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 1;
  overflow: hidden;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.75);
  transition: filter 0.4s ease;
}
.media-featured-card:hover .video-thumb img {
  filter: brightness(1);
}
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 56px;
  height: 40px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.video-play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}
.video-play:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%) scale(1.1);
}

/* Media feed — dense list layout */
.media-feed {
  display: flex;
  flex-direction: column;
}

.media-feed .feed-row {
  border-color: var(--border);
}
.media-feed .feed-row:hover {
  background: var(--bg-hover);
}
.media-feed .feed-row .tag {
  border: 1px solid var(--border);
}

/* Filtering: hidden media feed rows */
.media-feed .feed-row.hidden,
.media-featured-card.hidden {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}
.media-feed .feed-row.showing,
.media-featured-card.showing {
  opacity: 0;
  transform: translateY(6px);
}

/* Media tag styling (dark bg variant) */
.media-featured-card .tag {
  border: 1px solid var(--border);
}

/* Media filter buttons (dark bg variant) */
.media-section .filter-btn {
  border-color: var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  backdrop-filter: none;
}
.media-section .filter-btn:hover {
  border-color: var(--accent-2);
  color: var(--text);
}
.media-section .filter-btn.active {
  background: var(--bg-hover);
  border-color: var(--accent-2);
  color: var(--text);
}

/* Audio sub-section within media */
.media-audio-header {
  margin-top: 48px;
  margin-bottom: 24px;
}
.media-audio-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
}
.media-audio-subtitle {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: var(--text-muted);
}
.media-section .audio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}
.media-section .audio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2px;
}
.media-section .audio-card:hover {
  border-color: var(--accent-2);
}
.media-section .player-controls {
  background: var(--bg-hover);
}
.media-section .player-play {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.media-section .player-play:hover {
  background: var(--bg-hover);
}
.media-section .waveform span {
  background: var(--text-dim);
}
.media-section .player-time {
  color: var(--text-muted);
}
.media-section .audio-title {
  color: var(--text);
}
.media-section .audio-meta {
  color: var(--text-muted);
}

/* When filtered: flatten featured row to 3-col */
/* When filtered: hide featured row and audio grid, show duplicate feed rows */
.media-section.filtered .media-featured-row {
  display: none;
}
.media-section.filtered .audio-grid {
  display: none;
}
.audio-card.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}
.audio-card.showing {
  opacity: 0;
  transform: translateY(4px);
}
.media-section.filtered .feed-row-featured-dup {
  display: flex;
}

/* ========================================
   WRITING & EDITING
   ======================================== */

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.filter-btn:hover {
  border-color: rgba(255, 255, 255, 0.8);
  color: #fff;
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.8);
  color: #fff;
}

/* ========================================
   FEED ROWS — shared dense list style
   ======================================== */
.feed-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 12px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.2s, opacity 0.35s ease;
}
.feed-row:first-child {
  border-top: 1px solid var(--border);
}
.feed-row:hover {
  background: var(--bg-hover);
}

.feed-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 0;
  max-width: 44%;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.feed-meta .tag {
  flex-shrink: 0;
}

.feed-source {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-muted);
  flex-shrink: 0;
}

.feed-desc {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  opacity: 0.75;
}

.feed-arrow {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
}
.feed-row:hover .feed-arrow {
  color: var(--text);
  transform: translate(1px, -1px);
}

/* Feed filtering */
.feed-row.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}
.feed-row.showing {
  opacity: 0;
  transform: translateY(4px);
}
.feed-row {
  transition: opacity 0.35s ease, transform 0.35s ease, background 0.2s;
}

/* Writing section — still life background */
.writing-section {
  position: relative;
  min-height: 600px;
  overflow: hidden;
}
.writing-bg {
  position: absolute;
  inset: 0;
  background: url('../images/still life 2.jpeg') center top/cover no-repeat;
  background-attachment: fixed;
  transform: scale(1.1);
  z-index: 0;
}
.writing-dark-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 0;
}
.writing-section .container {
  position: relative;
  z-index: 1;
}

/* Two-column hero: header left, featured right */
.writing-featured-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  margin-bottom: 32px;
}
.writing-section .section-label {
  color: rgba(255, 255, 255, 0.8);
}
.writing-section .section-title {
  color: #fff;
}
.writing-section .section-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

/* Featured Piece */
.featured-piece {
  display: block;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  transition: border-color 0.25s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.featured-piece:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.featured-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.featured-piece:hover .featured-image img {
  transform: scale(1.03);
}

.featured-badge {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 600;
  font-style: italic;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-block;
  margin-bottom: 16px;
}

.featured-content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-content .tag {
  margin-bottom: 16px;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}

.featured-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 12px;
  line-height: 1.3;
  color: #fff;
}

.featured-excerpt {
  font-family: var(--font-body);
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 20px;
}

.read-link {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: gap 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 5px 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.read-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

/* Writing Feed — dense list layout */
.writing-feed {
  display: flex;
  flex-direction: column;
}

.writing-feed .feed-row {
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.writing-feed .feed-row:hover {
  background: rgba(255, 255, 255, 0.06);
}
.writing-feed .feed-title {
  color: #fff;
}
.writing-feed .feed-source {
  color: rgba(255, 255, 255, 0.7);
}
.writing-feed .feed-desc {
  color: rgba(255, 255, 255, 0.65);
}
.writing-feed .feed-arrow {
  color: rgba(255, 255, 255, 0.3);
}
.writing-feed .feed-row:hover .feed-arrow {
  color: rgba(255, 255, 255, 0.7);
}
.writing-feed .feed-row .tag {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}

/* Audio section — bouquet background (same treatment as writing) */
.audio-section {
  position: relative;
  overflow: hidden;
}
.audio-bg {
  position: absolute;
  inset: 0;
  background: url('../images/bouquet.jpeg') center 30%/cover no-repeat;
  transform: scale(1.15);
  z-index: 0;
}
.audio-dark-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  z-index: 0;
}
.audio-section .container {
  position: relative;
  z-index: 1;
}
.audio-section .section-label {
  color: rgba(255, 255, 255, 0.8);
}
.audio-section .section-title {
  color: #fff;
}
.audio-section .section-subtitle {
  color: rgba(255, 255, 255, 0.85);
}
.audio-section .audio-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.audio-section .audio-card:hover {
  border-color: rgba(255, 255, 255, 0.5);
}
.audio-section .player-controls {
  background: rgba(255, 255, 255, 0.06);
}
.audio-section .player-play {
  background: rgba(0, 0, 0, 0.4);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.audio-section .player-play:hover {
  background: rgba(0, 0, 0, 0.6);
}
.audio-section .waveform span {
  background: rgba(255, 255, 255, 0.7);
}
.audio-section .player-time {
  color: rgba(255, 255, 255, 0.7);
}
.audio-section .audio-title {
  color: #fff;
}
.audio-section .audio-meta {
  color: rgba(255, 255, 255, 0.6);
}

/* Filtering: hidden cards */
.featured-piece.hidden {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}
.book-card.hidden,
.book-year-heading.hidden {
  display: none;
}

/* Animated filter transitions */
.featured-piece {
  transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.25s;
}
.featured-piece.showing {
  opacity: 0;
  transform: translateY(6px);
}

/* When filtered: flatten featured row into uniform 3-col grid */
/* When filtered: hide featured row, show duplicate feed rows */
.writing-section.filtered .writing-featured-row {
  display: none;
}
.feed-row-featured-dup {
  display: none;
}
.writing-section.filtered .feed-row-featured-dup {
  display: flex;
}

/* Year headings inside book grid */
.book-year-heading {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  margin-top: 8px;
  margin-bottom: -8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.book-year-heading:first-child {
  margin-top: 0;
}

/* ========================================
   GROWTH
   ======================================== */

/* Dark background variant */
.section-dark {
  background: #0a1210;
  position: relative;
  z-index: 1;
}
.section-dark .section-label,
.section-dark .section-title {
  color: #e8e0d4;
}

.growth-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.growth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
  padding: 28px 0;
  border-bottom: 1px solid rgba(42, 61, 56, 0.5);
}
.growth-row:last-child {
  border-bottom: none;
}

.growth-role-compact h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #e8e0d4;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
}

.growth-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.growth-company {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: #a89e94;
}

.growth-date {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  color: #7a7068;
}

.growth-desc {
  font-family: var(--font-body);
  font-size: 14px;
  color: #8a8078;
  line-height: 1.6;
  margin-top: 8px;
}

.growth-stats-compact {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.growth-stats-compact li {
  font-family: var(--font-body);
  font-size: 14px;
  color: #8a8078;
  padding-left: 16px;
  position: relative;
}

.growth-stats-compact li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: #4a5a54;
}

.growth-stats-compact li strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: #e8e0d4;
  font-weight: 700;
  margin-right: 4px;
}

/* ========================================
   READING PAGE
   ======================================== */
/* Reading Hero — dark painting background like writing/audio sections */
.reading-hero {
  position: relative;
  padding: 140px 0 48px;
}
.reading-hero-bg {
  position: absolute;
  inset: 0;
  background: url('../images/bouquet.jpeg') center 30%/130% auto no-repeat;
  background-attachment: fixed;
  z-index: 0;
}
.reading-hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  z-index: 0;
}
.reading-hero .container {
  position: relative;
  z-index: 1;
}
.reading-hero .section-header {
  margin-bottom: 0;
}
.reading-hero .section-title {
  color: #fff;
}
.reading-hero .section-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

/* Book toolbar — filter left, legend right */
.book-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.book-toolbar .filter-bar {
  margin-bottom: 0;
}
.book-toolbar .filter-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.book-toolbar .filter-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.book-toolbar .filter-btn.active {
  background: #1a2e28;
  border-color: #1a2e28;
  color: #e0ddd8;
}

/* Reading legend (heart/star key) */
.reading-legend {
  display: flex;
  gap: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  font-style: italic;
  color: var(--accent);
  letter-spacing: 0.04em;
  padding: 4px 14px;
  border-radius: 4px;
  background: rgba(122, 154, 58, 0.1);
  border: 1px solid var(--border);
}
.legend-icon {
  width: 16px;
  height: 23px;
  flex-shrink: 0;
}

/* Reading Stats Chart */
.reading-stats {
  padding: 48px 0 0;
}
.chart-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--text);
  margin-bottom: 28px;
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}
.chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chart-tab {
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.2s;
}
.chart-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}
.chart-tab.active {
  background: #1a2e28;
  border-color: #1a2e28;
  color: #e0ddd8;
}
.chart-year-select {
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  padding: 6px 28px 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 0.02em;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a89e94'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.chart-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.chart-rating-select {
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  padding: 6px 28px 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  letter-spacing: 0.02em;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a89e94'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.chart-year-filter[hidden],
.chart-rating-filter[hidden] {
  display: none;
}

/* Collapse button on expanded POV parent */
.bubble-collapse {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: background 0.2s ease;
}
.bubble-collapse:hover {
  background: var(--border);
}

/* Chart bars */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chart-row {
  display: grid;
  grid-template-columns: 140px 1fr 36px;
  align-items: center;
  gap: 16px;
}
.chart-label {
  font-family: var(--font-display);
  font-size: 17px;
  font-style: normal;
  color: var(--text);
  text-align: right;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar-track {
  height: 28px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.chart-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  width: 0;
}
.chart-count {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  min-width: 20px;
}

/* Trope legend */
.trope-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.trope-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.trope-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Trope bar expanded book list */
.trope-books {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin-left: 156px;
  font-family: var(--font-body);
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
}
.trope-books.open {
  max-height: 600px;
  padding: 6px 0 10px;
}
.trope-book-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid var(--bg-hover);
}
.trope-book-item:last-child {
  border-bottom: none;
}
.trope-book-title {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  flex: 1;
}
.trope-book-author {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  flex-shrink: 0;
}
.trope-book-stars {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  flex-shrink: 0;
}
.chart-row.trope-row {
  cursor: pointer;
}
.chart-row.trope-row:hover .chart-label {
  color: var(--text);
}

/* Trope description tooltip (on label hover) */
.trope-desc-tip {
  position: fixed;
  background: #1a2e28;
  color: #e0ddd8;
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.trope-desc-tip.visible {
  opacity: 1;
}

/* Secret recipes tab */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.recipe-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 22px;
  background: var(--bg-card);
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(8px);
}
.recipe-card.in {
  opacity: 1;
  transform: translateY(0);
}
.recipe-name {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.recipe-desc {
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.recipe-books {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dim);
}
.recipe-books span::before {
  content: '\2022 ';
  color: var(--text-muted);
}
.recipe-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 3px;
  color: #e0ddd8;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ========================================
   BOOKS OVER TIME
   ======================================== */
.chart-books-over-time {
  padding-top: 8px;
}
.bot-totals {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
}
.bot-totals strong {
  font-weight: 700;
  font-size: 18px;
}
.bot-total-divider {
  color: var(--text-dim);
}
.bot-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.bot-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dim);
}
.bot-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.bot-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========================================
   BOOKS IN TIME
   ======================================== */
.chart-books-in-time {
  padding-top: 8px;
}
.bit-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bit-wrapper::-webkit-scrollbar {
  display: none;
}
.bit-scroll {
  position: relative;
  min-height: 320px;
}
.bit-axis {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
}
.bit-era {
  position: absolute;
  bottom: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  text-align: center;
  transform: translateX(-50%);
}
.bit-tick {
  position: absolute;
  bottom: 8px;
  width: 1px;
  height: 10px;
  background: var(--border);
  transform: translateX(-50%);
}
.bit-tick-label {
  position: absolute;
  bottom: -6px;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  transform: translateX(-50%);
}
.bit-dot {
  position: absolute;
  bottom: 13px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7B2D3F;
  border: 1.5px solid var(--bg);
  transform: translate(-50%, 50%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 2;
}
.bit-dot:hover {
  transform: translate(-50%, 50%) scale(1.5);
  box-shadow: 0 0 8px rgba(123, 45, 63, 0.5);
  z-index: 10;
}
.bit-dot.bit-dot-fav {
  background: #7a9a3a;
}
.bit-label {
  position: absolute;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  transform: translateX(-50%);
  pointer-events: none;
  line-height: 1.3;
  text-align: center;
  max-width: 180px;
  white-space: normal;
  word-wrap: break-word;
}
.bit-stem {
  position: absolute;
  width: 1px;
  background: rgba(123, 45, 63, 0.3);
  transform: translateX(-50%);
}
.bit-stem.bit-stem-fav {
  background: rgba(122, 154, 58, 0.3);
}
.bit-tooltip {
  position: fixed;
  background: #1a2e28;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  line-height: 1.5;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 220px;
  white-space: normal;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.bit-tooltip.visible {
  opacity: 1;
}
.bit-tooltip strong {
  display: block;
  color: var(--text);
  font-weight: 600;
}
.bit-tooltip .bit-tip-author {
  color: var(--text-dim);
  font-size: 11px;
}
.bit-tooltip .bit-tip-year {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
}
.bit-hint {
  text-align: center;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* ========================================
   BOOKS IN SPACE (Leaflet Map)
   ======================================== */
.chart-books-in-space {
  padding-top: 8px;
}
#bis-leaflet-map {
  background: var(--bg);
}
#bis-leaflet-map .leaflet-tile-pane {
  filter: saturate(0.3) brightness(0.8);
}
#bis-leaflet-map .leaflet-control-attribution {
  background: rgba(10, 18, 16, 0.7);
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-body);
}
#bis-leaflet-map .leaflet-control-attribution a {
  color: var(--accent);
}
.bis-leaflet-label {
  background: rgba(10, 18, 16, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}
.bis-popup .leaflet-popup-content-wrapper {
  background: #1a2e28;
  color: var(--text);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.bis-popup .leaflet-popup-tip {
  background: #1a2e28;
}
.bis-popup .leaflet-popup-close-button {
  color: var(--text-dim);
}
.bis-popup .leaflet-popup-close-button:hover {
  color: var(--text);
}
.bis-zoom-hint {
  text-align: center;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
  letter-spacing: 0.5px;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

/* ---- Horizontal Collapsible Era Strips ---- */
.bit-eras-container {
  display: flex;
  flex-direction: row;
  gap: 4px;
  width: 100%;
  min-height: 340px;
  align-items: stretch;
}

/* Each era strip — JS controls width directly for smooth animation */
.bit-era-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  will-change: width, border-color;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease;
  flex-shrink: 0;
}
.bit-era-section:hover {
  border-color: rgba(123, 45, 63, 0.3);
}
.bit-era-section.open {
  border-color: var(--accent, var(--border));
  cursor: default;
}

/* -- Collapsed strip (vertical label) -- */
.bit-era-strip {
  width: 48px;
  min-width: 48px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.bit-era-strip:hover {
  background: rgba(123, 45, 63, 0.06);
}
.bit-era-strip-name {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: var(--text);
}
.bit-era-strip-dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}
.bit-era-strip-count {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-body);
  white-space: nowrap;
}
.bit-era-mini-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7B2D3F;
  display: inline-block;
}
.bit-era-mini-dot.fav {
  background: #7a9a3a;
}

/* -- Expanded panel (beside the strip) -- */
.bit-era-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.35s ease 0.15s;
}
.bit-era-section.open .bit-era-panel {
  opacity: 1;
}
.bit-era-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.bit-era-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.bit-era-panel-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}
.bit-era-panel-tagline {
  font-size: 11px;
  font-style: italic;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bit-era-panel-count {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  font-family: var(--font-body);
  flex-shrink: 0;
}

/* Close button */
.bit-era-close {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(123, 45, 63, 0.1);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bit-era-close:hover {
  background: rgba(123, 45, 63, 0.2);
  color: var(--text);
}

/* Body with timeline */
.bit-era-body {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 12px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative;
  display: flex;
  flex-direction: column;
}
.bit-era-body::-webkit-scrollbar {
  display: none;
}
.bit-era-body .bit-wrapper {
  flex: 1;
  min-height: 280px;
}
.bit-era-body .bit-scroll {
  min-height: 100%;
  height: 100%;
}

/* Zoom-in animation for timeline content */
.bit-era-body .bit-wrapper {
  transform: scale(0.92);
  transform-origin: left top;
  opacity: 0;
  will-change: transform, opacity;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.12s,
              opacity 0.35s ease 0.18s;
}
.bit-era-section.open .bit-era-body .bit-wrapper {
  transform: scale(1);
  opacity: 1;
}

/* Responsive: stack vertically on small screens */
@media (max-width: 600px) {
  .bit-eras-container {
    flex-direction: column;
    min-height: auto;
  }
  .bit-era-section {
    flex-direction: column;
    width: 100% !important;
    min-height: auto;
  }
  .bit-era-strip {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    padding: 10px 14px;
    gap: 8px;
    justify-content: flex-start;
  }
  .bit-era-strip-name {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 13px;
  }
  .bit-era-strip-dots {
    flex-direction: row;
  }
  .bit-era-strip-count {
    writing-mode: horizontal-tb;
    transform: none;
  }
  .bit-era-panel {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.35s ease 0.1s;
  }
  .bit-era-section.open .bit-era-panel {
    max-height: 80vh;
    opacity: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .bit-era-body .bit-wrapper {
    min-height: 200px;
  }
  .bit-era-body .bit-scroll {
    min-height: 200px;
  }
  .bit-era-section.open .bit-era-strip {
    border-bottom: 1px solid var(--border);
  }
}

/* ========================================
   MOOD DRIFT
   ======================================== */
.chart-mood-drift {
  padding-top: 8px;
}
.md-legend {
  display: none;
}
.md-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========================================
   SCATTER PLOT (trope analysis)
   ======================================== */
.chart-scatter {
  position: relative;
  height: 460px;
  padding-top: 8px;
}
.scatter-area {
  position: absolute;
  top: 62px;
  left: 50px;
  right: 16px;
  bottom: 44px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.scatter-quadrant-line-x {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed var(--border);
  opacity: 0.6;
}
.scatter-quadrant-line-y {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed var(--border);
  opacity: 0.6;
}
.scatter-quadrant-label {
  position: absolute;
  font-family: var(--font-display);
  font-size: 15px;
  font-style: italic;
  color: var(--text);
  opacity: 0.7;
  pointer-events: none;
  white-space: nowrap;
}
.scatter-dot {
  position: absolute;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s ease;
  transform: translate(-50%, -50%) scale(0);
}
.scatter-dot:hover {
  transform: translate(-50%, -50%) scale(1.3);
  z-index: 10;
}
.scatter-dot::before {
  content: '';
  position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
}
.scatter-corner-tip {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #1a2e28;
  color: #e0ddd8;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: 6px;
  line-height: 1.6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 20;
  max-width: 260px;
  white-space: normal;
  word-wrap: break-word;
}
.scatter-corner-tip.active {
  opacity: 1;
}
.scatter-axis-label {
  position: absolute;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.03em;
}
.scatter-axis-label-x {
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
}
.scatter-axis-label-y {
  top: 50%;
  left: 4px;
  transform: rotate(-90deg) translateX(-50%);
  transform-origin: left center;
}
.scatter-tick {
  position: absolute;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
}

/* ========================================
   NARRATIVE ENERGY (axes labels)
   ======================================== */
.chart-narrative {
  height: 540px;
  padding-top: 0;
}
.chart-narrative .scatter-area {
  top: 84px;
}
.narrative-axis-left {
  bottom: 4px;
  left: 50px;
}
.narrative-axis-right {
  bottom: 4px;
  right: 16px;
}
.narrative-axis-bottom {
  bottom: 22px;
  left: calc(50% + 17px);
  transform: translateX(-50%);
  opacity: 0.7;
  font-style: italic;
}
.narrative-axis-top {
  top: 56px;
  left: calc(50% + 17px);
  transform: translateX(-50%);
  opacity: 0.7;
  font-style: italic;
}

/* ========================================
   BUBBLE CHARTS (inside chart-body)
   ======================================== */
.chart-bubbles {
  position: relative;
  min-height: 350px;
  overflow: hidden;
}
.bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--parchment);
  font-family: var(--font-body);
  font-weight: 600;
  text-align: center;
  cursor: grab;
  line-height: 1.15;
  padding: 6px;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.2s ease;
}
.bubble:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 5;
}
.bubble:active {
  cursor: grabbing;
}
.bubble-label {
  font-size: inherit;
  pointer-events: none;
}
.bubble-tooltip {
  display: none;
  position: fixed;
  background: #1a2e28;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
  line-height: 1.6;
}
.bubble:hover .bubble-tooltip {
  display: block;
}

.authors-panel {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #1a2e28;
  color: #e0ddd8;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.6;
  z-index: 50;
  max-height: calc(100% - 16px);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  max-width: 260px;
  white-space: nowrap;
}
.authors-panel.visible {
  opacity: 1;
}
.authors-panel-title {
  font-weight: 700;
  margin-bottom: 4px;
}
.authors-panel-entry {
  margin-bottom: 6px;
}
.authors-panel-name {
  font-weight: 600;
  font-style: italic;
}
.authors-panel-books {
  color: rgba(224, 221, 216, 0.75);
}

.reading-page {
  padding-top: 48px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px;
}

.book-card {
  position: relative;
  transition: transform 0.25s;
}
.book-card:hover {
  transform: translateY(-4px);
}

.book-cover-wrap {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  transition: border-color 0.25s;
}
.book-card:hover .book-cover-wrap {
  border-color: var(--accent);
}

.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
}

.book-hover-review {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 16, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s;
}

.book-hover-review p {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.7;
  text-align: center;
  font-style: italic;
}

.book-card:hover .book-hover-review,
.book-card.review-active .book-hover-review {
  opacity: 1;
}

.book-info {
  text-align: center;
}

/* Star ratings — hidden, kept for data */
.book-stars {
  display: none;
}

.book-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
}

.book-author {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}

.book-status-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  font-style: italic;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(139, 90, 43, 0.85);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  z-index: 2;
}
.book-status-tag.tag-up-next {
  background: rgba(90, 90, 90, 0.75);
}

/* Bookmark ribbon behind badge — no longer used, kept for compat */
.book-badge-ribbon { display: none; }

/* Book cover bookmark badges (hearts / stars) */
.book-badge {
  position: absolute;
  top: 0;
  right: 12px;
  width: 36px;
  height: 52px;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0.85;
}
.book-badge svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.12));
}
.book-card:hover .book-badge {
  opacity: 1;
  transform: scale(1.06);
}
.badge-heart, .badge-star {
  color: var(--accent);
}

/* Make the cover the click target for explosion */
.book-cover-wrap {
  cursor: pointer;
}

/* Heart particle containers — fixed layer on body so they float above all cards */
.book-particle-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
  overflow: visible;
}
.book-particle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.book-particle svg {
  width: 100%;
  height: auto;
  display: block;
}
.book-particle img {
  width: 100%;
  height: auto;
  display: block;
}
.book-card.exploding {
  z-index: 10;
}
.book-card.exploding .book-badge {
  animation: badge-pop 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}
@keyframes badge-pop {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* Face particle (Palmer rain) — wrap is appended to <body> with fixed positioning */
.face-particle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  border-radius: 50%;
  overflow: hidden;
}
.face-particle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Mountain particle (hill video) — same fixed-position layer as faces */
.mountain-particle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  line-height: 1;
}

/* ========================================
   ABOUT
   ======================================== */
.about-section {
  position: relative;
}
.about-bg {
  position: absolute;
  inset: 0;
  background: url('../images/bouquet.jpeg') center 30%/130% auto no-repeat;
  background-attachment: fixed;
  z-index: 0;
}
.about-dark-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  z-index: 0;
}
.about-section .container {
  position: relative;
  z-index: 1;
}
.about-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 60px;
  align-items: center;
}
.about-photo img {
  width: 100%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  aspect-ratio: 1;
  object-fit: cover;
}
.about-section .section-title {
  margin-bottom: 20px;
  color: #fff;
}
.about-text p {
  font-family: var(--font-body);
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.8;
  margin-bottom: 16px;
}
.about-text p:last-of-type {
  margin-bottom: 24px;
}
.about-links {
  display: flex;
  gap: 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
}
.about-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s;
}
.about-links a:hover {
  color: #fff;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
}

/* ========================================
   PASSWORD GATE
   ======================================== */

/* When locked: hide gated nav links, sections below hero, and footer */
.site-locked .nav-gated {
  opacity: 0;
  pointer-events: none;
}

.site-locked .nav-toggle {
  display: none !important;
}

/* When locked on mobile, keep nav-links visible so "reading" link shows inline */
.site-locked .nav-links {
  position: static;
  transform: none;
  opacity: 1;
  pointer-events: auto;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  padding: 0;
  flex-direction: row;
  align-items: center;
  height: 100%;
}

.nav-gated {
  transition: opacity 0.5s ease;
}

.site-locked .section,
.site-locked .footer,
.site-locked .art-interlude {
  display: none;
}

.site-locked .hero-scroll-hint {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
}

/* Hero painting stays visible after unlock */
.hero-painting {
  opacity: 1;
}
/* Overlay stays visible after unlock — keep the same subtle darkening */
.hero-overlay {
  opacity: 1;
}

.hero-scroll-hint {
  transition: opacity 0.8s ease 0.3s;
}

/* Gate container in hero — fixed size, no layout shift */
.hero-gate {
  margin-top: 32px;
  position: relative;
  height: 44px;          /* match button height so container never resizes */
}

.gate-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  text-transform: lowercase;
  padding: 10px 28px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.gate-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.gate-btn.hidden {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

/* Password form — unfurls smoothly from the left via clip-path */
.gate-form {
  display: flex;
  align-items: center;
  gap: 10px;
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  clip-path: inset(0 100% 0 0);
  opacity: 0;
  transition: clip-path 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.35s ease;
}

.gate-form.visible {
  clip-path: inset(0 0 0 0);
  opacity: 1;
}

.gate-input {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 200px;
  outline: none;
  transition: border-color 0.25s;
}

.gate-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.gate-input:focus {
  border-color: #fff;
}

.gate-submit {
  font-family: var(--font-body);
  font-size: 14px;
  font-style: italic;
  text-transform: lowercase;
  padding: 10px 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.25s, border-color 0.25s;
}

.gate-submit:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gate-error {
  font-family: var(--font-body);
  font-size: 12px;
  font-style: italic;
  color: rgba(255, 200, 200, 1);
  opacity: 0;
  transition: opacity 0.3s;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  white-space: nowrap;
}

.gate-error.visible {
  opacity: 1;
}

/* Hide gate entirely once unlocked */
.hero-gate.unlocked {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease;
}

/* ========================================
   SCROLL ANIMATIONS
   ======================================== */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  :root {
    --gap: 16px;
  }

  .hero-title {
    font-size: 32px;
    line-height: 1.15;
  }

  .hero-name {
    font-size: 32px;
    display: block;
    line-height: 1.15;
    margin-bottom: 6px;
  }

  .hero-box {
    padding: 28px 24px;
  }

  .hero-scroll-hint {
    right: 24px;
    bottom: 24px;
  }

  .section {
    padding: 48px 0;
  }

  .section-header {
    margin-bottom: 32px;
  }

  .art-interlude img {
    max-height: 40vh;
  }

  /* Background fixes for mobile — fixed attachment breaks on most mobile browsers */
  .hero-painting {
    background-attachment: scroll;
    background-size: cover;
    background-position: center 40%;
  }
  .writing-bg {
    background-attachment: scroll;
    background-size: cover;
    background-position: center 20%;
    transform: scale(1.05);
  }
  .audio-bg {
    transform: scale(1.05);
    background-position: center 30%;
  }
  .reading-hero-bg {
    background-attachment: scroll;
    background-size: cover;
    background-position: center 30%;
  }

  /* Writing featured row stacks on mobile */
  .writing-featured-row {
    grid-template-columns: 1fr;
  }

  .featured-content {
    padding: 24px;
  }

  /* Media grids */
  .media-featured-row {
    grid-template-columns: 1fr;
  }
  .media-section.filtered .media-featured-row {
    display: none;
  }

  .writing-section.filtered .writing-featured-row {
    grid-template-columns: 1fr;
  }

  /* Feed rows: stack title above meta on mobile */
  .feed-row {
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 12px 0;
  }
  .feed-title {
    max-width: 100%;
    flex-basis: 100%;
    white-space: normal;
  }
  .feed-desc {
    display: none;
  }

  /* Growth */
  .growth-row {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 0;
  }

  /* About */
  .about-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }
  .about-photo img {
    max-width: 220px;
    margin: 0 auto;
    display: block;
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  /* Chart */
  .chart-row {
    grid-template-columns: 100px 1fr 30px;
    gap: 10px;
  }
  .timeline-lane-label {
    width: 80px;
    min-width: 80px;
    font-size: 10px;
    padding-right: 8px;
  }
  .timeline-dot {
    width: 9px;
    height: 9px;
  }
  .chart-label {
    font-size: 12px;
  }
  .chart-bar-track {
    height: 22px;
  }

  /* Books */
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  /* Nav — hamburger menu */
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(10, 18, 16, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 24px var(--gap);
    gap: 20px;
    font-size: 16px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .reading-hero {
    padding: 120px 0 48px;
  }
  .reading-page {
    padding-top: 32px;
  }

  /* ---- Chart fixes for mobile ---- */

  /* Chart tabs: stack into a grid on mobile */
  .chart-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
  }
  .chart-tab {
    font-size: 12px;
    padding: 5px 12px;
    text-align: center;
  }

  /* Filters stack below tabs */
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Scatter / Stakes chart */
  .chart-scatter {
    height: 400px;
  }
  .chart-narrative {
    height: 460px;
  }
  .scatter-area {
    left: 16px;
    right: 8px;
    bottom: 40px;
    top: 56px;
  }
  .chart-narrative .scatter-area {
    top: 76px;
  }
  .scatter-quadrant-label {
    font-size: 10px;
  }
  .scatter-dot {
    width: 11px !important;
    height: 11px !important;
  }

  /* Axis labels — tighter positioning */
  .narrative-axis-left {
    left: 16px;
    font-size: 10px;
  }
  .narrative-axis-right {
    right: 8px;
    font-size: 10px;
  }
  .narrative-axis-bottom {
    font-size: 10px;
    left: calc(50% + 4px);
  }
  .narrative-axis-top {
    font-size: 10px;
    left: calc(50% + 4px);
    top: 48px;
  }

  /* Corner tooltip */
  .scatter-corner-tip {
    max-width: 200px;
    font-size: 11px;
    padding: 8px 10px;
  }

  /* Trope legend wraps tighter */
  .trope-legend {
    gap: 8px 14px;
  }
  .trope-legend-item {
    font-size: 11px;
  }

  /* Trope expanded book list — align to left */
  .trope-books {
    margin-left: 110px;
  }

  /* Bubble chart — smaller min height */
  .chart-bubbles {
    min-height: 280px;
  }
  .authors-panel {
    max-width: 200px;
    font-size: 11px;
  }

  /* Books In Time */
  .bit-scroll {
    min-height: 220px;
  }
  .bit-label {
    font-size: 10px;
    max-width: 80px;
  }
  .bit-label-alt {
    transform: translateX(-20%);
    text-align: left;
  }
  .bit-dot {
    width: 8px;
    height: 8px;
  }
  .bit-stem {
    opacity: 0.6;
  }

  /* Books In Space — Leaflet map on mobile */
  #bis-leaflet-map {
    height: 320px !important;
  }
  .bis-leaflet-label {
    font-size: 9px;
    padding: 1px 5px;
  }
}

@media (max-width: 480px) {
  .audio-grid {
    grid-template-columns: 1fr;
  }

  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ---- Chart fixes for small phones ---- */

  /* Bar chart labels narrower */
  .chart-row {
    grid-template-columns: 80px 1fr 26px;
    gap: 6px;
  }
  .chart-label {
    font-size: 11px;
  }
  .chart-bar-track {
    height: 20px;
  }
  .chart-count {
    font-size: 13px;
  }

  /* Trope expanded list flush left */
  .trope-books {
    margin-left: 86px;
    font-size: 11px;
  }
  .trope-book-author {
    display: none;
  }

  /* Stakes / scatter even tighter */
  .chart-scatter {
    height: 360px;
  }
  .chart-narrative {
    height: 420px;
  }
  .scatter-area {
    left: 10px;
    right: 6px;
    bottom: 36px;
    top: 50px;
  }
  .chart-narrative .scatter-area {
    top: 68px;
  }
  .scatter-quadrant-label {
    font-size: 9px;
  }
  .narrative-axis-left {
    left: 10px;
    font-size: 9px;
  }
  .narrative-axis-right {
    right: 6px;
    font-size: 9px;
  }
  .narrative-axis-bottom,
  .narrative-axis-top {
    font-size: 9px;
    left: calc(50% + 3px);
  }
  .narrative-axis-top {
    top: 42px;
  }
}
