/* ============ Design tokens ============ */
:root {
  --bg: #ffffff;
  --ink: #16151a;
  --ink-dim: #6b6874;
  --ink-faint: #a29fac;
  --line: #e9e7ea;
  --accent-gold: #ffb84d;
  --accent-coral: #ff6b4a;
  --accent-rose: #ff3d7f;
  --ring-gradient: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-coral) 45%, var(--accent-rose) 100%);
  --font-ig: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: var(--font-ig);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 26px -14px rgba(20,15,10,0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

::selection { background: var(--accent-rose); color: #fff; }

/* scrollbar hide helper */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }

/* ============ Sticky top area (header + stories + filters) ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

/* ============ Header ============ */
.site-header {
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.header-logo-link {
  display: block;
  line-height: 0;
}

.header-logo {
  height: 22px;
  width: auto;
  display: block;
}

.header-tagline {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 10px;
  font-size: 12.5px;
  color: var(--ink-dim);
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ============ Stories bar ============ */
.stories-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 0 2px;
}

.stories-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 20px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.stories-track::-webkit-scrollbar { display: none; }

.story-item {
  scroll-snap-align: start;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 64px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0;
}

.story-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--ring-gradient);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease;
}

.story-item:active .story-ring { transform: scale(0.94); }
.story-item:hover .story-ring { transform: scale(1.05); }

.story-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--bg);
}

.story-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #f2f0f3;
}

.story-label {
  font-size: 10.5px;
  color: var(--ink-dim);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}

/* ============ Filter chips ============ */
.filter-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0 2px;
}

.filter-bar-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 20px 5px;
  color: var(--ink-dim);
}

.filter-icon { width: 15px; height: 15px; flex: none; }

.filter-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: clamp(4px, 1.3vw, 8px);
  padding: 0 12px 9px;
}

.chip {
  flex: 1 1 0;
  max-width: max-content;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  font-family: var(--font-body);
  font-size: clamp(10px, 2.9vw, 12.5px);
  font-weight: 700;
  color: var(--ink-dim);
  border: 1.5px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    var(--ring-gradient) border-box;
  padding: 6px clamp(7px, 2.4vw, 15px);
  cursor: pointer;
  letter-spacing: 0.1px;
  transition: transform 0.15s ease, color 0.15s ease, box-shadow 0.2s ease;
}

.chip:active { transform: scale(0.96); }

.chip.active {
  color: #fff;
  background: var(--ring-gradient);
  border-color: transparent;
  box-shadow: 0 6px 16px -6px rgba(255, 61, 127, 0.5);
}

/* ============ Feed (horizontal category rows) ============ */
.feed {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 0 40px;
}

.category-row {
  margin-top: 16px;
  content-visibility: auto;
  contain-intrinsic-size: 1px 320px;
}

.category-row.is-hidden { display: none; }

.category-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 20px;
}

.category-title {
  font-family: var(--font-ig);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
}

.category-count {
  font-size: 12px;
  color: var(--ink-faint);
  margin-inline-start: auto;
  font-weight: 500;
}

.row-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 20px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.row-track::-webkit-scrollbar { display: none; }

.video-tile {
  position: relative;
  flex: 0 0 auto;
  height: 256px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f2f0f3;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--line);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* every tile is a uniform portrait */
.tile-std { width: 144px; }

@media (min-width: 700px) {
  .video-tile { height: 320px; }
  .tile-std { width: 180px; }
}

.video-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px -16px rgba(20,15,10,0.3);
}

.video-tile .tile-thumb,
.video-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-tile .tile-thumb { background: #f2f0f3; }

.tile-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 20px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  pointer-events: none;
}

.tile-company {
  font-size: 11.5px;
  color: #fff;
  font-weight: 600;
  margin-top: 3px;
  direction: ltr;
  display: inline-block;
}

.tile-play-icon {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  pointer-events: none;
}

.tile-play-icon svg { width: 11px; height: 11px; fill: #fff; }

/* ============ WhatsApp floating button ============ */
.whatsapp-float {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 60;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px -6px rgba(37, 211, 102, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.whatsapp-float svg { width: 30px; height: 30px; }

.whatsapp-float:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 26px -6px rgba(37, 211, 102, 0.75);
}

/* ============ Story viewer ============ */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.story-viewer.open { display: flex; }

.story-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,4,7,0.94);
  backdrop-filter: blur(6px);
}

.story-stage {
  position: relative;
  width: min(420px, 100vw);
  height: min(100vh, 860px);
  background: #000;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1), opacity 0.28s ease;
}

.story-stage.switching {
  transform: scale(0.9);
  opacity: 0.5;
}

@media (min-width: 480px) {
  .story-stage { border-radius: var(--radius-lg); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.8); }
}

.story-switch-banner {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(0,0,0,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.story-switch-banner.show { opacity: 1; }

.story-switch-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 14px 34px rgba(0,0,0,0.55);
  transform: scale(0.6);
  transition: transform 0.35s cubic-bezier(.34,1.56,.64,1);
}

.story-switch-banner.show .story-switch-avatar { transform: scale(1); }

.story-switch-name {
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  direction: ltr;
  letter-spacing: 0.3px;
}

.story-progress {
  position: absolute;
  top: 10px;
  inset-inline: 10px;
  z-index: 5;
  display: flex;
  gap: 4px;
}

.story-progress-seg {
  flex: 1;
  height: 2.5px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}

.story-progress-seg.done .story-progress-fill { width: 100%; }

.story-head {
  position: absolute;
  top: 28px;
  inset-inline: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  direction: ltr;
  padding-inline-end: 56px;
}

.story-head-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.5);
}

.story-head-name {
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
}

.story-head-cat {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  direction: rtl;
}

.story-close {
  position: absolute;
  top: 20px;
  right: 12px;
  z-index: 140;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.95);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
}

.story-video-wrap {
  position: relative;
  flex: 1;
  background: #000;
}

.story-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tap-zone:hover,
.tap-zone:active {
  opacity: 1;
}

.tap-zone.is-hidden { display: none; }

.tap-prev { inset-inline-start: 0; justify-content: flex-start; }
.tap-next { inset-inline-end: 0; justify-content: flex-end; }

@media (min-width: 700px) {
  .story-viewer.open .tap-zone { opacity: 0.85; }
  .story-viewer.open .tap-zone:hover { opacity: 1; }
}

.tap-arrow {
  width: 34px;
  height: 34px;
  margin: 0 14px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
}

/* ============ Story highlight nav (desktop) ============ */
.story-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 105;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
  display: none;
  place-items: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.story-nav:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-50%) scale(1.08);
}

.story-nav-next { left: calc(50% - 246px); }
.story-nav-prev { right: calc(50% - 246px); }

@media (min-width: 700px) {
  .story-viewer.open .story-nav.is-visible { display: grid; }
}

/* ============ Video loading state ============ */
.video-loading {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 5vh, 46px);
  padding: 8vw 4vw;
  text-align: center;
  background: #0b0b0f;
}

.video-loading.show { display: flex; }

.video-loading-spinner {
  flex: none;
  width: clamp(42px, 9vw, 62px);
  height: clamp(42px, 9vw, 62px);
  border-radius: 50%;
  border: 4px solid rgba(117, 255, 162, 0.25);
  border-top-color: #75ffa2;
  animation: video-loading-spin 0.8s linear infinite;
}

@keyframes video-loading-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .video-loading-spinner { animation-duration: 2.4s; }
}

.video-loading-text {
  margin: 0;
  max-width: 92vw;
  color: #75ffa2;
  font-family: var(--font-body);
  font-size: clamp(2rem, 7.5vw, 5.5rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ============ Lightbox ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
}

.lightbox.open { display: flex; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,4,7,0.92);
  backdrop-filter: blur(10px);
}

.lightbox-stage {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-video {
  max-width: 92vw;
  max-height: 78vh;
  border-radius: var(--radius-md);
  background: #000;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.8);
}

.lightbox-caption {
  margin-top: 14px;
  text-align: center;
  max-width: 440px;
}

.lightbox-cat {
  display: block;
  font-family: var(--font-ig);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.lightbox-desc {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
  direction: ltr;
}

.lightbox-close {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 140;
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.95);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* ============ Results ============ */
.results {
  position: relative;
  margin-top: 6px;
  padding: 6px 0 48px;
}

.results-fan {
  direction: ltr;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  padding: 34px 20px 30px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.results-fan::-webkit-scrollbar { display: none; }

.result-card {
  flex: 0 0 auto;
  width: clamp(150px, 19vw, 194px);
  aspect-ratio: 9 / 16;
  background: #fff;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 16px 36px -14px rgba(20, 15, 10, 0.42);
  transform: rotate(var(--r, 0deg)) translateY(var(--y, 0px));
  transition: transform 0.34s cubic-bezier(.34, 1.4, .5, 1), box-shadow 0.34s ease;
  cursor: pointer;
  position: relative;
  z-index: var(--z, 1);
  -webkit-tap-highlight-color: transparent;
  display: block;
}

.result-card + .result-card {
  margin-inline-start: clamp(-52px, -3.4vw, -34px);
}

.result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
  display: block;
  background: #f2f0f3;
}

.result-card:hover,
.result-card:focus-visible,
.result-card.is-active {
  transform: rotate(0deg) translateY(-12px) scale(1.05);
  box-shadow: 0 30px 56px -16px rgba(20, 15, 10, 0.5);
  z-index: 40;
  outline: none;
}

.results-hint {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 41;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  box-shadow: 0 4px 14px -4px rgba(20, 15, 10, 0.3);
  pointer-events: none;
  animation: results-hint-nudge 1.6s ease-in-out infinite;
  transition: opacity 0.3s ease;
}

.results-hint svg { width: 16px; height: 16px; }

.results-hint.hide { opacity: 0; }

@keyframes results-hint-nudge {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(-50%) translateX(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .results-hint { animation: none; }
}

@media (max-width: 680px) {
  .results-fan { padding: 30px 16px 26px; }
  .result-card { width: 44vw; }
  .result-card + .result-card { margin-inline-start: -20vw; }
}

/* ============ Responsive ============ */
@media (max-width: 380px) {
  .story-item { width: 58px; }
  .story-ring { width: 52px; height: 52px; }
}
