/* ============================================================
   base.css  -  FONTS AND TYPOGRAPHY BASE LAYER

   Nikita: this file loads the two custom fonts (Migra Italic
   and General Sans) from /assets/fonts, then sets the default
   look for the whole page (body background, default text,
   how headings look, container widths, focus states).

   Things to change here if asked:
   - body background colour (currently --paper, set in tokens.css)
   - default text size (currently --type-body = 17px)
   - container max width (currently 1440px, set in tokens.css)
   - the gold colour around a focused element (--gold)
============================================================ */

/* ----------------------------------------------------------
   FONT FILES
   The browser only downloads these if a real .woff2 file exists
   at the path. If a placeholder file is in place (during setup),
   the browser silently falls back to the next font in the
   --font-display / --font-body lists in tokens.css.

   font-display: swap means: show the fallback font immediately,
   swap to the custom font as soon as it has finished downloading.
   This prevents the page rendering as blank while fonts load.
---------------------------------------------------------- */
/* Self-hosted fonts (no third-party calls - POPIA friendly).
   Bitter (headings/display), Montserrat (body, the Proxima Nova
   stand-in), JetBrains Mono (small labels/numerals). Latin subset.
   Files live in assets/fonts/. */
@font-face { font-family: "Bitter"; font-style: italic; font-weight: 300; font-display: swap; src: url("../fonts/bitter-300-italic.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/bitter-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/bitter-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: italic; font-weight: 600; font-display: swap; src: url("../fonts/bitter-600-italic.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: normal; font-weight: 300; font-display: swap; src: url("../fonts/bitter-300.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/bitter-400.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/bitter-500.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/bitter-600.woff2") format("woff2"); }
@font-face { font-family: "Bitter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/bitter-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-500.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-400.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-500.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/montserrat-600.woff2") format("woff2"); }

/* ----------------------------------------------------------
   ROOT AND BODY
   These set the default look of every page.
   overflow-x: hidden stops accidental horizontal scrolling on
   phones, which is a common bug when an element is wider than
   the viewport.
---------------------------------------------------------- */
html {
  scroll-behavior: auto;
}

body {
  font-family: var(--font-body);
  font-size: var(--type-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "kern", "liga", "ss01"; /* Enable nicer kerning and stylistic letters. */
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Stop iOS from inflating text sizes when the phone is rotated. */
  -webkit-text-size-adjust: 100%;
}

main {
  display: block;
}

/* ----------------------------------------------------------
   TYPOGRAPHY DEFAULTS
   Every h1, h2, h3, h4 inherits the display font and a tight
   line height. To use a particular size, also add a class:
   <h1 class="display-1">...</h1>
---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

/* Headline size classes. Used on hero, page titles, sections. */
/* Big display: lighter weight + tighter tracking for editorial finesse. */
.display-1 { font-size: var(--type-display-1); line-height: var(--lh-display); letter-spacing: -0.028em; font-weight: 300; }
.display-2 { font-size: var(--type-display-2); line-height: var(--lh-tight); letter-spacing: -0.022em; font-weight: 300; }
.h2       { font-size: var(--type-h2); line-height: var(--lh-snug); }
.h3       { font-size: var(--type-h3); }
.h3-lg    { font-size: var(--type-h3-lg); }

/* Smaller text classes for paragraphs, labels, micro-copy. */
.lede  { font-size: var(--type-lede); line-height: var(--lh-lede); color: var(--ink); }
.small { font-size: var(--type-small); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ash); }
.micro { font-size: var(--type-micro); font-family: var(--font-mono); letter-spacing: 0.06em; color: var(--ash); text-transform: uppercase; }

em, i, .italic { font-style: italic; }
strong, b      { font-weight: 500; }

/* ----------------------------------------------------------
   SECTION LABEL  -  the "01 / The numbers" header pattern
   Nikita: this replaces the plain uppercase mono label with
   an editorial italic + mono pair, tilted slightly, with a
   coral underline. Used at the top of every section.
---------------------------------------------------------- */
.section-label {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 2.4vw, 28px);
  color: var(--ink);
  line-height: 1;
  position: relative;
  padding-block-end: 6px;
  transform: rotate(-1deg);
  transform-origin: left center;
  letter-spacing: 0;
  text-transform: none;
}
.section-label .num {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}
/* Secondary accent: the same hand-drawn brush, in coral, marks every
   section label (gold = emphasis on numbers/words, coral = section markers). */
.section-label::after {
  content: "";
  position: absolute;
  inset-block-end: -2px;
  inset-inline-start: 0;
  width: 64%;
  max-width: 210px;
  height: 0.5em;
  background: var(--accent-underline-coral) no-repeat left center / 100% 100%;
}
/* Dark variant for use on the case-teaser (ink background): gold brush reads better. */
.section-label--dark { color: var(--paper); }
.section-label--dark .num { color: var(--gold); }
.section-label--dark::after { background-image: var(--accent-underline); }

/* ----------------------------------------------------------
   ACCENT UNDERLINE  -  the one consistent emphasis mark
   Wrap any inline word/number in <span class="accent-underline">
   and it gets the scalable hand-drawn gold underline. Because the
   mark is sized to the element (100% 100%), it scales with the
   text and renders identically on mobile and desktop.
---------------------------------------------------------- */
.accent-underline {
  position: relative;
  display: inline-block;
}
.accent-underline::after {
  content: "";
  position: absolute;
  inset-inline: -0.04em;
  inset-block-end: -0.14em;
  height: 0.22em;
  background: var(--accent-underline) no-repeat center / 100% 100%;
  pointer-events: none;
}
/* Ink variant - use under GOLD words so the underline stays crisp. */
.accent-underline--ink::after { background-image: var(--accent-underline-ink); }

/* ----------------------------------------------------------
   LAYOUT PRIMITIVES
   .container: centers content and adds left/right padding.
   .section: adds large top/bottom padding for full-width sections.
   .section-tight: smaller version of .section.
   .rule: a thin horizontal line. Add .rule-gold for gold colour.
---------------------------------------------------------- */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--side-pad);
}

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

.section-tight {
  padding-block: var(--space-2xl);
}

.rule {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--rule);
  border: 0;
}

.rule-gold {
  height: 1px;
  background: var(--gold);
}

/* ----------------------------------------------------------
   ACCESSIBILITY HELPERS
   .skip-link lets keyboard users jump past the nav directly to
   the main content. It is invisible until focused (Tab key).
   :focus-visible draws a gold outline around any element a
   keyboard user has focused, so people who navigate without a
   mouse can see where they are on the page.
---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: var(--space-sm);
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-sm) var(--space-md);
  z-index: 999;
}
.skip-link:focus-visible { inset-block-start: var(--space-sm); }

/* ----------------------------------------------------------
   MOBILE TWEAKS
   Most layout already shrinks gracefully thanks to clamp() and
   logical properties. These rules tidy a few edge cases on
   small screens (<= 640px wide).
---------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 16px; } /* slightly smaller body on phones */
  .lede { font-size: 17px; line-height: 1.55; }
}
