/* ============================================================
   Jonathan DeHart — design system
   Portable, no runtime. Light + dark themes via [data-theme].
   ============================================================ */

:root {
  --paper: #faf9f6;
  --paper-2: #fffdf9;
  --panel: #f1ede4;
  --ink: #1a1815;
  --ink-2: #26221d;
  --ink-soft: #3a352e;
  --muted: #54504a;
  --muted-2: #6b665d;
  --faint: #9a9384;
  --line: #e0ddd6;
  --line-2: #e4e0d7;
  --accent: #7a2e26;
  --accent-dk: #641f18;
  --dark: #15130f;
  --on-dark: #ece3d6;
  --on-dark-soft: #bcb4a6;
  --on-dark-faint: #8a8275;
  --gold: #b89a82;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Hanken Grotesk', system-ui, sans-serif;
}

/* Dark theme — warm near-black surfaces, light text. The brand's
   permanently-dark bands (#15130f) sit just below the page surface. */
[data-theme="dark"] {
  --paper: #1b1814;
  --paper-2: #232019;
  --panel: #211d17;
  --ink: #f1ece2;
  --ink-2: #e7e1d6;
  --ink-soft: #d6d0c4;
  --muted: #b4ada0;
  --muted-2: #a39c8f;
  --faint: #8d8676;
  --line: #34302a;
  --line-2: #38332c;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}
img { display: block; }
a { color: inherit; }

/* ---------- shared helpers ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding-left: clamp(20px,5vw,48px); padding-right: clamp(20px,5vw,48px); }
.wrap-wide { max-width: 1320px; }
.wrap-narrow { max-width: 1080px; }
.eyebrow {
  font-size: 12px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}
.kicker {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
.serif { font-family: var(--serif); }

/* ============================================================
   NAV — permanently dark, like the footer
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(21,19,15,0.9);
  backdrop-filter: saturate(120%) blur(10px);
  -webkit-backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid #2c2922;
  font-family: var(--sans);
}
.site-nav__inner {
  max-width: 1240px; margin: 0 auto;
  padding: 0 clamp(20px,5vw,48px);
  display: flex; align-items: center; justify-content: space-between;
  height: 74px; gap: 20px;
}
.brand {
  text-decoration: none; color: #f6f1e7; font-family: var(--serif);
  font-size: 21px; letter-spacing: 0.01em; white-space: nowrap;
  display: flex; align-items: baseline; gap: 10px;
}
.brand b { font-weight: 500; }
.brand span {
  font-family: var(--sans); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: #a59e90; font-weight: 600;
}
.nav-right { display: flex; align-items: center; gap: 18px; margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links > a, .nav-item > a {
  text-decoration: none; font-size: 14px; font-weight: 500; letter-spacing: 0.01em;
  padding: 6px 0; color: #cfc8bb; display: flex; align-items: center; gap: 5px;
}
.nav-links a:hover { color: #fff; }
.nav-links a.active { color: var(--gold); }
.nav-item { position: relative; }
.nav-item > a .caret { font-size: 9px; opacity: 0.6; transform: translateY(1px); }
.nav-menu {
  position: absolute; top: calc(100% + 8px); left: -16px; min-width: 220px;
  background: #1d1a15; border: 1px solid #34302a; border-radius: 4px;
  box-shadow: 0 16px 40px -16px rgba(0,0,0,0.6); padding: 8px;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.nav-item:hover .nav-menu, .nav-item:focus-within .nav-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav-menu a {
  text-decoration: none; color: #d8d2c6; font-size: 14px;
  padding: 10px 12px; border-radius: 3px;
}
.nav-menu a:hover { background: #262019; color: #fff; }
.nav-cta {
  text-decoration: none; font-size: 14px; font-weight: 600; letter-spacing: 0.02em;
  color: #f6f1e7; border: 1px solid #4a443a; padding: 9px 18px; border-radius: 2px;
}
.nav-cta:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.nav-cta.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* theme toggle button */
.theme-toggle {
  background: none; border: 1px solid #4a443a; color: #cfc8bb;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; padding: 0; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--gold); color: #fff; }
.theme-toggle::before { content: "\263E"; } /* moon — click for dark */
[data-theme="dark"] .theme-toggle::before { content: "\2600"; } /* sun — click for light */
.theme-toggle--mobile {
  width: 100%; height: auto; border-radius: 2px; gap: 8px;
  font-size: 15px; padding: 13px 0; margin-top: 14px; font-family: var(--sans); font-weight: 600;
}
.theme-toggle--mobile::after { content: "Switch theme"; }
[data-theme="dark"] .theme-toggle--mobile::after { content: "Switch theme"; }

.nav-toggle { display: none; }
.mobile-panel { display: none; }

/* mobile */
@media (max-width: 880px) {
  .nav-links { display: none; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 5px; width: 40px; align-items: flex-end;
    background: none; border: none; cursor: pointer; padding: 8px;
  }
  .nav-toggle span { display: block; width: 24px; height: 1.5px; background: #cfc8bb; }
  .nav-toggle span:last-child { width: 16px; }
  .mobile-panel {
    border-top: 1px solid #2c2922; background: #1b1814;
    padding: 14px clamp(20px,5vw,48px) 26px; flex-direction: column;
  }
  .mobile-panel.open { display: flex; }
  .mobile-panel a {
    text-decoration: none; color: #e7e1d6; font-size: 17px; font-family: var(--serif);
    padding: 13px 0; border-bottom: 1px solid #2c2922;
  }
  .mobile-panel .group { padding: 13px 0; border-bottom: 1px solid #2c2922; }
  .mobile-panel .group .lbl {
    font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
    color: #8d8676; font-weight: 600; margin-bottom: 8px; font-family: var(--sans);
  }
  .mobile-panel .group a { border: none; font-size: 16px; color: #cfc8bb; padding: 6px 0; display: block; }
  .mobile-panel .m-cta {
    color: #fff; background: var(--accent); font-size: 15px; font-weight: 600;
    font-family: var(--sans); text-align: center; padding: 14px 0; border-radius: 2px;
    margin-top: 16px; border: none;
  }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--dark); color: #cfc8bb; font-family: var(--sans);
  padding: clamp(56px,8vw,96px) clamp(20px,5vw,48px) 40px;
}
.site-footer__inner { max-width: 1240px; margin: 0 auto; }
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 48px 40px; align-items: start;
}
.footer-lead { grid-column: 1/-1; max-width: 520px; margin-bottom: 8px; }
.footer-lead .name { font-family: var(--serif); font-size: clamp(26px,3.4vw,34px); color: #f6f1e7; line-height: 1.2; }
.footer-lead p { font-family: var(--serif); font-size: 17px; line-height: 1.65; color: #a59e90; margin: 14px 0 0; font-style: italic; }
.footer-col .lbl { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #7d7667; font-weight: 600; margin-bottom: 16px; }
.footer-col a { display: block; text-decoration: none; color: #cfc8bb; font-size: 15px; padding: 5px 0; }
.footer-col a:hover { color: #fff; }
.footer-base {
  border-top: 1px solid #2c2922; margin-top: 56px; padding-top: 24px;
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
}
.footer-base span { font-size: 13px; color: #6f6859; }

/* ============================================================
   ARTICLE-LIST PAGES (Writing / Travel / Culture / Society)
   ============================================================ */
.page-head { padding: clamp(56px,8vw,120px) clamp(20px,5vw,48px) clamp(32px,4vw,48px); max-width: 1180px; margin: 0 auto; }
.crumb { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--faint); margin-bottom: 24px; }
.crumb a { text-decoration: none; color: var(--accent); font-weight: 600; }
.crumb .here { color: var(--faint); text-transform: uppercase; letter-spacing: 0.18em; font-size: 12px; font-weight: 600; }
.page-title {
  font-family: var(--serif); font-weight: 400; font-size: clamp(36px,6.4vw,72px);
  line-height: 1.04; letter-spacing: -0.015em; margin: 0; max-width: 16ch; color: var(--ink);
}
.page-intro {
  font-family: var(--serif); font-size: clamp(18px,2.2vw,23px); line-height: 1.6;
  color: var(--muted); max-width: 62ch; margin: 24px 0 0;
}

/* featured row */
.feature {
  text-decoration: none; color: inherit;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px,1fr));
  gap: clamp(28px,4vw,56px); align-items: center;
  border-top: 1px solid var(--line); padding: clamp(36px,4vw,52px) 0;
}
.feature:hover { opacity: 0.97; }
.feature__img { aspect-ratio: 16/11; overflow: hidden; border-radius: 3px; }
.feature__img img { width: 100%; height: 100%; object-fit: cover; }
.feature h2 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(26px,3.4vw,40px);
  line-height: 1.14; letter-spacing: -0.01em; margin: 14px 0; color: var(--ink);
}
.feature p { font-family: var(--serif); font-size: 18px; line-height: 1.7; color: var(--muted); margin: 0 0 18px; max-width: 52ch; }
.readmore { font-size: 14px; font-weight: 600; color: var(--accent); border-bottom: 1px solid #d8c2b8; padding-bottom: 3px; }
.pub { font-size: 13px; color: var(--faint); }

/* card grid */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px,1fr));
  gap: clamp(28px,3vw,44px) clamp(24px,2.6vw,40px);
}
.card { text-decoration: none; color: inherit; display: block; border-top: 1px solid var(--line); padding-top: 24px; }
.card:hover { opacity: 0.97; }
.card__cat { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-bottom: 10px; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: clamp(20px,2.3vw,25px); line-height: 1.2; margin: 0 0 8px; color: var(--ink); }
.card p { font-family: var(--serif); font-size: 15.5px; line-height: 1.62; color: var(--muted-2); margin: 0 0 10px; }
.card .pub-line { font-size: 12.5px; color: var(--faint); letter-spacing: 0.02em; }
.card .pub-line b { color: var(--accent); font-weight: 600; }
.ext { font-size: 11px; opacity: 0.7; }

.section { max-width: 1180px; margin: 0 auto; padding: 0 clamp(20px,5vw,48px) clamp(64px,9vw,120px); }
.section--tight { padding-bottom: clamp(40px,5vw,56px); }

/* ============================================================
   PORTRAIT (with graceful placeholder until the real file exists)
   ============================================================ */
.portrait {
  position: relative; aspect-ratio: 4/5; border-radius: 4px; overflow: hidden;
  background: linear-gradient(150deg, #2a2620 0%, #15130f 100%);
}
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.portrait__ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; text-align: center; padding: 20px;
  color: #8a8275; font-family: var(--sans);
}
.portrait__ph b { color: #cdc4b6; font-size: 14px; font-weight: 600; letter-spacing: 0.04em; }
.portrait__ph span { font-size: 12px; font-family: ui-monospace, monospace; letter-spacing: 0.02em; }
.intro-split {
  max-width: 1080px; margin: 0 auto; padding: clamp(64px,9vw,128px) clamp(20px,5vw,48px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  gap: clamp(36px,5vw,72px); align-items: center;
}
.intro-split .portrait { max-width: 360px; }

/* ============================================================
   BALANCED GALLERIES & GRIDS
   ============================================================ */
/* Book-page photo gallery — even rows at every width (2-up, then 4-up). */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(8px,1.2vw,14px); }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(4, 1fr); } }

/* Article-list grid (Travel / Culture / Society) — generous cards,
   wrapped and centered so the final row is never left stranded. */
.article-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(30px,3.2vw,48px); }
.article-grid > .card { flex: 0 1 360px; border-top: none; padding-top: 0; }

/* "Keep reading" — links to the other two Writing sections */
.keep-reading {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(28px,3.5vw,40px) clamp(20px,5vw,48px) clamp(56px,7vw,88px);
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 30px;
}
.keep-reading .kr-label {
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}
.keep-reading a {
  font-family: var(--serif); font-size: clamp(20px,2.4vw,26px);
  text-decoration: none; color: var(--ink);
  border-bottom: 1px solid var(--line); padding-bottom: 2px;
}
.keep-reading a:hover { color: var(--accent); border-color: var(--accent); }
