/**
 * base.css — shared foundation for every v5 website page
 *
 * Reset, base typography, layout primitives, the nav + footer, buttons, and
 * accessibility affordances. Imports nothing; expects tokens.css to be loaded
 * first (it consumes the custom properties defined there).
 *
 * Page-specific styling lives in each page's own stylesheet (e.g.
 * pages/home/home.css). This file holds only what is shared across pages.
 */

/* ---- Reset ------------------------------------------------------------- */

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

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

html, body, h1, h2, h3, h4, p, figure, blockquote, ul, ol {
  margin: 0;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;          /* 17px — comfortable editorial body */
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { max-width: 100%; height: auto; display: block; }

ul, ol { padding-left: 1.25rem; }

/* ---- Layout primitives ------------------------------------------------- */

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

.section {
  padding-block: var(--space-12);
}

/* Left-spine motif — a 2px vertical accent on branded blocks.
   Role-dependent colour: --signal (primary), --verdant, --sapphire. */
.spine {
  border-left: var(--spine) solid var(--signal);
  padding-left: var(--space-3);
}
.spine--verdant  { border-left-color: var(--verdant); }
.spine--sapphire { border-left-color: var(--sapphire); }

/* ---- Typography -------------------------------------------------------- */

h1, h2, h3 { font-weight: 400; }

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--signal-lo);
}

p { max-width: var(--measure); }

a {
  color: var(--ink);
  text-decoration-color: var(--rule-firm);
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: var(--signal-lo); }

strong { font-weight: 600; }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--ink-04);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* The eyebrow — a mono, uppercase kicker above headings. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sapphire);
}

/* The lede — a serif standfirst paragraph. */
.lede {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 1.6vw, 1.375rem);
  line-height: 1.5;
  color: var(--muted);
  max-width: 56ch;
}

/* ---- Buttons + CTAs ---------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  padding: 0.875rem 1.5rem;
  border-radius: 4px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
}

.btn-primary {
  background: var(--signal-lo);
  color: var(--canvas);
}
/* Signal-Lo keeps the primary CTA at 6.31:1 with Canvas text (AA at any
   size); hover darkens it procedurally — no invented hex. */
.btn-primary:hover { transform: translateY(-1px); filter: brightness(0.93); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-firm);
}
.btn-secondary:hover { border-color: var(--ink); }

/* A plain text link styled as a quiet secondary action. */
.link-quiet {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule-firm);
}

/* An inline text link with a trailing arrow — "Learn more →" register. */
.link-arrow {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ink);
  text-decoration: none;
}
.link-arrow:hover { color: var(--signal-lo); }

/* ---- Card -------------------------------------------------------------- */

/* The shared card container — a bordered surface for tiered + gallery
   content. Sections style the card internals; this holds the container
   shell + the optional hover lift only. */
.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  background: var(--canvas);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
/* Add .card--interactive when the card leads somewhere. */
.card--interactive {
  transition: box-shadow var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.card--interactive:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

/* ---- Forms ------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field > label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
}

input[type="text"],
input[type="email"] {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.75rem 0.875rem;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--rule-firm);
  border-radius: 4px;
}
input::placeholder { color: var(--muted); }

/* ---- Site chrome ------------------------------------------------------- */

/* <rtsn-site-nav> + <rtsn-site-footer> are light-DOM wrappers. display:
   contents removes their box so the injected <header>/<footer> lay out as
   direct children of <body> — critical for the sticky nav, since a wrapper
   box would become the sticky containing block and break the stick. */
rtsn-site-nav, rtsn-site-footer { display: contents; }

/* ---- Site navigation --------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--canvas);   /* fallback for browsers without color-mix */
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: var(--wrap-max);
  margin-inline: auto;
  padding: var(--space-2) var(--space-4);
}
.site-nav__logo {
  display: inline-flex;
  color: var(--ink);            /* drives the lockup's currentColor fill */
  text-decoration: none;
}
.site-nav__logo-mark {
  height: 1.75rem;              /* 240x80 lockup, scaled to nav height */
  width: auto;
}
.site-nav__links {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__links a {
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--ink);
}
.site-nav__links a:hover { color: var(--signal-lo); }
.site-nav__cta { white-space: nowrap; }

/* Below 760px the link cluster collapses; wordmark + Book CTA remain.
   A full mobile menu is a follow-on increment. */
@media (max-width: 760px) {
  .site-nav__links { display: none; }
}

/* ---- Site footer ------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--soft-bg);
  padding-block: var(--space-8);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  justify-content: space-between;
  align-items: flex-start;
}
.site-footer__brand { display: flex; flex-direction: column; gap: var(--space-1); }
.site-footer__logo {
  display: inline-flex;
  color: var(--ink);            /* drives the cascade lockup's currentColor fill */
  text-decoration: none;
}
.site-footer__logo-mark {
  height: 2rem;                 /* 240x80 cascade lockup, scaled for the footer */
  width: auto;
}
.site-footer__tagline {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--muted);
}
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-footer__links a {
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--ink);
}
.site-footer__links a:hover { color: var(--signal-lo); }
.site-footer__meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: none;   /* a label, not prose — override the base p measure */
}

/* ---- Scaffold page (in-build skeleton) -------------------------------- */

/* A page that is structurally present but not yet built out. Centred, calm,
   honest — never a broken or empty surface. */
.scaffold { display: flex; align-items: center; min-height: 60vh; }
.scaffold__inner { text-align: center; }
.scaffold__inner h1 { margin-top: var(--space-2); max-width: 20ch; margin-inline: auto; }
.scaffold__inner .lede { margin: var(--space-3) auto 0; }
.scaffold-tag {
  display: inline-block;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule-firm);
  border-radius: 999px;
}

/* ---- Page mascot cameo ------------------------------------------------- */

/* A small in-content mascot cameo. The <rtsn-mascot> is inline-block; this
   just gives it breathing room within the section it punctuates. */
.page-cameo { margin-top: var(--space-6); }

/* ---- Accessibility ----------------------------------------------------- */

/* Skip link — visible only on keyboard focus. */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -3rem;
  z-index: 100;
  background: var(--ink);
  color: var(--canvas);
  padding: 0.625rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: var(--space-2); }

:focus-visible {
  outline: 2px solid var(--sapphire);
  outline-offset: 2px;
}

/* Screen-reader-only text. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Honour the OS reduced-motion preference globally. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
