/* ============================================================
   Seawest — brand layer

   Tokens, typography and the primitives every page is built from.
   Values come from the 2026 brand kit (css/tokens.json); anything derived
   from them is noted where it is defined. Page chrome and components live
   in site.css.
   ============================================================ */

@font-face {
  font-family: Montserrat;
  src: url('/assets/brand/fonts/montserrat-latin-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

:root {
  /* Brand palette */
  --charcoal: #2d2d2d;
  --brown: #7b5e3b;
  --gold: #c9a96a;
  --stone: #e6e0d6;
  --bone: #f8f7f4;
  --white: #fff;

  /* Derived tints. Mixed from the five brand colours, never new hues. */
  --charcoal-deep: color-mix(in srgb, var(--charcoal) 88%, #000);
  --brown-deep: color-mix(in srgb, var(--brown) 82%, var(--charcoal));
  --stone-soft: color-mix(in srgb, var(--stone) 55%, var(--bone));
  --line: color-mix(in srgb, var(--charcoal) 14%, var(--bone));
  --line-strong: color-mix(in srgb, var(--charcoal) 26%, var(--bone));
  --line-dark: color-mix(in srgb, var(--bone) 18%, var(--charcoal));

  /* Text. Muted still clears AA on bone white (7.4:1). */
  --ink: var(--charcoal);
  --ink-muted: color-mix(in srgb, var(--charcoal) 78%, var(--brown));
  --ink-inverse: var(--bone);
  --ink-inverse-muted: color-mix(in srgb, var(--bone) 74%, var(--charcoal));

  --surface: var(--bone);
  --surface-raised: var(--white);

  --font-heading: Montserrat, 'Segoe UI', arial, sans-serif;
  --font-body: system-ui, -apple-system, blinkmacsystemfont, 'Segoe UI', sans-serif;

  /* 4/8 rhythm from the kit, extended at the top for full-bleed sections. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --content: 75rem;
  --content-narrow: 46rem;
  --gutter: 1.5rem;
  --radius: 4px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--charcoal) 8%, transparent);
  --shadow-md: 0 12px 28px -18px color-mix(in srgb, var(--charcoal) 55%, transparent);
  --shadow-lg: 0 28px 60px -32px color-mix(in srgb, var(--charcoal) 60%, transparent);

  --ease: cubic-bezier(0.2, 0, 0.1, 1);
  --duration: 180ms;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 6.5rem;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
  max-inline-size: 100%;
  block-size: auto;
}

img {
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Margin, not margin-block: figure and blockquote also carry a 40px inline
   margin from the UA stylesheet, which quietly narrows article images. */
:where(h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, dl) {
  margin: 0;
}

:focus-visible {
  outline: 3px solid var(--charcoal);
  outline-offset: 3px;
  border-radius: 2px;
  box-shadow: 0 0 0 6px var(--bone);
}

.is-dark :focus-visible {
  outline-color: var(--gold);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--charcoal) 80%, #000);
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--charcoal);
}

h1 {
  font-size: clamp(2.25rem, 1.55rem + 2.9vw, 4rem);
}

h2 {
  font-size: clamp(1.875rem, 1.45rem + 1.8vw, 2.75rem);
}

h3 {
  font-size: clamp(1.375rem, 1.24rem + 0.6vw, 1.75rem);
  line-height: 1.2;
}

h4 {
  font-size: clamp(1.125rem, 1.07rem + 0.25vw, 1.25rem);
  letter-spacing: -0.01em;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--brown);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--duration) var(--ease);

  &:hover {
    color: var(--charcoal);
  }
}

strong,
b {
  font-weight: 650;
}

hr {
  border: 0;
  border-block-start: 1px solid var(--line);
  margin-block: var(--space-8);
}

::selection {
  background: var(--gold);
  color: var(--charcoal);
}

.eyebrow {
  display: block;
  margin: 0;
  color: var(--brown);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.5;
  text-transform: uppercase;
}

.lead {
  font-size: clamp(1.125rem, 1.06rem + 0.3vw, 1.3125rem);
  line-height: 1.6;
  color: var(--ink-muted);
}

.rule {
  inline-size: 4rem;
  block-size: 2px;
  margin: var(--space-6) 0;
  border: 0;
  background: var(--brown);
}

.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.container {
  inline-size: min(100% - (var(--gutter) * 2), var(--content));
  margin-inline: auto;
}

.section {
  padding-block: clamp(3rem, 1.75rem + 5vw, 6rem);
}

.section--tight {
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem);
}

.section__head {
  max-inline-size: 42rem;
  margin-block-end: clamp(2rem, 1.2rem + 3vw, 3.5rem);

  & h2 {
    margin-block-start: var(--space-3);
  }

  & .lead {
    margin-block-start: var(--space-4);
  }
}

.section__head--centre {
  margin-inline: auto;
  text-align: center;

  & .lead {
    margin-inline: auto;
  }
}

/* Dark panels. Set on the section that owns the surface, so anything
   nested inherits the inverted palette without repeating itself. */
.is-dark {
  /* Re-point the muted token rather than overriding each component: anything
     that reads --ink-muted flips with the surface it is sitting on. */
  --ink-muted: var(--ink-inverse-muted);
  --line: var(--line-dark);

  background: var(--charcoal);
  color: var(--ink-inverse);

  & h1,
  & h2,
  & h3,
  & h4 {
    color: var(--bone);
  }

  & .eyebrow {
    color: var(--gold);
  }

  & .rule {
    background: var(--gold);
  }

  & a:not(.button) {
    color: var(--gold);

    &:hover {
      color: var(--white);
    }
  }
}

.is-stone {
  background: var(--stone-soft);
}

/* ---------- Buttons ---------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: 48px;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--brown);
  border-radius: var(--radius);
  background: var(--brown);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    transform var(--duration) var(--ease);

  &:hover {
    border-color: var(--charcoal);
    background: var(--charcoal);
    color: var(--white);
    transform: translateY(-1px);
  }

  &:active {
    transform: none;
  }

  &[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }
}

.button--secondary {
  border-color: var(--charcoal);
  background: transparent;
  color: var(--charcoal);

  &:hover {
    background: var(--charcoal);
    color: var(--white);
  }
}

.button--inverse {
  border-color: var(--bone);
  background: transparent;
  color: var(--bone);

  &:hover {
    border-color: var(--bone);
    background: var(--bone);
    color: var(--charcoal);
  }
}

.button--small {
  min-block-size: 40px;
  padding: 0.4rem 1rem;
  font-size: 0.8125rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-block-start: var(--space-8);
}

/* Text link that reads as an action. The arrow is decorative. */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;

  &::after {
    content: '→';
    transition: transform var(--duration) var(--ease);
  }

  &:hover::after {
    transform: translateX(3px);
  }
}

/* ---------- Cards and grids -------------------------------------- */

.grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
}

.grid--4 {
  --columns: 4;
}

.grid-shell {
  container: grid / inline-size;
}

@container grid (width <= 60rem) {
  .grid--4 {
    --columns: 2;
  }
}

@container grid (width <= 48rem) {
  .grid {
    --columns: 2;
  }
}

@container grid (width <= 30rem) {
  .grid {
    --columns: 1;
  }
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    transform var(--duration) var(--ease);

  & h3 {
    margin-block: var(--space-4) var(--space-3);
  }

  & p {
    color: var(--ink-muted);
  }
}

.card__icon {
  inline-size: 48px;
  block-size: 48px;
  color: var(--brown);
}

.is-dark .card {
  background: color-mix(in srgb, var(--bone) 5%, var(--charcoal));
  box-shadow: none;
}

/* ---------- Media ------------------------------------------------ */

.media {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--stone);
}

.media img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.media--landscape {
  aspect-ratio: 4 / 3;
}

.media--wide {
  aspect-ratio: 16 / 9;
}

/* ---------- Long-form copy --------------------------------------- */

.prose {
  max-inline-size: var(--content-narrow);

  & > * + * {
    margin-block-start: var(--space-6);
  }

  & h2 {
    margin-block-start: clamp(2.25rem, 1.6rem + 2.5vw, 3.25rem);
    font-size: clamp(1.625rem, 1.4rem + 1vw, 2.125rem);
  }

  & h3 {
    margin-block-start: clamp(2rem, 1.5rem + 2vw, 2.75rem);
    font-size: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  }

  & h4 {
    margin-block-start: var(--space-8);
  }

  & ul,
  & ol {
    padding-inline-start: 1.35rem;
    display: grid;
    gap: var(--space-3);
  }

  & li::marker {
    color: var(--brown);
  }

  & img {
    border-radius: var(--radius);
  }

  & figure {
    display: grid;
    gap: var(--space-3);
  }

  & figcaption {
    color: var(--ink-muted);
    font-size: 0.9375rem;
  }

  & blockquote {
    padding-inline-start: var(--space-6);
    border-inline-start: 3px solid var(--gold);
    font-size: 1.1875rem;
    font-style: italic;
  }

  & table {
    inline-size: 100%;
    border-collapse: collapse;
  }

  & :is(th, td) {
    padding: var(--space-3) var(--space-4);
    border-block-end: 1px solid var(--line);
    text-align: start;
  }
}

/* ---------- Motion ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
