/* Xelleron system enquiry form: the contact app's form (Projects/Enquiry src/app/contact.css, screens C01-contact and
   C03-sent) with the "Your system" card on top, as design/app.pen draws it (S01-system · desktop 1440, tablet 834,
   phone 390, and the states board). Reads only var(--…) for colour, font and radius; the values live in tokens.css,
   generated from design/tokens.json. Sizes with no token (an icon, a fixed control height, a type size the frame sets)
   are copied from the boards. Phone first; the photo panel layout starts at 1100 px, as the contact app's. Navy only. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans-latin-wght.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

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

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

/* Canvas text without a line height uses the face's own, rounded to whole pixels: IBM Plex Sans 1.3 (a 16 px label is
   21 tall), Schibsted Grotesk 1.2333. Set on every element, not inherited: an inherited line height arrives already
   computed at the parent's font size. Rules set the ratio (--lh), which inherits as a number. */
.ct { --lh: 1.3; }
.ct * { line-height: round(calc(var(--lh) * 1em), 1px); }

.ct {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg-ground);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Resets inside :where(), at an element's weight: a component's own padding (the call line's 4) must win over them. */
:where(.ct) :is(h1, h2, h3, p, ul, fieldset, legend) { margin: 0; padding: 0; }
:where(.ct) ul { list-style: none; }
:where(.ct) fieldset { border: 0; min-width: 0; }
:where(.ct) a { color: var(--accent); }
.ct img { display: block; }
.ct [hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ct .icon {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ct .hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.ct a, .ct button, .ct input, .ct label, .ct textarea { touch-action: manipulation; }

.ct :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ct ::selection { background-color: var(--accent-steel); color: var(--text); }

/* ---------- Page and sky (phone and tablet: the Sky band) ---------- */

.ct-page {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg-navy);
}

.ct-sky {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  /* 52 below the title plus the 28 the sheet overlaps the band by (frame gap -28, band padding 80). */
  padding: 20px 22px 80px;
  padding-top: max(20px, env(safe-area-inset-top));
  background: var(--bg-navy);
  color: var(--text);
}

.ct-sky-top { display: flex; flex-direction: column; gap: 28px; }

/* Logo/Lockup: mark 40, gap 12, wordmark display 24.8 / 700, line 1.02, tracking -0.992. */
.ct-logo {
  position: relative;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: var(--space-12);
  color: var(--text);
  text-decoration: none;
}
.ct-logo::after { content: ""; position: absolute; inset: -2px 0; }
.ct-mark { width: 40px; height: 40px; }
.ct-wordmark {
  font-family: var(--font-display);
  font-size: 24.8px;
  font-weight: 700;
  --lh: 1.02;
  letter-spacing: -0.992px;
}

.ct-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  --lh: 1.04;
  letter-spacing: -1.08px;
}

.ct-panel-photo { display: none; }

/* Form/Call Card: a desktop panel's only (on a phone the call button under Submit does its job). */
.ct-call-card {
  display: flex;
  align-self: flex-start;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-16) var(--space-20);
  border-radius: var(--radius);
  background: var(--surface-glass);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
  text-decoration: none;
}
.ct-sky .ct-call-card { display: none; }
.ct-call-card .icon { width: 24px; height: 24px; color: var(--accent); }
.ct-call-text { display: flex; flex-direction: column; gap: var(--space-4); }
.ct-call-lead { font-size: 14px; --lh: 1.45; }
.ct-call-number { font-family: var(--font-display); font-size: 30px; font-weight: 700; --lh: 1.45; letter-spacing: -0.9px; }

/* ---------- Sheet ---------- */

.ct-sheet {
  position: relative;
  z-index: 1; /* over the band's last 28 px */
  margin-top: -28px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-ground);
  border-radius: var(--radius);
  padding: 28px 18px 40px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

/* The boards run the form the sheet's full width on a phone and a tablet (S01-system · tablet 834). */
.ct-column { flex: 1 0 auto; width: 100%; min-width: 0; display: flex; flex-direction: column; gap: var(--space-20); }

.ct-form { display: flex; flex-direction: column; gap: var(--space-20); }
.ct-name-phone { display: flex; flex-direction: column; gap: var(--space-20); }

/* ---------- Your system: part labels and the card (S01-system boards) ---------- */

.ct-system { display: flex; flex-direction: column; gap: var(--space-20); }

/* Part · Your system / Your details: the label, then a 1 px rule to the column's edge. */
.ct-part { display: flex; align-items: center; gap: var(--space-12); padding-bottom: var(--space-2); }
.ct-part::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.ct-part-text,
.ct-group-label {
  color: var(--text-subtle);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.ct-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  padding: 18px var(--space-16);
  border-radius: var(--radius);
  background: var(--bg-navy);
  box-shadow: inset 0 0 0 1px var(--line-mid);
}

.ct-card-head { display: flex; flex-direction: column; gap: var(--space-10); }
.ct-card-titles { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.ct-card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  --lh: 1.2333;
  overflow-wrap: anywhere;
}
.ct-card-note { color: var(--text-muted); font-size: 14px; font-weight: 400; --lh: 1.45; }

/* Link · Remove all: the x and the label, quiet. */
.ct-remove-all {
  position: relative;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  margin: 0;
  padding: var(--space-2) 0;
  border: 0;
  background: none;
  color: var(--text-subtle);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: round(calc(var(--lh) * 1em), 1px);
  cursor: pointer;
}
.ct-remove-all::after { content: ""; position: absolute; inset: -11px -8px; } /* a 44 px tall tap target */
.ct-remove-all .icon { width: 15px; height: 15px; }

.ct-card-rule { height: 1px; background: var(--line); }

/* Group · Components / Connects to: the label above (phone), or a 112 px column beside the chips. */
.ct-group { display: flex; flex-direction: column; gap: var(--space-8); }
.ct-group-body { display: flex; flex-direction: column; gap: var(--space-8); min-width: 0; flex: 1 1 auto; }

.ct-chips { display: flex; flex-wrap: wrap; gap: var(--space-8) var(--space-6); }
.ct-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  max-width: 100%;
  padding: var(--space-6) var(--space-8) var(--space-6) var(--space-12);
  border-radius: var(--radius);
  background: var(--fill-accent-tint);
  box-shadow: inset 0 0 0 1px var(--line-mid);
  font-size: 14px;
  font-weight: 500;
}
.ct-chip-label { min-width: 0; overflow-wrap: anywhere; }
.ct-chip-remove {
  position: relative;
  display: flex;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.ct-chip-remove::after { content: ""; position: absolute; inset: -15px -8px; } /* 44 px tall, 30 wide */
.ct-chip-remove .icon { width: 14px; height: 14px; }

/* Field · Other: 40 high, "Other:" then the visitor's own words, editable. */
.ct-other {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  height: 40px;
  padding: 0 var(--space-12);
  border-radius: var(--radius);
  background: var(--fill-tint);
  box-shadow: inset 0 0 0 1px var(--line-bone);
  font-size: 14px;
  font-weight: 500;
}
.ct-other:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.ct-other-prefix { flex: none; color: var(--text-subtle); }
.ct-other-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  caret-color: var(--accent);
  font: inherit;
  line-height: round(calc(var(--lh) * 1em), 1px);
  appearance: none;
}
/* The field draws the ring (:focus-within above), so the input's own outline goes. */
.ct-other-input:focus-visible { outline: none; }

/* ---------- Fields: Form/Field, /Focused, /Error; Form/Textarea, /Counter, /Error; Form/Error Line ---------- */

.ct-field { display: flex; flex-direction: column; gap: var(--space-8); min-width: 0; }

.ct-label { font-size: 16px; font-weight: 600; }
.ct-label--wrap { --lh: 1.35; }

.ct-input {
  display: block;
  width: 100%;
  height: 56px;
  margin: 0;
  padding: 0 var(--space-16);
  border: 0;
  border-radius: var(--radius);
  background: var(--fill-tint);
  box-shadow: inset 0 0 0 1px var(--line-bone);
  color: var(--text);
  caret-color: var(--accent);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: round(calc(var(--lh) * 1em), 1px);
  appearance: none;
}
.ct-input::placeholder { color: var(--text-muted); opacity: 1; line-height: inherit; }
.ct-input:focus-visible,
.ct-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.ct-input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--error); }
.ct-input[aria-invalid="true"]:focus { box-shadow: inset 0 0 0 2px var(--error), 0 0 0 2px var(--accent); }
.ct-input[readonly] { color: var(--text-muted); }

.ct-textarea {
  height: auto;
  min-height: 132px;
  padding: var(--space-16);
  --lh: 1.5;
  resize: none;
  overflow: hidden;
  field-sizing: content;
}

/* The text area that matches the vendor choice shows below it; neither before a choice. Works without JavaScript. */
.ct-field--details,
.ct-field--vendorDescription { display: none; }
.ct-form:has(#ct-vendor-no:checked) .ct-field--details,
.ct-form:has(#ct-vendor-yes:checked) .ct-field--vendorDescription { display: flex; }

.ct-counter-line { display: flex; justify-content: flex-end; }
.ct-counter { color: var(--text-muted); font-size: 14px; }

.ct-error-line {
  display: flex;
  gap: var(--space-6);
  color: var(--error);
  font-size: 14px;
  font-weight: 600;
}
.ct-error-line:empty { display: none; }
.ct-error-text { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Vendor choice: Contact/Vendor Option, /Selected (native radios) ---------- */

.ct-legend { width: 100%; font-size: 16px; font-weight: 600; --lh: 1.35; }
.ct-options { display: flex; gap: var(--space-12); margin-top: var(--space-12); }
.ct-vendor .ct-error-line { margin-top: var(--space-12); }

.ct-option {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  border-radius: var(--radius);
  background: var(--fill-tint);
  /* The canvas strokes the option outside its box (strokeAlignment outer). */
  box-shadow: 0 0 0 1px var(--line-bone);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.ct-option-input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ct-option .icon { color: var(--accent); }
.ct-option:not(:has(:checked)) .icon { display: none; }
/* Contact/Vendor Option/Selected: accent tint, a 2 px accent stroke inside, the tick in the accent. */
.ct-option:has(:checked) { background: var(--fill-accent-tint); box-shadow: inset 0 0 0 2px var(--accent); }
.ct-option:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.ct-option-input:focus-visible { outline: none; } /* drawn on the option (:has above) */

/* ---------- Send failed: Form/Alert/Send Failed ---------- */

.ct-alert {
  display: flex;
  gap: var(--space-12);
  padding: var(--space-16);
  border-radius: var(--radius);
  background: var(--error-tint);
  box-shadow: inset 0 0 0 1px var(--error);
}
/* Shown by form.js, or without JavaScript by its fragment (the function's ?error=1#send-error). */
.ct-alert:not(:target):not(.is-shown) { display: none; }
.ct-alert > .icon { width: 20px; height: 20px; color: var(--error); }
.ct-alert-body { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; font-size: 16px; --lh: 1.45; }
.ct-alert-message { font-weight: 500; overflow-wrap: anywhere; }
.ct-alert-phone { align-self: flex-start; font-weight: 600; text-decoration: underline; }

/* ---------- Buttons: Button/Primary, Button/Primary/Sending, Button/Secondary ---------- */

.ct-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-10);
  width: 100%;
  margin: 0;
  padding: var(--space-16) 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--text-on-light);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: round(calc(var(--lh) * 1em), 1px);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, opacity 150ms ease;
}
.ct-button .icon { color: var(--bg-ground); }
.ct-button .ct-spinner,
.ct-button[data-busy="true"] .ct-arrow { display: none; }
.ct-button[data-busy="true"] .ct-spinner { display: block; }
.ct-button[data-busy="true"] { background: var(--text-muted); cursor: progress; }
.ct-spinner { animation: ct-spin 800ms linear infinite; }

@keyframes ct-spin { to { transform: rotate(360deg); } }

.ct-button--secondary {
  background: var(--fill-ghost);
  box-shadow: inset 0 0 0 1px var(--line-bone);
  color: var(--text);
}
.ct-button--secondary .icon { color: var(--text); }

/* Form/Call Line: desktop only on the screen (on a phone the call button does its job). */
.ct-call-line {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-4) 0;
  color: var(--text-muted);
  font-size: 16px;
}
.ct-call-line .icon { color: var(--accent); }
.ct-page .ct-call-line { display: none; }
.ct-call-line-number { font-weight: 600; text-decoration: none; }

/* Links keep their drawn size; the padding makes a 44 px tall tap target without moving anything. */
.ct-call-line-number,
.ct-alert-phone {
  padding-block: var(--space-12);
  margin-block: calc(-1 * var(--space-12));
}

/* ---------- Sent (the contact app's C03-sent): Form/Tick Badge ---------- */

/* Shown by form.js, or without JavaScript by its fragment (the function's ?sent=1#sent); it replaces the form. */
.ct-sent { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-20); }
.ct-sent:not(:target):not(.is-shown) { display: none; }
.ct-page:has(#sent:target) .ct-form,
.ct-page.is-sent .ct-form { display: none; }

.ct-confirmation { display: flex; flex-direction: column; gap: var(--space-16); }

.ct-tick-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--fill-accent-tint);
  color: var(--accent);
}
.ct-tick-badge .icon { width: 28px; height: 28px; }

.ct-confirmation-heading {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  --lh: 1.04;
  letter-spacing: -1.08px;
}
.ct-confirmation-heading:focus:not(:focus-visible) { outline: none; }
.ct-confirmation-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.ct-confirmation-line { color: var(--text-muted); font-size: 18px; font-weight: 500; --lh: 1.45; }

/* Sent on a phone: the sky keeps only the logo and the call button sits at the foot of the sheet. */
.ct-page:has(#sent:target) .ct-sky-heading,
.ct-page.is-sent .ct-sky-heading { display: none; }
.ct-page:has(#sent:target) .ct-sheet,
.ct-page.is-sent .ct-sheet { padding: var(--space-32) 22px; padding-bottom: max(var(--space-32), env(safe-area-inset-bottom)); }

/* ---------- Hover (pointer devices only) ---------- */

@media (hover: hover) and (pointer: fine) {
  .ct-option:hover:not(:has(:checked)) { background: var(--fill-ghost); }
  .ct-button:hover:not([data-busy="true"]) { opacity: 0.92; }
  .ct-button--secondary:hover { background: var(--fill-accent-tint); opacity: 1; }
  .ct-call-line-number:hover, .ct-alert-phone:hover { text-decoration: underline; }
  .ct-call-card:hover .ct-call-number { text-decoration: underline; }
  .ct-remove-all:hover, .ct-chip-remove:hover { color: var(--text); }
}

/* ---------- Tablet and up: the card's head and groups side by side (S01-system · tablet 834, desktop 1440) ---------- */

@media (min-width: 600px) {
  .ct-card { padding: var(--space-20) 22px; }
  .ct-card-head { flex-direction: row; justify-content: space-between; align-items: flex-start; gap: var(--space-12); }
  .ct-card-title { font-size: 20px; }
  .ct-group { flex-direction: row; gap: var(--space-16); }
  .ct-group-label { flex: none; width: 112px; padding-top: 7px; }
}

/* ---------- Desktop (S01-system · desktop 1440) ---------- */

@media (min-width: 1100px) {
  .ct-page {
    display: grid;
    /* The panel grows by half of every pixel above 1440: 600 at 1440, 840 at 1920, never past 860. */
    grid-template-columns: clamp(600px, calc(50vw - 120px), 860px) minmax(0, 1fr);
    background: var(--bg-ground);
  }

  .ct-sky {
    position: sticky;
    top: 0;
    height: 100dvh;
    min-height: 640px;
    justify-content: space-between; /* the call card at the panel's foot */
    padding: var(--space-48) 56px;
    overflow: hidden;
  }

  /* Sky panel: the toned river photo under a navy wash (Navy tone, --photo-tone) and the Sky blend, navy from the top
     to 34% fading out by 64%. Top layer first. */
  .ct-panel-photo {
    position: absolute;
    inset: 0;
    z-index: -1;
    display: block;
    background:
      linear-gradient(180deg, var(--bg-navy) 0%, var(--bg-navy) 34%, transparent 64%),
      linear-gradient(var(--photo-tone), var(--photo-tone)),
      image-set(url("assets/panel-photo.webp") 1x, url("assets/panel-photo-2x.webp") 2x) center / cover no-repeat,
      var(--bg-navy);
  }

  .ct-sky-top { gap: 56px; }
  .ct-sky-heading { max-width: 488px; } /* the panel's 1440 text width: the title keeps its lines as it grows */
  .ct-title { font-size: 56px; letter-spacing: -1.68px; }

  .ct-sky .ct-call-card { display: flex; }

  /* The column is centred in its area at any width. */
  .ct-sheet {
    margin-top: 0;
    justify-content: center;
    align-items: center;
    padding: 64px 0;
    background: transparent;
  }
  /* 560 up to 1440, then 600 by 1920 and no wider. Below ~1210 the form's side is narrower than 560: the column
     narrows to fit it, 24 px from each edge. */
  .ct-column { flex: 0 0 auto; width: min(clamp(560px, calc(560px + (100vw - 1440px) / 12), 600px), 100% - 48px); }

  .ct-name-phone { flex-direction: row; align-items: flex-start; gap: var(--space-16); }
  .ct-name-phone .ct-field { flex: 1 1 0; }

  .ct-page .ct-call-button { display: none; }
  .ct-page .ct-call-line { display: flex; }
  .ct-call-line--centred { justify-content: center; }

  /* Sent on desktop keeps the panel's title and sits at the top of the centred column. */
  .ct-page:has(#sent:target) .ct-sky-heading,
  .ct-page.is-sent .ct-sky-heading { display: block; }
  .ct-page:has(#sent:target) .ct-sheet,
  .ct-page.is-sent .ct-sheet { padding: 64px 0; }
  .ct-sent { flex: 0 0 auto; justify-content: flex-start; }
}

/* ---------- Reduced motion: no motion at all ---------- */

@media (prefers-reduced-motion: reduce) {
  .ct *, .ct *::before, .ct *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
  }
}
