/* ==========================================================================
   Alvo — base design system (shared by the site and the portal)

   Carried over from the v1 concept: warm bone canvas, one grotesk at weight
   400, hierarchy from size and opacity (never bold), display type at
   line-height 1.0 with tight tracking. Contrast values are measured, not
   guessed — see the comments on the ink tokens.

   CSP note: the page CSP has no 'unsafe-inline' for styles, so nothing in
   the markup may use a style="" attribute. Everything visual lives here.
   ========================================================================== */

@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/assets/fonts/schibsted-grotesk.woff2') format('woff2');
}

:root {
  /* Canvas — never pure white, never pure black. */
  --bone: #f6f5f3;
  --bone-raised: #fbfaf9;
  --paper: #ffffff;
  --dark: #272625;
  --dark-raised: #302e2d;
  --dark-sunk: #1f1e1d;

  /* Ink. 0.6 alpha is the measured floor for 4.5:1 on both bone and paper,
     so there is no lighter text step; tertiary text separates by case and
     tracking instead (.eyebrow). */
  --ink: #111111;
  --ink-60: rgba(17, 17, 17, 0.6);
  --ink-stroke: rgba(17, 17, 17, 0.34);
  --ink-14: rgba(17, 17, 17, 0.14);
  --ink-08: rgba(17, 17, 17, 0.08);
  --ink-04: rgba(17, 17, 17, 0.04);

  --on-dark: #ffffff;
  --on-dark-60: rgba(255, 255, 255, 0.62);
  --on-dark-14: rgba(255, 255, 255, 0.14);
  --on-dark-08: rgba(255, 255, 255, 0.08);

  /* Accents are evidence: severity, status, outcomes. Not decoration. */
  --flame: #e16540;
  --flame-text: #bf5636;     /* 4.5:1 on white — the only flame allowed for words */
  --butter: #fbc768;
  --sky: #95d1fd;
  --mint: #81e4ba;
  --peri: #9999fe;
  --pink: #ff91be;
  --green-text: #1a7f55;

  --sev-critical: var(--flame);
  --sev-high: var(--butter);
  --sev-medium: var(--sky);
  --sev-low: #d9d6d1;
  --sev-info: var(--ink-08);

  --r-lg: 14px;
  --r-md: 9px;
  --r-sm: 5px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(17, 17, 17, .04), 0 2px 8px rgba(17, 17, 17, .04);
  --shadow-md: 0 1px 2px rgba(17, 17, 17, .04), 0 12px 32px -8px rgba(17, 17, 17, .14);
  --shadow-lg: 0 2px 4px rgba(17, 17, 17, .05), 0 30px 70px -18px rgba(17, 17, 17, .32);

  --measure: 1180px;
  --measure-narrow: 760px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(4.5rem, 10vh, 8rem);

  --t-display-xl: clamp(2.7rem, 6.4vw, 5rem);
  --t-display: clamp(2.1rem, 4.4vw, 3.3rem);
  --t-section: clamp(1.75rem, 3.2vw, 2.55rem);
  --t-sub: clamp(1.18rem, 1.9vw, 1.45rem);
  --t-body-lg: 1.125rem;
  --t-body: 1rem;
  --t-ui: 0.875rem;
  --t-micro: 0.8125rem;

  --sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

/* ---------------------------------------------------------------- reset */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; letter-spacing: -0.03em; line-height: 1.12; }
p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--flame);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: .6rem .9rem;
  border-radius: var(--r-md);
  font-size: var(--t-ui);
}
.skip:focus { top: 1rem; }

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

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

.display-xl { font-size: var(--t-display-xl); line-height: 1.0; letter-spacing: -0.055em; }
.display    { font-size: var(--t-display); line-height: 1.04; letter-spacing: -0.05em; }
.section-title { font-size: var(--t-section); line-height: 1.08; letter-spacing: -0.045em; }
.sub   { font-size: var(--t-sub); line-height: 1.42; letter-spacing: -0.02em; color: var(--ink-60); }
.lede  { font-size: var(--t-body-lg); line-height: 1.6; color: var(--ink-60); }
.ui    { font-size: var(--t-ui); }
.micro { font-size: var(--t-micro); }
.muted { color: var(--ink-60); }
.mono  { font-family: var(--mono); font-size: .8125rem; letter-spacing: -0.01em; }
.eyebrow {
  font-size: var(--t-micro);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-60);
}
.strong { font-weight: 500; }

/* ---------------------------------------------------------------- logo */

.logo { display: inline-flex; align-items: center; gap: .5rem; color: inherit; }
.logo svg { width: 22px; height: 20px; flex: none; }
.logo-word { font-size: 1.125rem; letter-spacing: -0.045em; line-height: 1; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.1rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--t-ui);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; cursor: progress; }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-ghost { color: var(--ink); border-color: var(--ink-14); background: transparent; }
.btn-ghost:hover { border-color: var(--ink-stroke); background: var(--ink-04); }
.btn-flame { background: var(--flame); color: var(--ink); }
.btn-flame:hover { background: #d4562f; }
.btn-lg { padding: .92rem 1.4rem; font-size: var(--t-body); }
.btn-sm { padding: .5rem .75rem; font-size: var(--t-micro); }
.btn-block { width: 100%; }

.on-dark .btn-primary { background: var(--paper); color: var(--ink); }
.on-dark .btn-primary:hover { background: var(--bone); }
.on-dark .btn-ghost { color: var(--on-dark); border-color: var(--on-dark-14); }
.on-dark .btn-ghost:hover { border-color: var(--on-dark-60); background: var(--on-dark-08); }

.link {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-stroke);
  transition: text-decoration-color .18s ease;
}
.link:hover { text-decoration-color: var(--ink); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--t-ui);
  color: var(--ink-60);
  transition: color .18s ease, gap .18s ease;
}
.link-arrow:hover { color: var(--ink); gap: .6rem; }

/* ---------------------------------------------------------------- severity */

.sev {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .18rem .5rem;
  border-radius: var(--r-sm);
  font-size: var(--t-micro);
  line-height: 1.4;
  color: var(--ink);
  white-space: nowrap;
}
/* Ink on flame is 5.5:1; white on flame is only 3.4:1, so ink it is. */
.sev-critical { background: var(--sev-critical); }
.sev-high     { background: var(--sev-high); }
.sev-medium   { background: var(--sev-medium); }
.sev-low      { background: var(--sev-low); }
.sev-info     { background: var(--sev-info); color: var(--ink-60); }
.sev-zero     { background: transparent; color: var(--ink-60); box-shadow: inset 0 0 0 1px var(--ink-08); }

/* ---------------------------------------------------------------- forms */

/* align-content:start stops a field from stretching when its grid neighbour
   grows (e.g. shows an error message). */
.field { display: grid; gap: .4rem; min-width: 0; align-content: start; }
.field-label { font-size: var(--t-ui); letter-spacing: -0.01em; }
.field-optional { color: var(--ink-60); font-size: var(--t-micro); margin-left: .35rem; }
.field-hint { font-size: var(--t-micro); color: var(--ink-60); }
.field-error { font-size: var(--t-micro); color: var(--flame-text); min-height: 0; }
.field-error:empty { display: none; }

.input,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  padding: .72rem .85rem;
  background: var(--paper);
  border: 1px solid var(--ink-14);
  border-radius: var(--r-md);
  font-size: var(--t-body);
  line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-60) 50%), linear-gradient(135deg, var(--ink-60) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}
.field textarea { resize: vertical; min-height: 7.5rem; }

/* Currency input: a "$" sitting inside the field's left edge. */
.money-input { position: relative; display: block; }
.money-prefix {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-60);
  pointer-events: none;
}
/* [name] matches the specificity of the general .field input rule above,
   and coming later, wins. */
.field .money-input input[name] { padding-left: 1.75rem; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-stroke); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, .08);
}
.field [aria-invalid="true"] { border-color: var(--flame); }
.field [aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(225, 101, 64, .2); }

fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { padding: 0; margin-bottom: .45rem; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 560px) { .choice-grid { grid-template-columns: 1fr; } }

.choice {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .8rem;
  border: 1px solid var(--ink-14);
  border-radius: var(--r-md);
  background: var(--paper);
  font-size: var(--t-ui);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--ink-stroke); }
.choice:has(input:checked) { border-color: var(--ink); background: var(--bone-raised); }
.choice input { accent-color: var(--ink); width: 1rem; height: 1rem; flex: none; margin: 0; }

.consent { display: flex; gap: .6rem; align-items: flex-start; font-size: var(--t-ui); color: var(--ink-60); }
.consent input { accent-color: var(--ink); width: 1rem; height: 1rem; margin: .2rem 0 0; flex: none; }

/* Honeypot: off-screen, out of the tab order, hidden from assistive tech. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-stack { display: grid; gap: 1.15rem; }

.form-status {
  font-size: var(--t-ui);
  padding: .75rem .9rem;
  border-radius: var(--r-md);
  background: rgba(225, 101, 64, .1);
  color: #a3492e;
}
.form-status:empty { display: none; }
.form-status.is-info { background: var(--ink-04); color: var(--ink-60); }

.form-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.form-success {
  display: grid;
  gap: .75rem;
  justify-items: start;
  padding: 1.5rem;
  border-radius: var(--r-lg);
  background: rgba(129, 228, 186, .25);
}
.form-success-mark {
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--mint);
  font-size: 1.1rem;
}

/* ---------------------------------------------------------------- dialog */

.dialog {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--ink-08);
  border-radius: var(--r-lg);
  background: var(--bone-raised);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}
.dialog::backdrop { background: rgba(31, 30, 29, .48); backdrop-filter: blur(3px); }
.dialog[open] { animation: dialog-in .22s cubic-bezier(.2, .7, .3, 1); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 1.5rem 1rem;
  background: var(--bone-raised);
  border-bottom: 1px solid var(--ink-08);
}
.dialog-title { font-size: 1.5rem; letter-spacing: -0.04em; line-height: 1.1; }
.dialog-body { padding: 1.25rem 1.5rem 1.5rem; display: grid; gap: 1.15rem; }
.dialog-close {
  flex: none;
  width: 2.1rem; height: 2.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-60);
  font-size: 1.35rem;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
}
.dialog-close:hover { background: var(--ink-08); color: var(--ink); }

body.has-dialog { overflow: hidden; }
