/* ==========================================================================
   TVIARA STUDIO — base.css
   Reset · Design tokens · Typography · Layout primitives
   Interior Design & Architecture · Dubai
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* --- Brand palette --- */
  --champagne: #E4BC74;
  --bronze:    #A68954;
  --ebony:     #332F28;
  --parchment: #FEF6E6;
  --ivory:     #FFFCF8;

  /* --- Semantic colour roles --- */
  --bg:          var(--parchment);   /* dominant background (the paper) */
  --bg-alt:      var(--ivory);       /* secondary surface / alt sections */
  --text:        var(--ebony);       /* all body text */
  --text-muted:  #6B6457;            /* meta, captions, eyebrow */
  --accent:      var(--champagne);   /* links, focus, one CTA, hairlines */
  --accent-deep: var(--bronze);      /* rare hover / detail accent */
  --line:        rgba(51, 47, 40, 0.12);   /* hairline rules */
  --line-strong: rgba(51, 47, 40, 0.22);

  /* --- Typography families --- */
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-ui:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* --- Fluid type scale (360px -> 1440px+) — cinematic editorial scale --- */
  --fs-mega:       clamp(3.5rem, 1.2rem + 10vw, 11rem);       /* huge statement type */
  --fs-display-xl: clamp(3rem, 1.2rem + 8vw, 8rem);           /* hero H1 */
  --fs-display-l:  clamp(2.25rem, 1.2rem + 4.6vw, 5rem);      /* section H2 */
  --fs-display-m:  clamp(1.9rem, 1.1rem + 3.4vw, 4rem);       /* quote / pull-line */
  --fs-h3:         clamp(1.25rem, 1rem + 0.95vw, 1.75rem);    /* card / sub title */
  --fs-body:       clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);   /* body copy */
  --fs-small:      0.875rem;                                   /* meta / caption */
  --fs-eyebrow:    0.75rem;                                     /* uppercase labels */

  /* --- Tracking --- */
  --track-label:   0.28em;   /* uppercase eyebrows / labels (~4-8px) */
  --track-display: -0.01em;  /* tighten the italic display face */

  /* --- Line heights --- */
  --lh-body:    1.7;
  --lh-display: 1.04;
  --lh-tight:   1.16;

  /* --- Spacing scale (rem) --- */
  --sp-1: 0.5rem;
  --sp-2: 0.75rem;
  --sp-3: 1rem;
  --sp-4: 1.5rem;
  --sp-5: 2rem;
  --sp-6: 3rem;
  --sp-7: 4rem;
  --sp-8: 6rem;
  --sp-9: 8rem;
  --sp-10: 12rem;

  /* --- Layout --- */
  --container:  1320px;
  --gutter:     clamp(1.25rem, 5vw, 6rem);
  --section-y:  clamp(6rem, 10vw, 12rem);
  --section-y-sm: clamp(4rem, 8vw, 6rem);

  /* --- Motion --- */
  --ease:       cubic-bezier(0.22, 1, 0.36, 1);   /* power3.out feel */
  --dur-fast:   0.4s;
  --dur:        0.9s;
  --dur-slow:   1.2s;

  /* --- Misc --- */
  --radius: 2px;
  --header-h: 88px;
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul,
ol { list-style: none; padding: 0; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  line-height: var(--lh-display);
  text-wrap: balance;
}

p { text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 4px;
  border-radius: 1px;
}

::selection {
  background: var(--champagne);
  color: var(--ebony);
}

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY PRIMITIVES
   -------------------------------------------------------------------------- */

/* Display face — Cormorant Garamond Italic 300 */
.display,
.h1, .h2, .h-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  letter-spacing: var(--track-display);
  line-height: var(--lh-display);
  color: var(--text);
}

.h1 { font-size: var(--fs-display-xl); }
.h2 { font-size: var(--fs-display-l); }
.h-quote { font-size: var(--fs-display-m); }
.h-mega {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--fs-mega);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

/* Structural sub-title — Inter Medium */
.h3 {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-h3);
  line-height: var(--lh-tight);
  letter-spacing: 0;
}

/* Eyebrow / label — uppercase Inter Medium, wide tracking */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--fs-eyebrow);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--text-muted);
  line-height: 1;
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent-deep);
  flex: none;
}
.eyebrow--plain::before { display: none; }

/* Lead / large intro paragraph */
.lead {
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  line-height: 1.55;
  color: var(--text);
}

/* Body copy block */
.body-copy { max-width: 60ch; }
.body-copy p + p { margin-top: var(--sp-4); }

/* Meta row (category · location etc.) */
.meta {
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.muted { color: var(--text-muted); }

/* --------------------------------------------------------------------------
   4. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); background: var(--bg); position: relative; z-index: 1; }
.section--sm { padding-block: var(--section-y-sm); }
.section--alt { background: var(--bg-alt); }
.section--dark {
  background: var(--ebony);
  color: var(--parchment);
}
.section--dark .eyebrow,
.section--dark .meta,
.section--dark .muted { color: rgba(254, 246, 230, 0.62); }
.section--dark .eyebrow::before { background: var(--champagne); }

/* 12-column grid for editorial layouts.
   NOTE: column-gap is the gap BETWEEN columns (×11), so it must stay small —
   never the page gutter, or columns collapse. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(1rem, 2vw, 2.25rem);
  row-gap: var(--sp-6);
}

/* Common column spans (desktop).
   Use grid-column-END (longhand) so spans compose correctly with .start-* . */
.col-3  { grid-column-end: span 3; }
.col-4  { grid-column-end: span 4; }
.col-5  { grid-column-end: span 5; }
.col-6  { grid-column-end: span 6; }
.col-7  { grid-column-end: span 7; }
.col-8  { grid-column-end: span 8; }
.col-12 { grid-column: 1 / -1; }

.start-2 { grid-column-start: 2; }
.start-6 { grid-column-start: 6; }
.start-7 { grid-column-start: 7; }
.start-8 { grid-column-start: 8; }

/* Stack helper */
.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }

/* Hairline */
.rule {
  width: 100%;
  height: 1px;
  background: var(--line);
  border: 0;
}

/* Utility */
.center { text-align: center; }
.measure { max-width: 64ch; }
.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;
}

/* Image mask wrapper — used for all reveal/parallax images */
.media {
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Graceful fallback: JS marks broken images; the wrapper becomes a warm,
   intentional material panel instead of a broken-image icon. */
.media img.is-broken { display: none; }
.media.is-empty {
  background:
    linear-gradient(135deg, #f4ead4 0%, #fbf4e4 60%, #efe2c8 100%);
}
.media.is-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(166,137,84,0.10) 100%);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  z-index: 1000;
  padding: 0.75rem 1.25rem;
  background: var(--ebony);
  color: var(--parchment);
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 1rem; }

/* --------------------------------------------------------------------------
   5. REVEAL STATE (animation-ready, JS-gated, motion-safe)
   IMPORTANT: elements only hide once main.js confirms it is running AND
   motion is allowed, by adding `.reveal-ready` to <html>. If JS never runs,
   or motion is reduced, content stays fully visible. No content can be
   trapped at opacity:0 by a missing script.
   -------------------------------------------------------------------------- */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  will-change: opacity, transform;
}
.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

/* Word-split lines (built by animations.js) clip their words for the reveal */
.reveal-ready .split-line { overflow: hidden; }
.reveal-ready .split-word { display: inline-block; }

/* --------------------------------------------------------------------------
   6. REDUCED MOTION — disable all motion, show content immediately
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal-ready [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
