/* =========================================================================
   Figures & Notes — Design system
   Tokens → reset → primitives → components → preferences
   ========================================================================= */

/* -------------------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------------------- */

:root {
  /* --- Color ---------------------------------------------------- */
  --color-bg: #f8f6f4;
  --color-fg: #333;
  --color-fg-rich: #1c110a;
  --color-fg-muted: #6a6a6a;
  --color-link: #704e2e;
  --color-emphasis: #db2b39;
  --color-border: rgba(28, 17, 10, 0.12);

  --color-overlay: rgba(0, 0, 0, 0.55);
  --color-card-tag-bg: rgba(0, 0, 0, 0.45);
  --color-page-tag-bg: #e8e1d4;
  --color-card-default: #e2ff4c;

  /* --- Fonts ---------------------------------------------------- */
  --font-base: Arial, sans-serif;
  --font-display: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;

  /* --- Type scale (fluid where the design benefits from scaling) -- */
  --text-2xs: 0.6875rem;   /* 11 */
  --text-xs: 0.75rem;      /* 12 */
  --text-sm: 0.8125rem;    /* 13 */
  --text-base: 0.875rem;   /* 14  — body default per Webflow base   */
  --text-md: 1rem;         /* 16 */
  --text-lg: 1.0625rem;    /* 17 */
  --text-xl: clamp(1.0625rem, 0.6vw + 0.85rem, 1.25rem);  /* 17 → 20  body copy */
  --text-2xl: clamp(1.125rem, 0.6vw + 0.95rem, 1.375rem); /* 18 → 22  card titles */
  --text-3xl: clamp(1.25rem, 1vw + 0.95rem, 1.5rem);      /* 20 → 24  article h5 */
  --text-4xl: clamp(1.5rem, 2vw + 0.875rem, 2rem);        /* 24 → 32  article h4 */
  --text-5xl: clamp(1.75rem, 3vw + 0.875rem, 2.5rem);     /* 28 → 40  article h3 */
  --text-6xl: clamp(2rem, 3.5vw + 1rem, 3rem);            /* 32 → 48  article h2 */
  --text-display: clamp(3rem, 6vw + 1rem, 6rem);          /* 48 → 96  page title */

  /* --- Line heights -------------------------------------------- */
  --leading-tight: 1.05;
  --leading-snug: 1.2;
  --leading-base: 1.4;
  --leading-body: 1.428;   /* matches Webflow base 14/20 */
  --leading-relaxed: 1.6;

  /* --- Weights ------------------------------------------------- */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* --- Spacing (4px increments) -------------------------------- */
  --space-1: 0.25rem;   /* 4  */
  --space-2: 0.5rem;    /* 8  */
  --space-3: 0.75rem;   /* 12 */
  --space-4: 1rem;      /* 16 */
  --space-5: 1.25rem;   /* 20 */
  --space-6: 1.5rem;    /* 24 */
  --space-7: 1.75rem;   /* 28 */
  --space-8: 2rem;      /* 32 */
  --space-10: 2.5rem;   /* 40 */
  --space-12: 3rem;     /* 48 */
  --space-14: 3.5rem;   /* 56 */
  --space-16: 4rem;     /* 64 */
  --space-20: 5rem;     /* 80 */
  --space-22: 5.5rem;   /* 88 */
  --space-24: 6rem;     /* 96 */

  /* --- Radii --------------------------------------------------- */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* --- Motion -------------------------------------------------- */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 450ms;

  /* --- Layout -------------------------------------------------- */
  --container-page: 1200px;
  --container-content: 880px;
  --column-card: 260px;

  /* --- Link affordances ---------------------------------------- */
  --underline-offset: 0.4rem;
  --underline-offset-hover: 0.55rem;
}

/* -------------------------------------------------------------------------
   Reset & base
   ------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-base);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

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

strong,
b {
  font-weight: var(--weight-bold);
}

/* Focus: invisible for mouse, visible for keyboard */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-fg-rich);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.container {
  width: 100%;
  max-width: var(--container-page);
  margin-inline: auto;
  padding-inline: clamp(var(--space-5), 4vw, var(--space-10));
}

/* -------------------------------------------------------------------------
   Navigation
   ------------------------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding-block: var(--space-5) var(--space-8);
  background: var(--color-bg);
  flex-wrap: wrap;
}

.logo {
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}

.logo strong {
  font-weight: var(--weight-bold);
}

.logo span {
  color: var(--color-fg-muted);
  font-weight: var(--weight-normal);
}

.nav-links {
  display: flex;
  gap: var(--space-7);
}

.nav-links a {
  color: var(--color-fg-muted);
  font-size: var(--text-base);
}

.nav-links a:hover {
  color: var(--color-fg);
}

/* -------------------------------------------------------------------------
   Card grid (masonry)
   ------------------------------------------------------------------------- */

.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  column-width: var(--column-card);
  column-gap: var(--space-5);
}

.card-grid > li {
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
  display: block;
  margin-block-end: var(--space-5);
}

.card {
  position: relative;
  display: block;
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  color: #fff;
  background-color: var(--card-color, transparent);
  transition: transform var(--duration-base) var(--ease-standard);
}

.card:hover {
  transform: translateY(-4px);
}

.card > img {
  display: block;
  width: 100%;
  height: auto;
}

/* Solid-color cards: gradient fill, optional per-card aspect ratio
   via style="--card-aspect: 3 / 4". */
.card--solid {
  aspect-ratio: var(--card-aspect, 1 / 1);
  background-image: linear-gradient(
    to bottom,
    var(--card-color, var(--color-card-default)) 0%,
    var(--color-overlay) 100%
  );
}

/* Image cards: dark gradient at the bottom for title legibility */
.card--image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 45%,
    var(--color-overlay) 100%
  );
  pointer-events: none;
}

.card__tag {
  position: absolute;
  inset-block-start: var(--space-3);
  inset-inline-end: var(--space-3);
  z-index: 2;
  display: inline-block;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--color-card-tag-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
}

.card__title {
  position: absolute;
  inset-block-end: var(--space-5);
  inset-inline: var(--space-5);
  z-index: 2;
  margin: 0;
  font-size: clamp(1.5rem, 1vw + 1.1rem, 1.75rem);
  font-weight: var(--weight-normal);
  line-height: var(--leading-snug);
  letter-spacing: -0.01em;
  color: #fff;
}

/* -------------------------------------------------------------------------
   Article (page title + rich-text body)
   ------------------------------------------------------------------------- */

.page-title {
  max-width: var(--container-content);
  margin-inline: auto;
  padding-block: var(--space-2) var(--space-12);
}

.page-title h1 {
  margin: 0 0 var(--space-7);
  font-family: var(--font-display);
  font-size: var(--text-display);
  line-height: var(--leading-tight);
  font-weight: var(--weight-light);
  color: var(--color-fg-rich);
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.page-tag {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-page-tag-bg);
  color: var(--color-fg-rich);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-normal);
  line-height: 1;
}

.article {
  max-width: var(--container-content);
  margin-inline: auto;
  padding-block-end: var(--space-24);
  font-family: var(--font-display);
}

/* --- Rich-text body  (matches Webflow All Paragraphs/Headings/Links/Bolds) */

.article p {
  margin: 0 0 var(--space-4);
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  font-weight: var(--weight-light);
  color: var(--color-fg-rich);
  text-align: justify;
  hyphens: auto;
}

.article h2,
.article h3,
.article h4,
.article h5,
.article h6 {
  margin-block: var(--space-8);
  font-weight: var(--weight-light);
  color: var(--color-fg-rich);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.article h2 {
  font-size: var(--text-6xl);
  line-height: var(--leading-snug);
}

.article h3 {
  font-size: var(--text-5xl);
  line-height: var(--leading-snug);
}

.article h4 {
  font-size: var(--text-4xl);
  line-height: var(--leading-base);
}

.article h5 {
  font-size: var(--text-3xl);
  line-height: var(--leading-base);
  font-weight: var(--weight-normal);
  text-wrap: pretty;
}

.article h6 {
  font-size: var(--text-xl);
  line-height: var(--leading-base);
  font-weight: var(--weight-semibold);
}

.article a {
  color: var(--color-link);
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 0.1rem;
  text-underline-offset: var(--underline-offset);
  text-underline-position: auto;
  transition: text-underline-offset var(--duration-slow) var(--ease-standard),
    color var(--duration-slow) var(--ease-standard);
}

.article a:hover {
  text-underline-offset: var(--underline-offset-hover);
}

.article strong,
.article b {
  color: var(--color-emphasis);
  font-weight: var(--weight-bold);
}

.article ol,
.article ul {
  margin: 0 0 var(--space-4);
  padding-inline-start: var(--space-6);
}

.article li {
  margin-block-end: var(--space-2);
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  font-weight: var(--weight-light);
  color: var(--color-fg-rich);
}

.article figure {
  margin: var(--space-8) 0;
}

.article figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

.article-sources {
  margin-block-start: var(--space-22);
}

.article-sources p {
  margin-block-end: var(--space-1);
  text-align: left;
  hyphens: manual;
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */

.site-footer {
  margin-block-start: auto;
  padding-block: var(--space-24) var(--space-8);
  text-align: left;
  color: var(--color-fg-muted);
  font-size: var(--text-sm);
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: var(--color-fg);
  font-weight: var(--weight-bold);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-link__arrow {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-inline-start: var(--space-1);
  vertical-align: -0.1em;
  color: var(--color-fg);
  transition: transform var(--duration-base) var(--ease-standard);
}

.site-footer a:hover .footer-link__arrow {
  transform: translate(1px, -1px);
}

/* -------------------------------------------------------------------------
   Responsive
   Type & padding are fluid via clamp() everywhere they can be, so this
   block only handles structural shifts at small viewports.
   ------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .site-nav {
    padding-block: var(--space-4) var(--space-6);
  }

  .logo {
    font-size: 1.125rem;
  }

  .nav-links {
    gap: var(--space-4);
  }

  /* Cards span (nearly) full viewport on mobile, so the title and tag
     get more breathing room from the edges, and the title scales up
     proportionally to fill the bigger surface. */
  .card__title {
    inset-block-end: var(--space-6);
    inset-inline: var(--space-6);
    font-size: 1.875rem;
  }

  .card__tag {
    inset-block-start: var(--space-4);
    inset-inline-end: var(--space-4);
    font-size: var(--text-sm);
    padding: 6px 11px;
  }

  .page-title {
    padding-block-end: var(--space-8);
  }

  .article p,
  .article li {
    text-align: left;
    hyphens: manual;
  }

  .article-sources {
    margin-block-start: var(--space-14);
  }

  .site-footer {
    padding-block-start: var(--space-16);
  }

  /* "All rights reserved, 2026." drops to its own line on mobile */
  .site-footer__rights {
    display: block;
  }
}

/* -------------------------------------------------------------------------
   Preferences
   ------------------------------------------------------------------------- */

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