/* Comedytrain — design tokens + primitives
   Editorial Luxury, with two calibrated worlds:
   night stage (default) and warm paper (light). */

:root{
  /* ---- night stage ---- */
  --bg-rgb:11 10 9;
  --bg-2-rgb:18 17 16;
  --bg-3-rgb:23 20 15;
  --fg-rgb:243 237 228;
  --dim-rgb:167 156 142;
  --accent-rgb:200 50 43;
  --accent-hi-rgb:217 65 58;

  --line-a:.12;
  --line-soft-a:.07;
  --pane-a:.045;
  --nav-a:.55;
  --sheet-a:.92;
  --grain:.035;
  --core-hi:rgba(255,255,255,.10);
  --nav-shadow:0 18px 60px -20px rgba(0,0,0,.90);
  --on-accent:#FFFFFF;
  --photo-filter:saturate(.82) contrast(1.04);

  --ease:cubic-bezier(.32,.72,0,1);
  --r-lg:2rem;
  --r-md:1.25rem;
}

[data-theme="light"]{
  /* ---- warm paper ---- */
  --bg-rgb:242 235 225;
  --bg-2-rgb:247 241 232;
  --bg-3-rgb:252 248 242;
  --fg-rgb:20 17 14;
  --dim-rgb:104 94 83;
  --accent-rgb:181 43 36;
  --accent-hi-rgb:158 34 28;

  --line-a:.14;
  --line-soft-a:.085;
  --pane-a:.05;
  --nav-a:.86;
  --sheet-a:.95;
  --grain:.05;
  --core-hi:rgba(255,255,255,.85);
  --nav-shadow:0 18px 46px -24px rgba(74,56,38,.38);
  --on-accent:#FFFFFF;
  --photo-filter:saturate(.96) contrast(1.02);
}

:root{
  --bg:rgb(var(--bg-rgb));
  --fg:rgb(var(--fg-rgb));
  --fg-dim:rgb(var(--dim-rgb));
  --line:rgb(var(--fg-rgb) / var(--line-a));
  --line-soft:rgb(var(--fg-rgb) / var(--line-soft-a));
  --accent:rgb(var(--accent-rgb));
}

*{ -webkit-tap-highlight-color: transparent; }

html{ scroll-behavior:smooth; background:var(--bg); }
@media (prefers-reduced-motion: reduce){ html{ scroll-behavior:auto; } }

body{
  background:var(--bg);
  color:var(--fg);
  font-family:'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight:400;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  transition:background-color .6s var(--ease), color .6s var(--ease);
}

::selection{ background:var(--accent); color:var(--on-accent); }

/* ---------- type ---------- */
.display{
  font-family:'Clash Display','Plus Jakarta Sans',sans-serif;
  font-weight:500;
  letter-spacing:-.025em;
  line-height:.94;
}
.eyebrow{
  font-size:10px; letter-spacing:.22em; text-transform:uppercase;
  font-weight:500; color:var(--fg-dim);
}
.mono-num{ font-variant-numeric:tabular-nums; }

/* ---------- grain ---------- */
.grain{
  position:fixed; inset:0; z-index:60; pointer-events:none; opacity:var(--grain);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  transition:opacity .6s var(--ease);
}

/* ---------- double bezel ---------- */
.bezel{
  background:rgb(var(--fg-rgb) / var(--pane-a));
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  padding:.5rem;
  transition:background-color .6s var(--ease), border-color .6s var(--ease);
}
.bezel > .core{
  border-radius:calc(var(--r-lg) - .4rem);
  overflow:hidden;
  background:rgb(var(--bg-3-rgb));
  box-shadow:inset 0 1px 1px var(--core-hi);
  position:relative;
  transition:background-color .6s var(--ease);
}
.bezel-cream{ background:rgb(var(--fg-rgb) / .06); border-color:rgb(var(--fg-rgb) / .18); }

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:.75rem;
  border-radius:999px; padding:.95rem 1.35rem;
  font-size:14px; font-weight:500; letter-spacing:.01em;
  transition:transform .55s var(--ease), background-color .55s var(--ease), color .55s var(--ease), border-color .55s var(--ease);
  will-change:transform;
}
.btn:active{ transform:scale(.98); }
.btn .ic{
  width:2rem; height:2rem; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  transition:transform .55s var(--ease), background-color .55s var(--ease);
}
.btn:hover .ic{ transform:translate(3px,-2px) scale(1.06); }

.btn-primary{ background:var(--accent); color:var(--on-accent); }
.btn-primary:hover{ background:rgb(var(--accent-hi-rgb)); }
.btn-primary .ic{ background:rgba(0,0,0,.18); }

.btn-ghost{ border:1px solid var(--line); color:var(--fg); }
.btn-ghost:hover{ border-color:rgb(var(--fg-rgb) / .32); background:rgb(var(--fg-rgb) / .05); }
.btn-ghost .ic{ background:rgb(var(--fg-rgb) / .08); }

.btn-cream{ background:var(--fg); color:rgb(var(--bg-rgb)); }
.btn-cream .ic{ background:rgba(0,0,0,.08); }

/* ---------- theme toggle ---------- */
.theme-toggle{
  position:relative; width:2.6rem; height:2.6rem; flex:0 0 auto;
  border-radius:999px; border:1px solid var(--line);
  display:grid; place-items:center;
  color:var(--fg);
  transition:background-color .5s var(--ease), border-color .5s var(--ease), color .5s var(--ease);
}
.theme-toggle:hover{ background:rgb(var(--fg-rgb) / .06); border-color:rgb(var(--fg-rgb) / .22); }
.theme-toggle .tt{
  position:absolute; inset:0; display:grid; place-items:center;
  transition:transform .6s var(--ease), opacity .45s var(--ease);
}
.theme-toggle .tt-sun{ transform:rotate(0deg) scale(1); opacity:1; }
.theme-toggle .tt-moon{ transform:rotate(-70deg) scale(.6); opacity:0; }
[data-theme="light"] .theme-toggle .tt-sun{ transform:rotate(70deg) scale(.6); opacity:0; }
[data-theme="light"] .theme-toggle .tt-moon{ transform:rotate(0deg) scale(1); opacity:1; }

/* ---------- nav ---------- */
.nav-shell{ position:fixed; top:1.25rem; left:0; right:0; z-index:56; display:flex; justify-content:center; padding:0 1rem; }
.nav-pill{
  display:flex; align-items:center; gap:.25rem;
  padding:.4rem .4rem .4rem 1.1rem;
  border-radius:999px;
  background:rgb(var(--bg-rgb) / var(--nav-a));
  border:1px solid var(--line);
  backdrop-filter:blur(18px) saturate(140%);
  -webkit-backdrop-filter:blur(18px) saturate(140%);
  box-shadow:var(--nav-shadow);
  transition:background-color .6s var(--ease), border-color .6s var(--ease), box-shadow .6s var(--ease);
}
.nav-link{
  font-size:13px; color:rgb(var(--fg-rgb) / .72); padding:.6rem .85rem; border-radius:999px;
  transition:color .4s var(--ease), background-color .4s var(--ease);
}
.nav-link:hover{ color:var(--fg); background:rgb(var(--fg-rgb) / .07); }
.nav-link[aria-current="page"]{ color:var(--fg); }

/* mobile sheet */
.sheet{
  position:fixed; inset:0; z-index:55;
  background:rgb(var(--bg-rgb) / var(--sheet-a));
  backdrop-filter:blur(28px); -webkit-backdrop-filter:blur(28px);
  opacity:0; pointer-events:none;
  transition:opacity .5s var(--ease), background-color .6s var(--ease);
}
.sheet.open{ opacity:1; pointer-events:auto; }
.sheet a{
  display:block; font-family:'Clash Display',sans-serif; font-size:2rem; line-height:1.15;
  letter-spacing:-.02em;
  opacity:0; transform:translateY(24px);
  transition:opacity .6s var(--ease), transform .6s var(--ease);
}
.sheet.open a{ opacity:1; transform:none; }

/* hamburger */
.burger{ width:2.6rem; height:2.6rem; border-radius:999px; display:grid; place-items:center; border:1px solid var(--line); }
.burger span{ display:block; width:16px; height:1.25px; background:var(--fg); border-radius:2px; transition:transform .5s var(--ease), opacity .3s var(--ease), background-color .6s var(--ease); }
.burger span + span{ margin-top:4px; }
.burger[aria-expanded="true"] span:nth-child(1){ transform:translateY(5.25px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2){ opacity:0; }
.burger[aria-expanded="true"] span:nth-child(3){ transform:translateY(-5.25px) rotate(-45deg); }

/* ---------- reveal ---------- */
[data-reveal]{
  opacity:0; transform:translateY(18px); filter:blur(8px);
  transition:opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease);
}
[data-reveal].is-in{ opacity:1; transform:none; filter:none; }

/* ---------- marquee ---------- */
.marquee{ overflow:hidden; border-top:1px solid var(--line-soft); border-bottom:1px solid var(--line-soft); }
.marquee__track{ display:flex; width:max-content; animation:slide 42s linear infinite; }
.marquee:hover .marquee__track{ animation-play-state:paused; }
@keyframes slide{ from{ transform:translate3d(0,0,0);} to{ transform:translate3d(-50%,0,0);} }

/* ---------- cards ---------- */
.show-card{
  position:relative; border-radius:var(--r-lg);
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgb(var(--fg-rgb) / .055), rgb(var(--fg-rgb) / .02));
  transition:transform .8s var(--ease), border-color .8s var(--ease), background-color .8s var(--ease);
  will-change:transform;
}
.show-card:hover{ border-color:rgb(var(--fg-rgb) / .26); transform:translateY(-6px) rotate(0deg) !important; }
.tilt-1{ transform:rotate(-1.4deg); }
.tilt-2{ transform:rotate(.9deg); }
.tilt-3{ transform:rotate(-.6deg); }

.chip{
  display:inline-flex; align-items:center; gap:.4rem;
  font-size:10.5px; letter-spacing:.14em; text-transform:uppercase; font-weight:500;
  padding:.4rem .7rem; border-radius:999px; border:1px solid var(--line);
  color:rgb(var(--fg-rgb) / .68);
  transition:background-color .6s var(--ease), color .6s var(--ease), border-color .6s var(--ease);
}
.chip-red{ border-color:rgb(var(--accent-rgb) / .40); color:var(--accent); background:rgb(var(--accent-rgb) / .10); }
.chip-cream{ background:var(--fg); color:rgb(var(--bg-rgb)); border-color:transparent; font-weight:600; }
.chip-live{ border-color:rgb(var(--accent-rgb) / .45); color:var(--accent); }
.chip-live .dot{ width:5px; height:5px; border-radius:999px; background:var(--accent); animation:pulse 2.4s infinite; }
@keyframes pulse{ 0%,100%{opacity:1} 50%{opacity:.25} }

.sold{ opacity:.55; }
.sold .show-card__title{ text-decoration:line-through; text-decoration-thickness:1px; text-decoration-color:rgb(var(--fg-rgb) / .35); }

/* ---------- images ---------- */
.photo{ width:100%; height:100%; object-fit:cover; display:block; filter:var(--photo-filter); transition:filter .6s var(--ease); }
.photo-wrap{ position:relative; }
.photo-wrap::after{
  content:''; position:absolute; inset:0;
  background:linear-gradient(180deg, rgb(var(--bg-rgb) / 0) 35%, rgb(var(--bg-rgb) / .78) 100%);
}

/* scrim over photography stays dark in both themes; captions stay cream */
.scrim{
  background:linear-gradient(to top,
    rgba(6,5,4,.94) 0%, rgba(6,5,4,.58) 30%,
    rgba(6,5,4,.10) 60%, rgba(6,5,4,0) 82%);
}
.on-photo{ color:#F3EDE4; }
.on-photo-soft{ color:rgba(243,237,228,.70); }

/* sticky mobile buy bar */
.buybar{ background:rgb(var(--bg-rgb) / .72); }
[data-theme="light"] .buybar{
  background:rgb(var(--bg-3-rgb) / .93);
  border-color:rgb(var(--fg-rgb) / .10);
  box-shadow:0 18px 40px -24px rgba(74,56,38,.55);
}
[data-theme="light"] .buybar > .core{ background:transparent; }

/* hero show card */
.hero-card{
  display:flex; align-items:center; justify-content:space-between; gap:.75rem;
  border-radius:1.35rem; padding:.75rem 1rem;
  border:1px solid rgb(var(--fg-rgb) / .15);
  background:rgb(var(--bg-rgb) / .62);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  transition:background-color .5s var(--ease), border-color .5s var(--ease), box-shadow .5s var(--ease);
}
.hero-card:hover{ background:rgb(var(--bg-rgb) / .80); }
.hero-card__title{ color:var(--fg); }
.hero-card__meta{ color:rgb(var(--fg-rgb) / .66); }

/* ---------- light theme refinements ---------- */
[data-theme="light"] .show-card{
  background:rgb(var(--bg-3-rgb));
  border-color:rgb(var(--fg-rgb) / .10);
  box-shadow:0 22px 44px -38px rgba(74,56,38,.55);
}
[data-theme="light"] .bezel{ box-shadow:0 16px 36px -32px rgba(74,56,38,.40); }
[data-theme="light"] .nav-pill{ box-shadow:0 14px 32px -22px rgba(74,56,38,.30); }
[data-theme="light"] .hero-card{
  background:rgb(var(--bg-3-rgb) / .97);
  border-color:rgb(var(--fg-rgb) / .10);
  backdrop-filter:none; -webkit-backdrop-filter:none;
  box-shadow:0 16px 36px -22px rgba(74,56,38,.50);
}
[data-theme="light"] .hero-card:hover{ background:#FFFDFA; }
[data-theme="light"] .btn-primary .ic{ background:rgba(0,0,0,.16); }
[data-theme="light"] .grain{ mix-blend-mode:multiply; }

.gift-glow{ background:radial-gradient(circle, rgb(var(--accent-rgb) / .32), transparent 62%); }
[data-theme="light"] .gift-glow{ background:radial-gradient(circle, rgb(var(--accent-rgb) / .16), transparent 64%); }

/* ---------- misc ---------- */
.hairline{ border-top:1px solid var(--line-soft); }
.link-u{ position:relative; }
.link-u::after{
  content:''; position:absolute; left:0; bottom:-3px; height:1px; width:100%;
  background:currentColor; transform:scaleX(0); transform-origin:left;
  transition:transform .6s var(--ease);
}
.link-u:hover::after{ transform:scaleX(1); }

:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:6px; }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
  [data-reveal]{ opacity:1 !important; transform:none !important; filter:none !important; }
  .tilt-1,.tilt-2,.tilt-3{ transform:none !important; }
}

/* very small phones: keep the nav pill inside the viewport */
@media (max-width: 359px){
  .nav-pill{ padding-left:.7rem; gap:.3rem; }
  .nav-wordmark{ font-size:10px; letter-spacing:.16em; padding-right:.35rem; }
  .nav-cta-label{ display:none; }
  .nav-pill .btn-primary{ padding:0 !important; width:2.55rem; height:2.55rem; justify-content:center; }
  .nav-pill .btn-primary .ic{ width:2.05rem; height:2.05rem; }
  .burger{ width:2.3rem; height:2.3rem; }
  .theme-toggle{ width:2.3rem; height:2.3rem; }
  .chip{ letter-spacing:.10em; font-size:10px; }
}
