/* =============================================================
   main.css — design system: tokens, reset, typography, layout
   ============================================================= */

/* ── Google Fonts ──────────────────────────────────────────── */
/* Loaded via <link> in each HTML file for better performance.
   Using HTML <link> instead of CSS @import avoids render-blocking
   and allows the browser to discover the request earlier.     */

/* ── Custom properties ─────────────────────────────────────── */
:root {

  /* Colour palette */
  --color-bg:           #FFFFFF;
  --color-surface:      #FAFAF8;   /* warm off-white — alternating sections    */
  --color-text:         #111111;
  --color-muted:        #6B6B6B;   /* secondary text, labels, captions         */
  --color-border:       #E8E8E4;   /* subtle warm-grey dividers                */
  --color-accent:       #1A56DB;   /* deep professional blue                   */
  --color-accent-light: #EBF1FD;   /* accent tint — hover bg, tags             */

  /* Typography */
  --font-display: 'Montserrat', 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-heading: 'Montserrat', 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  /* Type scale — fluid between 375 px and 1280 px */
  --text-xs:   0.75rem;    /*  12 px */
  --text-sm:   0.875rem;   /*  14 px */
  --text-base: 1rem;       /*  16 px */
  --text-lg:   1.125rem;   /*  18 px */
  --text-xl:   1.25rem;    /*  20 px */
  --text-2xl:  1.5rem;     /*  24 px */
  --text-3xl:  clamp(1.75rem, 3.5vw, 2.25rem);
  --text-4xl:  clamp(2.25rem, 5vw,   3.25rem);
  --text-5xl:  clamp(2.75rem, 7vw,   4.5rem);
  --text-6xl:  clamp(3.25rem, 9vw,   6rem);

  /* Line heights */
  --leading-tight:  1.15;
  --leading-snug:   1.3;
  --leading-normal: 1.6;
  --leading-loose:  1.8;

  /* Letter spacing */
  --tracking-tight:  -0.02em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-widest:  0.12em;

  /* Spacing scale */
  --space-xs:   0.25rem;   /*  4 px */
  --space-sm:   0.5rem;    /*  8 px */
  --space-md:   0.75rem;   /* 12 px */
  --space-base: 1rem;      /* 16 px */
  --space-lg:   1.5rem;    /* 24 px */
  --space-xl:   2rem;      /* 32 px */
  --space-2xl:  3rem;      /* 48 px */
  --space-3xl:  clamp(3.5rem, 8vw, 6rem);  /* 56–96 px — section rhythm */

  /* Layout */
  --content-width: 760px;   /* single-column editorial measure */
  --wide-width:    1100px;  /* wider contexts (grids, hero)     */

  /* Border radius */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   14px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Shadows — warm-tinted, not cold grey */
  --shadow-sm:  0 1px 3px rgba(17, 17, 17, 0.06),
                0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow-md:  0 4px 12px rgba(17, 17, 17, 0.08),
                0 2px 4px  rgba(17, 17, 17, 0.04);
  --shadow-lg:  0 12px 36px rgba(17, 17, 17, 0.10),
                0 4px  12px rgba(17, 17, 17, 0.05);

  /* Transitions */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.7, 0, 0.84, 0);
  --ease-base: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast:   150ms;
  --duration-base:   250ms;
  --duration-slow:   400ms;

}

/* ── Box-sizing reset ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Root / HTML ───────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Body ──────────────────────────────────────────────────── */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

/* ── Media defaults ────────────────────────────────────────── */
img, video, svg, canvas {
  display: block;
  max-width: 100%;
}

/* ── Lists ─────────────────────────────────────────────────── */
ul, ol {
  list-style: none;
}

/* ── Links ─────────────────────────────────────────────────── */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-base),
              text-decoration-color var(--duration-fast) var(--ease-base);
}

a:hover {
  color: var(--color-text);
  text-decoration-color: var(--color-text);
}

/* ── Headings ──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;           /* DM Serif Display is expressive at regular weight */
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); font-family: var(--font-body); font-weight: 600; letter-spacing: var(--tracking-normal); }
h5 { font-size: var(--text-xl);  font-family: var(--font-body); font-weight: 600; letter-spacing: var(--tracking-normal); }
h6 { font-size: var(--text-lg);  font-family: var(--font-body); font-weight: 600; letter-spacing: var(--tracking-normal); }

/* ── Paragraphs ────────────────────────────────────────────── */
p {
  max-width: 68ch;    /* comfortable reading measure */
  color: var(--color-text);
}

p + p {
  margin-top: var(--space-base);
}

/* ── Lead / intro paragraph ────────────────────────────────── */
.lead {
  font-size: var(--text-lg);
  line-height: var(--leading-loose);
  color: var(--color-muted);
  max-width: 60ch;
}

/* ── Strong / em ───────────────────────────────────────────── */
strong { font-weight: 600; }
em     { font-style: italic; font-family: var(--font-display); }

/* ── Horizontal rule ───────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-xl);
}

/* ── Code ──────────────────────────────────────────────────── */
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.4em;
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  line-height: var(--leading-loose);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* ── Blockquote ────────────────────────────────────────────── */
blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-lg);
  color: var(--color-muted);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-style: italic;
  line-height: var(--leading-snug);
  margin-block: var(--space-xl);
}

/* ── Accessibility ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.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;
}

/* =============================================================
   LAYOUT
   ============================================================= */

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--wide-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

@media (min-width: 640px) {
  .container { padding-inline: var(--space-2xl); }
}

/* ── Section ───────────────────────────────────────────────── */
/*
   PEEK STRATEGY (documented in animations.css):
   Each section has padding-bottom: var(--space-3xl) + an extra 60px.
   The *next* section's first .reveal element starts with translateY(30px),
   which means its top ~60px bleeds visually into the current section's
   bottom padding before the user scrolls — giving a natural "peek"
   of what's coming. No overflow:hidden is set on sections.
*/
.section {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-block: var(--space-3xl);
  padding-inline: var(--space-lg);
}

/* Alternate section backgrounds — apply to the wrapper, not .section */
.section-wrap {
  background-color: var(--color-bg);
}

.section-wrap--surface {
  background-color: var(--color-surface);
}

/* ── Section label ─────────────────────────────────────────── */
/*
   Usage: <p class="section-label">02 — About</p>
   Sits above the h2. Provides editorial chapter numbering.
*/
.section-label {
  display: block;
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: #22c55e;
  margin-bottom: var(--space-lg);
}

/* ── Section heading group ─────────────────────────────────── */
.section-header {
  margin-bottom: var(--space-2xl);
}

.section-header p {
  margin-top: var(--space-lg);
  color: var(--color-muted);
}

/* =============================================================
   BUTTONS
   ============================================================= */

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  padding: var(--space-md) var(--space-lg);
  transition:
    background-color var(--duration-fast) var(--ease-base),
    color            var(--duration-fast) var(--ease-base),
    border-color     var(--duration-fast) var(--ease-base),
    box-shadow       var(--duration-base) var(--ease-base),
    transform        var(--duration-fast) var(--ease-base);
}

.btn-primary:hover,
.btn-ghost:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary:active,
.btn-ghost:active {
  transform: translateY(0);
}

/* Filled blue */
.btn-primary {
  background-color: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background-color: #1545C0;
  border-color: #1545C0;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

/* Transparent / outlined */
.btn-ghost {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background-color: var(--color-surface);
  border-color: var(--color-text);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* =============================================================
   LEARN-MORE LINK
   ============================================================= */

/*
   Usage:
   <a href="/about/" class="learn-more-link">
     Read the full story
     <span class="learn-more-link__arrow" aria-hidden="true">→</span>
   </a>

   Sits at the bottom of a section as a soft CTA.
   The arrow slides right on hover.
*/
.learn-more-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
  text-decoration: none;
  margin-top: var(--space-xl);
  letter-spacing: 0.01em;
  transition: color var(--duration-fast) var(--ease-base),
              gap   var(--duration-base) var(--ease-out);
}

.learn-more-link:hover {
  color: var(--color-text);
  text-decoration: none;
  gap: var(--space-md);     /* arrow drifts right */
}

.learn-more-link__arrow {
  display: inline-block;
  transition: transform var(--duration-base) var(--ease-out);
  font-style: normal;
}

.learn-more-link:hover .learn-more-link__arrow {
  transform: translateX(4px);
}
