/* ==========================================================================
   Font Atlas — main stylesheet (mobile-first)
   ========================================================================== */

:root {
  --ink: #1c1b16;
  --ink-soft: #4a4840;
  --ink-faint: #8a877c;
  --paper: #faf9f5;
  --paper-raised: #ffffff;
  --line: #e6e3da;
  --accent: #b5462a;
  --accent-dark: #93361f;
  --accent-soft: #f7ece8;
  --code-bg: #f1efe8;
  --heading: "Fraunces", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(28, 27, 22, 0.07);
  --max-width: 1120px;
  --content-width: 720px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--heading);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 0.6em;
}

h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin-top: 1.8em; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.35rem); margin-top: 1.4em; }

p { margin: 0 0 1.2em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }

ul, ol { padding-left: 1.4em; margin: 0 0 1.2em; }
li { margin-bottom: 0.4em; }

img { max-width: 100%; height: auto; }

blockquote {
  margin: 1.5em 0;
  padding: 0.8em 1.2em;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--ink-soft);
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1em 1.2em;
  overflow-x: auto;
  margin: 0 0 1.4em;
}

pre code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.6; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.6em 0.8em;
  border-bottom: 1px solid var(--line);
}

th { font-weight: 600; background: var(--code-bg); }

hr { border: none; border-top: 1px solid var(--line); margin: 2.5em 0; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 8px;
  background: var(--ink);
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 0 0 6px 6px;
  z-index: 200;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; color: #fff; }

/* --------------------------------------------------------------------------
   Header & navigation
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 245, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.logo {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.logo span { color: var(--accent); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-nav {
  display: none;
  width: 100%;
  padding-bottom: 1rem;
}

.site-nav.open { display: block; }

.site-nav ul {
  list-style: none;
  margin: 0 0 0.8rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.site-nav a {
  display: block;
  padding: 0.55em 0.6em;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.98rem;
  border-radius: 6px;
}

.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.search-form {
  display: flex;
  gap: 0.4rem;
}

.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.5em 0.9em;
  font: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  color: var(--ink);
}

.search-form input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.search-form button {
  padding: 0.5em 0.9em;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.search-form button:hover { background: var(--accent-dark); }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav {
    display: flex !important;
    align-items: center;
    gap: 1rem;
    width: auto;
    padding-bottom: 0;
  }
  .site-nav ul { flex-direction: row; margin: 0; }
  .search-form { width: 220px; }
}

/* --------------------------------------------------------------------------
   Hero & sections
   -------------------------------------------------------------------------- */

main { min-height: 60vh; }

.hero {
  padding: 3.5rem 0 3rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  max-width: 800px;
  margin: 0 auto 0.5em;
}

.hero .tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 auto 1.8em;
}

.btn {
  display: inline-block;
  padding: 0.75em 1.6em;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover { background: var(--accent-dark); color: #fff; }

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

.btn.secondary:hover { background: var(--ink); color: #fff; }

.hero-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

.section { padding: 2.5rem 0; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.section-title h2 { margin: 0; }

.section-title a { font-size: 0.95rem; font-weight: 500; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Cards & grids
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(28,27,22,0.1); }

.card .card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.card h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }

.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent-dark); }

.card p { font-size: 0.94rem; color: var(--ink-soft); margin-bottom: 0.8rem; flex: 1; }

.card .card-meta { font-size: 0.82rem; color: var(--ink-faint); margin: 0; }

.category-card {
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}

.category-card .specimen {
  font-size: 2.6rem;
  line-height: 1.1;
  margin-bottom: 0.4rem;
  display: block;
}

.category-card h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.category-card p { font-size: 0.85rem; flex: 0; margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Article layout
   -------------------------------------------------------------------------- */

.post, .page-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
}

.post-meta {
  font-size: 0.88rem;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}

.post-meta a { color: var(--accent); }

.post .lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.related {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-bottom: 3rem;
}

.related h2 { font-size: 1.3rem; margin-top: 0; }

.related ul { list-style: none; padding: 0; }

.related li {
  padding: 0.6em 0;
  border-bottom: 1px solid var(--line);
}

.article-list { list-style: none; padding: 0; max-width: var(--content-width); margin: 0 auto; }

.article-list li {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
}

.article-list h3 { margin: 0.2rem 0 0.4rem; }
.article-list h3 a { color: var(--ink); text-decoration: none; }
.article-list h3 a:hover { color: var(--accent-dark); }
.article-list p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Ad slots — development placeholders.
   Replace the inner comment of each .ad-slot div with your AdSense unit code
   after approval, then delete these placeholder styles.
   -------------------------------------------------------------------------- */

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  margin: 2rem auto;
  max-width: var(--content-width);
  background: repeating-linear-gradient(45deg, #f4f2ec, #f4f2ec 12px, #efede6 12px, #efede6 24px);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.ad-slot::after {
  content: "Ad slot — " attr(data-ad);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------------------
   Glossary
   -------------------------------------------------------------------------- */

.glossary-filter { margin: 1.5rem 0 2rem; max-width: 420px; }

.glossary-filter input {
  width: 100%;
  padding: 0.7em 1em;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
}

.glossary-list dt {
  font-family: var(--heading);
  font-weight: 600;
  font-size: 1.15rem;
  margin-top: 1.6em;
}

.glossary-list dd {
  margin: 0.3em 0 0;
  color: var(--ink-soft);
}

.letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.letter-nav a {
  display: inline-block;
  min-width: 2em;
  text-align: center;
  padding: 0.25em 0.4em;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Pairing tool
   -------------------------------------------------------------------------- */

.tool-panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.tool-controls {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) { .tool-controls { grid-template-columns: 1fr 1fr; } }

.tool-controls label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.tool-controls select {
  width: 100%;
  padding: 0.6em 0.8em;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.preview-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.6rem;
  background: var(--paper);
}

.preview-stage h2 {
  margin: 0 0 0.4em;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-family: inherit;
}

.preview-stage h3 { margin: 1.2em 0 0.4em; font-size: 1.3rem; font-family: inherit; }

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.suggestion-row button {
  padding: 0.45em 0.9em;
  font: inherit;
  font-size: 0.85rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.suggestion-row button:hover { border-color: var(--accent); }

.embed-code { margin-top: 1.5rem; }

/* --------------------------------------------------------------------------
   Forms (contact)
   -------------------------------------------------------------------------- */

.contact-form { max-width: 560px; }

.contact-form label { display: block; font-weight: 600; font-size: 0.92rem; margin: 1.1rem 0 0.3rem; }

.contact-form input, .contact-form textarea {
  width: 100%;
  padding: 0.7em 1em;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
}

.contact-form input:focus, .contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.contact-form button { margin-top: 1.4rem; }

/* --------------------------------------------------------------------------
   Search results
   -------------------------------------------------------------------------- */

.search-results { list-style: none; padding: 0; }

.search-results li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}

.search-results .result-type {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

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

.site-footer {
  margin-top: 3rem;
  background: var(--ink);
  color: #cfcdc4;
  font-size: 0.92rem;
}

.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  padding: 2.5rem 1.25rem;
}

@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }

.site-footer h4 { color: #fff; font-family: var(--body); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.8em; }

.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.5em; }
.site-footer a { color: #cfcdc4; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

.footer-logo { font-family: var(--heading); font-weight: 700; font-size: 1.3rem; color: #fff; text-decoration: none; }
.footer-logo span { color: #e8927c; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 1.2rem 1.25rem;
  font-size: 0.82rem;
  color: #9c9a90;
}

.footer-bottom p { margin: 0; }

/* --------------------------------------------------------------------------
   Cookie consent banner (injected by js/main.js)
   -------------------------------------------------------------------------- */

.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 300;
  max-width: 480px;
  margin: 0 auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(28,27,22,0.18);
  padding: 1.2rem 1.4rem;
  font-size: 0.9rem;
}

.cookie-banner p { margin: 0 0 0.9rem; }

.cookie-banner .cookie-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.cookie-banner button {
  padding: 0.5em 1.2em;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.cookie-banner .cookie-accept { background: var(--accent); color: #fff; border: none; }
.cookie-banner .cookie-accept:hover { background: var(--accent-dark); }
.cookie-banner .cookie-decline { background: none; color: var(--ink-soft); border: 1px solid var(--line); }
.cookie-banner .cookie-decline:hover { border-color: var(--ink-soft); }

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

.font-sample {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
}

.font-sample .sample-text { font-size: 2rem; line-height: 1.2; margin: 0 0 0.6rem; }

.font-sample h3 { margin-top: 0; }

.font-sample .sample-links { font-size: 0.88rem; }

.breadcrumb { font-size: 0.85rem; color: var(--ink-faint); margin-bottom: 1rem; }

.notice {
  background: var(--accent-soft);
  border: 1px solid #ecd5cc;
  border-radius: var(--radius);
  padding: 1em 1.2em;
  font-size: 0.92rem;
  margin: 0 0 1.5em;
}
