/* ---- Design tokens ---- */
:root {
  --color-bg: #faf7f4;
  --color-surface: #ffffff;
  --color-text: #221d1b;
  --color-text-muted: #6b615c;
  --color-border: #e7ddd5;
  --color-accent: #9c3f5b;
  --color-accent-dark: #7a2f47;
  --color-gold: #a9863f;

  --font-heading: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --wrap-width: 1100px;
  --radius: 4px;
  --shadow-card: 0 1px 2px rgba(34, 29, 27, 0.06), 0 1px 12px rgba(34, 29, 27, 0.04);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent-dark); }
a:hover { color: var(--color-accent); }
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.9rem, 1.6rem + 1.2vw, 2.6rem); }
h2 { font-size: 1.5rem; margin-top: 1.6em; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-accent);
  color: #fff;
  padding: 0.6em 1em;
  z-index: 100;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.wrap {
  max-width: var(--wrap-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ---- Header ---- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}
.site-header__brand {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--color-accent);
}
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--color-bg); }
.nav-toggle__bar {
  width: 22px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(4) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Below this width the header nav can no longer fit brand + all links on
   one line without wrapping mid-row, so it collapses to a hamburger. */
@media (max-width: 960px) {
  .nav-toggle { display: flex; }
  .site-header__inner { flex-wrap: wrap; row-gap: 0; }
  .site-nav {
    flex-basis: 100%;
    order: 3;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.2s ease;
  }
  .site-nav.is-open { grid-template-rows: 1fr; }
  .site-nav > ul {
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
    gap: 0;
  }
  .site-nav li:not(:first-child) { border-top: 1px solid var(--color-border); }
  .site-nav a { display: block; padding: 0.85rem 0.25rem; }
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
  padding-block: 1.75rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer__links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}
.site-footer__links a { color: var(--color-text-muted); }

.share-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.share-buttons__label {
  font-size: 0.8rem;
}
.share-buttons__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.share-buttons__link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-bg);
}
.share-buttons__link svg {
  width: 16px;
  height: 16px;
}

/* ---- Home ---- */
.hero {
  padding-block: 3rem 2.5rem;
  border-bottom: 1px solid var(--color-border);
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: center;
}
.hero h1 { max-width: 16ch; }
.hero p { color: var(--color-text-muted); max-width: 48ch; font-size: 1.05rem; }
.hero__image {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
@media (max-width: 720px) {
  .hero__inner { grid-template-columns: 1fr; }
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding-block: 3rem;
}
@media (max-width: 720px) {
  .pillars { grid-template-columns: 1fr; }
}
.pillar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.pillar:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.pillar img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.pillar h2 { margin-top: 0; color: var(--color-text); }
.pillar p { color: var(--color-text-muted); margin-bottom: 0; }

/* ---- Collection index ---- */
.collection-index__header { padding-block: 2.5rem 1.5rem; }
.collection-index__header p { color: var(--color-text-muted); max-width: 60ch; }

.card-grid {
  list-style: none;
  margin: 0 0 3rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.card a { text-decoration: none; color: inherit; display: block; }
.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.card h2 { font-size: 1.05rem; margin: 0.9rem 1rem 0.3rem; }
.card p { font-size: 0.9rem; color: var(--color-text-muted); margin: 0 1rem 1rem; }

/* ---- Entry pages ---- */
.breadcrumbs { padding-top: 1.5rem; font-size: 0.85rem; color: var(--color-text-muted); }
.breadcrumbs ol { list-style: none; display: flex; gap: 0.4rem; padding: 0; margin: 0; flex-wrap: wrap; }
.breadcrumbs li:not(:last-child)::after { content: "/"; margin-left: 0.4rem; color: var(--color-border); }
.breadcrumbs a { color: var(--color-text-muted); }

.entry__header { padding-top: 1rem; max-width: 68ch; }
.entry__lede { font-size: 1.1rem; color: var(--color-text-muted); }
.entry__meta { font-size: 0.85rem; color: var(--color-text-muted); margin: 0.5em 0 0; }
.entry__image {
  margin: 0 0 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  max-width: 640px;
}
.entry__image img { aspect-ratio: 3 / 2; object-fit: cover; }
.entry__content {
  max-width: 68ch;
  padding-bottom: 2rem;
}
.entry__content h2:first-child { margin-top: 0; }

.related-links {
  border-top: 1px solid var(--color-border);
  padding-block: 1.5rem 3rem;
  max-width: 68ch;
}
.related-links h2 { font-size: 1.1rem; margin-top: 0; }
.related-links ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }

/* ---- Static pages ---- */
.page { padding-block: 2.5rem 3rem; max-width: 68ch; }
.page__content h2 { margin-top: 1.8em; }

/* ---- Glossary ---- */
.glossary-list dt { font-weight: 700; margin-top: 1.2em; font-family: var(--font-heading); }
.glossary-list dd { margin: 0.2em 0 0; color: var(--color-text-muted); }

/* ---- Glossary term tooltips ---- */
.gloss-term {
  position: relative;
  border-bottom: 1px dotted var(--color-text-muted);
  cursor: help;
}
.gloss-term__tip {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 0.4rem;
  width: max-content;
  max-width: 260px;
  background: var(--color-text);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 20;
}
.gloss-term:hover .gloss-term__tip,
.gloss-term:focus .gloss-term__tip {
  opacity: 1;
  transform: translateY(0);
}
@media (max-width: 480px) {
  .gloss-term__tip { max-width: 200px; }
}

/* ---- Foundation finder ---- */
.finder {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin: 1.5rem 0 2rem;
  max-width: 68ch;
}
.finder__field {
  border: 0;
  padding: 0;
  margin: 0 0 1.25rem;
}
.finder__field legend {
  font-family: var(--font-heading);
  font-weight: 700;
  padding: 0;
  margin-bottom: 0.6rem;
}
.finder__field label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 1.25rem 0.5rem 0;
  font-size: 0.95rem;
}
.finder__submit {
  background: var(--color-accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}
.finder__submit:hover { background: var(--color-accent-dark); }
.finder__result {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
.finder__result h2 { margin-top: 0; font-size: 1.25rem; }
.finder__cta { display: inline-block; font-weight: 700; }
.finder__see-also {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

/* ---- Ads ---- */
.ad-slot { margin-block: 2rem; }
