/* =============================================================================
   base.css — the fluid foundation. Copy into every site as css/base.css.
   Nothing here is width-locked: type, spacing and layout scale continuously
   from ~360px phones to ultrawide. This file is why sites are dynamic off the bat.
   ============================================================================= */

/* ── Vella brand fonts (local, /fonts) ─────────────────────────────────────── */
@font-face {
  font-family: 'Qlassy';
  src: url('../fonts/Qlassy-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/Montserrat-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Sintrua';
  src: url('../fonts/Sintrua.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  /* COLOURS — Vella brand palette (knowledge-base/brand-colors.png). */
  --brand:      #1b2e32;   /* Midnight Surf */
  --brand-dark: #142226;   /* deeper Midnight (hovers, footer) */
  --accent:     #615a48;   /* Forest */
  --sail:       #99acb1;   /* Sail */
  --muted:      #5c6b70;   /* secondary text */
  --surface:    #fbeee5;   /* Birchwood */
  --ink:        #1b2e32;   /* body text */
  --white:      #ffffff;   /* Sea Foam */

  /* TYPE — fluid scale. Never set a size that only looks right at one width. */
  --font: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Qlassy', Georgia, 'Times New Roman', serif;
  --font-script: 'Sintrua', cursive;
  --t-header: clamp(48px, 7vw,   88px);
  --t-h1:     clamp(40px, 5.4vw, 70px);
  --t-h2:     clamp(30px, 3.6vw, 46px);
  --t-h3:     clamp(24px, 2.6vw, 31px);
  --t-lg:   20px;
  --t-body: 16px;
  --t-small: 11px;
  --t-cta:   12px;

  /* SPACING — gutters and section rhythm breathe with the viewport. */
  --wrap: 1240px;                             /* max content width; page itself is fluid */
  --pad:  clamp(20px, 5vw, 64px);             /* fluid side padding */
  --section-y: clamp(56px, 8vw, 128px);       /* vertical section rhythm */
  --measure: 68ch;                            /* readable line-length cap */

  --nav-h: 68px;
  --radius: 0;               /* Vella: sharp edges everywhere — no rounded corners */
  --legal-h: 40px;           /* height of the bottom legal strip (splash fills the rest) */
  --ease: cubic-bezier(.22,.61,.36,1);
}

/* ── Minimal reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;                         /* body never gets a horizontal scrollbar */
  overflow-wrap: break-word;                  /* long words wrap instead of overflowing (else clipped by overflow-x) */
}
img, picture, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Typography scale ──────────────────────────────────────────────────────── */
h1 { font-size: var(--t-h1); line-height: 1.05; font-weight: 700; font-family: var(--font-display); }
h2 { font-size: var(--t-h2); line-height: 1.12; font-weight: 700; font-family: var(--font-display); }
h3 { font-size: var(--t-h3); line-height: 1.2;  font-weight: 700; font-family: var(--font-display); }
p  { max-width: var(--measure); }
/* Unbreakable tokens (URLs, emails, long single words) break instead of running off narrow screens. */
a, h1, h2, h3, h4, h5, h6, td, li { overflow-wrap: anywhere; }
.eyebrow { font-size: var(--t-cta); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 700; }

/* ── Layout helpers ────────────────────────────────────────────────────────── */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }
.section { padding-block: var(--section-y); }
.section--surface { background: var(--surface); }
.measure { max-width: var(--measure); }
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; margin-inline: auto; }

/* Auto-fit grid that never overflows: cells wrap when they can't hold min width. */
.grid { display: grid; gap: clamp(16px, 3vw, 32px); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }

/* Wide content (tables/code/diagrams) scrolls inside its own box, never the page. */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5em; padding: .9em 1.6em; border: 1px solid transparent; border-radius: var(--radius);
  font-size: var(--t-cta); letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-fill    { background: var(--brand); color: var(--white); }
.btn-fill:hover  { background: var(--brand-dark); }
.btn-outline { background: transparent; color: var(--brand); border-color: currentColor; }
.btn-outline:hover { background: var(--brand); color: var(--white); }

/* Submit in flight (main.js adds .is-loading + swaps the label to "Sending…"):
   a ring spins beside the label via ::after — .btn's inline-flex gap spaces it.
   Under the global reduced-motion animation kill the ring freezes to a static
   arc; the swapped label still signals progress on its own. */
.btn.is-loading { pointer-events: none; opacity: .9; }
.btn.is-loading::after {
  content: ""; width: 1em; height: 1em; flex: none; box-sizing: border-box;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ── Hero (100svh so mobile chrome doesn't clip it) ───────────────────────────── */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;   /* vh fallback for Safari < 15.4 */
  display: grid; place-items: center; text-align: center;
  color: var(--white); overflow: hidden;
}
.hero__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: -2; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.55)); z-index: -1; }
.hero__inner { padding: var(--pad); display: grid; gap: 1.2rem; justify-items: center; }
.hero h1 { font-size: var(--t-header); }

/* ── Navigation ────────────────────────────────────────────────────────────── */
.nav { position: fixed; inset: 0 0 auto; z-index: 40; transition: transform .3s var(--ease), background .3s var(--ease); }
.nav__bar { display: flex; align-items: center; gap: 1rem; min-height: var(--nav-h); }
.nav__logo { font-weight: 800; letter-spacing: .04em; font-size: var(--t-lg); }
.nav__links { display: flex; gap: clamp(12px, 2vw, 28px); margin-left: auto; }
.nav__links a { font-size: var(--t-cta); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.nav__cta { padding-block: .6em; }
/* Homepage bar: transparent over hero, solid once scrolled. Sub-page bar: always solid. */
.nav:not(.nav--static) { background: transparent; color: var(--white); }
.nav.nav--static, .nav.is-scrolled { background: var(--white); color: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.nav.nav--static .nav__cta, .nav.is-scrolled .nav__cta { background: var(--brand); color: var(--white); }

.nav__burger { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 5px; background: none; border: 0; padding: 8px; min-width: 44px; min-height: 44px; }
.nav__burger span { width: 24px; height: 2px; background: currentColor; }

/* Drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; height: 100dvh; width: min(86vw, 340px);
  background: var(--white); color: var(--ink); z-index: 60; padding: clamp(24px, 6vw, 48px);
  transform: translateX(100%); transition: transform .3s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: none; }
.drawer__close { align-self: flex-end; display: grid; place-items: center; min-width: 44px; min-height: 44px; font-size: 32px; line-height: 1; background: none; border: 0; color: inherit; }
.drawer__links { display: flex; flex-direction: column; gap: 1.2rem; margin-top: 2rem; font-size: var(--t-lg); }

@media (max-width: 860px) {
  .nav__links, .nav__cta { display: none; }
  .nav__burger { display: flex; }
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer { background: var(--brand-dark); color: var(--white); padding-block: clamp(40px, 6vw, 72px); }
.footer__inner { display: grid; gap: 1.4rem; justify-items: center; text-align: center; }
.footer__legal { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; font-size: var(--t-cta); letter-spacing: .06em; text-transform: uppercase; }
.footer__social { display: flex; gap: 1rem; list-style: none; padding: 0; }
.footer__social a { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; transition: background .2s; }
.footer__social a:hover { background: rgba(255,255,255,.12); }
.footer__copy { font-size: 13px; opacity: .8; line-height: 1.8; max-width: none; }
.footer__copy a { text-decoration: underline; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 1rem; max-width: 560px; }
.form__row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.form label { display: grid; gap: .4rem; font-size: 14px; }
.form input, .form select, .form textarea {
  font: inherit; font-size: 16px; padding: .8em 1em; border: 1px solid #cfcfcf; border-radius: var(--radius); background: var(--white); width: 100%;  /* font-size >=16px so iOS Safari doesn't zoom on focus */
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); outline: none; }
.form label.form__consent { display: flex; gap: .6rem; align-items: flex-start; font-size: 13px; } /* label.-qualified so .form label's display:grid can't stack the checkbox above the text */
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }  /* honeypot */
.form__msg { font-size: 14px; }
.form__msg.is-error { color: #b0261a; }

/* Body offset so fixed nav never covers content on sub-pages. */
.has-static-nav { padding-top: var(--nav-h); }

/* ── Legal pages (privacy / terms) — long-form readable typography ─────────────── */
.legal { max-width: var(--measure); }
.legal h1 { font-size: var(--t-h2); }
.legal h2 { font-size: var(--t-h3); margin-top: 2.2rem; }
.legal h3 { font-size: var(--t-lg); margin-top: 1.6rem; }
.legal p, .legal ul, .legal ol { margin-top: 1rem; }
.legal ul, .legal ol { padding-left: 1.4rem; }
.legal li { margin-top: .4rem; }
.legal a { color: var(--brand); text-decoration: underline; }

/* ── Image-layout repertoire — frames, captions, galleries (immersive, not stiff) ── */
.media-frame { position: relative; overflow: hidden; border-radius: var(--radius); }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-cap { position: absolute; inset: auto 0 0 0; padding: 1rem 1.2rem; color: var(--white);
  background: linear-gradient(0deg, rgba(0,0,0,.6), transparent); font-weight: 600; pointer-events: none; }
.gallery { display: grid; gap: clamp(12px, 2vw, 24px); grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.gallery-frame { position: relative; overflow: hidden; border-radius: var(--radius); aspect-ratio: 4 / 3; }
.gallery-frame img { width: 100%; height: 100%; object-fit: cover; }

/* =============================================================================
   Vella one-pager — splash layout, on-load motion, pattern decals
   ============================================================================= */

/* Top bar: no nav, just the centred logo. On the homepage it floats over the splash
   image (transparent); on sub-pages it stays a normal white bar in the flow. */
.topbar { display: grid; place-items: center; padding: clamp(16px, 2.6vw, 26px) var(--pad); background: var(--white); position: relative; z-index: 2; }
.topbar__logo { width: clamp(135px, 15.3vw, 194px); height: auto; }
/* Homepage: float the bar over the IMAGE pane only (1.15fr of 2.15fr = 53.49%),
   white logo with a soft shadow so it reads on sky. */
[data-route="home"] .topbar, [data-route^="landing-page"] .topbar { position: absolute; inset: 0 auto auto 0; width: 53.49%; background: transparent; z-index: 5;
  padding-top: calc(clamp(16px, 2.6vw, 26px) + 50px); }   /* logo sits ~50px below the top edge */
[data-route="home"] .topbar__logo, [data-route^="landing-page"] .topbar__logo { filter: drop-shadow(0 2px 10px rgba(0,0,0,.35)); }

/* Splash: image left / registration right. The page IS the splash — exactly one
   viewport tall on desktop, nothing below the fold. Stacks on small screens. */
.splash { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  /* One viewport when everything fits; grows (page scrolls) when the screen is too
     short, so the copy is never clipped and keeps its gap below. */
  min-height: max(600px, calc(100svh - var(--legal-h))); }
.splash__media { position: relative; overflow: hidden; min-height: 62svh; display: grid; }
.splash__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.splash__media::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(27,46,50,.22), rgba(27,46,50,0) 58%); }
/* Copy block top-anchored a CONSTANT 40px below the logo on every screen height.
   In-flow (not absolute) so a too-short screen grows the pane and scrolls instead
   of clipping the box; bottom padding keeps a clean gap below it. Top padding =
   logo offset (50px) + bar padding + logo height + 40px gap. */
.splash__copy { position: relative; z-index: 1;
  display: grid; align-content: start; justify-items: start;
  padding: calc(90px + clamp(72px, 8.17vw, 104px) + 2 * clamp(16px, 2.6vw, 26px))
           clamp(24px, 4vw, 56px)
           clamp(48px, 6vh, 72px)
           clamp(32px, 5vw, 80px); }
/* Glassy panel: low-opacity white + heavy blur so the render shows through, with a
   light top edge for the glass highlight. Text stays readable thanks to the blur. */
.splash__box { background: rgba(255,255,255,.32); -webkit-backdrop-filter: blur(16px) saturate(1.25); backdrop-filter: blur(16px) saturate(1.25);
  color: var(--ink); border: 1px solid rgba(255,255,255,.65); border-bottom-color: rgba(255,255,255,.35);
  box-shadow: 0 18px 50px rgba(27,46,50,.22);
  padding: clamp(22px, 2.8vw, 40px); max-width: 60ch; display: grid; gap: .95rem; }
@supports not (backdrop-filter: blur(1px)) {
  .splash__box { background: rgba(255,255,255,.88); }  /* no blur → keep it solid enough to read */
}
.splash__box h1 { font-size: clamp(28px, 3.2vw, 44px); color: var(--brand); }
.splash__intro { font-size: 14px; line-height: 1.55; font-weight: 500; }
.splash__lines { list-style: none; padding: 0; display: grid; gap: .2rem; }
.splash__lines li { font-size: clamp(13px, 1.05vw, 15px); letter-spacing: .05em; text-transform: uppercase; font-weight: 600;
  color: var(--brand); display: flex; align-items: center; gap: .7em; }
.splash__lines li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: none; }

/* Registration panel — Forest, form directly on it (no white card), compact enough
   to sit above the fold. */
.splash__panel { position: relative; overflow: hidden; background: var(--accent); color: var(--surface);
  display: grid; align-content: center; padding: clamp(24px, 3vw, 48px) clamp(20px, 3.5vw, 56px); }
.form-card { position: relative; z-index: 1; display: grid; gap: 1rem; }
.form-card h2 { font-size: clamp(24px, 2.2vw, 32px); color: var(--white); }
.form-card .eyebrow { color: var(--surface); }
.form-card .form { max-width: none; gap: 1.15rem; }
.form-card .form input, .form-card .form select { border: 0; }
.form-card .form input::placeholder { color: var(--muted); }
/* Selects: custom chevron, kept off the right edge. */
.form-card .form select { appearance: none; -webkit-appearance: none; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 6l4.5 4.5L12.5 6' stroke='%231b2e32' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px; }
/* Consent: checkbox flush left with the fields, text inline beside it. */
.form-card label.form__consent { align-items: center; gap: 13px; font-size: 11px; padding: 4px 0 7px; }
.form-card .form__consent input { width: 16px; height: 16px; flex: none; margin: 0; padding: 0; accent-color: var(--brand); }
.form-card .form__consent a { text-decoration: underline; }
.form-card .form__msg.is-error { color: #ffd9d2; }

/* Fake-success swap: the form card fades out, the thank-you message fades in.
   (Instant under prefers-reduced-motion via the global transition kill.) */
.form-card { transition: opacity .35s var(--ease), transform .35s var(--ease); }
.form-card.is-fading { opacity: 0; transform: translateY(14px); pointer-events: none; }
.form-card__thanks { position: relative; z-index: 1; display: grid; gap: .6rem; text-align: center;
  opacity: 0; transform: translateY(14px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.form-card__thanks.in { opacity: 1; transform: none; }
.form-card__thanks h2 { font-size: clamp(24px, 2.2vw, 32px); color: var(--white); }
.form-card__thanks p { max-width: none; }
/* display:grid on these blocks would beat the UA's [hidden] rule — enforce it. */
[hidden] { display: none !important; }

/* Visually-hidden labels (placeholder-driven fields keep accessible names). */
.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; }

/* Sailboat pattern decal — subtle, never loud. */
.pattern-decal { position: absolute; pointer-events: none; user-select: none; height: auto; }
.pattern-decal--panel { top: clamp(10px, 2vw, 28px); right: clamp(10px, 2vw, 28px); width: clamp(70px, 7vw, 110px); opacity: .12; }

/* Bottom legal strip — Midnight Surf, centred, sized so splash + strip = one viewport. */
.legal-strip { min-height: var(--legal-h); display: grid; place-items: center; text-align: center;
  background: var(--brand); color: var(--white); padding: 6px var(--pad); }
.legal-strip p { font-size: 11px; letter-spacing: .04em; max-width: none; }
.legal-strip a:hover { color: var(--sail); }

/* Legal popup (Terms / Privacy) — centred card, rounded, glossy blurred backdrop. */
.legal-dialog { position: fixed; inset: 0; margin: auto; border: 0; padding: 0;
  width: min(760px, calc(100vw - 32px)); max-height: min(82svh, 780px);
  display: grid; grid-template-rows: auto 1fr; background: var(--white);
  border-radius: 15px; overflow: hidden; box-shadow: 0 30px 80px rgba(20,34,38,.45); }
.legal-dialog:not([open]) { display: none; }
.legal-dialog::backdrop { background: rgba(27,46,50,.45); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
.legal-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--brand); color: var(--white); padding: 1rem 1.6rem; }
.legal-dialog__title { font-size: clamp(20px, 2vw, 26px); color: var(--white); }
.legal-dialog__close { background: none; border: 0; color: var(--white); font-size: 30px; line-height: 1;
  min-width: 44px; min-height: 44px; display: grid; place-items: center; opacity: .85; }
.legal-dialog__close:hover { opacity: 1; }
.legal-dialog__body { overflow: auto; padding: 1.4rem 1.6rem 2rem; -webkit-overflow-scrolling: touch;
  font-size: 15px; }
.legal-dialog__body.legal { max-width: none; }
.legal-dialog__body a { text-decoration: none; font-weight: 600; }  /* colour + weight carry the link, no underline */

/* On-load entrance sequence — gated behind .reveal-ready so JS-less visitors see
   everything at rest; the global reduced-motion rule collapses the animations. */
@keyframes rise-in { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.reveal-ready .load-rise { opacity: 0; animation: rise-in .8s var(--ease) forwards; }
.reveal-ready .load-rise.l2 { animation-delay: .18s; }
.reveal-ready .load-rise.l3 { animation-delay: .36s; }
.reveal-ready .load-rise.l4 { animation-delay: .54s; }
.reveal-ready .load-rise.l5 { animation-delay: .72s; }
/* Ken Burns settle: the splash image eases from a gentle zoom to rest on load. */
@keyframes kb-settle { from { transform: scale(1.07); } to { transform: none; } }
.reveal-ready .splash__img { animation: kb-settle 6.5s cubic-bezier(.16,.62,.36,1) both; }

@media (max-width: 900px) {
  .splash { grid-template-columns: 1fr; height: auto; min-height: 0; }
  /* Image pane is full width on mobile — so is the floating logo bar. */
  [data-route="home"] .topbar, [data-route^="landing-page"] .topbar { width: 100%; }

  /* The whole image banner becomes the glass: full-bleed blur panel, no border.
     Copy flows in-page so the pane grows with it; the pane height = the glass. */
  .splash__media { min-height: 0; display: grid; }
  .splash__copy { position: static; padding: 0; }
  .splash__box { width: 100%; max-width: none; border: 0; box-shadow: none;
    /* top clears the floating logo (~106px) + 50px gap; sides keep the desktop rhythm; 50px after the last line */
    padding: 160px clamp(32px, 5vw, 80px) 50px; }

  /* Centre the form panel's heading + intro line. */
  .form-card__intro { text-align: center; }

  /* Legal strip gets room to breathe on mobile. */
  .legal-strip { padding-top: 12px; padding-bottom: 12px; }
}

/* ── Reduced motion: every animation must have a no-motion path (spec §1.5). ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
