/* ============================================================
   SAÏDA / 971 — brand system
   Colour: ink / gold / cream sampled from the logo; plum from the
   label line. Each perfume adds its own --juice / --tint / --deep,
   sampled from its bottle (scripts/products.mjs). Text pairs are
   checked against WCAG AA; ratios noted.
   ============================================================ */

/* Juliett — GGBotNet, SIL Open Font License 1.1 (assets/fonts/Juliett-OFL.txt) */
@font-face { font-family: "Juliett"; src: url("../fonts/juliett-regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Juliett"; src: url("../fonts/juliett-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Juliett"; src: url("../fonts/juliett-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Juliett"; src: url("../fonts/juliett-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Juliett Fallback"; src: local("Arial"); size-adjust: 104%; ascent-override: 90%; descent-override: 20%; }

:root {
  --paper:     #f3e4d4;  /* the logo's cream                          */
  --paper-lt:  #faf3ea;  /* cores, fields                             */
  --paper-dk:  #eadbc8;
  --ink:       #1b1812;  /* on paper 14.22:1                          */
  --ink-2:     #2a251d;

  --gold:      #9d7d57;  /* decoration only                           */
  --gold-text: #7a5c3b;  /* small text on paper 4.93:1                */
  --gold-lt:   #cea673;  /* on ink 7.86:1                             */
  --plum:      #533546;  /* on paper 8.58:1                           */

  --muted:     #5f564a;  /* on paper 5.78:1                           */
  --on-ink:    #f3e4d4;  /* on ink 14.22:1                            */
  --on-ink-2:  #c3b6a5;  /* on ink 8.62:1                             */
  --field:     #7d705f;  /* input edges, 3:1 non-text                 */
  --danger:    #8c2f24;  /* on paper 6.1:1                            */
  /* Text on the glass nav and buy bar. Content scrolling underneath can be
     as dark as ink; these hold AA even then (glass at 0.85 over ink). */
  --on-glass:   #3f382f;  /* worst case 7.71:1                          */
  --gold-glass: #5e4528;  /* worst case 5.95:1                          */

  /* Defaults for the per-perfume set; product pages override these. */
  --juice: var(--gold);
  --tint: var(--paper);
  --tint-deep: var(--paper-dk);
  --deep: var(--gold-text);

  /* Hairlines that don't read as grey boxes: ink at very low alpha. */
  --hair: rgba(27, 24, 18, 0.08);
  --hair-2: rgba(27, 24, 18, 0.14);
  --hair-ink: rgba(243, 228, 212, 0.16);

  /* Diffuse, warm ambient shadows — never a hard dark drop. */
  --lift-1: 0 1px 1px rgba(27, 24, 18, 0.04), 0 8px 24px -12px rgba(60, 40, 20, 0.18);
  --lift-2: 0 2px 4px rgba(27, 24, 18, 0.04), 0 24px 60px -24px rgba(60, 40, 20, 0.28);

  --display: "Juliett", "Juliett Fallback", sans-serif;
  --text: "EB Garamond", Garamond, Georgia, serif;
  --arabic: "Noto Naskh Arabic", "Geeza Pro", "Arabic Typesetting", serif;

  --wrap: 1320px;
  --gut: clamp(1rem, 4.5vw, 3.5rem);
  --space: clamp(6rem, 12vw, 10rem);   /* phones: see the media query below */
  --r-xl: 12px;
  --r-lg: 8px;
  --r-md: 4px;

  /* Motion. Critically damped settles (no overshoot) for anything that
     simply appears; the spring-like curve for things you touch. */
  --settle: cubic-bezier(0.32, 0.72, 0, 1);
  --out: cubic-bezier(0.22, 1, 0.36, 1);
  --press: 100ms;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 7rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.08rem, 0.3vw + 1rem, 1.2rem);
  line-height: 1.6;
  letter-spacing: 0.003em;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-top: calc(var(--nav-h) + 28px); /* the floating nav sits above content */
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; }

/* ---------------- Type: tracking and leading change with size ---------------- */

.display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;     /* unicase: capitals need air, never negative tracking */
  text-wrap: balance;
}
.display em { font-style: italic; letter-spacing: 0.01em; }
h1.display { line-height: 0.95; letter-spacing: 0.012em; }
h1.display { font-size: clamp(3rem, 7vw, 6.4rem); line-height: 0.98; letter-spacing: 0.03em; }
h2.display { font-size: clamp(2.2rem, 4.4vw, 4rem); line-height: 1; letter-spacing: 0.045em; }
h3.display { line-height: 1.1; letter-spacing: 0.06em; }
/* One plum italic per page, on the h1. Every other heading stays roman ink. */
h2.display em, h3.display em { font-style: normal; color: inherit; letter-spacing: inherit; }

.caps {
  font-family: var(--text);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.22em;     /* small caps open up */
  text-transform: uppercase;
  line-height: 1.5;
}
.en-line {
  font-size: clamp(0.88rem, 0.5vw + 0.72rem, 1.05rem);
  letter-spacing: 0.17em;
  text-transform: uppercase;
  line-height: 1.75;
  text-wrap: balance;
}
.ar {
  font-family: var(--arabic);
  font-weight: 500;
  line-height: 1.8;           /* tall ascenders and descenders */
  letter-spacing: 0;
  direction: rtl;
  text-align: -webkit-match-parent;
  text-align: match-parent;
}
.lede { font-size: 1.12em; line-height: 1.55; color: var(--muted); max-width: 46ch; text-wrap: pretty; }
.muted { color: var(--muted); }
.prose { max-width: 62ch; }
.prose p + p { margin-top: 1.1em; }

/* Lining figures wherever a number carries the brand. */
.wordmark, .buy__price, .pcard__price, .line-item__price,
.summary, .buybar__name, .wear__n, .bag-pill__n { font-variant-numeric: lining-nums tabular-nums; }

/* ---------------- Layout ---------------- */

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }
.band { padding-block: var(--space); }
.ink { background: var(--ink); color: var(--on-ink); }
.ink .lede, .ink .muted { color: var(--on-ink-2); }

/* ---------------- Pill (eyebrow) ---------------- */

.pill {
  display: inline-block;
  color: var(--gold-text);
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; line-height: 1.4;
}
/* The one capsule left: a perfume's family on its own pages */
.pill--tint {
  padding: 0.38rem 0.85rem; border-radius: 999px;
  background: color-mix(in srgb, var(--juice) 12%, transparent); color: var(--deep);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--juice) 22%, transparent);
}
.pill--ink, .ink .pill { color: var(--gold-lt); }

.draft-tag {
  display: inline-block; margin-top: 0.8rem;
  font-size: 0.78rem; letter-spacing: 0.06em; color: var(--danger); font-style: italic;
}

/* ---------------- The island button ---------------- */

.island {
  --bg: var(--ink); --fg: var(--paper); --chip: rgba(243, 228, 212, 0.14);
  position: relative;
  display: inline-flex; align-items: center; gap: 0.9rem;
  min-height: 54px; padding: 0.4rem 0.45rem 0.4rem 1.6rem;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bg); color: var(--fg); text-decoration: none;
  font-family: var(--text); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
  box-shadow: var(--lift-1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: background-color 0.5s var(--settle), color 0.5s var(--settle), transform 0.5s var(--settle);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.island:not(:has(.island__icon)) { padding-right: 1.6rem; }
.island__icon {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 50%; background: var(--chip);
  transition: transform 0.6s var(--settle), background-color 0.5s var(--settle);
}
.island__icon .icon { width: 18px; height: 18px; }
.island:hover .island__icon { transform: translate(3px, -1px) scale(1.06); }
/* Feedback on press, not release — instant. */
.island:active { transform: scale(0.97); transition-duration: var(--press); }
.island[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }

.island--solid:hover { --bg: var(--plum); }
.island--gold { --bg: var(--gold-text); --fg: var(--paper-lt); }          /* 5.53:1 */
.island--gold:hover { --bg: var(--ink); }
.island--ghost {
  --bg: transparent; --fg: var(--ink);
  min-height: 44px; padding: 0 0.2rem; gap: 0.5rem; box-shadow: none; border-radius: 0;
  font-family: var(--text); font-size: 1rem; font-weight: 400; letter-spacing: 0; text-transform: none;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.28em;
}
.island--ghost .island__icon { width: auto; height: auto; background: none; }
.island--ghost .island__icon .icon { width: 16px; height: 16px; }
.island--ghost:hover { --fg: var(--plum); }
.island--ghost:hover .island__icon { transform: none; }
.ink .island--ghost { --fg: var(--on-ink); }
.ink .island--ghost:hover { --fg: var(--gold-lt); }
.island--small { min-height: 44px; padding: 0.2rem 0.25rem 0.2rem 1.05rem; gap: 0.6rem; font-size: 0.72rem; }
.island--small .island__icon { width: 36px; height: 36px; }
.island--small .island__icon .icon { width: 16px; height: 16px; }

.icon { width: 20px; height: 20px; display: block; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer;
  transition: background-color 0.4s var(--settle), transform var(--press) var(--settle);
}
.icon-btn:hover { background: rgba(127, 127, 127, 0.12); }
.icon-btn:active { transform: scale(0.94); }

.link {
  display: inline-flex; align-items: center; min-height: 44px; text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 11px) / 100% 1px no-repeat;
  transition: background-size 0.6s var(--settle);
}
.link:hover { background-size: 0% 1px; background-position: 100% calc(100% - 11px); }

:focus-visible { outline: 2px solid var(--gold-text); outline-offset: 3px; border-radius: 6px; }
.ink :focus-visible, .bag :focus-visible, .site-footer :focus-visible { outline-color: var(--gold-lt); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0; z-index: 300; background: var(--ink); color: var(--paper); padding: 0.9rem 1.3rem; border-radius: 999px; text-decoration: none; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------------- Ornament: line · diamond · line (from the posters) ---------------- */

.orn { display: block; width: 180px; height: 12px; margin: 1.1rem auto; color: var(--gold); }
.orn--start { margin-inline: 0; }
.orn:empty {
  position: relative;
  background:
    linear-gradient(currentColor, currentColor) left 50% / calc(50% - 10px) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right 50% / calc(50% - 10px) 1px no-repeat;
}
.orn:empty::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
.ink .orn:empty { color: var(--gold-lt); }

/* ---------------- Reveals ---------------- */

/* Hidden only once scripting is confirmed; .no-motion is the watchdog's way out. */
.js :is(h1, h2, .display)[data-reveal] {
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.5s var(--settle), transform 0.6s var(--settle);
}
.js :is(h1, h2, .display)[data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal-img] img { opacity: 0; transition: opacity 0.8s var(--settle); }
.js [data-reveal-img].is-in img { opacity: 1; }
.js.no-motion [data-reveal], .js.no-motion [data-reveal-img] img { opacity: 1; transform: none; }

/* ---------------- Intro (once per visit, CSS only — it can't trap the page) ---------------- */

.intro-curtain { display: none; }
.intro .intro-curtain {
  position: fixed; inset: 0; z-index: 250; display: grid; place-content: center; justify-items: center; gap: 0.2rem;
  background: var(--paper);
  animation: curtain-out 0.9s var(--settle) 2.2s forwards;
}
.intro-curtain__ar {
  font-family: var(--arabic); font-weight: 600; font-size: clamp(4.5rem, 16vw, 10rem); line-height: 1.25;
  -webkit-mask-image: linear-gradient(to left, #000 45%, transparent 55%); mask-image: linear-gradient(to left, #000 45%, transparent 55%);
  -webkit-mask-size: 250% 100%; mask-size: 250% 100%;
  -webkit-mask-position: 0% 0; mask-position: 0% 0;
  animation: write-rtl 1.25s var(--out) 0.2s forwards;
}
.intro-curtain__mark { font-family: var(--display); font-weight: 400; font-size: clamp(1.1rem, 2.4vw, 1.6rem); letter-spacing: 0.34em; opacity: 0; animation: rise 0.9s var(--out) 1.15s forwards; }
.intro-curtain__mark span { color: var(--gold-text); }
.intro-curtain__rule { width: 120px; height: 1px; margin-top: 0.9rem; background: var(--gold); transform: scaleX(0); animation: rule 0.9s var(--out) 1.45s forwards; }
@keyframes write-rtl { to { -webkit-mask-position: 100% 0; mask-position: 100% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes rule { to { transform: scaleX(1); } }
/* Materialise out: the paper lifts and blurs, rather than just fading. */
@keyframes curtain-out { to { opacity: 0; transform: scale(1.04); filter: blur(10px); visibility: hidden; } }

/* Cross-document transitions between pages, where supported. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 0.28s var(--out) both vt-out; }
::view-transition-new(root) { animation: 0.5s var(--settle) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* ---------------- Accessibility preferences ---------------- */

/* Reduced motion: no slides, springs or blur — short cross-fades only. */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { transform: none; transition: opacity 0.3s ease; }
  .js [data-reveal-img] img { transition: none; }
  .island:active, .icon-btn:active { transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  :root { --hair: rgba(27, 24, 18, 0.4); --hair-2: rgba(27, 24, 18, 0.6); --muted: #3f382f; }
}

/* Phones: a 390px screen doesn't need 96px of air above and below every band. */
@media (max-width: 640px) { :root { --space: clamp(3.5rem, 12vw, 5rem); } }
