/**
 * @file        base.css
 * @description Reset, document defaults and the banded layout primitives
 *
 * @author      Thomas Dobler - SYNTHETIXMIND LTD
 * @email       tom@synthetixmind.com
 * @company     SYNTHETIXMIND LTD, Paphos, Cyprus
 * @url         https://synthetixmind.com
 *
 * @uid         e4c91a76-8b52-4d30-9e17-0fa3c586d2b9
 * @version     0.2.0.3
 * @created     2026-09-11
 * @updated     2026-09-17
 *
 * @copyright   (c) 2026 by SYNTHETIXMIND LTD
 * @license     Proprietary — All rights reserved
 */

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

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

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-4);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }

p { margin: 0 0 var(--space-4); }

img {
  max-width: 100%;
  height: auto;
}

/* Links are underlined so colour never carries meaning alone (NFR21). */
a {
  color: var(--text-link);
  text-underline-offset: 0.15em;
}

a:hover { text-decoration-thickness: 2px; }

/* 2px ring, 2px offset. The inverse token is required on dark surfaces —
 * --focus-ring there would be 1.00:1 and invisible. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.band--inverse :focus-visible {
  outline-color: var(--focus-ring-inverse);
}

/* Keyboard-only skip target (WCAG 2.4.1). */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface-raised);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

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

/* --- Banded layout -------------------------------------------------------
 * Direction B. Full-width horizontal sections in a fixed order, distinguished
 * by surface tone and vertical rhythm — never by borders, gradients or
 * full-bleed imagery. No band carries a background image, so all contrast
 * stays inside the token guarantee. */

.band {
  padding-block: var(--space-8);
}

@media (min-width: 768px) {
  .band { padding-block: var(--space-10); }
}

.band--page    { background: var(--surface-page); }
.band--raised  { background: var(--surface-raised); }

.band--inverse {
  background: var(--surface-inverse);
  color: var(--text-on-dark);
}

/* On Deep Space the ONLY permitted text colours are Cloud White (11.28:1) and
 * Golden Accent (4.88:1). Digital Blue (3.61:1) and Steel Mist (4.05:1) both
 * fail AA there at any size — DESIGN.md §2 rule 6. */
.band--inverse a {
  color: var(--text-on-dark);
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.container--reading {
  max-width: var(--container-reading);
}

/* Every interactive target clears the 44px floor (WCAG 2.5.5). */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out);
}

.button--primary {
  background: var(--cta-primary-bg);
  color: var(--cta-primary-text);   /* Deep Space on gold = 4.88:1 */
}

.button--secondary {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-link);
}

.button--secondary:hover { background: var(--surface-page); }

/* --- Buttons on an inverse band --------------------------------------------
 * `.band--inverse a` above is (0,1,1) and `.button--primary` is (0,1,0), so
 * WITHOUT these rules a primary button inside a Deep Space band loses its Deep
 * Space label to Cloud White and renders white-on-gold: 1.90:1, a fail so far
 * below AA that the text is barely legible, plus a stray underline through it.
 *
 * It was unreachable until the homepage hero became an inverse band, because
 * the only inverse surfaces were the masthead and the footer and neither holds
 * a button. Fixed here rather than in home.css: the next inverse band with a
 * call to action must not have to rediscover it. */
.band--inverse .button {
  text-decoration: none;
}

.band--inverse .button--primary {
  color: var(--cta-primary-text);   /* Deep Space on gold = 4.88:1, unchanged */
}

/* Cloud White on Deep Space is 11.28:1 for the label, and the border is a
 * non-text control boundary needing 3:1 (SC 1.4.11) - the same token clears
 * both. Steel Mist would not: 2.79:1 against Deep Space. */
.band--inverse .button--secondary {
  color: var(--text-on-dark);
  border-color: var(--text-on-dark);
}

.band--inverse .button--secondary:hover {
  background: rgb(238 240 242 / 0.12);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Call-to-action motion (Stitch comp, 2026-09-17) ------------------------
 *
 * The comp gives its primary buttons a lift on hover and nudges the icon inside
 * a call to action one step in the direction it points. Both are here rather
 * than on one page's stylesheet because `.button` is the global control and the
 * next band with a CTA should not have to reimplement them.
 *
 * NOTHING IS GUARDED INDIVIDUALLY. The `prefers-reduced-motion: reduce` block
 * above collapses every transition and animation on the site to 0.01ms, so a
 * visitor who has asked for less motion gets the same colours and the same
 * layout with no movement at all. That is why these are transitions rather than
 * keyframe animations - a transition has a resting state that is already
 * correct.
 */
.button {
  /* `transform` and `box-shadow` join the existing background transition. */
  transition: background-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.button--primary:hover {
  /* 1px, not 4. A control that jumps under the pointer reads as instability;
     a control that rises slightly reads as responsive. */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(45 49 66 / 0.18);
}

.button--primary:active {
  /* Returns to rest on press, so the click has a physical answer. */
  transform: translateY(0);
  box-shadow: none;
}

/*
 * The arrow nudge. Any icon inside a button moves a quarter-step on hover -
 * the comp applies it to an external-link glyph, and it reads correctly for any
 * mark that implies direction.
 */
.button svg {
  transition: transform var(--duration-fast) var(--ease-out);
}

.button:hover svg {
  transform: translateX(2px);
}
