/* ============================================================
   LUSTHAUS — "REEL"  (v3)
   Full-screen vertical swipe.  One 9:16 frame per viewport,
   native scroll-snap, endless shuffled feed.  Dark + red only.
   Sora (self-hosted).  Zero dependencies, no build step.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg: #08080a;
  --glass: rgba(16, 16, 19, 0.5);
  --glass-2: rgba(22, 22, 26, 0.62);
  --line: rgba(255, 255, 255, 0.14);
  --line-2: rgba(255, 255, 255, 0.24);

  --text: #f6f6f7;
  --text-2: #c7c7cc;
  --text-3: #8a8a92;

  --red: #ff3049;
  --red-deep: #b00d20;
  --accent: linear-gradient(120deg, #ff3049, #b00d20);
  --glow: rgba(255, 48, 73, 0.3);

  --font: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", system-ui, sans-serif;
  --mono: "Sora", system-ui, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --legalbar-h: 34px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01";
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
::selection { background: rgba(255, 48, 73, 0.4); color: #fff; }
:focus-visible { outline: 2px solid #ff8a99; outline-offset: 2px; border-radius: 6px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- stage: one scroll pane per mode ---------- */
.stage { position: fixed; inset: 0; }

.feed {
  position: absolute; inset: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  scrollbar-width: none;
  overflow-anchor: none;
  background: var(--bg);
}
.feed::-webkit-scrollbar { display: none; }
/* the inactive mode stays mounted (and keeps its position) but is not painted */
.feed.is-hidden { visibility: hidden; pointer-events: none; }

.track { position: relative; width: 100%; }

.slide {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #08080a;
}

.slide::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0) 16%,
    rgba(0, 0, 0, 0) 62%,
    rgba(0, 0, 0, 0.6) 100%
  );
  pointer-events: none;
}

.slide__media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #08080a;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.slide.is-loaded .slide__media { opacity: 1; }

/* wide screens: present the 9:16 frame as a centred phone column */
@media (min-width: 700px) {
  .slide__media,
  .slide__ui {
    width: calc(100vh * 9 / 16);
    width: calc(100dvh * 9 / 16);
    left: 0; right: 0;
    margin: 0 auto;
  }
  .slide__media {
    height: 100%;
    border-radius: 6px;
    box-shadow: 0 40px 120px -50px rgba(0, 0, 0, 1);
  }
}

/* overlay layer for the caption; sits above the bottom scrim so the name
   stays bright white instead of being multiplied by the gradient */
.slide__ui { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

/* pause overlay */
.slide__play {
  position: absolute; top: 50%; left: 50%;
  width: 74px; height: 74px; margin: -37px 0 0 -37px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0; transform: scale(0.9);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.slide.is-paused .slide__play { opacity: 1; transform: scale(1); }
.slide__play svg { width: 26px; height: 26px; fill: #fff; margin-left: 3px; }

/* caption */
.slide__info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 calc(16px + var(--safe-r)) calc(22px + var(--safe-b) + var(--legalbar-h)) calc(16px + var(--safe-l));
  pointer-events: none;
}
.slide__title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  overflow-wrap: break-word;
  max-width: 84%;
}
.slide__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; max-width: 84%; }
.slide__tags span {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-2);
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* like button (feed) */
.slide__like {
  position: absolute;
  right: calc(14px + var(--safe-r));
  bottom: calc(16px + var(--safe-b) + var(--legalbar-h));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), color 0.18s var(--ease);
}
.slide__like svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linejoin: round;
}
.slide__like.is-liked {
  color: #ff3049;
  border-color: rgba(255, 48, 73, 0.6);
  background: rgba(255, 48, 73, 0.16);
}
.slide__like.is-liked svg { fill: currentColor; }
.slide__like:active { transform: scale(0.94); }

/* loading / empty state */
.state {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-content: center; justify-items: center;
  gap: 14px; text-align: center; padding: 24px;
  color: var(--text-3);
}
.state[hidden] { display: none; }
.state__spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--red);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.state__text { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.state--empty .state__spin { display: none; }
.state--empty .state__text { max-width: 34ch; line-height: 1.7; letter-spacing: 0.02em; text-transform: none; }

/* ---------- HUD ---------- */
.hud {
  position: fixed; left: 0; right: 0; z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) 0 calc(14px + var(--safe-l));
  pointer-events: none;
}
.hud > * { pointer-events: auto; }

.brand { display: flex; align-items: center; justify-self: start; min-width: 0; }
.brand__logo {
  height: 26px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.6));
}

.topcenter { display: grid; justify-items: center; min-width: 0; }

.icon-btn {
  justify-self: end;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:active { transform: scale(0.94); }

/* ---------- segmented mode switch ---------- */
.switch {
  position: relative;
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.9);
}
.switch__thumb {
  position: absolute;
  top: 4px; left: 4px; bottom: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 6px 22px -8px var(--red);
  transition: transform 0.3s var(--ease);
  will-change: transform;
}
.switch[data-mode="image"] .switch__thumb { transform: translateX(100%); }
.switch__btn {
  position: relative; z-index: 1;
  min-width: 84px;
  height: 32px; padding: 0 16px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
  transition: color 0.2s ease;
}
.switch__btn[aria-selected="true"] { color: #fff; }

/* ---------- age gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 20px;
  background:
    radial-gradient(700px 460px at 50% 12%, rgba(255, 48, 73, 0.16), transparent 60%),
    #08080a;
}
html:not(.gated) .gate { display: none; }
.gate__box {
  width: 100%; max-width: 380px;
  text-align: center;
  padding: 30px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: 0 40px 90px -50px #000;
}
.gate__logo { width: 220px; max-width: 70%; height: auto; margin: 0 auto 18px; }
.gate__age { font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-3); margin-bottom: 18px; }
.gate__title { font-size: 19px; font-weight: 600; line-height: 1.3; letter-spacing: 0.01em; color: var(--text); margin: 0 0 14px; }
.gate__lead { color: var(--text-2); font-size: 13.5px; margin: 0 0 22px; line-height: 1.65; }
.gate__actions { display: grid; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px;
  border-radius: 999px;
  font-weight: 600; font-size: 13.5px; letter-spacing: 0.03em;
  transition: transform 0.15s ease, opacity 0.2s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 14px 34px -16px var(--red); }
.btn--ghost { border: 1px solid var(--line-2); color: var(--text-2); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.gate__tiny { margin-top: 18px; color: var(--text-3); font-size: 11px; line-height: 1.6; }
.gate__browse { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.gate__browse:hover { color: var(--text); }

/* the gate must win until consent */
html.gated .hud,
html.gated .feed { visibility: hidden; }

/* ---------- legal / document page ---------- */
html.doc, html.doc body { height: auto; overflow-y: auto; }
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-t)) calc(18px + var(--safe-r)) calc(46px + var(--safe-b)) calc(18px + var(--safe-l));
}
.doc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.doc-top .brand__logo { height: 26px; }
.legal__inner { max-width: 68ch; }
.legal h1 { font-family: var(--display); font-size: clamp(24px, 7vw, 36px); letter-spacing: -0.02em; margin: 0 0 4px; }
.legal h2 { font-family: var(--display); font-size: 17px; margin: 34px 0 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.legal h2:first-of-type { border-top: 0; }
.legal p, .legal li { color: var(--text-2); font-size: 13.5px; line-height: 1.7; overflow-wrap: break-word; }
.legal a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.legal .back { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 18px; color: var(--text-3); font-size: 12.5px; }
.legal .back:hover { color: var(--text); }

.foot { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; }
.foot__row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.foot a:hover { color: var(--text); }
.foot__note { margin: 14px 0 0; max-width: 70ch; line-height: 1.6; overflow-wrap: break-word; }
.foot__badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; color: var(--text-2);
}

/* ---------- persistent legal bar (home feed) ---------- */
.legalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 5px 13px;
  padding: 8px calc(14px + var(--safe-r)) calc(8px + var(--safe-b)) calc(14px + var(--safe-l));
  background: linear-gradient(to top, rgba(8, 8, 10, 0.94) 55%, rgba(8, 8, 10, 0));
  font-size: 11px; letter-spacing: 0.06em; color: var(--text-3);
  pointer-events: none;
}
.legalbar > * { pointer-events: auto; }
.legalbar a { color: var(--text-3); }
.legalbar a:hover { color: var(--text); }
.legalbar__b {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.08em; color: var(--text-2);
}
html.gated .legalbar { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .slide--image.is-active .slide__media { animation: none; transform: none; }
}

/* very narrow phones */
@media (max-width: 379px) {
  .brand__logo { height: 20px; }
  .switch__btn { min-width: 72px; padding: 0 12px; letter-spacing: 0.05em; }
}

/* ---------- fullscreen interstitial ---------- */
.gate__ads { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.55; }

.ad-overlay {
  position: fixed; inset: 0; z-index: 999999;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}
.ad-overlay__frame { position: relative; width: 100%; height: 100%; background: #050507; overflow: hidden; }
.ad-overlay__media { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; background: transparent; }
.ad-overlay__media.is-clickable { cursor: pointer; }
.ad-overlay__image { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.ad-overlay__image.is-clickable { cursor: pointer; }
.ad-overlay__label {
  position: absolute; z-index: 3; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l));
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.7); color: var(--text-2);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; pointer-events: none;
}
.ad-overlay__close {
  position: absolute; z-index: 3; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r));
  min-width: 44px; height: 44px; padding: 0 15px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45); background: rgba(0, 0, 0, 0.72);
  color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
  max-width: calc(100vw - 24px);
}
.ad-overlay__cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px 28px; border-radius: 999px; background: var(--accent); color: #fff;
  font-weight: 600; text-decoration: none;
}
.ad-overlay__native {
  display: grid; grid-template-columns: 1fr; gap: 14px; align-content: center;
  width: 100%; height: 100%; padding: calc(60px + var(--safe-t)) 18px calc(18px + var(--safe-b));
  overflow-y: auto; background: var(--bg);
}
.ad-overlay__native a { display: block; border-radius: 14px; overflow: hidden; background: var(--glass); border: 1px solid var(--line); text-decoration: none; }
.ad-overlay__native img { display: block; width: 100%; height: auto; }
.ad-overlay__native span { display: block; padding: 12px 14px; color: var(--text); font-size: 14px; }

/* ---------- feed filters (assets/js/filters.js) ---------- */
.hud__right { justify-self: end; display: flex; gap: 8px; }
.filter-btn { position: relative; }
.filter-btn[aria-pressed="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red) inset; }
.filter-btn__n {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.fchips {
  display: flex; gap: 6px; margin-top: 8px;
  max-width: min(72vw, 560px); overflow-x: auto; scrollbar-width: none;
}
.fchips::-webkit-scrollbar { display: none; }
.fchip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 8px 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--glass-2);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #fff; font: 600 12px var(--font); text-transform: capitalize;
}
.fchip svg { width: 13px; height: 13px; opacity: 0.8; }
.fsheet { position: fixed; inset: 0; z-index: 80; }
.fsheet[hidden] { display: none; }
.fsheet__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
.fsheet__panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 82vh; display: flex; flex-direction: column;
  background: #111114; border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding-bottom: var(--safe-b);
  animation: fsheet-up 0.28s var(--ease);
}
@keyframes fsheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 760px) {
  .fsheet__panel { left: 50%; right: auto; width: 640px; transform: translateX(-50%); bottom: 24px; border-radius: 18px; border: 1px solid var(--line); animation: none; }
}
.fsheet__head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.fsheet__head h2 { margin: 0; font: 700 17px var(--display); flex: 1; }
.fsheet__clear { background: none; border: 0; color: var(--text-2); font: 600 13px var(--font); }
.fsheet__x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: none; color: #fff; display: grid; place-items: center; }
.fsheet__x svg { width: 16px; height: 16px; }
.fsheet__body { overflow-y: auto; padding: 6px 16px 16px; overscroll-behavior: contain; }
.fsheet__group h3 { margin: 16px 0 8px; font: 700 11px var(--font); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.fsheet__values { display: flex; flex-wrap: wrap; gap: 7px; }
.fval {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border-radius: 999px; line-height: 1;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
  color: var(--text); font: 600 13px var(--font);
}
.fval small { color: var(--text-3); font-weight: 500; font-size: 11px; }
.fval[aria-pressed="true"] { background: var(--accent); border-color: transparent; }
.fval[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.8); }
.fval:disabled { opacity: 0.35; }
.fsheet__foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.fsheet__go {
  width: 100%; height: 48px; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff; font: 700 15px var(--font);
}
.fsheet__go:disabled { opacity: 0.4; }
.fsheet__alt {
  width: 100%; height: 42px; margin-top: 8px; border-radius: 14px;
  border: 1px solid var(--line); background: none; color: var(--text); font: 600 14px var(--font);
}
html.fsheet-open, html.fsheet-open body { overflow: hidden; }
