/* =============================================================
   The AAMA Catalog — site stylesheet
   Design language: "journal of record"
   Inspirations: Foreign Affairs, Brookings, Lawfare.
   ============================================================= */

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

:root {
  /* Paper & ink */
  --paper:        #FAF7F1;   /* warm cream — primary background */
  --paper-warm:   #F3EEE3;   /* a half-shade darker — for callouts */
  --ink:          #15171C;   /* near-black — body text */
  --ink-soft:     #2A2E38;
  --slate:        #3C4250;   /* secondary text */
  --slate-soft:   #5A6172;
  --muted:        #7B8294;
  --rule:         #D9D1C0;   /* hairline rule on cream */
  --rule-soft:    #E8E2D3;

  /* Accent */
  --accent:       #7B2D26;   /* oxblood — the single accent */
  --accent-soft:  #A24B41;
  --accent-pale:  #F1E4E1;

  /* Category accents — borrowed from heraldic / scholarly palettes */
  --cat-nudity:           #5C5478;   /* aubergine */
  --cat-sexual-content:   #8A6A2F;   /* old gold */
  --cat-sexual-abuse:     #7B2D26;   /* oxblood — gravest */
  --cat-violence:         #2E4A3F;   /* forest green */

  /* Typography */
  --serif:        'Source Serif 4', 'Source Serif Pro', 'Sabon', 'Garamond', Georgia, 'Times New Roman', serif;
  --serif-disp:   'Source Serif 4', 'Source Serif Pro', 'Sabon', 'Garamond', Georgia, serif;
  --sans:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:         'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Type scale */
  --fs-xs:   12px;
  --fs-sm:   14px;
  --fs-base: 17px;
  --fs-lg:   19px;
  --fs-xl:   22px;
  --fs-2xl:  28px;
  --fs-3xl:  36px;
  --fs-4xl:  48px;
  --fs-5xl:  60px;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  /* Layout widths */
  --width-prose:  640px;
  --width-narrow: 760px;
  --width-page:   1100px;
  --width-wide:   1240px;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--fs-base);
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--sp-7) 0;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif-disp);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 var(--sp-4);
  letter-spacing: -0.005em;
}

h1 { font-size: var(--fs-4xl); font-weight: 700; line-height: 1.1; letter-spacing: -0.015em; }
h2 { font-size: var(--fs-3xl); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl);  }
h5 { font-size: var(--fs-lg);  }
h6 { font-size: var(--fs-base); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--sans); font-weight: 600; color: var(--slate); }

p {
  margin: 0 0 var(--sp-4);
  hyphens: auto;
  -webkit-hyphens: auto;
}

p + p { margin-top: var(--sp-4); }

em, i { font-style: italic; }
strong, b { font-weight: 700; color: var(--ink); }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-color: rgba(123, 45, 38, 0.35);
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover { color: var(--accent-soft); text-decoration-color: var(--accent-soft); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

blockquote {
  margin: var(--sp-6) 0;
  padding: 0 0 0 var(--sp-5);
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--slate);
  font-size: var(--fs-lg);
}

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--paper-warm);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--slate-soft); cursor: help; }

ul, ol { margin: 0 0 var(--sp-4); padding-left: var(--sp-5); }
li { margin-bottom: var(--sp-2); }

/* Tabular numerals for any element with .tnum */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* -- Utility containers ---------------------------------------- */

.page         { max-width: var(--width-page);   margin: 0 auto; padding: 0 var(--sp-5); }
.page-narrow  { max-width: var(--width-narrow); margin: 0 auto; padding: 0 var(--sp-5); }
.page-prose   { max-width: var(--width-prose);  margin: 0 auto; padding: 0 var(--sp-5); }
.page-wide    { max-width: var(--width-wide);   margin: 0 auto; padding: 0 var(--sp-5); }

/* -- Eyebrows & section markers -------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--slate);
}

.eyebrow .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.eyebrow-rule {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--slate);
  margin-bottom: var(--sp-5);
}
.eyebrow-rule::before, .eyebrow-rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.eyebrow-rule.left::before  { flex: 0 0 32px; }
.eyebrow-rule.left::after   { display: none; }

/* -- Header / masthead ----------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 241, 0.96);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header .inner {
  max-width: var(--width-wide);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-3);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif-disp);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); }
.brand .mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  transform: rotate(45deg);
  margin-right: var(--sp-2);
  position: relative;
  top: -2px;
}
.brand .sublabel {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--slate);
}

.site-nav {
  display: flex;
  gap: var(--sp-5);
  align-items: center;
}
.site-nav a {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--slate);
  text-decoration: none;
  letter-spacing: 0.01em;
  padding: var(--sp-2) 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
  cursor: pointer;
  border-radius: 2px;
}

@media (max-width: 820px) {
  .site-header .inner { flex-wrap: wrap; }
  .nav-toggle { display: inline-block; }
  .site-nav {
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--rule-soft);
    display: none;
  }
  .site-nav.open { display: flex; }
}

/* -- Hero ------------------------------------------------------ */

.hero {
  padding: var(--sp-9) 0 var(--sp-8);
  border-bottom: 1px solid var(--rule);
}
.hero .lead-rule {
  width: 64px;
  height: 2px;
  background: var(--accent);
  margin-bottom: var(--sp-5);
}
.hero h1 {
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-5);
  max-width: 22ch;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede {
  font-size: var(--fs-lg);
  line-height: 1.55;
  color: var(--slate);
  max-width: 60ch;
  margin-bottom: var(--sp-6);
}
.hero .lede strong { color: var(--ink); }
.hero .meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-5);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: var(--sp-7);
}
.hero .meta span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1px;
  background: var(--muted);
  margin-right: var(--sp-3);
  vertical-align: middle;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: var(--sp-3) var(--sp-5);
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn .arrow { font-family: var(--serif); font-size: 1.1em; }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-accent {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* -- Hero stat counters ---------------------------------------- */

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--rule);
  margin-top: var(--sp-8);
}
.hero-stat {
  padding: var(--sp-5) var(--sp-4) 0 0;
  border-right: 1px solid var(--rule);
}
.hero-stat:last-child { border-right: 0; }
.hero-stat .num {
  display: block;
  font-family: var(--serif-disp);
  font-size: var(--fs-4xl);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-2);
}
.hero-stat .num em {
  font-style: normal;
  font-size: 0.45em;
  color: var(--slate);
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 2px;
}
.hero-stat .lbl {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--slate);
}
.hero-stat.accent .num { color: var(--accent); }

@media (max-width: 720px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stat { border-right: 0; border-bottom: 1px solid var(--rule); padding-bottom: var(--sp-4); padding-right: var(--sp-3); }
  .hero-stat:nth-child(2) { border-right: 0; }
  .hero-stat:nth-child(odd) { border-right: 1px solid var(--rule); }
}

/* -- Generic section ------------------------------------------- */

section.section { padding: var(--sp-8) 0; }
section.section + section.section { border-top: 1px solid var(--rule); }

.section-head { margin-bottom: var(--sp-6); }
.section-head h2 { margin-bottom: var(--sp-3); }
.section-head h2 em { font-style: italic; color: var(--accent); font-weight: 600; }
.section-head .lede { color: var(--slate); font-size: var(--fs-lg); max-width: 56ch; }

/* -- Article (used by About, Methodology, FAQ, Press) ---------- */

article.document {
  padding: var(--sp-9) 0 var(--sp-8);
}

article.document .doc-header {
  max-width: var(--width-narrow);
  margin: 0 auto var(--sp-7);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--rule);
  padding-bottom: var(--sp-6);
}
article.document .doc-header .eyebrow {
  margin-bottom: var(--sp-4);
}
article.document .doc-header h1 {
  font-size: clamp(32px, 4.2vw, 48px);
  letter-spacing: -0.018em;
  max-width: 24ch;
  margin-bottom: var(--sp-4);
}
article.document .doc-header h1 em { font-style: italic; color: var(--accent); font-weight: 700; }
article.document .doc-header .lede {
  font-size: var(--fs-lg);
  color: var(--slate);
  max-width: 56ch;
}

article.document .doc-body {
  max-width: var(--width-prose);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  font-size: var(--fs-base);
  line-height: 1.7;
}
article.document .doc-body h2 {
  font-size: var(--fs-2xl);
  margin-top: var(--sp-7);
  margin-bottom: var(--sp-4);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
}
article.document .doc-body h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
article.document .doc-body h3 {
  font-size: var(--fs-xl);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
  color: var(--ink-soft);
}

article.document .doc-body p.dropcap::first-letter {
  font-family: var(--serif-disp);
  font-size: 4.2em;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  padding: 0.08em var(--sp-3) 0 0;
  color: var(--accent);
}

article.document .signature {
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--rule);
  font-family: var(--serif-disp);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--ink);
}
article.document .signature .where {
  display: block;
  margin-top: var(--sp-2);
  font-style: normal;
  font-size: var(--fs-xs);
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* -- Callouts -------------------------------------------------- */

.callout {
  background: var(--paper-warm);
  border-left: 2px solid var(--accent);
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-6) 0;
  font-size: var(--fs-base);
  color: var(--ink-soft);
}
.callout .callout-label {
  display: block;
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}

.pull {
  font-family: var(--serif-disp);
  font-size: var(--fs-2xl);
  font-style: italic;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
  padding: var(--sp-5) 0;
  margin: var(--sp-6) 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  max-width: 32ch;
}

/* -- Comparison / data tables ---------------------------------- */

table.data {
  width: 100%;
  border-collapse: collapse;
  margin: var(--sp-5) 0 var(--sp-6);
  font-size: var(--fs-sm);
  font-feature-settings: "tnum", "lnum";
}
table.data thead th {
  text-align: left;
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate);
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}
table.data tbody td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  font-family: var(--serif);
  color: var(--ink);
}
table.data tbody tr:hover { background: var(--paper-warm); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.title { font-family: var(--serif-disp); font-weight: 600; }
table.data tfoot td {
  padding: var(--sp-3) var(--sp-3);
  border-top: 2px solid var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink);
}

/* -- Card grids (downloads, FAQ items) ------------------------- */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }

@media (max-width: 880px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: var(--sp-5);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.card.dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.card.dark h3, .card.dark p { color: var(--paper); }
.card.dark a { color: var(--paper); text-decoration-color: rgba(250, 247, 241, 0.5); }
.card .meta-label {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--slate);
}
.card h3 { font-size: var(--fs-xl); margin: 0; }
.card p { margin: 0; color: var(--slate); font-size: var(--fs-sm); line-height: 1.5; }
.card .card-cta {
  margin-top: auto;
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* -- FAQ list -------------------------------------------------- */

.faq-list { margin: var(--sp-5) 0; }
.faq-item {
  border-top: 1px solid var(--rule);
  padding: var(--sp-5) 0;
}
.faq-item:last-child { border-bottom: 1px solid var(--rule); }
.faq-item h3 {
  font-family: var(--serif-disp);
  font-size: var(--fs-xl);
  font-weight: 600;
  margin: 0 0 var(--sp-3);
  color: var(--ink);
}
.faq-item p { color: var(--slate); margin-bottom: var(--sp-3); }
.faq-item p:last-child { margin-bottom: 0; }

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

.site-footer {
  background: var(--ink);
  color: rgba(250, 247, 241, 0.85);
  padding: var(--sp-8) 0 var(--sp-6);
  margin-top: var(--sp-8);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.site-footer .inner {
  max-width: var(--width-wide);
  margin: 0 auto;
  padding: 0 var(--sp-5);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-6);
}
.site-footer h4 {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--paper);
  margin: 0 0 var(--sp-4);
}
.site-footer a {
  color: rgba(250, 247, 241, 0.85);
  text-decoration: none;
  display: block;
  padding: var(--sp-1) 0;
  font-family: var(--sans);
}
.site-footer a:hover { color: var(--accent-soft); }
.site-footer .footer-brand {
  font-family: var(--serif-disp);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--paper);
  margin-bottom: var(--sp-3);
}
.site-footer p { color: rgba(250, 247, 241, 0.72); margin-bottom: var(--sp-3); max-width: 38ch; }
.site-footer .footer-colophon {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(250, 247, 241, 0.15);
  padding-top: var(--sp-4);
  margin-top: var(--sp-5);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  color: rgba(250, 247, 241, 0.55);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

@media (max-width: 820px) {
  .site-footer .inner { grid-template-columns: 1fr 1fr; }
  .site-footer .footer-colophon { flex-direction: column; }
}
@media (max-width: 520px) {
  .site-footer .inner { grid-template-columns: 1fr; }
}

/* -- Category color chips -------------------------------------- */

.cat-chip {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 1px;
  color: var(--paper);
  vertical-align: middle;
}
.cat-chip[data-cat='Nudity']             { background: var(--cat-nudity); }
.cat-chip[data-cat='Sexual content']     { background: var(--cat-sexual-content); }
.cat-chip[data-cat='Sexual abuse']       { background: var(--cat-sexual-abuse); }
.cat-chip[data-cat='Excessive violence'] { background: var(--cat-violence); }

/* -- Print hooks (extended in print.css) ----------------------- */

@media print {
  .site-header, .site-nav, .nav-toggle, .site-footer, .cta-row { display: none !important; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
  .hero, article.document { padding-top: 0; }
}
