/* ============================================================
   Rare&Chosen — Main page
   Rebuilt 1:1 from Figma (file WJ05z2pI2nV10igu8BawSD).
   Desktop reference frame = 1440px.
   ============================================================ */

/* ----------------------------------------------------------------
   1. DESIGN TOKENS
   ---------------------------------------------------------------- */
:root {
  /* — Brand palette (exact Figma hexes) — */
  --c-maroon:    #601c1c;   /* primary ink / fills / dark section bg   */
  --c-ink:       #141210;   /* hero base (under photo)                 */
  --c-bone:      #e6e6e6;   /* light section bg                        */
  --c-white:     #ffffff;   /* light section bg / inverted ink         */
  --c-sage:      #4d8780;   /* cyan/teal labels + leads (all sections)  */
  --c-teal:      #4ecdbe;   /* bright accent (reserved)                 */
  --c-rule:      #c5c5c5;   /* hairline rules / ghost outline           */
  --c-rule-soft: #ffffff;   /* (legacy)                                 */
  --c-rule-plum: #8e2e5f;   /* (legacy)                                 */

  /* Backgrounds are painted by the animated WebGL field (bg-canvas.js);
     there are no per-section background colours anymore. */

  /* — Typefaces — */
  --font-display: "Lastik", Georgia, "Times New Roman", serif;
  --font-body:    "Suisse Intl", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  /* — Type scale: fluid clamp() everywhere. Each preferred term is anchored
       so the size equals the original Figma px exactly at 1440px (desktop
       reference stays pixel-accurate) and scales down to the mobile floor. — */
  --fs-display-xl: clamp(38px, 29.5px + 2.19vw, 61px);  --lh-display-xl: 0.86;  --ls-display-xl: -1.83px; /* hero h1          */
  --fs-display:    clamp(34px, 24.3px + 2.48vw, 60px);  --lh-display:    0.92;  --ls-display:    -1.8px;  /* section headings */
  --fs-display-sm: clamp(21px, 17.7px + 0.86vw, 30px);  --lh-display-sm: 0.92;  --ls-display-sm: -0.9px;  /* tabs             */
  --fs-lead:       clamp(24px, 19.9px + 1.05vw, 35px);  --lh-lead:       1.1;                             /* dark leads       */
  --fs-body-xl:    clamp(21px, 16.5px + 1.14vw, 33px);                                                    /* big body items   */
  --fs-body-lg:    clamp(18px, 15.8px + 0.57vw, 24px);                                                    /* hero subline     */
  --fs-body:       clamp(17px, 14.8px + 0.57vw, 23px);                                                    /* standard body    */
  --fs-body-sm:    clamp(13px, 12.6px + 0.10vw, 14px);                                                    /* small body / btns*/
  --fs-label:      clamp(11px, 10.6px + 0.10vw, 12px);  --ls-label: 2.4px;                                /* eyebrow labels   */
  --lh-body:       1.3;

  /* — Layout rhythm — */
  --maxw:       1440px;
  --gutter:     25px;   /* heading inset from frame edge */
  --head-top:   29px;
  --col:        665px;  /* centred content column        */
  --label-col:  90px;
  --row-gap:    50px;
  --row-gap-sm: 34px;
  --sub-gap:    25px;
  --rule-w:     3px;
  --rule-pad:   5px;

  /* — Buttons — */
  --btn-py: 16px;  --btn-px: 30px;  --btn-radius: 5px;

  /* — Section heights (Figma frame heights) — */
  --h-hero:        900px;
  --h-whynow:      900px;
  --h-whatwedo:    900px;
  --h-whychooseus: 1320px;
  --h-forwhom:     900px;
  --h-services:    1238px;
  --h-contacts:    900px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1); /* slight overshoot */

  /* nav ink — maroon everywhere; the field is uniformly light now */
  --nav-ink: var(--c-maroon);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--c-maroon);
  background: #ececea;   /* ultimate fallback behind the canvas */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

p { margin: 0; }
a { color: inherit; }

::selection { background: var(--c-maroon); color: var(--c-bone); }

/* ----------------------------------------------------------------
   3. ANIMATED BACKGROUND CANVAS
   One fixed full-viewport WebGL canvas behind ALL content — the
   only background on the site (see bg-canvas.js). A flowing simplex-
   noise gradient field melts warm cream→maroon (hero) into calm
   light-grey (content) as you scroll. The CSS rule here is also the
   static fallback shown when WebGL is unavailable or the user
   prefers reduced motion (html.no-webgl).
   ---------------------------------------------------------------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
  background: #e3e3e3;   /* flat grey fallback (matches the field base) */
  pointer-events: none;
}
/* No-WebGL / reduced-motion fallback: a static gradient. Content stays
   light (canvas flat fallback); the hero gets its own warm pool so the
   white hero copy keeps its contrast. */
html.no-webgl .sec--hero {
  background: radial-gradient(120% 100% at 50% 42%, #e6e6e6 0%, #d8c6bf 58%, #c2a39c 100%);
}

/* ----------------------------------------------------------------
   4. SECTION SHELL  (transparent — the canvas shows through)
   ---------------------------------------------------------------- */
main {
  position: relative;
  z-index: 0;
  /* SPA page transition: <main> crossfades out/in with a slight vertical
     move while the persistent canvas keeps drifting (see router.js). */
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  will-change: opacity, transform;
}
main.pt-still { transition: none; }           /* snap, no tween */
main.pt-out   { opacity: 0; transform: translateY(-18px); }  /* leaving (lift up) */
main.pt-in    { opacity: 0; transform: translateY(18px); }   /* arriving (start below) */

.sec { position: relative; width: 100%; background: transparent; }
.sec__frame {
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
}

.sec--hero        .sec__frame { height: 100svh; min-height: 540px; }
.sec--whynow      .sec__frame { height: var(--h-whynow); }
.sec--whatwedo    .sec__frame { height: var(--h-whatwedo); }
.sec--whychooseus .sec__frame { height: var(--h-whychooseus); }
.sec--forwhom     .sec__frame { height: var(--h-forwhom); }
.sec--services    .sec__frame { height: var(--h-services); }
.sec--contacts    .sec__frame { height: var(--h-contacts); }

/* ----------------------------------------------------------------
   5. SHARED TYPE PRIMITIVES
   ---------------------------------------------------------------- */
.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  color: var(--c-maroon);
}

/* heading pinned to the top-left of a frame */
.sec__head {
  position: absolute;
  left: var(--gutter);
  top: var(--head-top);
  margin: 0;
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-label);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-sage);
}

em, .italic { font-style: normal; }

/* centred content column */
.col {
  position: absolute;
  left: calc(50% + 0.5px);
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--col);
}

/* ----------------------------------------------------------------
   6. RULE-LIST  (label + body rows divided by hairlines)
   used by: why-now, what-we-do, for-whom, services
   ---------------------------------------------------------------- */
.rows {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
}
.row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  padding-bottom: var(--rule-pad);
  border-bottom: var(--rule-w) solid var(--c-rule);
}
.row__label {
  flex: none;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-label);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-sage);
}
.row__body {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-maroon);
}

/* ----------------------------------------------------------------
   7. BUTTONS
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--btn-py) var(--btn-px);
  border-radius: var(--btn-radius);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  will-change: transform;
  transition: transform 0.5s var(--ease-bounce), background-color 0.35s var(--ease),
              color 0.35s var(--ease), border-color 0.35s var(--ease);
}
/* hover: bounce-eased scale-up (no translate). active: soft press. */
.btn:hover { transform: scale(1.05); }
.btn:active { transform: scale(0.95); transition-duration: 0.12s; }
.btn--solid {
  background: var(--c-maroon);
  color: var(--c-white);
  border: 1px solid var(--c-maroon);
}
.btn--solid:hover { background: #4d1616; border-color: #4d1616; }
.btn--ghost {
  background: transparent;
  color: var(--c-maroon);
  border: 1px solid var(--c-rule);
  text-transform: uppercase;
}
.btn--ghost:hover { border-color: var(--c-maroon); }

/* a button absolutely centred on the X axis at a fixed top/bottom.
   Centring uses the `translate` property so `transform` stays free for the
   hover scale (otherwise the scale would wipe out the -50% centring). */
.btn-anchor { position: absolute; left: 50%; translate: -50% 0; }

/* ================================================================
   8. SECTION — HERO
   ================================================================ */
/* Hero is transparent — the warm WebGL field is its background. */
.sec--hero { background: transparent; }
.hero__inner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 689px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  isolation: isolate; /* own stacking context: scrim sits below the copy */
}
/* soft light halo that travels WITH the hero / closing copy — lifts a faintly
   lighter pool behind the maroon type so it stays crisp over the glass band */
.hero__inner::before,
.contacts__inner::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  /* capped so the centred halo never exceeds the viewport (it's centred on
     the viewport, so 96vw stays on-screen) — contains the only residual
     horizontal overflow without clipping the scroll root */
  width: min(178%, 96vw);
  height: 190%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side,
    rgba(255, 251, 243, 0.55), rgba(255, 251, 243, 0) 72%);
  filter: blur(28px);
  z-index: -1;
  pointer-events: none;
}
.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display-xl);
  line-height: var(--lh-display-xl);
  letter-spacing: var(--ls-display-xl);
  color: var(--c-maroon);
}
.hero__sub {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  color: var(--c-maroon);
}

/* ================================================================
   9. SECTION — WHY NOW
   ================================================================ */
.whynow__rows { gap: var(--row-gap); }
.whynow__rows .row { gap: 57px; }
.whynow__rows .row__label { width: 71px; }
.whynow__finale {
  position: absolute;
  left: var(--gutter);
  top: 818px;
  width: 950px;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  color: var(--c-maroon);
}

/* ================================================================
   10. SECTION — WHAT WE DO
   ================================================================ */
/* working tab switcher (For tech-companies / For top-level professionals) */
.wwd { display: flex; flex-direction: column; gap: clamp(28px, 3.5vw, 48px); width: 100%; }
.wwd__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 4vw, 56px);
}
.wwd__tab {
  appearance: none;
  background: none;
  margin: 0;
  padding: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display-sm);
  line-height: 1;
  letter-spacing: var(--ls-display-sm);
  color: var(--c-maroon);
  cursor: pointer;
  border: 0;
  border-bottom: 1px solid var(--c-rule);   /* inactive = light underline */
  opacity: 0.5;
  transition: opacity 0.3s var(--ease), border-color 0.3s var(--ease);
}
.wwd__tab:hover { opacity: 0.8; }
.wwd__tab.is-active {
  opacity: 1;
  border-bottom: var(--rule-w) solid var(--c-maroon);  /* active = solid underline */
}

.wwd__panel { display: none; }
.wwd__panel.is-active {
  display: flex;
  flex-direction: column;
  animation: tab-fade 0.65s var(--ease) both;
}
/* incoming panel crossfades up into place with a long eased curve */
@keyframes tab-fade {
  from { opacity: 0; translate: 0 16px; filter: blur(6px); }
  to   { opacity: 1; translate: none; filter: blur(0); }
}

.wwd__rows { gap: var(--row-gap); }
.wwd__rows .row { gap: var(--row-gap); }
.wwd__rows .row__label { width: var(--label-col); }

/* ================================================================
   11. SECTION — LEAD + BODY LIST  (why choose us / event formats)
   Lives on the same light field as everything else: cyan serif lead
   over the shared maroon body. Same components on both pages.
   ================================================================ */
.whyus__col {
  top: 197px;
  transform: translateX(-50%);
}
.whyus__list { gap: var(--row-gap-sm); }
.whyus__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  gap: 4px;
  padding-bottom: var(--rule-pad);
  border-bottom: var(--rule-w) solid var(--c-rule);
}
.whyus__lead {
  font-family: var(--font-display);
  font-weight: 400;
  /* serif reads ~20% larger than the sans body at equal px — shrink it so the
     cyan label and the body beneath it match optically */
  font-size: calc(var(--fs-lead) * 0.8);
  line-height: var(--lh-lead);
  color: var(--c-sage);
}
.whyus__body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body);     /* shared body size — same as every list */
  line-height: var(--lh-body);
  color: var(--c-maroon);
}

/* ================================================================
   12. SECTION — FOR WHOM  (single content, full-bleed)
   ================================================================ */
.forwhom__list { gap: clamp(22px, 3vw, 40px); }
.forwhom__item {
  display: flex;
  width: 100%;
  padding-bottom: clamp(14px, 1.6vw, 20px);
  border-bottom: var(--rule-w) solid var(--c-rule);
}
.forwhom__text {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body);     /* shared body size */
  line-height: var(--lh-body);
  color: var(--c-maroon);
}

/* ================================================================
   13. SECTION — SERVICES (overview list)
   ================================================================ */
.services__rows { gap: var(--row-gap); }
.services__rows .row { gap: var(--row-gap); }
.services__rows .row__label { width: var(--label-col); }

/* row that nests a sub-list */
.services__col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sub-gap);
}
.subrow { display: flex; align-items: flex-start; width: 100%; gap: var(--row-gap); }
.subrow__num {
  flex: none;
  width: 30px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-label);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-sage);
}
.subrow__body {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body);     /* shared body size — all list items match */
  line-height: var(--lh-body);
  color: var(--c-maroon);
}
.services__cta { bottom: 102px; }

/* ================================================================
   14. SECTION — CONTACTS
   ================================================================ */
.contacts__inner {
  position: absolute;
  left: calc(50% + 0.5px);
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--col);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  isolation: isolate;   /* own stacking context for the legibility halo */
}
.contacts__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  color: var(--c-maroon);
}

/* ----------------------------------------------------------------
   15. TOP NAV  (fixed, transparent; ink re-themed per section in JS)
   ---------------------------------------------------------------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* side padding matches the 20px section gutters used across both pages */
  padding: clamp(16px, 2vw, 26px) 20px;
  color: var(--nav-ink);
  pointer-events: none;                 /* clicks pass through except on links */
  transition: color 0.5s var(--ease);
}
.nav a { pointer-events: auto; color: var(--nav-ink); text-decoration: none; }
.nav__brand {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(12px, 10px + 0.3vw, 14px);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.nav__links { display: flex; gap: clamp(18px, 2vw, 32px); }
.nav__links a {
  position: relative;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-label);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  opacity: 0.7;
  transition: opacity 0.35s var(--ease), color 0.5s var(--ease);
}
/* smooth underline that grows from the left on hover / active */
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s var(--ease);
}
.nav__links a:hover,
.nav__links a.is-active { opacity: 1; }
.nav__links a:hover::after,
.nav__links a.is-active::after { transform: scaleX(1); }

/* ----------------------------------------------------------------
   16. SCROLL TRANSITIONS
   scroll-bg.js animates each .sec__frame: fade + heavy blur + vertical
   movement on enter/exit, plus a subtle randomised parallax drift.
   ---------------------------------------------------------------- */
.sec__frame { will-change: opacity, transform, filter; }

/* No-JS / reduced-motion: everything visible, no animation. */
.no-js .sec__frame,
.no-fx .sec__frame { opacity: 1 !important; filter: none !important; transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover, .btn:active { transform: none; }
  .wwd__panel.is-active { animation: none; }
  .nav__links a::after { transition: none; }
}
