/* =========================================================
   Brand tokens — measured from the logo file
   (the three colours can be overridden from config.js → colors)
   ========================================================= */
:root {
  color-scheme: dark;

  --bg: #15110E;               /* warm black   */
  --cream: #FAF7F0;            /* warm off-white */
  --accent: #FE5A2D;           /* signal orange (the logo dot) */
  --bg-2: #1F1A16;
  --wa: #25D366;               /* WhatsApp brand green */
  --wa-2: #1BAE56;             /* slightly deeper end of the button gradient */

  /* button: default = cream pill, dark text, orange arrow dot */
  --btn-bg: var(--cream);
  --btn-fg: var(--bg);
  --btn-icon: var(--wa);
  --btn-arrow-bg: var(--accent);
  --btn-arrow-fg: #fff;
  --btn-shadow: 0 16px 32px -14px rgba(0, 0, 0, .7), inset 0 -2px 0 rgba(21, 17, 14, .07);

  /* layout */
  --gutter: 16px;                                    /* side margin shared by bar, card and button */
  --card-radius: 28px;                               /* config.js → radius */
  --bar-h: calc(58px + env(safe-area-inset-top));    /* top bar + its breathing room */
  --chrome: calc(var(--bar-h) + 172px + env(safe-area-inset-bottom)); /* everything on a slide except the photo */

  --focus: 50% 50%;            /* config.js → focus */
  --fit: contain;              /* config.js → fit   */

  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-en: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}
@supports (color: color-mix(in srgb, red, blue)) {
  :root { --bg-2: color-mix(in srgb, var(--bg), #fff 7%); }
}

/* config.js → button: "whatsapp"  → classic green button */
html[data-button="whatsapp"] {
  --btn-bg: linear-gradient(135deg, var(--wa), var(--wa-2));
  --btn-fg: #fff;
  --btn-icon: #fff;
  --btn-arrow-bg: rgba(255, 255, 255, .22);
  --btn-shadow: 0 16px 32px -12px rgba(37, 211, 102, .5), inset 0 1px 0 rgba(255, 255, 255, .28);
}
html[data-button="whatsapp"] .btn--wa { text-shadow: 0 1px 2px rgba(0, 60, 25, .28); }

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font-ar);
  font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.feed:focus { outline: none; }

.i {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.i--fill { fill: currentColor; stroke: none; }

/* Logo mark (ring + dot) — drawn from the original file's measurements */
.logo { display: block; height: 28px; width: auto; overflow: visible; }
.logo .ring { stroke: var(--cream); }
.logo .dot { fill: var(--accent); }

/* =========================================================
   Stage + phone frame
   ========================================================= */
.stage {
  position: fixed; top: 0; left: 0; right: 0;
  height: 100vh; height: 100dvh;
  display: grid; place-items: center;
  background: var(--bg);
}
.phone {
  position: relative; overflow: hidden;
  width: 100%; height: 100%;
  background: var(--bg);
  container-type: size;              /* slides size themselves from the frame (cqw / cqh), phone or desktop */
}

/* =========================================================
   Top bar + progress
   ========================================================= */
/* brand bar: same width as the photo card, corners rounded to match it */
.topbar {
  position: absolute; z-index: 5;
  top: calc(10px + env(safe-area-inset-top)); inset-inline: var(--gutter);
  height: 48px; padding: 0 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: calc(var(--card-radius) * .7);
  background: var(--bg-2);
  border: 1px solid rgba(250, 247, 240, .1);
  box-shadow: 0 14px 26px -18px rgba(0, 0, 0, .9);
  pointer-events: none;
  transition: opacity .3s;
}
.topbar.is-end { opacity: 0; }          /* the closing slide shows the big logo instead */

/* logo mark + name, side by side */
.brand { display: flex; align-items: center; gap: 11px; direction: ltr; }
.brand:empty { display: none; }
.brand .logo { height: 24px; }
.brand__name {
  font-family: var(--font-en); font-weight: 600; font-size: 20px; line-height: 1;
  letter-spacing: .26em; margin-right: -.26em;      /* cancels the trailing letter-space so it centres */
  text-transform: uppercase;
}
.brand__name--ar {
  direction: rtl; font-family: var(--font-ar); font-size: 19px;
  letter-spacing: 0; margin-right: 0; text-transform: none;
}

.dots {
  position: absolute; z-index: 5;
  inset-inline-start: 5px; top: 50%; translate: 0 -50%;
  display: grid; gap: 7px;
  pointer-events: none;
  transition: opacity .3s;
}
.dots.is-hidden { opacity: 0; }
.dots i {
  display: block; width: 4px; height: 4px; border-radius: 4px;
  background: rgba(250, 247, 240, .38);
  transition: height .35s var(--ease), background-color .35s;
}
.dots i.on { height: 20px; background: var(--accent); }

/* =========================================================
   Feed — one slide per screen, snap scrolling
   ========================================================= */
.feed {
  height: 100%;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  position: relative; isolation: isolate; overflow: hidden;
  height: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
}

/* ---------------------------------------------------------
   Model slide — every slide has the same three parts, centred as one group:
   [ photo card ]  [ caption ]  [ WhatsApp button ]
   --------------------------------------------------------- */
.slide--model {
  display: grid; align-content: center; justify-items: center; row-gap: 14px;
  padding: calc(var(--bar-h) + 8px) var(--gutter) calc(16px + env(safe-area-inset-bottom));
}

.slide__bg {                                         /* clean brand black with a barely-there lift behind the card */
  position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(85% 52% at 50% 44%, var(--bg-2) 0%, var(--bg) 100%);
}

/* the photo is shown whole (native 3:4); the card is as large as the screen allows */
.slide__card {
  position: relative; overflow: hidden; isolation: isolate;
  width: min(100%, calc((100cqh - var(--chrome)) * .75));
  aspect-ratio: 3 / 4;
  border-radius: var(--card-radius);
  background-color: #2b2723;                          /* while loading: blurred preview of the photo itself */
  background-image: var(--amb, none);
  background-size: cover; background-position: center;
  box-shadow: 0 0 0 1px rgba(250, 247, 240, .12), 0 30px 50px -30px rgba(0, 0, 0, .9);
}
.slide__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: var(--fit); object-position: var(--focus);
  opacity: 0; transition: opacity .5s ease;
}
.slide__img.is-loaded { opacity: 1; }
.slide.is-empty .slide__img { display: none; }

.slide__ph {                                         /* shown only if a photo is missing */
  position: absolute; inset: 0; display: none; place-items: center;
  color: rgba(250, 247, 240, .3);
}
.slide__ph .i { width: 44px; height: 44px; stroke-width: 1.25; }
.slide.is-empty .slide__ph { display: grid; }

.slide__ui { width: 100%; display: grid; row-gap: 12px; }

/* caption under the card: dress name + one detail line (each model has its own, one line each so the layout never shifts) */
.caption { display: grid; justify-items: center; gap: 3px; min-width: 0; padding: 0 4px; text-align: center; }
.caption > * { max-width: 100%; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.caption__title { font-size: clamp(19px, 5.8cqw, 24px); font-weight: 600; line-height: 1.3; }
.caption__sub {
  font-size: 12.5px; font-weight: 500; line-height: 1.5;
  color: rgba(250, 247, 240, .62);
}
.caption__sub::before {                              /* the logo's orange dot */
  content: ""; display: inline-block; vertical-align: middle;
  width: 5px; height: 5px; margin-inline-end: 8px; border-radius: 50%; background: var(--accent);
}

/* shorter phones: drop the detail line so the photo keeps its size */
@container (max-height: 700px) {
  .slide--model { --chrome: calc(var(--bar-h) + 143px + env(safe-area-inset-bottom)); row-gap: 10px; }
  .caption__sub { display: none; }
}

/* =========================================================
   WhatsApp button
   ========================================================= */
.btn {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; height: 68px;
  padding-inline: 22px 12px;
  border-radius: 999px;
  font-weight: 700; font-size: clamp(16px, 5.4cqw, 19px); line-height: 1;   /* shrinks a little only on very narrow screens */
  transition: transform .2s var(--ease), filter .2s;
  user-select: none;
}
.btn:active { transform: scale(.975); }
.btn--wa { color: var(--btn-fg); background: var(--btn-bg); box-shadow: var(--btn-shadow); }
.btn--wa .i--fill { color: var(--btn-icon); width: 44px; height: 44px; margin-inline-start: -2px; }
@media (hover: hover) { .btn--wa:hover { filter: brightness(1.06); } }
.btn__arrow {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--btn-arrow-bg); color: var(--btn-arrow-fg);
}
.btn__arrow .i { width: 22px; height: 22px; stroke-width: 2; }

.icon-btn {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(250, 247, 240, .08);
  border: 1px solid rgba(250, 247, 240, .12);
  transition: background-color .2s, opacity .2s;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
@media (hover: hover) { .icon-btn:not(:disabled):hover { background: rgba(250, 247, 240, .18); } }

/* =========================================================
   Closing slide
   ========================================================= */
.slide--end {
  display: grid; place-items: center;
  padding: 0 var(--gutter);                           /* same side margin as every other slide, so the button lines up */
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
}
.slide--end::before {                      /* soft orange glow, like the logo dot */
  content: ""; position: absolute; z-index: -1;
  width: 320px; height: 320px; border-radius: 50%;
  top: 12%; left: 50%; translate: -50% 0;
  background: var(--accent); opacity: .16; filter: blur(110px);
}
.end { display: grid; justify-items: center; gap: 14px; width: 100%; text-align: center; }
.end .logo { height: 74px; margin-bottom: 10px; }
.end h2 { font-size: clamp(28px, 8cqw, 38px); line-height: 1.25; font-weight: 600; }
.end p { max-width: 20em; color: rgba(250, 247, 240, .72); margin-bottom: 12px; }
.ghost {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 10px 18px; border-radius: 999px;
  color: rgba(250, 247, 240, .75); font-size: 14px;
  transition: background-color .2s, color .2s;
}
.ghost .i { width: 18px; height: 18px; }
@media (hover: hover) { .ghost:hover { background: rgba(250, 247, 240, .08); color: var(--cream); } }

/* =========================================================
   Desktop: centred 9:16 phone frame + up/down buttons
   ========================================================= */
.desk-nav { display: none; }

@media (min-width: 760px) and (min-height: 520px) {
  .stage { --ph: calc(100dvh - 32px); --pw: calc(var(--ph) * 9 / 16); }
  .phone {
    width: var(--pw); height: var(--ph);
    border-radius: 24px;
    box-shadow: 0 40px 90px -24px rgba(0, 0, 0, .9), 0 0 0 1px rgba(250, 247, 240, .08);
  }
  .desk-nav {
    position: fixed; top: 50%; translate: 0 -50%;
    left: calc(50% + var(--pw) / 2 + 22px);
    display: grid; gap: 12px;
  }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
