@import url('../fonts/fonts.css');

/* ==========================================================================
   Shri Sai Interior — design tokens and base layer
   Palette: deep charcoal, warm ivory, soft beige, walnut, stone grey, brass.
   ========================================================================== */

:root {
  /* --- Colour ------------------------------------------------------------ */
  --charcoal:        #22201D;
  --charcoal-soft:   #2E2B27;
  --charcoal-tint:   #3A3630;

  --ivory:           #F6F1E9;
  --ivory-warm:      #FBF8F3;
  --beige:           #E8DFD1;
  --beige-deep:      #DCD0BD;

  --walnut:          #6B4F3A;
  --walnut-deep:     #4A3627;

  /*
   * Stone ramp. Each rung has ONE job, because the old ramp did not and the
   * text went dull as a result.
   *
   * Contrast against --ivory #F6F1E9 / --charcoal #22201D:
   *   stone      #443F39  9.27 ivory / 7.89 warm band   (body copy, ledes)
   *   stone-mid  #655E55  5.68 ivory / 4.84 warm / 6.03 panel  (hints, ordinals)
   *   stone-light #C6BFB4 8.91 on charcoal               (muted text on dark)
   *
   * stone-mid is scored against the WARM #E8DFD1 band as well as ivory, because
   * faint text lands on both. At #736C63 it cleared ivory at 4.61 and quietly
   * failed the band at 3.92 — passing on the surface you happen to test is not
   * the same as passing.
   *
   * These sit high on purpose. 4.96 and 6.37 both "passed" AA and both still
   * read as grey mush next to headings at 14.45 — passing the floor is not the
   * same as being legible. They stay well clear of 14.45 so headings and the
   * active nav item still outrank body copy; the ramp is compressed, not gone.
   *
   * The old file used --stone for body on light AND for muted text on dark
   * surfaces, where it measured 2.91 and failed AA outright. One value cannot
   * serve both directions; that is why stone-light exists and why stone must
   * never appear on a dark surface.
   */
  --stone:           #443F39;
  --stone-mid:       #655E55;
  --stone-light:     #C6BFB4;
  /* --stone-faint (#C9C2B8) removed: nothing referenced it, and it now sat one
     shade off --stone-light, which is a trap for whoever reaches for it next. */

  /*
   * Brass ramp — same one-token-two-directions trap the stone ramp had.
   *
   *   brass-deep  #775E2D  5.46 on ivory, 4.65 on the warm band  — TEXT/ICONS ON LIGHT
   *   brass       #B08D4F  2.76 on ivory (FAILS), 5.24 on charcoal — rules, borders,
   *                        fills, and text on DARK only
   *   brass-light #C9A768  7.13 on charcoal                        — text on dark
   *
   * --brass is the brand colour and it is staying exactly as it is wherever it
   * is a rule, a border, a hairline or a fill — none of which carry a contrast
   * duty. But as TEXT or an ICON on ivory it measured 2.76, under both the 4.5
   * text floor and the 3.0 non-text floor. brass-deep is the same hue pushed
   * down in value until it clears both, on the warm #E8DFD1 band as well as
   * plain ivory, because brass text lands on both.
   *
   * Nothing on a dark surface changes: brass reads 5.24 there and is fine.
   */
  --brass:           #B08D4F;
  --brass-deep:      #775E2D;
  --brass-light:     #C9A768;
  --brass-pale:      #E4D3AE;

  --olive:           #4A5240;

  /* Semantic */
  --bg:              var(--ivory);
  --bg-raised:       var(--ivory-warm);
  --bg-sunken:       var(--beige);
  --bg-inverse:      var(--charcoal);

  --text:            var(--charcoal);
  --text-muted:      var(--stone);
  /* stone-mid, NOT stone-light: --text-faint lands on IVORY (form hints,
     placeholders, captions), where stone-light measured 2.27 and failed AA.
     stone-light stays the token for muted text on dark, below. */
  --text-faint:      var(--stone-mid);
  --text-inverse:    var(--ivory);
  --text-inverse-muted: var(--stone-light);

  --accent:          var(--brass);
  --accent-on-dark:  var(--brass-light);

  --rule:            rgba(34, 32, 29, 0.14);
  --rule-strong:     rgba(34, 32, 29, 0.26);
  --rule-inverse:    rgba(246, 241, 233, 0.18);

  --focus:           var(--brass);

  /* --- Type -------------------------------------------------------------- */
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /*
   * Fluid scale, tuned across 320px -> 1600px.
   *
   * The display sizes are pinned to what a 320px screen can actually hold: at
   * 320 the content box is only ~280px, and a single unbreakable word like
   * "Transforming" set at 48px is wider than that. Its glyphs then paint outside
   * their box and get silently clipped by the body's overflow guard — the
   * element's own rect still measures in-bounds, so it does not look like
   * overflow, it just looks like missing letters.
   */
  --step--2: clamp(0.69rem, 0.67rem + 0.10vw, 0.75rem);
  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0:  clamp(1.00rem, 0.95rem + 0.25vw, 1.13rem);
  --step-1:  clamp(1.13rem, 1.06rem + 0.35vw, 1.50rem);
  --step-2:  clamp(1.35rem, 1.22rem + 0.65vw, 2.00rem);
  --step-3:  clamp(1.55rem, 1.34rem + 1.05vw, 2.66rem);
  --step-4:  clamp(1.75rem, 1.30rem + 2.25vw, 3.55rem);
  --step-5:  clamp(2.00rem, 1.32rem + 3.41vw, 4.73rem);
  --step-6:  clamp(2.25rem, 1.23rem + 5.08vw, 6.31rem);

  /*
   * Display sizes, for the hero and section openers.
   *
   * Exaggerated Minimalism territory: the reference template's impact comes
   * almost entirely from photography, so ours has to come from type. Still
   * pinned at the small end to what a 320px screen can physically hold — the
   * word "Transforming" set in Fraunces is ~6.4x its font-size in width, and a
   * 280px content box is the real constraint.
   */
  /*
   * Capped at 7rem, not larger. Bigger looked spectacular in isolation and
   * pushed the hero's CTAs below the fold on a 1440x900 laptop — the headline
   * was winning an argument with the thing the page exists to do. Budget at
   * 900px tall: 118 chrome + 44 eyebrow + ~315 title + 156 lede + 48 actions
   * + 100 strip = 781.
   */
  --step-7:  clamp(2.5rem, 1.15rem + 5.1vw, 5.5rem);
  --step-8:  clamp(2.75rem, 1.2rem + 6.6vw, 7rem);

  --leading-tight: 1.05;
  --leading-display: 0.92;   /* display type sets tighter than text type */
  --leading-snug: 1.22;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --tracking-label: 0.18em;
  --tracking-tight: -0.02em;
  --tracking-display: -0.035em;

  /* --- Space ------------------------------------------------------------- */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs:  0.75rem;
  --space-s:   1rem;
  --space-m:   1.5rem;
  --space-l:   2.25rem;
  --space-xl:  3.5rem;
  --space-2xl: 5rem;
  --space-3xl: 7.5rem;
  /* Section rhythm. Tightened from clamp(4rem, 2.5rem + 7vw, 9rem), which
     resolved to 140.8px top AND bottom on a 1440 screen — 281px between every
     pair of sections, and roughly 3,100px (a fifth) of the homepage was nothing
     but this padding. Enough air to separate sections, not enough to strand
     them. */
  --section-y: clamp(2.75rem, 2rem + 3.5vw, 5.5rem);

  /* --- Structure --------------------------------------------------------- */
  --measure: 68ch;
  --shell: 1440px;
  --shell-narrow: 940px;
  --gutter: clamp(1.25rem, 0.7rem + 2.6vw, 4rem);

  /* Restrained — this brand is architectural, not a stack of rounded cards. */
  --radius-none: 0;
  --radius-xs: 2px;
  --radius-s: 3px;

  --shadow-subtle: 0 1px 2px rgba(34, 32, 29, 0.04), 0 4px 14px rgba(34, 32, 29, 0.05);
  --shadow-lift: 0 2px 6px rgba(34, 32, 29, 0.06), 0 18px 42px rgba(34, 32, 29, 0.10);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur: 320ms;
  --dur-slow: 620ms;

  --header-h: 76px;
  --z-header: 100;
  --z-mobilenav: 110;
  --z-lightbox: 200;
  --z-actionbar: 90;
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-normal);
  /*
   * 450, not 400. Manrope is a variable face (400..800), so this costs no extra
   * file — it is a weight the font already carries. Manrope's 400 is drawn light
   * for a grotesque, and against a warm ivory it reads washed rather than crisp.
   * 450 thickens the stems just enough to bite without turning the page bold.
   */
  font-weight: 450;
  /*
   * -webkit-font-smoothing: antialiased was removed here.
   *
   * It forces greyscale antialiasing in place of subpixel, which THINS every
   * stroke — the opposite of what this page needs. It is also macOS/WebKit only,
   * so it was never doing anything on Windows: dropping it changes nothing for a
   * Windows viewer and stops mac and iOS visitors getting a lighter, mushier
   * render than the design intends.
   */
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; margin: 0; padding: 0; }

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

/*
 * Default size for every <x-icon>. An inline SVG with no width/height falls back
 * to a 300x150 default box, so any icon placed somewhere without an explicit
 * size rule renders enormous. Sizing to 1em here means an icon always matches
 * the text it sits beside, and component rules below can still override it.
 */
.icon {
  inline-size: 1em;
  block-size: 1em;
  flex: none;
}

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

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

/* ==========================================================================
   Typography
   ========================================================================== */

h1, .h1, h2, .h2, h3, .h3, h4, .h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-variation-settings: 'SOFT' 0, 'WONK' 0;
  text-wrap: balance;
  /* Last-resort guard: a word longer than its container breaks rather than
     painting outside the box and being clipped by the overflow rule on body. */
  overflow-wrap: break-word;
}

h1, .h1 { font-size: var(--step-5); line-height: var(--leading-tight); }
h2, .h2 { font-size: var(--step-4); }
h3, .h3 { font-size: var(--step-2); }
h4, .h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }

.lede {
  font-size: var(--step-1);
  line-height: var(--leading-relaxed);
  color: var(--text-muted);
  max-width: 58ch;
}

.prose > * + * { margin-top: var(--space-m); }
.prose { max-width: var(--measure); }
.prose p { color: var(--text-muted); }
.prose h2 { margin-top: var(--space-xl); }
.prose h3 { margin-top: var(--space-l); }
.prose ul { padding-left: 1.15em; color: var(--text-muted); }
.prose li + li { margin-top: var(--space-2xs); }
.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-underline-offset: 3px;
}

/* The small uppercase label that opens most sections. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-size: var(--step--2);
  font-weight: 700;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}
.eyebrow::before {
  content: '';
  inline-size: 2rem;
  block-size: 1px;
  background: var(--brass);
  flex: none;
}
.eyebrow--plain::before { display: none; }
.on-dark .eyebrow, .eyebrow--inverse { color: var(--text-inverse-muted); }
.on-dark .eyebrow::before, .eyebrow--inverse::before { background: var(--brass-light); }

/* --------------------------------------------------------------------------
   Display type
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-size: var(--step-7);
  font-weight: 600;
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  /* Fraunces is variable: opsz high + SOFT 0 gives sharp, high-contrast cuts
     that only read correctly at large sizes. */
  font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.display--xl { font-size: var(--step-8); }

/* The one italic brass word per headline. Used once, or it stops being an accent. */
.display em,
.accent-word {
  font-style: italic;
  color: var(--brass);
  font-variation-settings: 'opsz' 144, 'SOFT' 60, 'WONK' 1;
}
.on-dark .display em,
.on-dark .accent-word { color: var(--brass-light); }

/* Outlined display type — used sparingly, for a single word behind/beside a
   filled one. Falls back to solid where text-stroke is unsupported. */
.display-outline {
  color: transparent;
  -webkit-text-stroke: 1px var(--brass);
  text-stroke: 1px var(--brass);
}
@supports not ((-webkit-text-stroke: 1px black) or (text-stroke: 1px black)) {
  .display-outline { color: var(--brass); }
}

/* --------------------------------------------------------------------------
   Editorial details
   -------------------------------------------------------------------------- */

/* Drop cap for the opening paragraph of a long editorial block. */
.drop-cap::first-letter {
  float: inline-start;
  font-family: var(--font-display);
  font-size: 3.6em;
  line-height: 0.82;
  font-weight: 600;
  color: var(--brass);
  padding-inline-end: 0.09em;
  padding-block-start: 0.04em;
}

/* Project / step numerals set as an editorial detail. */
.numeral {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--brass);
  letter-spacing: 0;
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--narrow { max-width: var(--shell-narrow); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.section--flush-top { padding-block-start: 0; }

.on-dark {
  background: var(--bg-inverse);
  color: var(--text-inverse);
}
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: var(--text-inverse); }
.on-dark p, .on-dark .lede { color: var(--text-inverse-muted); }
.on-dark .rule { background: var(--rule-inverse); }

.on-beige { background: var(--bg-sunken); }

.rule {
  block-size: 1px;
  inline-size: 100%;
  background: var(--rule);
  border: 0;
}

/* --------------------------------------------------------------------------
   Editorial grid
   A 12-column field that sections opt into, so elements can be placed
   asymmetrically and overlap — rather than every band being a centred stack.
   -------------------------------------------------------------------------- */

.ed-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--space-m);
  row-gap: var(--space-l);
}
@media (min-width: 48rem) {
  .ed-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (min-width: 62rem) {
  .ed-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--space-l);
  }
}

/* Column spans, desktop only — everything stacks below 62rem. */
@media (min-width: 62rem) {
  .col-1  { grid-column: span 1; }  .col-2  { grid-column: span 2; }
  .col-3  { grid-column: span 3; }  .col-4  { grid-column: span 4; }
  .col-5  { grid-column: span 5; }  .col-6  { grid-column: span 6; }
  .col-7  { grid-column: span 7; }  .col-8  { grid-column: span 8; }
  .col-9  { grid-column: span 9; }  .col-10 { grid-column: span 10; }
  .col-12 { grid-column: 1 / -1; }

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

  /* Deliberate vertical offsets — the thing that stops a grid reading as a table. */
  .offset-down   { transform: translateY(clamp(2rem, 5vw, 5.5rem)); }
  .offset-down-s { transform: translateY(clamp(1rem, 2.5vw, 2.75rem)); }
  .offset-up     { transform: translateY(calc(-1 * clamp(2rem, 5vw, 5.5rem))); }
}

/* --------------------------------------------------------------------------
   Full-bleed
   Escapes the shell without a wrapper, using the shell's own gutter.
   -------------------------------------------------------------------------- */

.bleed {
  width: 100vw;
  margin-inline-start: 50%;
  transform: translateX(-50%);
  max-width: none;
}

/* Bleeds to one edge only, staying in the grid on the other — an editorial
   device the reference template uses well. */
.bleed-end {
  margin-inline-end: calc(-1 * var(--gutter));
}
.bleed-start {
  margin-inline-start: calc(-1 * var(--gutter));
}

/*
 * Parallax on page-hero media — CSS scroll-driven, no JavaScript.
 *
 * This was written for the homepage material band, which has since been removed;
 * <x-page-hero> is now the only consumer, so the wording and the keyframe name
 * follow it rather than pointing at a section that no longer exists.
 *
 * This replaced a hand-rolled IntersectionObserver + rAF + scroll-listener
 * implementation. That version worked, but it had four moving parts that could
 * each fail silently, and it was effectively unverifiable in automation
 * (a backgrounded tab throttles IntersectionObserver, so it never fires).
 *
 * animation-timeline: view() is declarative: the browser drives it from the
 * element's own progress through the viewport. Where it is unsupported, the
 * @supports guard means the layer simply sits still — which is exactly the
 * intended fallback, and cannot break.
 *
 * The reduced-motion guard is a media query rather than a JS branch, so it also
 * responds if the visitor changes the setting without reloading.
 */
[data-parallax-layer] {
  inset-block: 0;
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    [data-parallax-layer] {
      /* Overscan gives the layer room to travel without exposing an edge. */
      inset-block: -9% -9%;
      will-change: transform;
      animation: hero-parallax linear both;
      animation-timeline: view();
      animation-range: cover 0% cover 100%;
    }

    @keyframes hero-parallax {
      from { transform: translate3d(0, -7%, 0); }
      to   { transform: translate3d(0, 7%, 0); }
    }
  }
}

.stack > * + * { margin-block-start: var(--flow, var(--space-m)); }

.grid {
  display: grid;
  gap: var(--space-l);
}

/* Section heading block: label, title, optional lede + action. */
.section-head {
  display: grid;
  gap: var(--space-s);
  margin-block-end: var(--space-xl);
}
.section-head__main {
  display: grid;
  gap: var(--space-s);
  align-content: start;
}
.section-head__title { max-width: 22ch; }
.section-head--wide .section-head__title { max-width: 30ch; }

@media (min-width: 60rem) {
  /*
   * Both columns start on the same line.
   *
   * This used to bottom-align (align-items: end + align-self: end on the
   * aside), which reads well only when the two columns are a similar height.
   * They rarely are: where the lede runs five lines and the left column is just
   * an eyebrow and a title, the eyebrow got shoved 67px down the page and left a
   * hole in the top-left corner of the section. Aligning the tops means the
   * uneven column simply ends earlier, which nobody reads as a gap.
   */
  /*
   * Two columns, one cell each — no row spanning, so nothing can inflate a row
   * from the inside (see section-heading.blade.php).
   *
   * Tops align rather than bottoms. Bottom-aligning reads well only when the two
   * columns are a similar height; they rarely are, and where the lede ran five
   * lines against a bare eyebrow and title, the left column was pushed down and
   * left a hole in the section's top-left corner. Aligned tops just mean the
   * shorter column ends earlier, which nobody reads as a gap.
   */
  .section-head--split {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
    column-gap: var(--space-2xl);
  }
  .section-head--split .section-head__main { grid-column: 1; }
  .section-head--split .section-head__aside { grid-column: 2; grid-row: 1; }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: -100%;
  z-index: 999;
  padding: var(--space-xs) var(--space-m);
  background: var(--charcoal);
  color: var(--ivory);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: inset-block-start var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { inset-block-start: var(--space-s); }

/* A visible, branded focus ring — never removed, only replaced. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
.on-dark :where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline-color: var(--brass-light);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }
