/* ============================================================
   Rafidain Labs
   Quiet, editorial, corporate. Warm paper, navy ink, blue-grey
   secondary text, sand tones; photography carries the colour.
   All tokens live in :root.
   ============================================================ */

:root {
  /* Colour */
  --paper:        #f8f6f2;   /* warm off-white page */
  --paper-raised: #fcfbf9;   /* secondary button fill */
  --sand-50:      #efe9e0;   /* partnership band */
  --sand-200:     #ddd0bc;   /* fallback artwork fills */
  --sand-400:     #b59d7c;   /* fallback artwork strokes */
  --ink:          #192635;   /* logo dark — type + primary buttons */
  --ink-hover:    #283a4f;
  --ink-2:        #4f5a6b;   /* secondary text (blue-grey) */
  --ink-3:        #919ca9;   /* logo light — captions, legal lines */
  --rule:         #e4dfd6;   /* hairline dividers */
  --rule-strong:  #cfc8bc;   /* button outlines, separators */

  /* Product panel backgrounds (phone screenshots sit on top) */
  --panel-qarin:  #141d30;
  --panel-aku:    #2b221a;
  --panel-future: #1f2835;

  /* Type */
  --sans: "Figtree", "Helvetica Neue", Arial, system-ui, sans-serif;

  --text-xs:   0.75rem;                              /* legal, chips   */
  --text-sm:   0.875rem;                             /* nav, captions  */
  --text-base: 1rem;
  --text-md:   clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-h3:   clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
  --text-h2:   clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem);
  --text-h2-lg:clamp(2rem, 1.55rem + 1.9vw, 2.875rem);
  --text-h1:   clamp(2.5rem, 1.7rem + 3.4vw, 4.25rem);

  /* Layout */
  --content: 70rem;
  --gutter: clamp(1.25rem, 4.5vw, 4.5rem);
  --section-y: clamp(4rem, 3rem + 4vw, 6.5rem);
  --header-h: 4.75rem;
  --radius: 6px;
  --radius-sm: 4px;

  /* Logo — adjust if the final asset needs a different height */
  --logo-h: 2.75rem;
  --logo-h-sm: 2.375rem;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 180ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
ul, ol { padding: 0; list-style: none; }

/* Desktop scale: everything is sized in rem, so the root size scales the whole
   design — up to 133%, the look of the site at 133% browser zoom.
   Width:  100% at ≤1024px wide, easing to 133% at 1440px.
   Height: 100% at ≤680px tall, easing to 133% at 900px — so short laptop
           screens (1366×768, 1280×720) keep the hero within the first screen.
   The smaller of the two wins. Relative to the visitor's own default text
   size, so their browser setting is still respected. */
html {
  font-size: clamp(100%,
    min(calc(100% + (100vw - 64rem) * 0.0128),
        calc(100% + (100vh - 42.5rem) * 0.0242)),
    133.333%);
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}
/* Sections focused by script.js after a nav click shouldn't draw a giant outline. */
[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: 100%;
  max-width: calc(var(--content) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ============================================================
   Shared components
   ============================================================ */

/* Eyebrow — small uppercase section label */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Section heading */
.section-head { margin-bottom: clamp(1.75rem, 1.4rem + 1.2vw, 2.5rem); }
.section-head-split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}
.section-title {
  font-size: var(--text-h2);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin-top: 0.6rem;
  text-wrap: balance;
}
.section-title-lg { font-size: var(--text-h2-lg); }

/* Buttons */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  transition: background-color var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              color var(--fast) var(--ease);
}
.button-primary { background: var(--ink); color: var(--paper); }
.button-primary:hover { background: var(--ink-hover); }
.button-secondary {
  background: var(--paper-raised);
  border-color: var(--rule-strong);
  color: var(--ink);
}
.button-secondary:hover { border-color: var(--ink); }

/* Text link with arrow */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
/* Underline the words only — the arrow just slides. */
.text-link:hover .text-link-label { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.arrow {
  display: inline-block;
  transition: transform var(--fast) var(--ease);
}
.button:hover .arrow,
.text-link:hover .arrow { transform: translateX(3px); }

/* Company / legal line — "A | B | C", wraps without orphaned separators */
.company-line {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.3rem;
  row-gap: 0.25rem;
  overflow: hidden;           /* clips the separator on each line's first item */
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.company-line span { position: relative; white-space: nowrap; }
.company-line span::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 0.2em;
  bottom: 0.2em;
  width: 1px;
  background: var(--rule-strong);
}

/* Image feathering: the photo fades in from transparent over --fade of its
   length, on the side facing the text. Eased stops avoid a visible band.
   Defined on the elements (not :root) so each can set its own --fade. */
.hero-media,
.partner-media {
  --fade-dir: to right;
  --fade-steps: transparent 0%,
    rgb(0 0 0 / 0.02) calc(var(--fade) * 0.18),
    rgb(0 0 0 / 0.06) calc(var(--fade) * 0.26),
    rgb(0 0 0 / 0.13) calc(var(--fade) * 0.34),
    rgb(0 0 0 / 0.22) calc(var(--fade) * 0.42),
    rgb(0 0 0 / 0.33) calc(var(--fade) * 0.5),
    rgb(0 0 0 / 0.45) calc(var(--fade) * 0.58),
    rgb(0 0 0 / 0.58) calc(var(--fade) * 0.66),
    rgb(0 0 0 / 0.71) calc(var(--fade) * 0.74),
    rgb(0 0 0 / 0.83) calc(var(--fade) * 0.82),
    rgb(0 0 0 / 0.92) calc(var(--fade) * 0.9),
    rgb(0 0 0 / 0.98) calc(var(--fade) * 0.96),
    #000 var(--fade);
  -webkit-mask-image: linear-gradient(var(--fade-dir), var(--fade-steps));
          mask-image: linear-gradient(var(--fade-dir), var(--fade-steps));
}

/* Media slot: fallback artwork sits underneath; the <img>, once the
   file exists, covers it. script.js removes images that fail to load. */
.media {
  position: relative;
  overflow: hidden;
  background: var(--sand-50);
}
.media > img:not(.product-shot) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-fallback {
  position: absolute;
  inset: 0;
}

/* Logo — two files, shown side by side:
   mark:     assets/rafidainlogomark.svg (1254×1254 canvas; crop trims its padding)
   wordmark: RAFIDAIN / LABS cropped from assets/rafidainlogo.svg (830×749)
   Replacing either file (same name) updates the site. --x/--y/--w/--h are the
   crop regions in each file's own units (viewBox --src-w × --src-h); re-measure
   only if a file's layout or canvas size changes. */
.logo {
  --lh: var(--logo-h);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: var(--lh);
}
.logo-sm { --lh: var(--logo-h-sm); }

.logo-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  height: 100%;
}
.logo-part {
  --src-w: 830;
  --src-h: 749;
  position: relative;
  display: block;
  flex: none;
  overflow: hidden;
  height: var(--part-h);
  width: calc(var(--part-h) * var(--w) / var(--h));
}
.logo-part img {
  position: absolute;
  max-width: none;
  width: calc(var(--part-h) * var(--src-w) / var(--h));
  height: calc(var(--part-h) * var(--src-h) / var(--h));
  left: calc(var(--part-h) * var(--x) / var(--h) * -1);
  top: calc(var(--part-h) * var(--y) / var(--h) * -1);
}
.logo-part-mark { --src-w: 1254; --src-h: 1254; --x: 0; --y: 60; --w: 1254; --h: 1134; --part-h: var(--lh); }
.logo-part-word { --x: 8;   --y: 530; --w: 814; --h: 200; --part-h: calc(var(--lh) * 0.62); }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color 300ms var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }
/* Own compositor layer so the sticky header is moved, not repainted, while
   scrolling. Desktop only: a transform-layer would become the containing
   block for the fixed-position mobile menu inside the header. */
@media (min-width: 821px) {
  .site-header { will-change: transform; }
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: var(--header-h);
}

.primary-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 2.6vw, 2.5rem);
}
.primary-nav a {
  position: relative;
  display: inline-block;
  padding-block: 0.5rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 240ms var(--ease);
}
.primary-nav a:hover::after,
.primary-nav a[aria-current]::after { transform: scaleX(1); }

.menu-toggle { display: none; }

/* ============================================================
   Hero
   Copy sits in the content column; the image runs to the
   right edge of the viewport.
   ============================================================ */
.hero {
  --hero-gap: clamp(2rem, 4vw, 4rem);
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [copy-start] minmax(0, calc(var(--content) * 0.42))
    [copy-end] var(--hero-gap)
    [media-start] minmax(0, calc(var(--content) * 0.58 - var(--hero-gap)))
    minmax(var(--gutter), 1fr) [full-end];
  align-items: center;
  padding-top: clamp(1rem, 2vw, 1.5rem);
}

.hero-copy {
  grid-column: copy;
  padding-block: clamp(2.5rem, 4vw, 3.5rem);
}
.hero-title {
  margin-top: 1.25rem;
  font-size: var(--text-h1);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.022em;
}
.hero-lead {
  margin-top: 1.5rem;
  max-width: 44ch;
  font-size: var(--text-md);
  line-height: 1.65;
  color: var(--ink-2);
}
.hero-copy .button-row { margin-top: 2.25rem; }

.hero-company {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  position: relative;
}
.hero-company::after {        /* short hairline above the company line */
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 1.75rem;
  height: 1px;
  background: var(--rule-strong);
}

.hero-media {
  --fade: 55%;               /* how far the text-side edge feathers into the page */
  grid-column: media-start / full-end;
  align-self: center;
  height: clamp(28.75rem, 42vw, 37.5rem);
}

/* Hero fallback: the Tigris and Euphrates converging at Al-Qurnah */
.hero-fallback { background: var(--sand-50); }
.hero-fallback svg { width: 100%; height: 100%; }
.hero-fallback .river {
  fill: none;
  stroke: var(--sand-400);
  stroke-width: 1.25;
  stroke-linecap: round;
}
.hero-fallback .river-joined { stroke: var(--ink); stroke-opacity: 0.55; }
.hero-fallback .confluence { fill: var(--ink); }
.hero-fallback-caption {
  position: absolute;
  left: clamp(1.25rem, 2.5vw, 2rem);
  bottom: clamp(1.25rem, 2.5vw, 1.75rem);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

/* ============================================================
   Sections
   ============================================================ */
.section { padding-block: var(--section-y); }

/* ---------- Products ---------- */
.products { padding-bottom: calc(var(--section-y) * 0.85); }

.product-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.product {
  display: flex;
  flex-direction: column;
}
.product-media {
  aspect-ratio: 2 / 1;
  border-radius: var(--radius);
}
.product-name {
  margin-top: 1.25rem;
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: 1.3;
}
.product-desc {
  margin-top: 0.5rem;
  max-width: 40ch;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.6;
}
.product .text-link {
  margin-top: auto;
  padding-top: 0.75rem;
  align-self: flex-start;
}

.product-media-qarin  { background: var(--panel-qarin); }
.product-media-aku    { background: var(--panel-aku); }
.product-media-future { background: var(--panel-future); }

.product-fallback {
  display: flex;
  align-items: center;
  padding-inline: clamp(1.25rem, 2.5vw, 2rem);
  color: #fff;
}
.product-fallback::after {    /* single hairline curve — nods to the river motif */
  content: "";
  position: absolute;
  inset: 0;
  background: no-repeat right -10% bottom -30% / 75% auto
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 150'%3E%3Cpath d='M0 150 C 90 140, 150 90, 190 60 S 260 10, 300 0' fill='none' stroke='white' stroke-opacity='.16' stroke-width='1'/%3E%3C/svg%3E");
}
.product-fallback-name {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.product-media-aku .product-fallback-name {
  color: #ecdcc4;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.product-fallback-quiet {
  font-size: 1.0625rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.78);
}

/* Product screenshot: top of the phone, bleeding off the bottom edge */
.product-shot {
  position: absolute;
  right: 6%;
  bottom: -4%;
  height: var(--shot-h, 90%);
  width: auto;
  max-width: none;
}
.product-media-aku { --shot-h: 80%; }

/* Status chip */
.status {
  position: absolute;
  top: 0.875rem;
  left: 0.875rem;
  z-index: 1;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.3;
}
.status-live     { background: rgba(255, 255, 255, 0.16); color: #fff; }
.status-dev      { background: #eadfcd; color: var(--ink); }
.status-research { background: #dde1e7; color: var(--ink); }

/* ---------- What we do ---------- */
.about { padding-top: 0; }
.about .wrap > .about-head {
  padding-top: calc(var(--section-y) * 0.85);
  border-top: 1px solid var(--rule);
}

.about-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.about-statement {
  padding-top: 1.6rem;
  max-width: 46ch;
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: 1.65;
}

.capability-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem clamp(2rem, 5vw, 4.5rem);
  margin-top: clamp(2.5rem, 2rem + 2vw, 3.75rem);
}
.capability-icon {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.capability-title {
  margin-top: 1rem;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.35;
}
.capability-desc {
  margin-top: 0.4rem;
  max-width: 36ch;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ============================================================
   Partnership CTA
   Full-bleed sand band; the photograph fills the right side and
   feathers into the band on its left edge.
   ============================================================ */
.partner {
  display: grid;
  background: var(--sand-50);
  overflow: hidden;
}
.partner > * { grid-area: 1 / 1; }

.partner-media {
  justify-self: end;
  width: min(58%, 56.25rem);
  background: transparent;
  --fade: 75%;
}
.partner-media > img { object-position: right center; }   /* keep the arches in frame */
.partner-fallback svg { width: 100%; height: 100%; }
.partner-fallback path {
  fill: none;
  stroke: var(--sand-400);
  stroke-width: 1.25;
}
.partner-fallback .ground { stroke: var(--rule-strong); }

.partner-inner {
  position: relative;
  padding-block: clamp(3.5rem, 3rem + 3vw, 5.5rem);
}
.partner-copy { max-width: 32rem; }
.partner-lead {
  margin-top: 1rem;
  max-width: 44ch;
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: 1.65;
}
.partner-copy .button { margin-top: 2rem; }

/* ============================================================
   Contact
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2.5rem clamp(2.5rem, 7vw, 7rem);
  align-items: start;
}
.contact-lead {
  margin-top: 1rem;
  max-width: 36ch;
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: 1.65;
}
.contact-email { margin-top: 1.5rem; }
.contact-email a {
  font-size: var(--text-md);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 5px;
  transition: text-decoration-color var(--fast) var(--ease);
}
.contact-email a:hover { text-decoration-color: var(--ink); }

/* Form */
.contact-form {
  display: grid;
  gap: 1.25rem;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.field { display: grid; gap: 0.4rem; align-content: start; }
.field label {
  font-size: var(--text-sm);
  font-weight: 500;
}
.field-optional { font-weight: 400; color: var(--ink-3); }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.875rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;              /* ≥16px prevents iOS zoom on focus */
  line-height: 1.5;
  transition: border-color var(--fast) var(--ease);
}
.field textarea { resize: vertical; min-height: 9rem; }
.field select {
  appearance: none;
  padding-right: 2.5rem;
  background: var(--paper-raised) no-repeat right 0.875rem center / 12px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23192635' stroke-width='1.5'/%3E%3C/svg%3E");
  cursor: pointer;
}
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--ink-3); }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  border-color: var(--ink);
  outline: 2px solid var(--ink);
  outline-offset: 0;
}
.field [aria-invalid="true"] { border-color: #a3362b; }
.field-error {
  font-size: var(--text-sm);
  color: #a3362b;               /* the one non-palette colour: errors only */
}

.field-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-top: 0.25rem;
}
.form-note {
  max-width: 34ch;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.contact-form button { cursor: pointer; }
.contact-form button[disabled] { opacity: 0.6; cursor: progress; }

/* Send failure — inline, quiet, clears when the visitor edits or retries */
.form-error {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: #a3362b;
}
.form-error[hidden] { display: none; }
.form-error svg {
  flex: none;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.form-error a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.contact-form button[aria-busy="true"] { opacity: 0.75; cursor: progress; }

/* Toast — drops in top-right under the header (full width on phones), away
   from the Send button, and dismisses itself */
.toast {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  top: calc(var(--header-h) + 1rem);
  z-index: 60;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 0.75rem 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 30px rgb(25 38 53 / 0.18), 0 2px 6px rgb(25 38 53 / 0.12);
  opacity: 0;
  transform: translateY(-0.75rem);
  transition: opacity 220ms var(--ease), transform 320ms var(--ease);
}
.toast.is-visible { pointer-events: auto; }
.toast.is-visible .toast-inner { opacity: 1; transform: none; }
.toast-icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
  fill: none;
  stroke: #b9d3c3;             /* soft green tick, readable on navy */
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 0.9375rem; font-weight: 500; line-height: 1.4; }
.toast-text {
  margin-top: 0.15rem;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: rgb(248 246 242 / 0.72);
  overflow-wrap: anywhere;
}
.toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin: -0.35rem 0 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgb(248 246 242 / 0.6);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.toast-close:hover { color: var(--paper); background: rgb(248 246 242 / 0.08); }
.toast-close:focus-visible { outline-color: var(--paper); }
.toast-close svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
@media (max-width: 600px) {
  .toast { left: 1rem; right: 1rem; width: auto; top: calc(var(--header-h) + 0.75rem); }
}

/* ============================================================
   Legal page
   ============================================================ */
.legal { padding-block: clamp(3rem, 2.5rem + 3vw, 5rem) var(--section-y); }
.legal-wrap { max-width: calc(46rem + 2 * var(--gutter)); }
.legal-updated {
  margin-top: 0.75rem;
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.legal-section {
  margin-top: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  padding-top: clamp(2rem, 1.75rem + 1vw, 2.5rem);
  border-top: 1px solid var(--rule);
}
.legal-section h2 {
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: 1.3;
}
.legal-section h3 {
  margin-top: 2rem;
  font-size: 1rem;
  font-weight: 600;
}
.legal-section p,
.legal-section li {
  color: var(--ink-2);
  line-height: 1.7;
}
.legal-section p { margin-top: 0.75rem; }
.legal-section ul {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding-left: 1.1rem;
  list-style: disc;
}
.legal-section li::marker { color: var(--ink-3); }
.legal-section strong { color: var(--ink); font-weight: 500; }
.legal-section a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}
.legal-section a:hover { text-decoration-color: var(--ink); }

.legal-facts { margin-top: 1.25rem; }
.legal-facts > div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.25rem 1.5rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--rule);
}
.legal-facts dt { font-size: var(--text-sm); color: var(--ink-2); }
.legal-facts dd { margin: 0; }
@media (max-width: 600px) {
  .legal-facts > div { grid-template-columns: 1fr; }
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding-bottom: 2rem;
}
.site-footer > .wrap::before {   /* hairline within the content width */
  content: "";
  display: block;
  height: 1px;
  margin-bottom: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  background: var(--rule);
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding-bottom: 2rem;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem clamp(1.25rem, 2.4vw, 2.25rem);
}
.footer-nav a {
  display: inline-block;
  padding-block: 0.5rem;
  font-size: var(--text-sm);
  color: var(--ink);
}
.footer-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: var(--text-xs);
  color: var(--ink-3);
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet: stack hero, products become horizontal rows */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: [full-start] var(--gutter) [copy-start media-start] 1fr [copy-end] var(--gutter) [full-end];
    padding-top: 0;
  }
  .hero-copy { padding-bottom: 2.5rem; }
  .hero-media {
    grid-column: media-start / full-end;
    height: auto;
    aspect-ratio: 16 / 9;
    -webkit-mask-image: none;
            mask-image: none;
    border-radius: var(--radius) 0 0 var(--radius);
  }

  .product-list { grid-template-columns: 1fr; gap: 2.5rem; }
  .product {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 1.75rem;
  }
  .product-media { grid-row: 1 / -1; align-self: start; aspect-ratio: 16 / 10; }
  .product-name { margin-top: 0; }
  .product .text-link { margin-top: 0; align-self: end; }

  .partner-media { width: 42%; }

  .about-head { grid-template-columns: 1fr; }
  .about-statement { padding-top: 0; }
  .capability-list { grid-template-columns: 1fr 1fr; }

  .contact-grid { grid-template-columns: 1fr; }
}

/* Mobile navigation */
@media (max-width: 820px) {
  :root { --header-h: 64px; --logo-h: 38px; }

  .js .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    margin-right: -0.5rem;
    padding: 0 0.5rem;
    background: none;
    border: 0;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
  }
  .menu-toggle-icon {
    position: relative;
    width: 18px;
    height: 10px;
  }
  .menu-toggle-icon::before,
  .menu-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    height: 2px;               /* whole pixels only: 1.5px lines round unevenly, */
    background: var(--ink);    /* so one bar looked thinner than the other      */
    transition: transform 220ms var(--ease), top 220ms var(--ease);
  }
  .menu-toggle-icon::before { top: 0; }
  .menu-toggle-icon::after  { top: 8px; }
  .menu-toggle[aria-expanded="true"] .menu-toggle-icon::before { top: 4px; transform: rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-toggle-icon::after  { top: 4px; transform: rotate(-45deg); }

  .js .primary-nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    padding: 0.5rem var(--gutter) 2rem;
    background: var(--paper);
    border-top: 1px solid var(--rule);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transition: opacity 200ms var(--ease), visibility 0s linear 200ms;
  }
  .js .primary-nav.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity 200ms var(--ease), visibility 0s;
  }
  .js .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .js .primary-nav li { border-bottom: 1px solid var(--rule); }
  .js .primary-nav a {
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: 0;
    font-size: 1.375rem;
    font-weight: 400;
  }
  .js .primary-nav a::after { display: none; }
  .js .primary-nav a[aria-current] { font-weight: 500; }

  /* No-JS: links stay visible and wrap */
  html:not(.js) .site-header-inner { flex-wrap: wrap; padding-block: 0.75rem; }
  html:not(.js) .primary-nav ul { flex-wrap: wrap; gap: 0.25rem 1.25rem; }

  html.menu-open { overflow: hidden; }
}

/* Phone */
@media (max-width: 600px) {
  .br-lg { display: none; }
  .hero-copy { padding-top: 2rem; }
  .hero-title { margin-top: 1rem; }
  .hero-company { margin-top: 2rem; }
  .button-row .button { flex: 1 1 auto; }
  .hero-media { aspect-ratio: 3 / 2; }
  .hero-fallback-caption { right: 1.25rem; }

  .section-head-split { align-items: flex-end; }

  .product-list { gap: 2.75rem; }
  .product { display: flex; flex-direction: column; }
  .product-media { aspect-ratio: 16 / 9; align-self: stretch; }
  .product-name { margin-top: 1.125rem; }
  .product .text-link { margin-top: 0.25rem; padding-top: 0.25rem; align-self: flex-start; }

  .capability-list { grid-template-columns: 1fr; gap: 1.75rem; }
  .capability {
    display: grid;
    grid-template-columns: 24px 1fr;
    column-gap: 1rem;
  }
  .capability-icon { grid-row: 1 / 3; margin-top: 0.1rem; }
  .capability-title { margin-top: 0; }

  .partner > * { grid-area: auto; }
  .partner-inner { order: 1; padding-bottom: 2rem; }
  .partner-media {
    order: 2;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    --fade-dir: to bottom;
    --fade: 50%;
  }
  .partner-copy .button { width: 100%; }

  .field-row { grid-template-columns: 1fr; }
  .form-footer { flex-direction: column-reverse; align-items: stretch; }
  .form-footer .button { width: 100%; }

  .footer-top { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
  .footer-nav ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
    width: 100%;
  }
  .footer-nav a { padding-block: 0.625rem; }
  .footer-nav { width: 100%; }
  .footer-bottom { flex-direction: column; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
