/* ============================================================
   The UN Reference — independent educational reference
   Palette: ink #1f2a37 · sand #c8862c · terracotta #a9482f · paper #faf8f4
   Type: Sora (headings) + Source Sans 3 (body). Custom CSS, no framework.
   Content is visible with CSS alone; JS is enhancement only.
   ============================================================ */
:root {
  --ink: #1f2a37;
  --ink-2: #2b3948;
  --ink-soft: #3a4a5c;
  --paper: #faf8f4;
  --paper-2: #f2ede3;
  --white: #ffffff;
  --sand: #c8862c;
  --sand-dark: #a96f1f;
  --terra: #a9482f;
  --terra-dark: #8a3823;
  --text: #23282f;
  --text-soft: #566372;
  --rule: #e3dccd;
  --rule-2: #d8cdb8;
  --shadow: 0 1px 2px rgba(31,42,55,.05), 0 8px 28px rgba(31,42,55,.07);
  --shadow-lg: 0 18px 50px rgba(31,42,55,.14);
  --radius: 12px;
  --wrap: 1140px;
  --sans: 'Source Sans 3', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --head: 'Sora', var(--sans);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
  line-height: 1.68;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--terra); text-decoration: none; }
a:hover { color: var(--terra-dark); text-decoration: underline; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }

h1, h2, h3, h4 { font-family: var(--head); color: var(--ink); line-height: 1.18; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 2.4rem 0 .9rem; }
h3 { font-size: 1.28rem; margin: 1.7rem 0 .6rem; font-weight: 600; }
p { margin: 0 0 1.1rem; }

.i-ext { opacity: .55; margin-left: 3px; vertical-align: -1px; }

/* Skip link */
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 10px 16px; z-index: 200; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }

/* Top disclaimer strip */
.topbar { background: var(--ink); color: #cfd8e2; font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.topbar .wrap { padding-top: 7px; padding-bottom: 7px; text-align: center; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(250,248,244,.92); backdrop-filter: saturate(140%) blur(8px); border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--head); font-weight: 800; font-size: 1.16rem; color: var(--ink); letter-spacing: -.02em; }
.wordmark:hover { text-decoration: none; color: var(--ink); }
.wordmark .mark { color: var(--sand); flex: none; }
.primary-nav ul { display: flex; flex-wrap: wrap; gap: 2px; list-style: none; margin: 0; padding: 0; }
.primary-nav a { display: block; padding: 8px 12px; color: var(--ink-soft); font-weight: 600; font-size: .92rem; border-radius: 8px; font-family: var(--head); }
.primary-nav a:hover { color: var(--ink); background: var(--paper-2); text-decoration: none; }
.primary-nav a.active { color: var(--terra-dark); }
.primary-nav a.active::after { content: ""; display: block; height: 2px; margin-top: 3px; background: var(--sand); border-radius: 2px; }
.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 40px; background: none; border: 1px solid var(--rule-2); border-radius: 9px; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; width: 22px; margin: 0 auto; background: var(--ink); transition: transform .2s, opacity .2s; }

/* Hero */
.hero { position: relative; color: #fff; overflow: hidden; }
.hero--plain { background: linear-gradient(140deg, var(--ink) 0%, #263749 60%, #34302a 130%); }
.hero--image { background: var(--ink); min-height: 380px; display: flex; align-items: flex-end; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero-overlay { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(20,28,38,.30) 0%, rgba(20,28,38,.55) 55%, rgba(18,24,33,.85) 100%); }
.hero-inner { position: relative; z-index: 2; padding: 74px 22px 54px; max-width: 900px; }
.hero--plain .hero-inner { padding: 66px 22px 58px; }
.hero h1 { color: #fff; max-width: 20ch; }
.hero-sub { font-size: 1.12rem; color: #eef1f4; max-width: 60ch; margin: .6rem 0 0; }
.kicker { display: inline-block; font-family: var(--head); font-weight: 700; font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: #ffd493; margin: 0 0 .8rem; padding-bottom: .35rem; border-bottom: 2px solid rgba(200,134,44,.75); }
.kicker--dark { color: var(--terra); border-color: var(--sand); }

/* Sections + article layout */
.section { padding: 54px 0; }
.section--cards { background: var(--paper-2); border-top: 1px solid var(--rule); }
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 46px; align-items: start; }
.article-single { max-width: 820px; }
.article-single .prose { max-width: 74ch; }

/* Prose */
.prose { font-size: 1.06rem; }
.prose > p:first-of-type, .prose .lead { font-size: 1.2rem; color: var(--ink-soft); line-height: 1.6; }
.prose .lead { font-weight: 400; }
.prose h2 { padding-top: .2rem; border-top: 1px solid var(--rule); margin-top: 2.6rem; padding-top: 1.4rem; }
.prose h2:first-of-type { border-top: none; margin-top: 1.4rem; padding-top: 0; }
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.25rem; }
.prose li { margin: .4rem 0; }
.prose strong { color: var(--ink); }
.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(169,72,47,.35); }
.prose a:hover { text-decoration-color: currentColor; }

/* Notice / callout */
.notice { background: #fff; border: 1px solid var(--rule-2); border-left: 4px solid var(--sand); border-radius: 10px; padding: 16px 20px; margin: 1.6rem 0; box-shadow: var(--shadow); font-size: 1rem; }
.notice h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.notice p { margin: 0; color: var(--text-soft); }
.notice p + p { margin-top: .6rem; }

/* Aside */
.article-aside { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 92px; }
.card { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.aside-h { font-family: var(--head); font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--sand-dark); margin: 0 0 .7rem; }
.src-list, .rel-list { list-style: none; margin: 0; padding: 0; }
.src-list li { border-top: 1px solid var(--rule); padding: .5rem 0; }
.src-list li:first-child { border-top: none; padding-top: 0; }
.src-list a { color: var(--ink); font-weight: 600; font-size: .96rem; }
.rel-list li { padding: .35rem 0; }
.rel-list a { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-soft); font-weight: 600; font-size: .95rem; }
.rel-list a svg { color: var(--sand); flex: none; margin-top: 3px; }
.rel-list a:hover { color: var(--terra-dark); text-decoration: none; }

/* Contact form */
.contact-form { display: grid; gap: 14px; max-width: 520px; margin: 1.4rem 0 1rem; }
.contact-form label { display: grid; gap: 6px; font-weight: 600; color: var(--ink); font-size: .95rem; }
.contact-form input, .contact-form textarea { font-family: var(--sans); font-size: 1rem; padding: 11px 13px; border: 1px solid var(--rule-2); border-radius: 9px; background: #fff; color: var(--text); }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--sand); border-color: var(--sand); }
.contact-form button, .btn { font-family: var(--head); font-weight: 700; font-size: 1rem; background: var(--terra); color: #fff; border: none; padding: 12px 22px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.contact-form button:hover, .btn:hover { background: var(--terra-dark); color: #fff; text-decoration: none; transform: translateY(-1px); }
.small { font-size: .88rem; color: var(--text-soft); }

/* Home card grid */
.section-title { margin: 0 0 1.4rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { background: #fff; border: 1px solid var(--rule); border-top: 3px solid var(--sand); border-radius: var(--radius); padding: 22px 22px 20px; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; }
.tile h3 { margin: 0 0 .5rem; display: flex; align-items: center; gap: 8px; color: var(--ink); font-family: var(--head); }
.tile h3 svg { color: var(--sand); transition: transform .18s; }
.tile p { margin: 0; color: var(--text-soft); font-size: .98rem; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-top-color: var(--terra); text-decoration: none; }
.tile:hover h3 svg { transform: translateX(4px); }

/* 404 */
.section--404 { padding: 90px 0; text-align: center; }
.section--404 .lead { font-size: 1.2rem; color: var(--text-soft); max-width: 46ch; margin: 0 auto 1.6rem; }
.q-links { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; margin-top: 2rem; }
.q-links a { font-weight: 600; }

/* Footer */
.site-footer { background: var(--ink); color: #c3ccd6; margin-top: 10px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 34px; padding: 52px 22px 30px; }
.f-brand .wordmark--footer { color: #fff; }
.f-brand .wordmark--footer .mark { color: var(--sand); }
.f-tag { margin: .8rem 0 0; font-size: .96rem; color: #9fadba; max-width: 34ch; }
.f-col h3 { color: #fff; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 .9rem; }
.f-col ul { list-style: none; margin: 0; padding: 0; }
.f-col li { margin: .45rem 0; }
.f-col a { color: #c3ccd6; font-size: .96rem; }
.f-col a:hover { color: #fff; text-decoration: none; }
.f-note { border-top: 1px solid #33414f; padding: 22px 22px 34px; }
.f-note p { font-size: .86rem; color: #93a1ae; margin: 0 0 .5rem; max-width: 100ch; }
.f-note strong { color: #d7dee5; }
.f-copy { color: #7f8d9a !important; }

/* Focus visibility */
:focus-visible { outline: 2px solid var(--sand); outline-offset: 2px; border-radius: 4px; }

/* Responsive */
@media (max-width: 900px) {
  body { font-size: 17px; }
  .nav-toggle { display: flex; }
  /* Without JS: nav is visible (stacked). With JS (.js): collapses, toggle opens it. */
  .primary-nav { width: 100%; order: 3; }
  .primary-nav ul { flex-direction: column; gap: 0; padding: 6px 0 10px; }
  .primary-nav a { padding: 11px 6px; border-radius: 6px; }
  .primary-nav a.active::after { display: none; }
  .header-inner { flex-wrap: wrap; }
  .js .primary-nav { max-height: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: max-height .28s ease, opacity .2s; }
  .js .primary-nav.open { max-height: 640px; opacity: 1; visibility: visible; }
  .article-grid { grid-template-columns: 1fr; gap: 30px; }
  .article-aside { position: static; flex-direction: column; }
  .card-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px; padding: 40px 22px 24px; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .hero-inner { padding: 54px 22px 40px; }
  .card-grid { gap: 16px; }
}

/* Safeguard: never leave content hidden waiting on JS (no scroll-reveal libs used). */
[data-aos] { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
