/* ==========================================================================
   ALQASR — Handmade Moroccan Doors & Mirrors
   main.css — design tokens, reset, typography, layout primitives
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------ */
:root{
  /* Brand palette */
  --c-charcoal:      #11100E;
  --c-ivory:          #F5F0E8;
  --c-sand:           #D8C8B0;
  --c-walnut:         #3A281D;
  --c-walnut-deep:    #241811;
  --c-bronze:         #9A7650;
  --c-gold:           #B79A6A;
  --c-white:          #FFFFFF;

  /* Semantic */
  --bg:               var(--c-ivory);
  --bg-dark:           var(--c-charcoal);
  --ink:              var(--c-charcoal);
  --ink-soft:          #4A4640;
  --ink-on-dark:       var(--c-ivory);
  --ink-on-dark-soft:  #C9C2B6;
  --line:              rgba(17,16,14,0.12);
  --line-on-dark:       rgba(245,240,232,0.16);
  --accent:            var(--c-gold);

  /* Typography */
  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --fs-hero: clamp(2.8rem, 6.4vw, 6.4rem);
  --fs-h1: clamp(2.4rem, 4.6vw, 4.2rem);
  --fs-h2: clamp(2rem, 3.4vw, 3rem);
  --fs-h3: clamp(1.4rem, 2vw, 1.9rem);
  --fs-h4: clamp(1.1rem, 1.3vw, 1.3rem);
  --fs-lead: clamp(1.05rem, 1.4vw, 1.3rem);
  --fs-body: 1rem;
  --fs-small: 0.85rem;
  --fs-micro: 0.72rem;

  /* Spacing scale (fluid) */
  --sp-3xs: 0.4rem;
  --sp-2xs: 0.8rem;
  --sp-xs: 1.2rem;
  --sp-sm: 1.8rem;
  --sp-md: clamp(2.4rem, 4vw, 3.6rem);
  --sp-lg: clamp(4rem, 7vw, 7rem);
  --sp-xl: clamp(6rem, 10vw, 11rem);
  --sp-2xl: clamp(8rem, 13vw, 15rem);

  /* Layout */
  --container-max: 1440px;
  --container-pad: clamp(1.25rem, 4vw, 4rem);
  --header-h: 176px;
  --header-h-scrolled: 108px;

  /* Motion */
  --ease-lux: cubic-bezier(.65,0,.35,1);
  --dur-fast: 280ms;
  --dur-base: 560ms;
  --dur-slow: 1000ms;

  /* Radius — kept near-zero, this brand is architectural, not "app" rounded */
  --radius-sm: 1px;
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after{ box-sizing: border-box; }
html{
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, video{ max-width: 100%; display: block; }
img{ height: auto; }
a{ color: inherit; text-decoration: none; }
ul, ol{ list-style: none; margin: 0; padding: 0; }
button, input, textarea, select{ font: inherit; color: inherit; }
button{ background: none; border: none; cursor: pointer; }
figure{ margin: 0; }
h1,h2,h3,h4,h5,p{ margin: 0; }

/* ---- Focus / a11y --------------------------------------------------------- */
:focus-visible{
  outline: 1px solid var(--c-gold);
  outline-offset: 4px;
}
.skip-link{
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--c-charcoal);
  color: var(--c-ivory);
  padding: 1em 1.4em;
  z-index: 10000;
  letter-spacing: 0.08em;
  font-size: var(--fs-small);
}
.skip-link:focus{ left: var(--sp-xs); top: var(--sp-xs); }
.sr-only{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- Typography ------------------------------------------------------- */
.font-display{ font-family: var(--font-display); }
.font-body{ font-family: var(--font-body); }

h1, .h1{ font-family: var(--font-display); font-size: var(--fs-h1); font-weight: 500; line-height: 1.05; letter-spacing: -0.01em; }
h2, .h2{ font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 500; line-height: 1.1; letter-spacing: -0.01em; }
h3, .h3{ font-family: var(--font-display); font-size: var(--fs-h3); font-weight: 500; line-height: 1.2; }
h4, .h4{ font-family: var(--font-body); font-size: var(--fs-h4); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.hero-type{
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.eyebrow{
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--font-body);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--c-bronze);
}
.eyebrow::before{
  content: '';
  width: 28px; height: 1px;
  background: currentColor;
  display: inline-block;
}
.eyebrow--center{ justify-content: center; }
.eyebrow--center::before{ display: none; }

.lead{ font-size: var(--fs-lead); line-height: 1.55; color: var(--ink-soft); font-weight: 400; }
.on-dark .lead, .lead.on-dark{ color: var(--ink-on-dark-soft); }

.section-index{
  font-family: var(--font-body);
  font-size: var(--fs-micro);
  letter-spacing: 0.2em;
  color: var(--c-bronze);
}

/* ---- Layout ------------------------------------------------------------ */
.container{
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container--wide{ max-width: 1680px; }
.container--narrow{ max-width: 880px; }

section{ position: relative; }
#main{ padding-top: var(--header-h); }
.hero, .page-hero{ margin-top: calc(-1 * var(--header-h)); }
.section{ padding-block: var(--sp-xl); }
.section--tight{ padding-block: var(--sp-lg); }
.section--dark{ background: var(--c-charcoal); color: var(--ink-on-dark); }
.section--walnut{ background: var(--c-walnut); color: var(--ink-on-dark); }
.section--sand{ background: var(--c-sand); color: var(--ink); }

.grid{ display: grid; gap: var(--sp-md); }
.grid-2{ grid-template-columns: repeat(2, 1fr); }
.grid-3{ grid-template-columns: repeat(3, 1fr); }
.grid-4{ grid-template-columns: repeat(4, 1fr); }

.split{
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}
/* Grid items get an implied min-width:auto (= their content's min-content) unless reset — without this,
   a wide child (e.g. a <select> with long options) can force a whole .split column, and the page,
   wider than the viewport on mobile even after the column collapses to a single 1fr track. */
.split > *{ min-width: 0; }
.split--gap{ gap: clamp(2rem, 6vw, 6rem); }
.split--gap{ align-items: flex-start; }
/* Desktop-only column ratios for cart/checkout — kept as real CSS (not an inline style) so the
   .split mobile collapse in responsive.css can still override it; an inline style would always
   win over that media query regardless of viewport, which is what broke checkout on mobile. */
.split--cart{ grid-template-columns: 2fr 1fr; }
.split--checkout{ grid-template-columns: 1.4fr 1fr; }

.stack{ display: flex; flex-direction: column; }

.visually-divide{ border-top: 1px solid var(--line); }
.on-dark .visually-divide{ border-color: var(--line-on-dark); }

/* ---- Buttons / links ----------------------------------------------------- */
.btn{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 1.05em 2.1em;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  transition: background var(--dur-fast) var(--ease-lux), color var(--dur-fast) var(--ease-lux), border-color var(--dur-fast) var(--ease-lux);
  white-space: nowrap;
}
.btn svg{ width: 14px; height: 10px; transition: transform var(--dur-fast) var(--ease-lux); }
.btn:hover svg{ transform: translateX(4px); }

.btn--dark{ background: var(--c-walnut); color: var(--c-ivory); border-color: var(--c-walnut); }
.btn--dark:hover{ background: transparent; color: var(--c-walnut); }

.btn--ghost{ background: transparent; color: var(--c-walnut); border-color: currentColor; }
.btn--ghost:hover{ background: var(--c-walnut); color: var(--c-ivory); }

.btn--ghost-light{ background: transparent; color: var(--c-ivory); border-color: rgba(245,240,232,0.55); }
.btn--ghost-light:hover{ background: var(--c-ivory); color: var(--c-charcoal); border-color: var(--c-ivory); }

.btn--gold{ background: var(--c-gold); color: var(--c-charcoal); border-color: var(--c-gold); }
.btn--gold:hover{ background: transparent; color: var(--c-gold); }

.btn--block{ width: 100%; justify-content: center; }
.btn--sm{ padding: 0.8em 1.5em; font-size: var(--fs-micro); }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; }

.text-link{
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-bottom: 0.35em;
  border-bottom: 1px solid currentColor;
}
.text-link svg{ width: 12px; height: 9px; transition: transform var(--dur-fast) var(--ease-lux); }
.text-link:hover svg{ transform: translateX(4px); }

/* ---- Reveal / scroll animation hooks (see js/animations.js) ------------- */
[data-reveal]{
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1100ms var(--ease-lux), transform 1100ms var(--ease-lux);
}
[data-reveal].is-visible{ opacity: 1; transform: translateY(0); }
[data-reveal="fade"]{ transform: none; }
[data-reveal-delay="1"]{ transition-delay: 120ms; }
[data-reveal-delay="2"]{ transition-delay: 240ms; }
[data-reveal-delay="3"]{ transition-delay: 360ms; }
[data-reveal-delay="4"]{ transition-delay: 480ms; }

.img-reveal{ overflow: hidden; }
.img-reveal img{
  transform: scale(1.12);
  transition: transform 1400ms var(--ease-lux);
}
.img-reveal.is-visible img{ transform: scale(1); }

/* ---- Misc utilities ------------------------------------------------------ */
.u-center{ text-align: center; }
.u-relative{ position: relative; }
.u-hide-mobile{ display: initial; }
.u-hide-desktop{ display: none; }
.ratio{ position: relative; overflow: hidden; background: var(--c-walnut); }
.ratio img, .ratio video{ position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ratio--portrait{ aspect-ratio: 4/5; }
.ratio--square{ aspect-ratio: 1/1; }
.ratio--wide{ aspect-ratio: 16/9; }
.ratio--tall{ aspect-ratio: 3/4; }

.divider-motif{
  width: 100%;
  height: 34px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 34'%3E%3Cpath d='M60 3 78 17 60 31 42 17Z' fill='none' stroke='%23B79A6A' stroke-width='1'/%3E%3Cline x1='0' y1='17' x2='40' y2='17' stroke='%23B79A6A' stroke-width='1'/%3E%3Cline x1='80' y1='17' x2='120' y2='17' stroke='%23B79A6A' stroke-width='1'/%3E%3C/svg%3E") center/120px 34px no-repeat;
  opacity: 0.6;
}

.badge{
  display: inline-block;
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-bronze);
  border: 1px solid var(--c-bronze);
  padding: 0.4em 0.9em;
}

::selection{ background: var(--c-gold); color: var(--c-charcoal); }

/* Custom cursor (desktop, optional, see navigation.js) */
.cursor-dot{
  position: fixed; top: 0; left: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-gold); pointer-events: none; z-index: 9999;
  transform: translate(-50%,-50%); mix-blend-mode: difference;
  transition: opacity 200ms ease, width 220ms var(--ease-lux), height 220ms var(--ease-lux);
  opacity: 0;
}
.cursor-dot.is-active{ opacity: 1; }
.cursor-dot.is-hover{ width: 46px; height: 46px; }
@media (hover:none), (pointer:coarse){ .cursor-dot{ display: none; } }

/* Page loader hairline (used briefly by main.js) */
.route-progress{
  position: fixed; top: 0; left: 0; height: 2px; width: 0%;
  background: var(--c-gold); z-index: 10001;
  transition: width 700ms var(--ease-lux), opacity 400ms ease;
}
