/* TehranSnack — 3D can stage. Fresh stylesheet (no legacy styles). */
:root {
  --bg: #33030a;
  --bg-2: #470814;
  --ink: #fff7f8;
  --muted: #d1b7bc;
  --accent: #ff3f59;
  --accent-2: #ff6a66;
  --line: rgba(255, 255, 255, .09);
  --header-h: 64px;
  --font: 'Vazirmatn', Tahoma, 'Segoe UI', system-ui, sans-serif;
  /* 3D pedestal/cans vertical position (world units; edit these to move the full stage up/down) */
  --ts-pedestal-y-desktop: 1;
  --ts-pedestal-y-mobile: 0.28;
  /* How big the product looks once it has landed on its card (world-space scale).
     Desktop and mobile use different camera distances, so this is tuned separately
     per layout — raise the mobile value if the product still looks too small once
     docked on its card. */
  --ts-dock-scale-desktop: 0.8;
  --ts-dock-scale-mobile: 0.9;
  /* Podium colors — tweak these to change how the pedestal under the cans looks.
     They are read by static/js/stage3d.js, so a page reload is needed after editing. */
  --ts-podium-base: #1c0a0d;   /* lower/outer tier */
  --ts-podium-top: #24080c;    /* upper tier the cans stand on */
  --ts-podium-ring: #7a0f1e;   /* thin glowing outline on the upper tier */
  --ts-podium-glow: #6e0916;   /* soft light pool under the cans */
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* NOTE: overflow-x:hidden must live on <html>, not <body> — on iOS/Android,
     hiding overflow on body breaks position:fixed children (like .bottom-nav),
     making them appear to shift/jump once the page is scrolled to the end. */
  position: relative;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  width: 100%; height: var(--header-h);
  display: grid; grid-template-columns: minmax(200px, 1fr) auto minmax(200px, 1fr);
  align-items: center; gap: 24px;
  padding: 0 clamp(20px, 5.5vw, 76px);
  padding-top: env(safe-area-inset-top, 0px);
  direction: ltr;
  background: linear-gradient(180deg, rgba(74, 1, 8, .58), rgba(74, 1, 8, 0));
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.brand { display: inline-flex; align-items: center; gap: 9px; justify-self: start; color: #ff2f4e; }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 4px 12px rgba(255, 35, 68, .35)); }
.brand-word { font-family: 'Plus Jakarta Sans', var(--font); font-weight: 800; font-size: 23px; color: #fff; letter-spacing: -.45px; white-space: nowrap; }
.brand-word-tehran { color: #fff; font-weight: 800; }
.brand-word-snack { color: #ff3450; font-weight: 800; }

.top-nav {
  display: flex; align-items: center; justify-content: center; gap: clamp(22px, 3.1vw, 46px);
  font-weight: 600; font-size: 14px; direction: rtl; white-space: nowrap;
}
.top-nav a { position: relative; padding: 7px 2px 11px; color: rgba(255,255,255,.76); transition: color .2s, transform .2s; }
.top-nav a:hover, .top-nav a.is-active { color: #fff; }
.top-nav a:hover { transform: translateY(-1px); }
.top-nav a.is-active::after {
  content: ''; position: absolute; inset: auto 50% 0 auto; width: 34px; height: 3px;
  border-radius: 999px; background: #ff304c; transform: translateX(50%);
  box-shadow: 0 0 14px rgba(255, 48, 76, .75);
}

.header-actions { justify-self: end; display: flex; align-items: center; justify-content: flex-end; gap: 9px; direction: ltr; }
.header-action {
  position: relative; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: rgba(93, 0, 11, .12);
  color: rgba(255,255,255,.96); transition: transform .2s ease, background .2s ease, color .2s ease;
}
.header-action:hover { transform: translateY(-1px); background: rgba(255,255,255,.08); color: #fff; }
.header-action svg { width: 23px; height: 23px; stroke-width: 1.8; }
.header-badge {
  position: absolute; top: -1px; right: -2px; min-width: 16px; height: 16px;
  padding-inline: 4px; border-radius: 999px; display: grid; place-items: center;
  background: #ff3450; color: #fff; font-size: 9px; font-weight: 800; line-height: 1;
  box-shadow: 0 3px 10px rgba(255, 52, 80, .4);
}

/* ---------- Initial loading curtain ---------- */
.site-loader {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 20px; padding: 30px; text-align: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 35, 62, .16), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(127, 3, 19, .45), transparent 58%),
    #240207;
  color: #fff; opacity: 1; visibility: visible;
  transition: opacity .55s ease, visibility .55s ease;
}
.site-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-brand { display: inline-flex; align-items: center; gap: 11px; color: #ff304e; font-family: 'Plus Jakarta Sans', var(--font); font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -.8px; }
.loader-word-tehran { color: #fff; }
.loader-word-snack { color: #ff304e; }
.loader-brand-mark { width: 48px; height: 48px; display: block; filter: drop-shadow(0 6px 18px rgba(255, 46, 73, .35)); }
.loader-progress { position: relative; width: min(300px, 72vw); height: 5px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.12); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.loader-progress span { display: block; width: 8%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8e0719, #ff3555); box-shadow: 0 0 18px rgba(255, 53, 85, .55); transition: width .45s ease; }
.loader-caption { color: rgba(255,255,255,.56); font-size: 12px; }

/* ---------- Hero (normal page scroll + 360° scroll-linked stage) ---------- */
.hero-track { position: relative; height: 100vh; min-height: 680px; scroll-margin-top: var(--header-h); }
.hero-sticky {
  position: relative; top: auto; height: 100%;
  overflow: hidden;
  background:
    radial-gradient(34rem 28rem at 72% 30%, rgba(255, 52, 79, .28), transparent 70%),
    radial-gradient(30rem 24rem at 48% 88%, rgba(255, 38, 61, .24), transparent 72%),
    linear-gradient(135deg, #4c050c 0%, #900918 34%, #c80d27 67%, #a3071b 100%);
}
.hero-sticky::before, .hero-sticky::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero-sticky::before {
  background:
    radial-gradient(23rem 23rem at 95% 15%, rgba(255,255,255,.14), transparent 36%),
    radial-gradient(ellipse at 74% 22%, transparent 0 37%, rgba(255,255,255,.055) 37.2% 37.5%, transparent 37.8%),
    radial-gradient(46rem 23rem at 59% 118%, rgba(255,76,91,.23), transparent 64%),
    linear-gradient(122deg, rgba(33, 0, 5, .28) 0%, transparent 31%, transparent 73%, rgba(255,255,255,.035) 100%);
}
.hero-sticky::after {
  background:
    linear-gradient(24deg, rgba(62, 1, 9, .95) 0%, rgba(62, 1, 9, .88) 19%, transparent 19.2%),
    radial-gradient(36rem 11rem at 74% -2%, rgba(255,255,255,.08), transparent 62%);
  opacity: .68;
}
.stage {
  position: fixed; inset: 0; z-index: 3; width: 100vw; height: 100dvh;
  display: block; pointer-events: none; touch-action: none; outline: none;
}
.stage.is-interactive { pointer-events: auto; touch-action: pan-y; }

.hero-copy {
  position: absolute; z-index: 4; top: 30%; right: clamp(6%, 8vw, 11%); width: min(520px, 42vw);
  padding: 0; text-align: right; direction: rtl; pointer-events: none;
}
.kicker {
  display: inline-flex; align-items: center; gap: 12px; margin: 0 0 13px;
  color: rgba(255,255,255,.68); font-weight: 600; font-size: clamp(12px, 1.2vw, 15px); letter-spacing: .1px;
}
.kicker::after { content: ''; width: 34px; height: 3px; border-radius: 999px; background: #ff3555; box-shadow: 0 0 12px rgba(255, 53, 85, .6); }
.hero-copy h1 { margin: 0; font-weight: 900; line-height: 1.11; font-size: clamp(48px, 5.2vw, 76px); text-wrap: balance; letter-spacing: -2.6px; }
.hero-copy h1 em { font-style: normal; color: #ffe3c9; text-shadow: 0 4px 18px rgba(0, 0, 0, .45), 0 0 24px rgba(255, 154, 90, .35); }
.hero-copy h1 em { background: none; -webkit-text-fill-color: initial; }

.btn-primary {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; margin-top: clamp(16px, 2.5vh, 24px);
  padding: 13px 26px; border-radius: 999px; font-weight: 800; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, #ff3c58, #eb1738);
  box-shadow: 0 12px 32px -8px rgba(70, 0, 10, .48);
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -7px rgba(70, 0, 10, .58); filter: brightness(1.05); }
.btn-primary svg { width: 18px; height: 18px; }

.scroll-hint {
  position: absolute; z-index: 5; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; color: rgba(255,255,255,.58); pointer-events: none; transition: opacity .4s;
}
.scroll-hint i { width: 20px; height: 31px; border: 2px solid rgba(255, 255, 255, .36); border-radius: 12px; position: relative; }
.scroll-hint i::after {
  content: ''; position: absolute; top: 6px; left: 50%; width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px; background: #fff; animation: wheel 1.6s infinite;
}
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }
.scroll-hint.is-hidden { opacity: 0; }

/* floating name tag for hover */
.tip {
  position: absolute; z-index: 6; left: 0; top: 0; display: grid; gap: 1px; min-width: 150px; max-width: 220px;
  padding: 9px 14px; border-radius: 14px; text-align: center; background: rgba(61, 2, 9, .76);
  border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -10px rgba(38, 0, 5, .7); pointer-events: none; opacity: 0; transform: translate(-50%, -100%); transition: opacity .18s;
}
.tip.is-on { opacity: 1; }
.tip strong { font-size: 13px; font-weight: 800; }
.tip span { font-size: 13px; color: #ff8c91; font-weight: 700; }
.tip small { font-size: 11px; color: rgba(255,255,255,.56); }

.stage-fallback { position: absolute; inset: auto 0 12% 0; display: flex; justify-content: center; gap: 10px; padding: 0 12px; z-index: 2; }
.stage-fallback[hidden] { display: none; }
.stage-fallback img { width: min(22vw, 180px); border-radius: 14px; box-shadow: 0 14px 30px -10px rgba(41, 0, 6, .7); }

/* ---------- Sections ---------- */
.section { position: relative; scroll-margin-top: var(--header-h); padding: clamp(48px, 8vw, 96px) clamp(16px, 5vw, 64px); max-width: 1240px; margin: 0 auto; }
.section-title { margin: 0 0 28px; font-size: clamp(22px, 3vw, 32px); font-weight: 900; text-align: center; }
.section-title::after { content: ''; display: block; width: 44px; height: 3px; margin: 10px auto 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.feature {
  display: grid; justify-items: center; gap: 2px; padding: 22px 12px; text-align: center;
  background: linear-gradient(180deg, rgba(101, 6, 19, .9), rgba(52, 3, 10, .95)); border: 1px solid var(--line); border-radius: 18px;
}
.feature svg { width: 30px; height: 30px; margin-bottom: 8px; color: var(--accent); }
.feature strong { font-size: 15px; }
.feature span { font-size: 13px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, rgba(111, 7, 20, .9), rgba(57, 3, 10, .95)); border: 1px solid var(--line); border-radius: 22px;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(255, 64, 96, .5); box-shadow: 0 20px 40px -18px rgba(255, 64, 96, .5); }
.card.is-flash { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 64, 96, .5); }
.card-img {
  aspect-ratio: 4 / 5; overflow: hidden; position: relative;
  background:
    radial-gradient(60% 45% at 50% 88%, rgba(255, 64, 96, .16), transparent 70%),
    linear-gradient(180deg, rgba(111, 7, 20, .35), rgba(20, 1, 4, .55));
}
/* landing pad: marks where the 3D can (rendered by the fixed canvas above the page) settles */
.card-img::after {
  content: ''; position: absolute; left: 50%; bottom: 10%; width: 46%; height: 8%;
  background: radial-gradient(ellipse at center, rgba(255, 64, 96, .38), transparent 72%);
  transform: translateX(-50%); border-radius: 50%; filter: blur(1px);
}
/* only used if WebGL isn't available — static product image instead of an empty pad */
.no-webgl .card-img { background-image: var(--card-img, none); background-size: 60% auto; background-position: center 40%; background-repeat: no-repeat; }
.card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 16px; }
.card-cat { font-size: 12px; color: var(--accent-2); font-weight: 600; }
.card h3 { margin: 0; font-size: 16px; font-weight: 800; line-height: 1.5; }
.card p { margin: 0; font-size: 13px; color: var(--muted); }
.card-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-size: 15px; font-weight: 800; }
.add {
  width: 38px; height: 38px; border: 0; border-radius: 50%; font-size: 22px; line-height: 1; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); transition: transform .15s;
}
.add:hover { transform: scale(1.1); }
.add:active { transform: scale(.94); }

.site-footer { padding: 32px 16px 40px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 90; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); padding: 10px 18px; border-radius: 999px;
  background: #fff; color: #1a0a10; font-weight: 700; font-size: 14px;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Mobile bottom nav ---------- */
.bottom-nav { display: none; }

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

@media (max-width: 1023px) {
  :root { --header-h: 60px; }
  .site-header { grid-template-columns: 1fr auto; padding-inline: 22px; gap: 14px; }
  .top-nav { display: none; }
  .header-actions { gap: 4px; }
  .header-action { width: 34px; height: 34px; }
  .header-action svg { width: 22px; height: 22px; }
  .hero-track { min-height: 640px; }
  .hero-copy { top: 23%; right: 7%; width: min(420px, 50vw); }
  .hero-copy h1 { font-size: clamp(40px, 7vw, 58px); }
  .kicker { font-size: 12px; }
  .btn-primary { font-size: 13px; }
}

@media (max-width: 767px) {
  :root { --header-h: 56px; }
  .site-header { grid-template-columns: 1fr auto; padding: 0 16px; }
  .brand-word { font-size: 18px; }
  .brand-mark { width: 28px; height: 28px; }
  .header-action { width: 32px; height: 32px; }
  .header-action svg { width: 20px; height: 20px; }
  .hero-track { min-height: 680px; }
  .hero-copy { top: 22%; right: 22px; left: 22px; width: auto; text-align: center; }
  .kicker { justify-content: center; }
  .hero-copy h1 { font-size: clamp(34px, 11vw, 48px); letter-spacing: -1.6px; }
  .btn-primary { margin-top: 16px; padding: 12px 20px; }
  .scroll-hint { bottom: 72px; }
  .stage-fallback img { width: min(24vw, 130px); }
  .grid { gap: 12px; }
  .card-body { padding: 12px; }
  .card h3 { font-size: 14px; }
  .card p { display: none; }
  .price { font-size: 13px; }
  .site-footer { padding-bottom: 100px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

  .bottom-nav {
    position: fixed !important; z-index: 9999; left: 0; right: 0; bottom: 0;
    width: 100%; height: calc(62px + env(safe-area-inset-bottom, 0px));
    display: flex; justify-content: space-around; align-items: stretch;
    padding: 6px 8px env(safe-area-inset-bottom, 0px);
    background: rgba(58, 3, 12, .94); border-top: 1px solid var(--line);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    contain: layout paint; will-change: transform;
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1 1 20%; min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 2px;
    background: none; border: 0; color: var(--muted); font-size: 10px; font-weight: 600;
    white-space: nowrap;
  }
  .bottom-nav svg { width: 21px; height: 21px; }
  .bottom-nav .active { color: var(--accent); }
  .bottom-nav button:active, .bottom-nav a:active { transform: scale(.97); }
  .ico-wrap { position: relative; display: inline-grid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint i::after { animation: none; }
}
