/*
  Alelas Holdings site styles (layout and components)
  ------------------------------------------------------------------
  Uses:    tokens.css only. No colour, size, space or duration is typed here.
  CSP:     no inline style or script needed. Motion lives here.

  Background: the indigo field. Every page sets class="bg-field" on <html>: the
  header and intro sit on indigo with the reverse logo; the form and document
  pages read on white.
*/

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-surface);
  overflow-wrap: break-word;
}
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }

a { color: var(--color-link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}
[tabindex="-1"]:focus { outline: none; }  /* programmatic focus targets (summary, notices, success heading) */

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

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-skip-link);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--radius-control);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

/* Below 340 px the side padding drops to 10 px, so the content column is at least
   300 px: Turnstile's fixed widget width. Without this, a 320 px screen scrolls sideways
   (WCAG 1.4.10). */
@media (max-width: 21.24rem) {
  :root { --gutter: var(--gutter-narrow); }
}

/* ---------- Page grid ----------
   360 px: one column: header, intro, form, footer.
   From 60rem: two equal halves. Left half (header + intro) is the field;
   right half holds the form. Content aligns to a 72rem container. */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-rows: auto 1fr auto;
}
.site-header,
.intro,
.enquiry,
.site-footer,
.doc-wrap {
  padding-inline: var(--gutter);
}
.site-header { padding-block: var(--space-5) var(--space-2); }

.logo {
  /* 180 px box at 360 px: the drawn artwork is ≈ 147 px wide (81.5 % of the box),
     above the 140 px minimum. The SVG has 9 % empty space on its left,
     pulled back so the artwork lines up with the text edge. Clear space (X = ¼ of
     the artwork height ≈ 11 px) is kept by the box's own top and bottom space. */
  --logo-width: 11.25rem;
  width: var(--logo-width);
  height: auto;
  margin-left: calc(var(--logo-width) * -0.09);
}
.logo-link { display: inline-block; }


/* ---------- Intro (h1, description, Coming Soon!, Contact) ---------- */
.intro {
  position: relative;
  overflow: hidden;
  padding-block: var(--space-5) var(--space-6);
}
.intro__inner { position: relative; z-index: var(--z-content); }
.h1 {
  text-wrap: balance;
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-h1);
  font-weight: var(--font-weight-bold);
  color: var(--color-heading);
}
.lead {
  text-wrap: pretty;
  margin-top: var(--space-4);
  max-width: var(--measure-lead);
  font-size: var(--text-lead);
  line-height: var(--leading-snug);
}
.soon {
  margin-top: var(--space-6);
  font-size: var(--text-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  font-weight: var(--font-weight-bold);
  color: var(--color-display);
}
.contact { margin-top: var(--space-7); }
.contact p { margin-top: var(--space-2); }

/* Section heading with the short green rule above it (graphic) */
.h2 {
  font-size: var(--text-h2);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
  color: var(--color-heading);
}
.h2--ruled::before {
  content: "";
  display: block;
  width: var(--rule-length);
  height: var(--bar-width);
  margin-bottom: var(--space-3);
  background: var(--color-accent);
}

/* ---------- Motif: the arc ---------- */
.motif { pointer-events: none; }
.motif__arc { fill: var(--color-accent); }
.motif__ring { fill: none; stroke: var(--color-text); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* Below 960 px: the arc at logo proportions, 120 px wide, in the flow after Contact,
   placed at the right as on wide screens: its right end is inset from the field's
   right edge by 3.9 % of the arc's width (wide screens: 11.6 px of 297 px). The box
   ends 0.8 px past the arc's tip, hence 3.15 % of the box width. Two thin tails
   continue its circle past the box (overflow visible); the screen edge and the
   bottom of the field clip them (.intro overflow hidden), so they never add height
   or sideways scroll. The box itself, and so the height of the field, is the arc's
   alone. */
.motif--strip {
  display: block;
  width: 7.5rem;
  height: auto;
  margin-top: var(--space-6);
  margin-left: auto;
  margin-right: calc(7.5rem * 0.0315 - var(--gutter));
  overflow: visible;
}
.motif--panel { display: none; }

/* ---------- Enquiry section ---------- */
.enquiry { padding-block: var(--space-7) var(--space-8); }
.enquiry__intro { margin-top: var(--space-3); }
.form { margin-top: var(--space-5); }
.field + .field { margin-top: var(--space-5); }

.label {
  display: block;
  font-size: var(--text-label);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-snug);
}
.hint { display: block; margin-top: var(--space-1); font-size: var(--text-small); }

.input {
  display: block;
  width: 100%;
  min-height: var(--control-height);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  line-height: var(--leading-snug);
}
.input--area { min-height: 9rem; resize: vertical; }
.input:focus-visible { outline-offset: var(--focus-offset); }
.input[readonly] { border-style: dashed; cursor: progress; }

/* Error: indigo, never colour alone: side bar + thicker border + icon + "Error:" text */
.field--error {
  position: relative;
  padding-left: var(--space-4);
}
.field--error::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--bar-width);
  background: var(--color-error);
}
.field--error .input { box-shadow: inset 0 0 0 var(--border-width) var(--color-error); }
.field__error {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin-top: var(--space-1);
  font-weight: var(--font-weight-semibold);
  color: var(--color-error);
}
.icon { flex: none; width: var(--icon-size); height: var(--icon-size); margin-top: 0.1em; }

/* Spam check: space reserved before the widget loads (no layout shift) */
.spam {
  margin-top: var(--space-5);
  min-height: var(--spam-check-height);
}
.spam__placeholder {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--spam-check-height);
  width: var(--spam-check-width);
  padding-inline: var(--space-3);
  border: var(--border-width) dashed var(--color-border);
  border-radius: var(--radius-control);
  font-size: var(--text-small);
}

.actions { margin-top: var(--space-5); }
.notice-line { margin-top: var(--space-4); font-size: var(--text-body); }  /* body size */

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-5);
  overflow: hidden;
  border: var(--border-width-strong) solid var(--color-button-bg);
  border-radius: var(--radius-control);
  background: var(--color-button-bg);
  color: var(--color-button-text);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
/* Hover: a green bar grows under the label (transform only; graphic, not text) */
.btn::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--bar-width);
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
}
.btn:hover::after { transform: scaleX(1); }
.btn:active { transform: translateY(1px); }
.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
}
.btn[aria-disabled="true"] { cursor: progress; }
.btn[aria-disabled="true"]::after { transform: scaleX(0); }
.btn--block-sm { width: 100%; }

.spinner { width: var(--icon-size); height: var(--icon-size); }
.spinner__track { fill: none; stroke: currentColor; stroke-width: 3; stroke-dasharray: 40 100; stroke-linecap: round; }

/* ---------- Notices, error summary, success ---------- */
.notice {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  border: var(--border-width-strong) solid var(--color-border);
  border-left-width: calc(var(--bar-width) * 2);
  border-radius: var(--radius-control);
}
.notice__title {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-semibold);
}
.notice p, .notice ul { margin-top: var(--space-2); }
.notice ul { padding-left: var(--space-5); }
.notice li + li { margin-top: var(--space-1); }
.notice a { font-weight: var(--font-weight-semibold); }

.success { margin-top: var(--space-5); }
.success__icon { width: 3rem; height: 3rem; }
.success__icon circle { fill: var(--color-accent); }
.success__icon path { fill: none; stroke: var(--color-white); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.success__title { margin-top: var(--space-4); font-size: var(--text-h2); line-height: var(--leading-snug); font-weight: var(--font-weight-semibold); }
.success p { margin-top: var(--space-2); }
.success .btn { margin-top: var(--space-5); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: var(--border-width) solid var(--color-accent);
  padding-block: var(--space-4);
  font-size: var(--text-small);
}
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); align-items: center; }
.site-footer a { display: inline-flex; align-items: center; min-height: var(--control-height); }
.site-footer p { padding-block: var(--space-2); }

/* ---------- Privacy and 404 (document pages) ---------- */
.doc-wrap { padding-block: var(--space-6) var(--space-8); }
.doc { max-width: var(--measure); }
.doc .h1 { font-size: var(--text-h1); }
.doc__meta { margin-top: var(--space-3); font-size: var(--text-small); }
.doc h2 { margin-top: var(--space-6); font-size: var(--text-h2); line-height: var(--leading-snug); font-weight: var(--font-weight-semibold); }
.doc h2 + p, .doc h2 + .slot { margin-top: var(--space-3); }
.doc p + p { margin-top: var(--space-4); }
/* Lists in the privacy notice */
.doc ul { margin-top: var(--space-3); padding-left: var(--space-5); }
.doc li + li { margin-top: var(--space-1); }
.doc ul + p { margin-top: var(--space-4); }
.doc__back { margin-top: var(--space-7); }
.doc .btn { margin-top: var(--space-5); }

/* ================================================================
   The indigo field (.bg-field on <html>)
   ================================================================ */
.bg-field .site-header,
.bg-field .intro {
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
  --color-heading: var(--color-text-inverse);
  --color-text: var(--color-text-inverse);
  --color-link: var(--color-link-inverse);
  --color-display: var(--color-display-inverse);
  --color-accent: var(--color-accent-inverse);
  --color-focus: var(--color-focus-inverse);
  --color-surface: var(--color-surface-inverse);
}
/* The skip link sits on the indigo header: its ring must be white (11.63:1 on indigo), not indigo (1:1). */
.bg-field .skip-link { background: var(--color-white); color: var(--color-indigo); --color-focus: var(--color-focus-inverse); }
.bg-field .motif__ring { stroke: var(--color-accent-inverse); }

/* ================================================================
   Two columns from 60rem (960 px)
   ================================================================ */
@media (min-width: 60rem) {
  /* Two equal halves. The header sits over the left half only; main is its own
     two-column grid of the same halves, so its columns line up with the header. */
  .page--home { grid-template-rows: auto 1fr auto; }
  .page--home .site-header { width: 50%; }
  .main--home { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  /* Left half: content aligned to the 72rem container's left edge */
  .intro {
    padding-left: max(var(--gutter-wide), calc(100% - (var(--container-max) / 2)));
    padding-right: var(--space-8);
  }
  .page--home .site-header {
    /* percentages here refer to the full page width */
    padding-left: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
    padding-right: var(--space-8);
  }
  .site-header { padding-top: var(--space-6); }
  .logo { --logo-width: 13.75rem; }        /* 220 px box, artwork ≈ 179 px */
  .intro { padding-top: var(--space-7); padding-bottom: var(--space-8); display: flex; flex-direction: column; }
  .intro__inner { max-width: 32rem; }

  /* Right half: form, top-aligned with the h1 */
  .enquiry {
    padding-left: var(--space-8);
    padding-right: max(var(--gutter-wide), calc(100% - (var(--container-max) / 2)));
    padding-top: var(--space-7);   /* top-aligned with the h1 */
  }
  .enquiry > * { max-width: 32rem; }
  .btn--block-sm { width: auto; }

  .page--home .site-footer {
    padding-left: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
    padding-right: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
  }
  .doc-wrap {
    padding-left: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
    padding-right: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
  }
  /* Privacy and 404 on wide screens: the reading column (40rem measure) is centred on
     the page; text stays left-aligned. Header logo and footer keep the container edge
     like every page. Below 960 px the column
     stays on the gutter, aligned with the logo. */
  .doc { margin-inline: auto; }

  /* In the flow, below Contact: it can never sit behind text, whatever the form state.
     Pushed to the bottom of the field and cropped by it (overflow hidden). */
  .intro__inner { margin-bottom: var(--space-7); }
  .motif--strip { display: none; }
  .motif--panel {
    display: block;
    width: var(--motif-width);
    max-width: none;
    height: auto;
    margin-top: auto;
    align-self: flex-end;
    --motif-width: 44rem;
    margin-left: 0;
    margin-right: -16rem;
    margin-bottom: -22rem;
  }
}

/* Document pages: header spans the full width */
@media (min-width: 60rem) {
  .page--doc .site-header {
    grid-column: 1 / -1;
    padding-left: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
    padding-right: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
    padding-bottom: var(--space-5);
  }
  .page--doc .site-footer {
    padding-left: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
    padding-right: max(var(--gutter-wide), calc(50% - (var(--container-max) / 2)));
  }
}
.page--doc .site-header { padding-bottom: var(--space-5); }

/* ================================================================
   Motion (only transform and opacity). Default styles above are the
   final, still state. Everything below runs only when motion is allowed.
   ================================================================ */
@media (prefers-reduced-motion: no-preference) {
  .btn::after { transition: transform var(--duration-fast) var(--ease-out); }

  /* CSS only, no script gating: if animations aren't supported, the still state shows.
     Contact and form: fade and rise 8 px, staggered. Not the h1, description or
     "Coming Soon!" (one of them is the LCP element). */
  .contact,
  .enquiry > * {
    animation: enter var(--duration-enter) var(--ease-out) both;
  }
  .enquiry > :nth-child(2) { animation-delay: var(--delay-stagger); }
  .enquiry > :nth-child(3) { animation-delay: calc(var(--delay-stagger) * 2); }

  /* The arc settles once (1.5 s in total, under the 5 s of WCAG 2.2.2). No loop. */
  .motif__move {
    transform-box: view-box;
    animation: settle var(--duration-motif) var(--ease-out) var(--delay-motif) both;
  }

  .success { animation: fade var(--duration-base) var(--ease-out) both; }
  .spinner { animation: spin var(--duration-spin) linear infinite; }
}
@media (prefers-reduced-motion: reduce) {
  /* Fade only, short. Spinner replaced by a still icon; "Sending…" carries the meaning. */
  .contact, .enquiry > * { animation: fade var(--duration-reduced) linear both; }
  .spinner { display: none; }
  .spinner-still { display: block; }
}
.spinner-still { display: none; width: var(--icon-size); height: var(--icon-size); }
@media (prefers-reduced-motion: reduce) { .spinner-still { display: block; } }

@keyframes enter { from { opacity: 0; transform: translateY(var(--rise)); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes settle { from { opacity: 0; transform: rotate(var(--motif-turn)); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
