/* NORMA | نورما — unofficial concept
   Colours are CHOSEN approximations of the burgundy / cream / blush seen in
   @norma.saudi photos; sample the final hex values from the original files.
   Fonts are a design choice (Cormorant Garamond, Amiri, IBM Plex) — not NORMA's own. */

:root {
  --paper: #f6eee2;
  --cream: #efe2cf;
  --curtain: #ebdcc5;
  --curtain-shade: rgba(92, 52, 40, .10);
  --burgundy: #6c1426;
  --burgundy-2: #4a0d19;
  --blush: #e9c6c0;
  --cocoa: #5b3b2d;
  --ink: #2b0d13;
  --muted: #6e4f4a;
  --line: rgba(108, 20, 38, .22);

  --display-lat: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --display-ar: "Amiri", "Noto Naskh Arabic", serif;
  --ui-lat: "IBM Plex Sans", system-ui, sans-serif;
  --ui-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;

  --bar-h: 64px;
  --gutter: clamp(16px, 4vw, 56px);
  --radius: 2px;
  --ease: cubic-bezier(.22, .7, .2, 1);
  --fast: 160ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--bar-h); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--ui-lat);
  overflow-x: clip;
}
html[lang="ar"] body { font-family: var(--ui-ar); }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 3px; }
.box :focus-visible, .viewer :focus-visible { outline-color: var(--blush); }

.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50;
  background: var(--burgundy); color: var(--paper); padding: 12px 16px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-inline: var(--gutter);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--fast);
}
.bar.is-scrolled { border-bottom-color: var(--line); }
.bar__brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  text-decoration: none; color: var(--burgundy);
}
.cameo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.bar__name { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.bar__name [lang="en"] { font: 600 19px/1 var(--display-lat); letter-spacing: .14em; }
.bar__name [lang="ar"] { font: 700 19px/1 var(--display-ar); }
.bar__sep { opacity: .4; font-size: 14px; }
.bar__nav { display: flex; align-items: center; gap: 4px; }
.bar__link {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 12px;
  text-decoration: none; font-size: 14px; letter-spacing: .04em; color: var(--burgundy);
  border-radius: var(--radius);
  transition: background-color var(--fast);
}
.bar__link:hover { background: rgba(108, 20, 38, .07); }
.lang {
  display: inline-flex; align-items: center; gap: 2px;
  min-width: 64px; min-height: 44px; padding: 4px;
  background: transparent; border: 1px solid var(--line); border-radius: 22px; cursor: pointer;
}
.lang__opt {
  flex: 1; display: grid; place-items: center; height: 34px; border-radius: 17px;
  font-size: 13px; letter-spacing: .04em; color: var(--burgundy);
  transition: background-color var(--fast), color var(--fast);
}
.lang__opt[data-l="ar"] { font-family: var(--ui-ar); font-size: 15px; }
html[lang="en"] .lang__opt[data-l="en"],
html[lang="ar"] .lang__opt[data-l="ar"] { background: var(--burgundy); color: var(--paper); }
.lang:active .lang__opt { transform: scale(.96); }

/* ---------- shared ---------- */
.eyebrow, .label {
  margin: 0; font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--burgundy);
  font-weight: 500;
}
html[lang="ar"] .eyebrow, html[lang="ar"] .label { letter-spacing: 0; font-size: 15px; text-transform: none; }
.label--light { color: var(--blush); position: relative; z-index: 3; }
.note { margin: 0; font-size: 13px; color: var(--muted); }
.note a { color: var(--burgundy); text-underline-offset: 3px; }
.handle { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding-inline: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding-inline: 22px; border-radius: var(--radius);
  text-decoration: none; font-size: 15px; letter-spacing: .03em;
  transition: background-color var(--fast), color var(--fast), transform var(--fast) var(--ease);
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn--solid { background: var(--burgundy); color: var(--paper); }
.btn--solid:hover { background: var(--burgundy-2); }
.btn--line { border: 1px solid var(--burgundy); color: var(--burgundy); }
.btn--line:hover { background: rgba(108, 20, 38, .07); }
.arrow { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform var(--fast) var(--ease); }
[dir="rtl"] .arrow { transform: scaleX(-1); }
.btn:hover .arrow { transform: translateX(3px); }
[dir="rtl"] .btn:hover .arrow { transform: scaleX(-1) translateX(3px); }

/* ---------- 1 · house + curtain ---------- */
.house {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: end;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(16px, 3vw, 32px) var(--gutter) clamp(32px, 5vw, 64px);
  min-height: calc(100svh - var(--bar-h));
}
.house__text { display: grid; gap: 22px; padding-bottom: clamp(8px, 3vw, 40px); }
.house__title { margin: 0; color: var(--burgundy); display: grid; gap: 4px; }
.house__latin {
  font: 500 clamp(60px, 8.4vw, 148px)/.86 var(--display-lat);
  letter-spacing: .06em; margin-inline-start: -.04em;
}
.house__arabic { font: 400 clamp(48px, 7vw, 108px)/1.15 var(--display-ar); }
.house__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.stage {
  --o: 0;                 /* curtain open amount, 0…1, set by JS */
  position: relative;
  height: calc(100svh - var(--bar-h) - clamp(48px, 8vw, 96px));
  min-height: 420px;
  max-height: 900px;
  overflow: hidden;
  background: var(--burgundy-2);
  border-radius: var(--radius);
  isolation: isolate;
}
.stage__scene { margin: 0; position: absolute; inset: 0; }
.stage__scene img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%;
  transform: scale(calc(1.14 - var(--o) * .14));
  will-change: transform;
}
.curtain {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  background:
    repeating-linear-gradient(90deg,
      transparent 0 14px, var(--curtain-shade) 22px, transparent 30px,
      rgba(255, 250, 240, .35) 36px, transparent 44px),
    var(--curtain);
  will-change: transform;
  box-shadow: 0 0 0 1px rgba(108, 20, 38, .06);
}
.curtain::after {          /* fine burgundy hem on the inner edge */
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--burgundy); opacity: .45;
}
.curtain--a { left: 0; transform-origin: 0 50%; transform: scaleX(calc(1 - var(--o) * .94)); }
.curtain--a::after { right: 0; }
.curtain--b { right: 0; transform-origin: 100% 50%; transform: scaleX(calc(1 - var(--o) * .94)); }
.curtain--b::after { left: 0; }
.valance {
  position: absolute; inset: 0 0 auto; height: 18px; background: var(--curtain);
  border-bottom: 1px solid rgba(108, 20, 38, .35);
}
.stage.intro .curtain { transition: transform 1.25s var(--ease); }
.stage.intro .stage__scene img { transition: transform 1.6s var(--ease); }

/* ---------- strata divider (tiramisu layers between scenes) ---------- */
.strata { --p: 0; display: grid; gap: 0; padding-block: 8px; }
.strata i { display: block; transform-origin: 0 50%; transform: scaleX(var(--b, 0)); will-change: transform; }
[dir="rtl"] .strata i { transform-origin: 100% 50%; }
.strata i:nth-child(1) { height: 3px; background: var(--cocoa); }
.strata i:nth-child(2) { height: 10px; background: var(--cream); }
.strata i:nth-child(3) { height: 6px; background: var(--burgundy); }
.strata--warm i:nth-child(3) { background: var(--blush); }

/* ---------- 2 · box ---------- */
.box { --lid: 0; --g: 0; height: 140vh; background: var(--burgundy-2); color: var(--paper); }
.box__pin {
  position: sticky; top: 0; height: 100svh;
  display: grid; place-items: center; align-content: center; gap: 14px;
  padding: calc(var(--bar-h) + 4px) var(--gutter) 14px;
  overflow: hidden;
}
.box__frame {
  position: relative;
  height: min(calc(100svh - var(--bar-h) - 120px), calc((100vw - 2 * var(--gutter)) * 1.25), 940px);
  aspect-ratio: 4 / 5;
  perspective: 1400px;
  transform: scale(calc(.93 + var(--g) * .07));
  will-change: transform;
}
.box__open {
  position: absolute; inset: 0; padding: 0; border: 0; cursor: zoom-in;
  background: var(--burgundy); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .55);
}
.box__open img { width: 100%; height: 100%; object-fit: cover; }
.lid {
  position: absolute; inset: -2%; pointer-events: none;
  background: var(--burgundy);
  border: 1px solid rgba(233, 198, 192, .45);
  outline: 1px solid rgba(233, 198, 192, .2); outline-offset: -10px;
  border-radius: var(--radius);
  transform-origin: 50% 0;
  transform: translateY(calc(var(--lid) * -24%)) rotateX(calc(var(--lid) * 82deg));
  opacity: calc(1 - max(0, var(--lid) - .4) * 1.8);
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .6);
  will-change: transform, opacity;
}
.lid__ribbon { position: absolute; inset: 0 auto 0 50%; width: 10px; translate: -50% 0; background: var(--blush); opacity: .85; }
.lid__seal {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 56px; height: 56px; box-shadow: 0 0 0 4px var(--burgundy), 0 0 0 5px rgba(233, 198, 192, .6);
}
.box.manual .lid, .box.manual .box__frame { transition: transform .9s var(--ease), opacity .9s var(--ease); }
.box__toggle {
  min-height: 44px; padding-inline: 18px; cursor: pointer;
  background: transparent; color: var(--blush); border: 1px solid rgba(233, 198, 192, .45); border-radius: 22px;
  font-size: 14px; letter-spacing: .04em;
  transition: background-color var(--fast), transform var(--fast) var(--ease);
}
.box__toggle:hover { background: rgba(233, 198, 192, .1); }
.box__toggle:active { transform: scale(.97); }

/* ---------- 3 · layers: tall photos, stepped like strata ---------- */
.layers { padding: clamp(48px, 7vw, 96px) var(--gutter) clamp(24px, 4vw, 48px); }
.layers .label { margin-bottom: clamp(18px, 3vw, 32px); }
.layers__stack {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 24px); align-items: start;
}
.slab {
  --s: 1;
  position: relative;
  /* stepped resting offsets, then a scroll-linked settle */
  margin-top: calc(var(--i) * clamp(16px, 3vw, 48px));
  transform: translateY(calc((1 - var(--s)) * 90px));
  opacity: calc(.25 + var(--s) * .75);
  will-change: transform, opacity;
}
.slab button {
  display: block; width: 100%; padding: 0; border: 0; cursor: zoom-in; overflow: hidden;
  aspect-ratio: 4 / 5; background: var(--cream); border-radius: var(--radius);
}
.slab img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.slab button:hover img { transform: scale(1.03); }
.slab::after {       /* cocoa line under each layer */
  content: ""; display: block; height: 2px; margin-top: 10px;
  background: repeating-linear-gradient(90deg, var(--cocoa) 0 2px, transparent 2px 6px); opacity: .5;
}
.slab__tag {
  display: block; margin-top: 8px; color: var(--burgundy);
  font-size: 13px; letter-spacing: .06em;
}
html[lang="ar"] .slab__tag { letter-spacing: 0; font-size: 14px; }

/* ---------- 4 · seasons ---------- */
.seasons { padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 6vw, 80px); }
.seasons__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px;
  padding-inline: var(--gutter); margin-bottom: 20px;
}
.rail {
  list-style: none; margin: 0; padding: 4px var(--gutter) 16px;
  display: flex; gap: clamp(12px, 2vw, 24px); align-items: flex-start;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.rail li { flex: 0 0 clamp(232px, 27vw, 360px); scroll-snap-align: start; }
.rail button {
  display: block; width: 100%; padding: 0; border: 0; background: var(--cream); cursor: zoom-in;
  border-radius: var(--radius); overflow: hidden;
}
.rail img { width: 100%; height: auto; transition: transform .5s var(--ease); }
.rail button:hover img { transform: scale(1.02); }

/* ---------- 5 · visit ---------- */
.visit {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px); align-items: center;
  padding: clamp(40px, 6vw, 96px) var(--gutter);
  border-top: 1px solid var(--line);
}
.visit__front { margin: 0; justify-self: center; width: min(100%, 480px); }
.visit__photo { display: block; width: 100%; padding: 0; border: 0; background: var(--cream); cursor: zoom-in; border-radius: var(--radius); overflow: hidden; }
.visit__photo img { width: 100%; height: auto; }
.visit__title { margin: 0; color: var(--burgundy); font: 500 clamp(40px, 5vw, 72px)/1 var(--display-lat); }
html[lang="ar"] .visit__title { font: 400 clamp(38px, 4.6vw, 64px)/1.3 var(--display-ar); }
.visit__city { margin: 8px 0 28px; color: var(--muted); font-size: 15px; letter-spacing: .08em; }
html[lang="ar"] .visit__city { letter-spacing: 0; font-size: 17px; }
.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-width: 520px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; padding-inline: 4px; text-decoration: none;
  border-bottom: 1px solid var(--line); color: var(--burgundy); font-size: 17px;
  transition: background-color var(--fast), padding var(--fast) var(--ease);
}
.row:hover { background: rgba(108, 20, 38, .05); padding-inline: 12px; }
.row__meta { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------- footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  background: var(--cream); color: var(--muted); font-size: 13px;
}
.foot p { margin: 0; flex: 1 1 240px; }
.foot .cameo { width: 44px; height: 44px; }
.foot__top { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 8px; color: var(--burgundy); text-underline-offset: 3px; }

/* ---------- viewer ---------- */
.viewer {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(43, 13, 19, .96); color: var(--paper);
}
.viewer[open] { display: grid; grid-template-rows: 1fr auto; animation: v-in .28s var(--ease); }
.viewer::backdrop { background: rgba(43, 13, 19, .6); }
@keyframes v-in { from { opacity: 0; } to { opacity: 1; } }
.viewer__fig { margin: 0; display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px var(--gutter) 0; min-height: 0; }
.viewer__fig img { max-width: 100%; max-height: calc(100dvh - 150px); width: auto; height: auto; object-fit: contain; border-radius: var(--radius); }
.viewer__fig figcaption { font-size: 14px; color: var(--blush); text-align: center; }
.viewer__ctl { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px var(--gutter) calc(16px + env(safe-area-inset-bottom)); }
.viewer__count { min-width: 56px; text-align: center; font-size: 13px; color: var(--blush); }
.ico {
  width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid rgba(233, 198, 192, .35); border-radius: 50%;
  transition: background-color var(--fast), transform var(--fast) var(--ease);
}
.ico:hover { background: rgba(233, 198, 192, .12); }
.ico:active { transform: scale(.94); }
.ico svg { width: 16px; height: 16px; fill: none; stroke: var(--paper); stroke-width: 1.6; }
[dir="rtl"] #v-prev svg, [dir="rtl"] #v-next svg { transform: scaleX(-1); }
.ico--close { margin-inline-start: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .house { grid-template-columns: 1fr; align-items: start; min-height: 0; }
  .house__text { padding-bottom: 0; }
  .stage { height: auto; aspect-ratio: 4 / 5; min-height: 0; max-height: 78svh; width: 100%; }
  .visit { grid-template-columns: 1fr; }
  .layers__stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slab { margin-top: 0; }
  .slab:nth-child(even) { margin-top: 28px; }
  .visit__front { width: min(100%, 420px); }
}
@media (max-width: 520px) {
  :root { --bar-h: 60px; }
  .bar__link:not(.bar__link--menu) { display: none; }
  .bar__name [lang="en"], .bar__name [lang="ar"] { font-size: 17px; }
  .bar__brand { gap: 8px; }
  .cameo { width: 36px; height: 36px; }
  .house__actions .btn { flex: 1 1 auto; }
}
@media (max-width: 359px) {
  .bar__sep, .bar__name [lang="ar"] { display: none; }
  html[lang="ar"] .bar__name [lang="ar"] { display: inline; }
  html[lang="ar"] .bar__name [lang="en"] { display: none; }
  .bar__link { padding-inline: 8px; }
}

/* ---------- reduced motion: everything visible, nothing pinned ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .stage { --o: .55 !important; }
  .stage__scene img { transform: none !important; }
  .strata i { transform: none !important; }
  .box { height: auto; }
  .box__pin { position: relative; height: auto; min-height: 0; padding-block: 64px; }
  .box__frame { transform: none !important; }
  .lid, .box__toggle { display: none; }
  .slab { transform: none !important; opacity: 1 !important; }
}
/* no JS: show everything at rest */
html:not(.js) .stage { --o: .55; }
html:not(.js) .strata i { transform: none; }
html:not(.js) .box { height: auto; }
html:not(.js) .box__pin { position: relative; height: auto; }
html:not(.js) .lid { display: none; }
html:not(.js) .slab { transform: none; opacity: 1; }
html:not(.js) .box__toggle { display: none; }
