@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;700;800&family=Cormorant+Garamond:ital,wght@1,500&family=Pacifico&display=swap');

/* ============================================================
   LITTLE LENNY'S — Design Library
   Based on Lenny's Newsletter (lennysnewsletter.com) design tokens
   Child twist: larger base type, more generous spacing,
   slightly rounder corners, secondary warmth accent
   ============================================================ */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  /* --- Campfire orange — primary CTA and flame accents --- */
  --accent:           #F97316;
  --accent-hover:     #EA580C;
  --accent-bg:        rgba(249, 115, 22, 0.12);
  --accent-bg-hover:  rgba(249, 115, 22, 0.22);

  /* --- Design system accent aliases --- */
  --accent-primary:   #F97316;
  --accent-gold:      #FACC15;
  --illustration-shadow: #8B5E3C;

  /* --- Ember yellow — concept chips, inner flame highlight --- */
  --accent-2:         #FACC15;
  --accent-2-bg:      rgba(250, 204, 21, 0.18);

  /* --- Semantic colours --- */
  --color-success:    #65A30D;
  --color-info:       #0EA5E9;
  --color-error:      #DC2626;

  /* --- Backgrounds — warm off-whites, no pure white --- */
  --bg-primary:       #FFF8ED;
  --bg-secondary:     #F5E6C8;
  --bg-tertiary:      #E7D3B1;
  --bg-sunken:        #FAF7F2;

  /* --- Design system backgrounds (soft beige / warm) --- */
  --bg-warm:          #F5E6C8;
  --bg-soft:          #FFF8ED;

  /* --- Text — charcoal, never pure black --- */
  --text-primary:     #1F1F1F;
  --text-secondary:   #78716C;
  --text-tertiary:    #A8A29E;
  --text-on-accent:   #ffffff;

  /* --- Borders --- */
  --border:           1px solid #E7D3B1;
  --border-focus:     1px solid #F97316;
  --border-color:     #E7D3B1;

  /* --- Border radius --- */
  --radius-xs:        4px;
  --radius-sm:        8px;
  --radius-md:        12px;
  --radius-lg:        20px;
  --radius-full:      9999px;

  /* --- Typography: base (child twist = 16px not 14px) --- */
  --font-sans:        "Inter", -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif:       "Cormorant Garamond", Georgia, "Times New Roman", serif;

  --text-xs:          12px;
  --text-sm:          14px;
  --text-base:        16px;    /* +2px vs Lenny's — easier for children */
  --text-md:          18px;
  --text-lg:          22px;
  --text-xl:          28px;
  --text-2xl:         36px;
  --text-3xl:         48px;
  --text-h3:          28px;    /* design system H3 */
  --text-h2:          40px;    /* design system H2 */
  --text-h1:          64px;    /* design system H1 */

  --weight-regular:   400;
  --weight-medium:    500;
  --weight-semibold:  600;
  --weight-bold:      700;

  --leading-tight:    1.25;
  --leading-normal:   1.5;
  --leading-relaxed:  1.7;    /* slightly more generous for child reading */

  /* --- Spacing scale --- */
  --space-1:    4px;
  --space-2:    8px;
  --space-3:    12px;
  --space-4:    16px;
  --space-5:    20px;
  --space-6:    24px;
  --space-8:    32px;
  --space-10:   40px;
  --space-12:   48px;
  --space-16:   64px;
  --space-20:   80px;

  /* --- Layout --- */
  --content-width:     680px;   /* Lenny's newsletter column width */
  --catalogue-width:   1200px;  /* wider for the episode grid */
  --side-padding:      24px;
  --ep-nav-width:      var(--catalogue-width);

  /* --- Shadows --- */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-card:  0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 20px rgba(249,115,22,0.15), 0 2px 8px rgba(0,0,0,0.06);

  /* --- Transitions (Lenny's easing) --- */
  --ease:         cubic-bezier(0.19, 1, 0.22, 1);
  --duration-fast: 0.125s;
  --duration:      0.25s;
}


/* ============================================================
   RESET & BASE
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

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


/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.heading-display {
  font-family: var(--font-sans);
  font-size: var(--text-h1);
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
  letter-spacing: -0.04em;
}

.heading-1 {
  font-family: var(--font-sans);
  font-size: var(--text-h1);
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
  letter-spacing: -0.04em;
}

.heading-2 {
  font-family: var(--font-sans);
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}

.heading-3 {
  font-family: var(--font-sans);
  font-size: var(--text-h3);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.body-lg {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
}

.body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
}

.body-sm {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
}

.caption {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--weight-semibold);
}

.concept-word {
  font-weight: var(--weight-bold);
  color: var(--accent);
}


/* ============================================================
   LAYOUT
   ============================================================ */

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--catalogue-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
}

.container--narrow {
  max-width: var(--content-width);
}


/* ============================================================
   DEMO BANNER
   ============================================================ */

.demo-banner {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-align: center;
  padding: 6px var(--side-padding);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  line-height: 1.4;
}


/* ============================================================
   NAVIGATION
   ============================================================ */

.nav {
  border-bottom: var(--border);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
  height: 56px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: var(--space-4);
  align-items: center;
}

.nav__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.nav__logo-text {
  font-family: 'Pacifico', cursive;
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  color: var(--text-primary);
  white-space: nowrap;
}

.nav__logo-text span {
  color: var(--accent);
}

.nav__tagline {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: right;
  display: block;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .nav__tagline { display: none; }
  .nav__campfire { height: 36px; }
}

/* Campfire image in nav */
.nav__campfire {
  height: 48px;
  width: auto;
  mix-blend-mode: multiply;
  flex-shrink: 0;
}

/* Campfire — standalone */
.campfire {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 40px auto;
}

/* A-frame logs: 140° opening angle, wide and shallow */
.log {
  position: absolute;
  width: 80px;
  height: 18px;
  background: var(--illustration-shadow);
  border: 3px solid var(--text-primary);
  border-radius: 9px;
  bottom: 18px;
  z-index: 2;
}

.log-left {
  left: 4px;
  transform-origin: 0% 50%;
  transform: rotate(-20deg);
}

.log-right {
  right: 4px;
  transform-origin: 100% 50%;
  transform: rotate(20deg);
}

/* Outer flame — 4 licks, pointed base, sits behind logs */
.flame.outer {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 70px;
  height: 80px;
  background: var(--accent-gold);
  border: 3px solid var(--text-primary);
  transform: translateX(-50%);
  z-index: 1;
  clip-path: polygon(
    50% 100%,
    6% 82%,
    0% 62%,
    8% 42%,
    18% 18%,
    28% 40%,
    37% 8%,
    47% 34%,
    55% 2%,
    65% 30%,
    74% 14%,
    84% 42%,
    92% 62%,
    94% 82%
  );
}

/* Inner flame — 2 licks, lighter orange, pointed base */
.flame.inner {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: 36px;
  height: 60px;
  background: #FCC988;
  transform: translateX(-50%);
  z-index: 1;
  clip-path: polygon(
    50% 100%,
    6% 82%,
    2% 60%,
    14% 36%,
    28% 8%,
    48% 36%,
    62% 6%,
    80% 36%,
    96% 62%,
    94% 82%
  );
}

/* nav__campfire now defined above */


/* ============================================================
   HERO / PAGE HEADER
   ============================================================ */

.page-hero {
  background: var(--bg-warm);
  border-bottom: var(--border);
  padding: var(--space-16) var(--side-padding) var(--space-12);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-hero__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.page-hero__title {
  font-family: var(--font-sans);
  font-size: clamp(var(--text-3xl), 6vw, var(--text-h1));
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  margin-bottom: var(--space-4);
}

.page-hero__title em {
  font-style: normal;
  color: var(--accent);
}

.page-hero__subtitle {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   PAGE TABS
   ============================================================ */

.page-tabs {
  border-top: var(--border);
  border-bottom: var(--border);
}

.page-tabs__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
  display: flex;
}

.page-tab {
  flex: 1;
  text-align: center;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 12px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.page-tab:hover {
  color: var(--text-primary);
}

.page-tab--active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}


/* ============================================================
   PERSONALISATION BAR
   ============================================================ */

.name-bar {
  background: linear-gradient(to right, rgba(249,115,22,0.06), rgba(250,204,21,0.05));
  border-top: 1px solid rgba(249,115,22,0.18);
  border-bottom: 1px solid rgba(249,115,22,0.18);
  padding: var(--space-4) var(--side-padding);
}

.name-bar__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.name-bar__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.name-bar__spark {
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
}

.name-bar__input {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  height: 34px;
  padding: 0 var(--space-3);
  border: 1.5px solid rgba(249,115,22,0.30);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
  outline: none;
}

.name-bar__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}

.name-bar__input::placeholder {
  color: var(--text-tertiary);
}

.name-bar__note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Name highlighted inside newsletter body text */
.name-highlight {
  font-weight: var(--weight-bold);
  color: var(--accent);
  background: rgba(249,115,22,0.10);
  padding: 1px 5px 2px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}


.personalised-name {
  color: var(--accent);
  font-weight: var(--weight-semibold);
}

@media (max-width: 600px) {
  .name-greeting {
    margin: var(--space-4) var(--side-padding) 0;
  }
}


/* ============================================================
   SEARCH
   ============================================================ */

.search-bar {
  padding: var(--space-6) var(--side-padding) var(--space-4);
}

.search-bar__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
  position: relative;
}

.search-bar__input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4) 0 44px;
  border: var(--border);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  transition: border var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
  outline: none;
}

.search-bar__input:focus {
  border: var(--border-focus);
  box-shadow: var(--shadow-md);
}

.search-bar__input::placeholder {
  color: var(--text-tertiary);
}

.search-bar__icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

.search-bar__results-count {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  padding: 0 var(--space-4);
}


/* ============================================================
   EPISODE CATALOGUE GRID
   ============================================================ */

.catalogue {
  padding: var(--space-4) var(--side-padding) var(--space-20);
}

.catalogue__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
}

.catalogue__section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: var(--border);
}

.catalogue__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 540px) {
  .catalogue__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 860px) {
  .catalogue__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.catalogue__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-16) var(--space-4);
  color: var(--text-secondary);
}

.catalogue__empty-icon {
  font-size: 40px;
  margin-bottom: var(--space-3);
}


/* ============================================================
   CAROUSEL
   ============================================================ */

.carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.carousel__track-wrap {
  flex: 1;
  overflow: hidden;
  /* Right-edge fade hint — signals more content */
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
  /* Safari: force GPU layer so mask-image renders correctly */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* Remove the fade when scrolled to the end */
.carousel__track-wrap--at-end {
  -webkit-mask-image: linear-gradient(to left, black 85%, transparent 100%);
  mask-image: linear-gradient(to left, black 85%, transparent 100%);
}

.carousel__track-wrap--middle {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 88%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 88%, transparent 100%);
}

.carousel__track {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* scroll-behavior handled via JS smoothScrollTo for Safari compatibility */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--space-2); /* prevent shadow clipping */
}

.carousel__track::-webkit-scrollbar {
  display: none;
}

/* Cards inside the carousel: 3 per view on desktop */
.carousel__track .episode-card {
  flex: 0 0 calc((100% - 2 * var(--space-6)) / 3);
  scroll-snap-align: start;
}

@media (max-width: 860px) {
  .carousel__track .episode-card {
    flex: 0 0 calc((100% - var(--space-6)) / 2);
  }
}

@media (max-width: 540px) {
  .carousel__track .episode-card {
    flex: 0 0 82%;
  }
}

/* Arrow buttons */
.carousel__btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}

.carousel__btn:hover:not(:disabled) {
  background: var(--bg-primary);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
}

.carousel__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

/* Dots */
.carousel__dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.carousel__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-tertiary);
  cursor: pointer;
  padding: 0;
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}

.carousel__dot:hover {
  background: var(--text-tertiary);
}

.carousel__dot--active {
  background: var(--accent);
  transform: scale(1.25);
}

/* Skeleton loading card (used while episodes fetch) */
.episode-card--loading {
  background: var(--bg-primary);
  border: 1px solid rgba(54, 55, 55, 0.08);
  border-radius: 20px;
  overflow: hidden;
  pointer-events: none;
}

.episode-card--loading::before {
  content: '';
  display: block;
  aspect-ratio: 4 / 3;
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.episode-card--loading::after {
  content: '';
  display: block;
  height: 88px;
  margin: var(--space-5) var(--space-6);
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 0%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s ease-in-out infinite 0.1s;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ============================================================
   CATEGORY PILLS
   ============================================================ */

.category-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s, color 0.15s, border-color 0.15s;
}

.category-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.category-pill:active { transform: none; }

/* Per-category OFF states — warm tints derived from design system */
.category-pill[data-category="Big decisions"]     { background: #FEF3D8; color: #92400E; border-color: #F5D99C; }
.category-pill[data-category="Start a business"]  { background: #FEFCE8; color: #854D0E; border-color: #FEF08A; }
.category-pill[data-category="Your future"]       { background: #FEF9EC; color: #B45309; border-color: #FCDFA0; }
.category-pill[data-category="Get famous"]        { background: #FFF0E5; color: #C2410C; border-color: #FDD0A8; }
.category-pill[data-category="Build things"]      { background: #F5EDE4; color: #7C5233; border-color: #DBBCA0; }
.category-pill[data-category="AI and robots"]     { background: #FEF0E0; color: #7C2D12; border-color: #F5C89A; }
.category-pill[data-category="Selling"]           { background: #FEF0F0; color: #B91C1C; border-color: #F5B8B8; }
.category-pill[data-category="Measure things"]    { background: #F5F3F1; color: #57534E; border-color: #D8D5D2; }
.category-pill[data-category="Be a leader"]       { background: #FFF1F0; color: #9F1239; border-color: #FECDD3; }

/* Per-category ON (active) states — full design system colours */
.category-pill[data-category="Big decisions"].category-pill--active     { background: #B45309; color: #fff; border-color: #B45309; }
.category-pill[data-category="Start a business"].category-pill--active  { background: #A16207; color: #fff; border-color: #A16207; }
.category-pill[data-category="Your future"].category-pill--active       { background: #D97706; color: #fff; border-color: #D97706; }
.category-pill[data-category="Get famous"].category-pill--active        { background: #F97316; color: #fff; border-color: #F97316; }
.category-pill[data-category="Build things"].category-pill--active      { background: #8B5E3C; color: #fff; border-color: #8B5E3C; }
.category-pill[data-category="AI and robots"].category-pill--active     { background: #92400E; color: #fff; border-color: #92400E; }
.category-pill[data-category="Selling"].category-pill--active           { background: #DC2626; color: #fff; border-color: #DC2626; }
.category-pill[data-category="Measure things"].category-pill--active    { background: #78716C; color: #fff; border-color: #78716C; }
.category-pill[data-category="Be a leader"].category-pill--active       { background: #BE123C; color: #fff; border-color: #BE123C; }

/* Generic active shadow (applied alongside per-category colour) */
.category-pill--active { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }


/* ============================================================
   BROWSE LIST — editorial rows
   ============================================================ */

#browse-list {
  border-top: 1px solid rgba(54, 55, 55, 0.08);
}

.browse-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-2);
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(54, 55, 55, 0.07);
  transition: background 0.15s var(--ease);
  border-radius: 8px;
}

.browse-item:hover {
  background: var(--bg-soft);
}

.browse-item__chip {
  flex-shrink: 0;
  width: 120px;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: rgba(168, 131, 98, 0.12);
  color: var(--illustration-shadow);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.browse-item__chip--empty {
  background: transparent;
  visibility: hidden;
}

.browse-item__content {
  flex: 1;
  min-width: 0;
}

.browse-item__guest {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.browse-item__title {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-item__arrow {
  flex-shrink: 0;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  transition: transform 0.15s var(--ease), color 0.15s;
}

.browse-item:hover .browse-item__arrow {
  transform: translateX(3px);
  color: var(--accent);
}

.browse-empty {
  padding: var(--space-6) 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

@media (max-width: 540px) {
  .browse-item__chip {
    display: none;
  }
}


/* ============================================================
   EPISODE CARD
   ============================================================ */

.episode-card {
  background: var(--bg-primary);
  border: 1px solid rgba(54, 55, 55, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: transform 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.episode-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.07);
}

.episode-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  background: var(--bg-warm);
}


.episode-card__image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-warm);
  color: var(--illustration-shadow);
  font-size: var(--text-3xl);
  aspect-ratio: 1 / 1;
}

.episode-card__body {
  padding: var(--space-6) var(--space-6) var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.episode-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.episode-card__number {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.episode-card__number--available {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.episode-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: var(--space-3);
}

.episode-card__concept-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  background: rgba(168, 131, 98, 0.09);
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.episode-card__title {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-top: var(--space-1);
}

.episode-card__guest {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

.episode-card__guest strong {
  color: var(--text-primary);
  font-weight: 600;
}

.episode-card__footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid rgba(54, 55, 55, 0.07);
}

.episode-card__runtime {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.episode-card__cta {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}


/* ============================================================
   EPISODE PAGE
   ============================================================ */

.episode-page {
  padding-bottom: var(--space-20);
}

.promo-quote {
  max-width: var(--content-width);
  margin: var(--space-6) auto;
  padding: 0 var(--side-padding);
}

.promo-quote blockquote {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-style: italic;
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  margin: 0;
  padding: var(--space-3) var(--space-5);
}

.audio-section {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
}

.podcast-cta {
  max-width: var(--content-width);
  margin: var(--space-8) auto;
  padding: var(--space-5) calc(var(--side-padding) + var(--space-5));
  background: var(--bg-sunken);
  border: var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.lenny-source__label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin: var(--space-5) 0 6px;
}

.lenny-source__link {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  text-decoration: none;
}

.lenny-source__link:hover { text-decoration: underline; }

.newsletter-signoff {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-top: var(--space-8);
  line-height: var(--leading-relaxed);
}

.explore-block {
  max-width: var(--content-width);
  margin: var(--space-8) auto 0;
  padding: 0 var(--side-padding);
}

.explore-block__heading {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.explore-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.explore-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-warm);
  border: var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: border-color 150ms ease, background 150ms ease;
}

.explore-link:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.explore-link__icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.explore-link__yt {
  flex-shrink: 0;
}

.explore-link__label {
  flex: 1;
}

.explore-link__arrow {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: color 150ms ease;
}

.explore-link:hover .explore-link__arrow {
  color: var(--accent);
}

.curriculum-section {
  max-width: var(--content-width);
  margin: var(--space-8) auto var(--space-16);
  padding: var(--space-5) var(--side-padding) 0;
  border-top: 1.5px solid var(--border-color);
}

.curriculum-section h3 {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.episode-page__hero {
  background: var(--bg-warm);
  border-bottom: var(--border);
  padding: var(--space-10) var(--side-padding);
}

.episode-page__hero-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  gap: var(--space-8);
  align-items: stretch;
  min-height: 180px;
}

#guest-photo-slot {
  order: 2;
  flex-shrink: 0;
  width: 180px;
  align-self: center;
  margin: 9px 2.5rem 9px 0;
  display: flex;
}

.episode-page__guest-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  object-fit: cover;
  object-position: center top;
  display: block;
}

.episode-page__meta {
  order: 1;
}

.episode-page__guest-photo--placeholder {
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  color: var(--accent);
}

.episode-page__meta {
  flex: 1;
}

.episode-page__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.episode-page__title {
  font-family: var(--font-sans);
  font-size: clamp(var(--text-xl), 4vw, var(--text-h2));
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
  letter-spacing: -0.04em;
  margin-bottom: var(--space-2);
}

.episode-page__guest-line {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.episode-page__guest-line strong {
  color: var(--text-primary);
  font-weight: var(--weight-semibold);
}

.episode-page__concept-tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: rgba(168, 131, 98, 0.12);
  color: var(--illustration-shadow);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}


/* ============================================================
   AUDIO PLAYER
   ============================================================ */

.audio-player {
  background: var(--bg-primary);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-6) auto;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-sm);
}

.audio-player__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.audio-player__controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.audio-player__play {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}

.audio-player__play:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.audio-player__play svg {
  width: 18px;
  height: 18px;
  margin-left: 2px; /* optical centre for play triangle */
}

.audio-player__progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.audio-player__progress {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  outline: none;
}

.audio-player__progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--accent);
  cursor: pointer;
  margin-top: -5px;
}

.audio-player__progress::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-full);
}

.audio-player__time {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}


/* ============================================================
   NEWSLETTER BODY (episode content)
   ============================================================ */

.newsletter-content {
  max-width: var(--content-width);
  margin: var(--space-8) auto;
  padding: 0 var(--side-padding);
}

.newsletter-content h2 {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: var(--space-8) 0 var(--space-4);
}

.newsletter-content p {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
}

.newsletter-content strong {
  font-family: var(--font-serif);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}

.newsletter-content ul {
  padding-left: var(--space-5);
  margin-bottom: var(--space-5);
}

.newsletter-content li {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.newsletter-content .concept-callout {
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-4) var(--space-5);
  margin: var(--space-6) 0;
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.7;
}

.newsletter-content .podcast-cta {
  background: var(--bg-sunken);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin: var(--space-8) 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.newsletter-content .podcast-cta strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: var(--space-2);
}

.curriculum-note {
  max-width: var(--content-width);
  margin: var(--space-8) auto var(--space-16);
  padding: var(--space-4) var(--side-padding);
  border-top: var(--border);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-normal);
}


/* ============================================================
   QUICK TAKE BLOCK
   ============================================================ */

.quick-take-block {
  max-width: var(--content-width);
  margin: var(--space-8) auto 0;
  padding: var(--space-5) var(--side-padding) 0;
  border-top: 1.5px solid var(--border-color);
}

.quick-take__inner {
  padding: 0;
}

.quick-take__label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 var(--space-4);
}

.quick-take__inner ul {
  padding-left: var(--space-5);
  margin: 0;
}

.quick-take__inner li {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.quick-take__inner li:last-child { margin-bottom: 0; }


/* ============================================================
   CHALLENGE BLOCK
   ============================================================ */

.challenge-block {
  max-width: var(--content-width);
  margin: var(--space-8) auto 0;
  padding: var(--space-5) var(--side-padding) 0;
  border-top: 1.5px solid var(--border-color);
}

.challenge-block__inner {
  padding: 0;
}

.challenge-block__heading {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.challenge-block__body {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-primary);
}

#challenge-content {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-primary);
}

#curriculum-note {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}


/* ============================================================
   PODCAST LINK CTA (episode page → podcast page)
   ============================================================ */

.podcast-link-block {
  display: none; /* audio element still in DOM for playback; tab is the visual UI */
}

/* ── Listen tab — fixed left edge (desktop) / bottom-right pill (mobile) ── */
.listen-tab {
  position: fixed;
  left: 0;
  top: 140px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 20px 13px;
  box-shadow: 4px 0 14px rgba(0,0,0,0.18);
  cursor: default;
  user-select: none;
  min-width: 54px;
}

/* Once the viewport is wide enough to have a real left margin, float centered in it */
@media (min-width: 860px) {
  .listen-tab {
    left: calc((100vw - var(--content-width)) / 2 - 66px);
    top: 140px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0,0,0,0.16);
  }
}

.listen-tab[hidden] { display: none; }

.listen-tab__icon {
  font-size: 22px;
  line-height: 1;
}


.listen-tab__play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s ease;
}

.listen-tab__play:hover {
  background: rgba(255,255,255,0.38);
}

.listen-tab__duration {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.8;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.04em;
}

.listen-tab__progress {
  width: 4px;
  height: 64px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.listen-tab__progress-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  height: 0%;
  transition: height 0.1s linear;
}

/* Mobile: bottom-right floating pill */
@media (max-width: 480px) {
  .listen-tab {
    left: auto;
    right: 16px;
    bottom: 24px;
    top: auto;
    transform: none;
    flex-direction: row;
    border-radius: 999px;
    padding: 12px 16px;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    min-width: unset;
  }

  .listen-tab__progress {
    display: none;
  }

  .listen-tab__icon {
    font-size: 20px;
  }

  .listen-tab__duration {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 13px;
  }

  .listen-tab__play {
    width: 40px;
    height: 40px;
  }
}

.listen-bar {
  background: var(--accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: #fff;
}

.listen-bar__main {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
}

.listen-bar__play {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background 0.15s ease;
}

.listen-bar__play:hover {
  background: rgba(255, 255, 255, 0.35);
}

.listen-bar__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.listen-bar__label {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
}

.listen-bar__time {
  font-size: var(--text-sm);
  opacity: 0.85;
}

.listen-bar__track {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
}

.listen-bar__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #fff;
  width: 0%;
  pointer-events: none;
  transition: width 0.1s linear;
}

.listen-bar__scrub {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  margin: 0;
  padding: 0;
  height: 100%;
}

.listen-bar--speech .listen-bar__track {
  display: none;
}


/* ============================================================
   PODCAST SCRIPT (podcast page)
   ============================================================ */

.audio-section__speech {
  max-width: var(--content-width);
  margin: var(--space-6) auto 0;
  padding: 0 var(--side-padding);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.web-speech-btn {
  background: var(--bg-sunken);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
  white-space: nowrap;
}

.web-speech-btn:hover {
  background: var(--accent-bg);
}

.audio-section__speech-note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.podcast-page__label {
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: var(--weight-semibold);
  margin-top: var(--space-2);
}

.lenny-quote-block {
  max-width: var(--content-width);
  margin: var(--space-8) auto 0;
  padding: var(--space-5) var(--side-padding) 0;
  border-top: 1.5px solid var(--border-color);
}

.lenny-quote-block__label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-4);
}

.lenny-quote-block__context {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  line-height: var(--leading-relaxed);
}

.lenny-quote-block__quote {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  font-style: italic;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  margin: 0;
  padding: var(--space-3) var(--space-5);
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}

.btn--secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn--secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  padding: 0;
  height: auto;
}

.btn--ghost:hover {
  color: var(--accent-hover);
}

.btn--sm {
  height: 32px;
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
}

.btn--lg {
  height: 48px;
  padding: 0 var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-md);
}


/* ============================================================
   BACK NAVIGATION
   ============================================================ */

.back-nav {
  max-width: var(--catalogue-width);
  margin: 0 auto;
  padding: var(--space-5) var(--side-padding) 0;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.back-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease);
}

.back-nav__link:hover {
  color: var(--text-primary);
}

.back-nav__link + .back-nav__link::before {
  content: '·';
  margin-right: var(--space-6);
  color: var(--text-tertiary);
}

/* ============================================================
   EPISODE NAV (bottom)
   ============================================================ */

.ep-nav {
  border-top: 1.5px solid var(--border-color);
}

.ep-nav__inner {
  max-width: var(--ep-nav-width);
  margin: 0 auto;
  padding: var(--space-5) var(--side-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ep-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.18s ease;
}

.ep-nav__link:hover { color: var(--text-primary); }

.ep-nav__link--mid {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.ep-nav--top {
  border-top: none;
  border-bottom: 1.5px solid var(--border-color);
}

.ep-nav--top .ep-nav__inner {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.ep-nav--bottom {
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}


/* ============================================================
   KARAOKE
   ============================================================ */

.karaoke {
  background: var(--bg-warm);
  border-top: var(--border);
  padding: 48px var(--side-padding) 64px;
}

.karaoke__inner {
  max-width: 760px;
  margin: 0 auto;
}

.karaoke__label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 24px;
  text-align: center;
}

.karaoke__body {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: center;
}

.karaoke__left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.karaoke__fire {
  height: 220px;
  width: auto;
}

@keyframes fire-glow {
  0%, 100% { transform: scale(1) translateY(0);       filter: drop-shadow(0 4px 10px rgba(229,139,95,0.4)); }
  50%       { transform: scale(1.07) translateY(-5px); filter: drop-shadow(0 10px 24px rgba(229,139,95,0.8)); }
}

.karaoke__btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 9px 22px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.karaoke__btn:hover { opacity: 0.85; }

@media (max-width: 600px) {
  .karaoke__body {
    flex-direction: column;
    gap: 24px;
  }
  .karaoke__fire { height: 140px; }
  .karaoke__scroll {
    width: 100%;
    height: 10rem;
  }
}

.karaoke__scroll {
  position: relative;
  width: 360px;
  height: 8rem;
  overflow: hidden;
  text-align: left;
}

.karaoke__scroll-inner {
  transition: transform 0.4s ease;
}

.karaoke__line {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 2;
  padding: 0;
}

.karaoke__line--done .karaoke__word { color: rgba(54,55,55,0.4); }

.karaoke__word {
  color: rgba(54,55,55,0.25);
  display: inline;
  transition: color 0.15s;
}

.karaoke__word--active {
  color: var(--accent);
  font-weight: 700;
}

.karaoke__word--done {
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .karaoke__scroll { text-align: center; }
  .karaoke__line  { text-align: center; }
}

/* ============================================================
   INTEREST SIGNUP
   ============================================================ */

.interest-signup {
  border-top: var(--border);
  padding: var(--space-12) var(--side-padding);
  background: var(--bg-warm);
}

.interest-signup__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
}

.interest-signup__heading {
  font-family: var(--font-sans);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.interest-signup__body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 520px;
  margin-bottom: var(--space-6);
}

.interest-signup__form {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.interest-signup__input {
  flex: 1;
  min-width: 200px;
  height: 44px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms ease;
}

.interest-signup__input:focus {
  border-color: var(--accent);
}

.interest-signup__btn {
  height: 44px;
  padding: 0 var(--space-5);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms ease;
}

.interest-signup__btn:hover    { background: var(--accent-hover); }
.interest-signup__btn:disabled { opacity: 0.5; cursor: not-allowed; }

.interest-signup__thanks {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-3) 0;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  border-top: var(--border);
  background: var(--bg-sunken);
  padding: var(--space-8) var(--side-padding);
  margin-top: auto;
}

.footer__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.footer__credit {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-normal);
}

.footer__credit a {
  color: var(--accent);
}

.footer__lenny-link {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.footer__lenny-link a {
  color: var(--accent);
  font-weight: var(--weight-semibold);
}


/* ============================================================
   UTILITY
   ============================================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.font-bold { font-weight: var(--weight-bold); }


/* ============================================================
   GENERATE PAGE
   ============================================================ */

.generate-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px var(--side-padding) var(--space-12);
  text-align: center;
}


.state { display: none; }
.state--visible { display: block; }

.name-form__label {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  display: block;
}

.name-form__input {
  font-size: 16px; /* 16px minimum prevents iOS zoom on focus */
  padding: 12px var(--space-4);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 320px;
  display: block;
  margin: 0 auto var(--space-3);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease);
}

.name-form__input:focus {
  border-color: var(--accent);
}

.name-form__submit {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  padding: 12px var(--space-7);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}

.name-form__submit:hover { background: var(--accent-hover); }

.name-form__helper {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.progress__message {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  min-height: 1.6em;
  margin-bottom: var(--space-2);
}

.terminal__message {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: 0 auto var(--space-5);
  max-width: 360px;
  line-height: var(--leading-relaxed);
}

.retry-btn {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  padding: 12px var(--space-7);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}

.retry-btn:hover { background: var(--accent-hover); }

.retry-btn--link {
  display: inline-block;
  text-decoration: none;
  font-size: var(--text-sm);
  padding: 8px 20px;
  border-radius: var(--radius-full);
}

.coming-soon__sub {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin: 0 auto var(--space-5);
  max-width: 320px;
  line-height: var(--leading-relaxed);
  text-align: center;
}

@media (min-width: 768px) {
  .name-form__input  { font-size: 1.1rem; }
  .name-form__label  { font-size: var(--text-xl); }
  .progress__message { font-size: var(--text-xl); }
}


/* ============================================================
   MASCOTS — character image placements
   ============================================================ */

/* Homepage hero: campfire scene to the right of the headline */
.page-hero--with-mascot {
  text-align: left;
  padding-bottom: 0;
}

.page-hero__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
}

.page-hero--with-mascot .page-hero__inner {
  display: flex;
  align-items: flex-end;
  gap: var(--space-8);
}

.page-hero__text {
  flex: 1;
  padding-bottom: var(--space-12);
}

.hero-campfire {
  flex-shrink: 0;
  width: 340px;
  height: auto;
  display: block;
}

/* Portrait-oriented hero mascots (single character images) */
.hero-mascot {
  flex-shrink: 0;
  height: 280px;
  width: auto;
  display: block;
}

.page-hero--with-mascot .page-hero__subtitle {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 700px) {
  .page-hero--with-mascot { text-align: center; }
  .page-hero__inner { flex-direction: column; align-items: center; gap: 0; }
  .page-hero__text { padding-bottom: var(--space-4); }
  .hero-campfire { width: 220px; order: -1; }
  .hero-mascot { height: 180px; order: -1; }
}

/* Episode/podcast hero: mascot peeks up from bottom-right corner */
.episode-page__hero {
  position: relative;
  overflow: hidden;
}


/* Generate page: mascot above progress / error messages */
.state-mascot {
  width: 300px;
  height: auto;
  margin: 0 auto var(--space-5);
  display: block;
}

/* Empty / error states in browse list */
.empty-state {
  text-align: center;
  padding: var(--space-10) 0;
}

.empty-state__mascot {
  width: 180px;
  height: auto;
  margin: 0 auto var(--space-4);
  display: block;
}


/* ============================================================
   ABOUT PAGE — editorial layout
   ============================================================ */

.about-hero__title {
  font-family: var(--font-sans);
  font-size: clamp(var(--text-xl), 4vw, var(--text-h2));
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
}

.about-body {
  max-width: 840px;
  margin: 0 auto;
  padding: var(--space-16) var(--side-padding) var(--space-20);
}

.about-section {
  margin-bottom: var(--space-12);
}

.about-section + .about-section {
  padding-top: var(--space-12);
  border-top: var(--border);
}

.about-section__heading {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.about-section p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.about-section p:last-child {
  margin-bottom: 0;
}

.about-section a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-section a:hover {
  color: var(--accent-hover);
}

.about-section p + p {
  margin-top: var(--space-1);
}

.about-pullquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-3) var(--space-5);
  margin: var(--space-6) 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.about-pullquote cite {
  display: block;
  font-size: var(--text-xs);
  font-style: normal;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-top: var(--space-3);
}

.about-callout {
  background: var(--bg-sunken);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin: var(--space-6) 0;
}

.about-callout__label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.about-callout p {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: var(--space-3);
}

.about-callout p:last-child {
  margin-bottom: 0;
}

.evidence-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

@media (min-width: 540px) {
  .evidence-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.evidence-card {
  background: var(--bg-primary);
  border: 1px solid rgba(54,55,55,0.08);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}

.evidence-card__guest {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.evidence-card__concept {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.evidence-card__result {
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

.about-creator {
  display: flex;
  align-items: flex-end;
  gap: var(--space-6);
}

.about-creator__avatar {
  flex-shrink: 0;
  height: 140px;
  width: auto;
  display: block;
}

.about-attribution {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: var(--leading-relaxed);
  padding-top: var(--space-8);
  border-top: var(--border);
  margin-top: var(--space-8);
}

.about-attribution a {
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-attribution a:hover {
  color: var(--text-secondary);
}


/* ============================================================
   EXPLORE PAGE — filter controls + card grid
   ============================================================ */

.explore-layout {
  flex: 1;
  padding: var(--space-8) var(--side-padding) var(--space-20);
}

.explore-layout__inner {
  max-width: var(--catalogue-width);
  margin: 0 auto;
}

/* Filter + sort controls block */
.explore-controls {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-hint {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  margin: 0;
}

.explore-filter__pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
}

.filter-count-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.filter-match-count {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--accent);
  transition: color 0.2s ease;
}

.filter-match-count--all {
  color: var(--text-secondary);
  font-weight: var(--weight-semibold);
}

.explore-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.explore-meta-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.clear-filters-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.clear-filters-btn:hover { color: var(--accent-hover); }

/* Sort segmented control */
.sort-control {
  display: inline-flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.sort-btn--active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.sort-btn:hover:not(.sort-btn--active) { color: var(--text-primary); }

@media (max-width: 600px) {
  .sort-control {
    flex-direction: column;
    gap: 1px;
  }
  .sort-btn {
    padding: 5px 10px;
    justify-content: center;
    font-size: 12px;
  }
}

/* Search bar (secondary — below controls) */
.explore-search {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.explore-search__inner {
  position: relative;
  max-width: 380px;
}

/* ============================================================
   ARCHIVE GRID — card layout for Explore page
   ============================================================ */

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 860px) { .archive-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .archive-grid { grid-template-columns: 1fr; } }

.archive-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 14px;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  border-left: 4px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  /* Safari: will-change ensures composited layer so animation fires on dynamic content */
  will-change: opacity, transform;
  animation: cardEnter 0.32s ease forwards;
}

.archive-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Consistent left border — matches hero warm shade */
.archive-card { border-left-color: var(--bg-tertiary); }

.archive-card__title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.archive-card__guest {
  font-size: var(--text-xs, 12px);
  color: var(--text-tertiary);
  line-height: 1.3;
}

.archive-card__date {
  margin-left: 6px;
  opacity: 0.6;
}

.archive-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 8px;
}

.archive-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.archive-chip--big-decisions     { background: #FEF3D8; color: #92400E; }
.archive-chip--start-a-business  { background: #ECFAE3; color: #3F6B09; }
.archive-chip--your-future       { background: #FEF9EC; color: #B45309; }
.archive-chip--get-famous        { background: #FFF0E5; color: #C2410C; }
.archive-chip--build-things      { background: #F5EDE4; color: #7C5233; }
.archive-chip--ai-and-robots     { background: #FEF0E0; color: #7C2D12; }
.archive-chip--sales             { background: #FEF0F0; color: #B91C1C; }
.archive-chip--measure-things    { background: #F5F3F1; color: #57534E; }
.archive-chip--be-a-leader       { background: #EEF2FF; color: #3730A3; }
.archive-chip--available         { background: var(--accent); color: #fff; font-weight: var(--weight-bold); }

.archive-card--featured {
  border-left-color: var(--accent);
}


/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 480px) {
  :root {
    --side-padding: 16px;
    --text-base: 15px;
  }

  .page-hero {
    padding: var(--space-10) var(--side-padding) var(--space-8);
  }

  .episode-page__hero-inner {
    flex-direction: column;
    align-items: flex-start;
    min-height: unset;
  }

  #guest-photo-slot {
    order: -1;
    width: 100%;
    height: auto;
    align-self: auto;
  }

  .episode-page__guest-photo {
    width: 100%;
    height: auto;
    min-height: unset;
    aspect-ratio: 1 / 1;
  }


  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Responsive content width for episode/newsletter page ── */
@media (min-width: 900px) {
  :root { --content-width: 760px; }
}

@media (min-width: 1100px) {
  :root { --content-width: 860px; }
}

@media (min-width: 1400px) {
  :root { --content-width: 960px; }
}


/* ============================================================
   LITTLE LENNY AI AGENT — chat widget (site dark mode)
   Inverted site palette: --text-primary as bg, --bg-primary as text
   ============================================================ */

.chat-widget {
  max-width: var(--content-width);
  margin: var(--space-8) auto;
  padding: 0 var(--side-padding);
}

.chat-widget__inner {
  background: #2C1A0E;
  border: 1px solid #4A2E18;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  font-family: 'IBM Plex Mono', 'Courier New', 'Courier', monospace;
}

.chat-widget__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid #4A2E18;
}

.chat-widget__icon {
  font-size: 40px;
  line-height: 1;
  flex-shrink: 0;
}

.chat-widget__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.5em;
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--accent);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.chat-widget__subtitle {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--bg-primary);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  letter-spacing: 0;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  min-height: 0;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #4A2E18 #2C1A0E;
}

.chat-messages:empty {
  display: none;
}

.chat-message {
  max-width: 86%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.7;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

.chat-message--user {
  align-self: flex-end;
  background: #3A2010;
  color: var(--bg-primary);
  border: 1px solid #5A3520;
  border-radius: var(--radius-sm) var(--radius-sm) 2px var(--radius-sm);
}

.chat-message--agent {
  align-self: flex-start;
  background: #221408;
  color: var(--bg-primary);
  border: 1px solid #4A2E18;
  border-radius: 2px var(--radius-sm) var(--radius-sm) var(--radius-sm);
}

.chat-message--agent::before {
  content: '> ';
  color: var(--accent);
}

.chat-message--typing {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-2) 0;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

.chat-starters {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
  padding: 0 var(--space-2);
}

.chat-starters:empty {
  display: none;
  padding: 0;
}

.chat-starter {
  background: transparent;
  color: var(--accent);
  border: 1px solid #4A2E18;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}


.chat-starter:hover {
  border-color: var(--accent);
  color: var(--bg-primary);
  background: var(--accent);
}

.chat-form {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}

.chat-input-area {
  flex: 1;
  background: #221408;
  border: 1px solid #4A2E18;
  border-radius: var(--radius-sm);
  transition: border-color 150ms ease;
  overflow: hidden;
}

.chat-input-area:focus-within {
  border-color: var(--accent);
}

.chat-input-row {
  display: flex;
  align-items: center;
}

.chat-input {
  flex: 1;
  height: 44px;
  padding: 0 var(--space-4);
  border: none;
  background: transparent;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--bg-primary);
  outline: none;
}

.chat-input::placeholder {
  color: #7A5030;
  font-weight: 400;
}

.chat-mic {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-tertiary);
  border: none;
  border-left: 1px solid #4A2E18;
  border-radius: 0;
  cursor: pointer;
  transition: color 150ms ease, background 150ms ease;
  flex-shrink: 0;
}

.chat-mic:hover {
  background: #3A2010;
  color: var(--accent);
}

.chat-mic--listening {
  background: #3A1A1A;
  color: #EF4444;
  border-color: #EF4444;
  animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.chat-submit {
  height: 44px;
  padding: 0 var(--space-5);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease;
  white-space: nowrap;
  letter-spacing: 0.05em;
}

.chat-submit:hover    { background: var(--accent-hover); }
.chat-submit:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 480px) {
  .chat-message { max-width: 94%; }
}
