/* Site shell shared by every page: fonts, design tokens, header, footer.
   Loaded before v2.css (redesigned pages) or global.css (article pages). */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-latin-wght.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/ibm-plex-mono-latin-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/ibm-plex-mono-latin-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/fonts/ibm-plex-mono-latin-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --ink: #12161A;
  --ground: #F3F5F4;
  --card: #FFFFFF;
  --border: #D5DAD8;
  --control: #C3CAC7;
  --muted: #4A5560;
  --accent: #1746D1;
  --accent-hover: #0F2F96;
  --cost: #B93C0A;
  --muted-on-ink: #B7C0C7;
  --pay-on-ink: #FFD9A8;
  --rule-on-ink: #333B43;
  --track: #E6EAE8;
  --sans: Archivo, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', Menlo, Consolas, monospace;

  /* Spacing scale (design brief section 2). Every margin, padding and gap uses these. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;
  /* Fluid side gutter: 16px on phones up to 32px on wide screens. */
  --gutter: clamp(var(--space-3), 4vw, var(--space-5));

  /* Type scale, ratio 1.25 from 16px (13 16 20 25 31 39 49). Article body
     text is 18px, a project choice for long-form reading. */
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-md: 1.25rem;
  --text-lg: 1.5625rem;
  --text-xl: 1.9375rem;
  --text-2xl: 2.4375rem;
  --text-3xl: 3.0625rem;
  --header-h: 64px;
}

html { scroll-padding-top: calc(var(--header-h) + var(--space-3)); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--space-3); top: calc(var(--space-7) * -1); z-index: 100;
  background: var(--ink); color: #fff; padding: var(--space-2) var(--space-3); border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: var(--space-3); color: #fff; }

/* ----------------------------------------------------------- header */
.v2-header { position: sticky; top: 0; z-index: 40; background: var(--card); border-bottom: 1px solid var(--border); }
.v2-header__bar { display: flex; align-items: center; gap: var(--space-3); min-height: var(--header-h); }
.v2-logo {
  font-weight: 800; font-size: var(--text-base); letter-spacing: -0.01em; color: var(--ink);
  text-decoration: none; min-height: 44px; display: flex; align-items: center; margin-right: auto;
}
.v2-logo:hover { color: var(--ink); }
.v2-header__link { font-weight: 600; font-size: var(--text-base); min-height: 44px; display: flex; align-items: center; }

.v2-nav { display: none; }
.v2-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-2); }
.v2-nav a {
  min-height: 44px; display: flex; align-items: center; padding: 0 var(--space-2); border-radius: 8px;
  color: var(--ink); font-weight: 600; font-size: var(--text-base); text-decoration: none;
}
.v2-nav a:hover { background: var(--ground); color: var(--ink); }
.v2-nav a[aria-current='page'] { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0; }

.v2-header__cta {
  display: none; min-height: 44px; align-items: center; padding: 0 var(--space-3); border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: var(--text-base); text-decoration: none; white-space: nowrap;
}
.v2-header__cta:hover { background: var(--accent-hover); color: #fff; }

.menu-btn {
  min-height: 44px; min-width: 44px; border: 1.5px solid var(--control); border-radius: 8px; padding: 0 var(--space-3);
  background: var(--card); color: var(--ink); display: flex; align-items: center; gap: var(--space-2);
  font-weight: 600; font-size: var(--text-base);
}
.menu-grid {
  padding-top: var(--space-1); padding-bottom: var(--space-3);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: var(--space-2);
}
.menu-grid[hidden] { display: none; }
.menu-grid a {
  min-height: 48px; display: flex; align-items: center; padding: 0 var(--space-3);
  background: var(--ground); border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600;
}
.menu-grid a:hover { background: var(--track); }
.menu-grid a[aria-current='page'] { box-shadow: inset 3px 0 0 var(--accent); }
.menu-grid .menu-grid__cta { background: var(--accent); color: #fff; }

@media (min-width: 640px) { .v2-header__cta { display: flex; } .menu-grid__cta { display: none !important; } }
@media (min-width: 1080px) {
  .v2-nav { display: block; }
  .menu-btn, .menu-grid { display: none !important; }
}

/* ---------------------------------------------------------------- footer */
.v2-footer { margin-top: var(--space-6); background: var(--ink); color: var(--border); }
.v2-footer__in { padding-top: var(--space-5); padding-bottom: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); font-size: 1rem; }
.v2-footer p { margin: 0; }
.v2-footer__name { font-weight: 700; font-size: 1rem; color: #fff; }
.v2-footer a { color: #fff; }
.v2-footer a:hover { color: var(--pay-on-ink); }
.v2-footer__top { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 900px) { .v2-footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); } .v2-footer__about { grid-column: 1 / -1; } }
@media (max-width: 480px) { .v2-footer__top { grid-template-columns: 1fr; } }
.v2-footer__about { display: flex; flex-direction: column; gap: var(--space-2); }
.v2-footer__head { font-family: var(--mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-on-ink); margin: 0 0 var(--space-1); }
.v2-footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.v2-footer__col a { min-height: 44px; display: flex; align-items: center; text-decoration: none; }
.v2-footer__col a:hover { text-decoration: underline; }
.v2-footer__legal { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); border-top: 1px solid var(--rule-on-ink); padding-top: var(--space-2); }
.v2-footer__legal a { min-height: 44px; display: flex; align-items: center; }
.v2-footer__copy { color: var(--muted-on-ink); }

/* Links inside running text are underlined, not told apart by colour alone (WCAG 1.4.1). */
.v2-footer p a { text-decoration: underline; text-underline-offset: 2px; }
.skip-link { min-height: 44px; display: inline-flex; align-items: center; }
h1, h2, h3 { overflow-wrap: break-word; hyphens: auto; }
