/* =========================================================================
   TOTALLY JERUSALEM — CORE STYLESHEET
   Design language: Jerusalem stone, old-city gold, Armenian tile blue,
   Judean olive, pomegranate red. See /HANDOFF.md for the design rationale.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* --- Palette (named, subject-derived) --- */
  --stone:        #EFE8D8;   /* Jerusalem limestone — page background */
  --stone-dim:    #E3D9C1;   /* limestone in shadow — section bands   */
  --paper:        #FBF8EF;   /* pale card / surface                   */
  --ink:          #211D18;   /* basalt ink — primary text             */
  --ink-soft:     #55503F;   /* secondary text                        */
  --gold:         #A97C2F;   /* old-city gold / Dome accent           */
  --gold-deep:    #7E5A1E;   /* gold, darker, for text-on-light       */
  --lapis:        #1F4A5C;   /* Armenian tile blue                    */
  --lapis-deep:   #16333F;
  --olive:        #6B7A4F;   /* Judean hillside olive                 */
  --pomegranate:  #8C2F2B;   /* rare accent — alerts, emphasis        */
  --line:         rgba(33,29,24,0.14);
  --line-strong:  rgba(33,29,24,0.28);
  --shadow:       0 12px 32px rgba(33,29,24,0.14);

  /* --- Type --- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'IBM Plex Mono', 'SF Mono', Consolas, monospace;

  /* --- Layout --- */
  --max: 1180px;
  --radius: 4px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--stone);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lapis); text-decoration-color: rgba(31,74,92,0.35); text-underline-offset: 3px; }
a:hover { color: var(--gold-deep); }

:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

img { max-width: 100%; display: block; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- The four-quarters rule (site signature) ----------
   A thin four-tone bar — one tone per Old City quarter's traditional
   material palette — used as a section signature, not a caption. */
.quarters-rule {
  height: 4px;
  width: 72px;
  display: flex;
  border-radius: 2px;
  overflow: hidden;
  margin: 18px 0 0;
}
.quarters-rule span { flex: 1; }
.quarters-rule span:nth-child(1) { background: var(--gold); }
.quarters-rule span:nth-child(2) { background: var(--lapis); }
.quarters-rule span:nth-child(3) { background: var(--olive); }
.quarters-rule span:nth-child(4) { background: var(--pomegranate); }

/* =========================================================================
   TICKER BAR — live/evergreen facts, never faked as live if not live
   ========================================================================= */
.ticker {
  background: var(--ink);
  color: var(--stone);
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.ticker .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  padding: 8px 24px;
}
.ticker .item { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.ticker .dot { color: var(--gold); }
.ticker .label { color: rgba(239,232,216,0.6); }
.ticker a { color: var(--stone); text-decoration-color: rgba(239,232,216,0.4); }
.ticker a:hover { color: var(--gold); }

/* =========================================================================
   HEADER / NAV
   ========================================================================= */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: var(--ink); }
.logo .mark {
  width: 30px; height: 30px; flex: none;
}
.logo .mark svg { width: 100%; height: 100%; }
.logo .site-logo-img {
  display: block;
  width: auto;
  height: 64px;
  max-width: min(320px, 42vw);
  object-fit: contain;
}


.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--ink); }
.main-nav a[aria-current="page"] { border-bottom: 2px solid var(--gold); padding-bottom: 3px; }

.nav-toggle { display: none; }

@media (max-width: 780px) {
  .main-nav { display: none; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--line-strong);
    background: transparent; border-radius: var(--radius); cursor: pointer;
  }
}

/* =========================================================================
   HERO — boxed 8:3 image, NOT full-bleed. Falls back to nothing (no box,
   no placeholder) if the -hero.webp asset is missing. See js/main.js.
   ========================================================================= */
.hero-box {
  max-width: var(--max);
  margin: 28px auto 0;
  padding: 0 24px;
}
.hero-box .hero-frame {
  aspect-ratio: 8 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--stone-dim);
  box-shadow: var(--shadow);
}
.hero-box .hero-frame img {
  width: 100%; height: 100%; object-fit: cover;
}
/* When JS determines the hero image doesn't exist, it adds this class
   to the wrapping <figure data-hero>. This removes the box entirely —
   no placeholder, no reserved space, straight into the content. */
.hero-box[data-hero-missing] { display: none; }

@media (max-width: 640px) {
  .hero-box { margin-top: 16px; padding: 0 16px; }
  .hero-box .hero-frame { aspect-ratio: 4 / 3; border-radius: 6px; }
}

/* =========================================================================
   ARTICLE LAYOUT + 4:5 SUPPORTING GRAPHIC
   ========================================================================= */
.article-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: 48px;
  align-items: start;
}
.article-main { min-width: 0; }
.article-aside { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 22px; }

/* The 4:5 graphic. Same missing-asset behaviour as the hero. */
.graphic-box .graphic-frame {
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  background: var(--stone-dim);
  box-shadow: var(--shadow);
}
.graphic-box .graphic-frame img { width: 100%; height: 100%; object-fit: cover; }
.graphic-box[data-graphic-missing] { display: none; }

@media (max-width: 900px) {
  .article-shell { grid-template-columns: 1fr; }
  .article-aside { position: static; }
  .article-aside .graphic-box { max-width: 320px; }
}

.breadcrumb {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 22px 0 0;
}
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb .sep { margin: 0 6px; opacity: 0.5; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin-top: 18px;
}

h1.article-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 4.4vw, 48px);
  line-height: 1.08;
  margin: 10px 0 0;
  color: var(--ink);
}

.dek {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 16px 0 0;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 20px 0 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.byline strong { color: var(--ink); font-weight: 600; }

.lede-note {
  background: var(--paper);
  border-left: 3px solid var(--lapis);
  padding: 14px 18px;
  font-size: 15px;
  color: var(--ink-soft);
  margin: 26px 0;
  border-radius: 0 6px 6px 0;
}

.callout {
  background: #F6EFE0;
  border: 1px solid rgba(169,124,47,0.35);
  border-radius: 8px;
  padding: 18px 20px;
  margin: 30px 0;
}
.callout .callout-label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-deep);
  display: block;
  margin-bottom: 6px;
}

.article-main h2 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  margin: 44px 0 6px;
  color: var(--ink);
  scroll-margin-top: 90px;
}
.article-main h2 .num {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--gold-deep);
  margin-right: 10px;
  font-weight: 500;
}
.article-main h3 {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
  margin: 26px 0 4px;
}
.article-main p { margin: 14px 0; color: var(--ink); }
.article-main ul, .article-main ol { padding-left: 22px; }
.article-main li { margin: 6px 0; }
.article-main strong { color: var(--ink); }

table.compare {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: 15px;
}
table.compare th, table.compare td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
table.compare th {
  background: var(--stone-dim);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}
table.compare tr:nth-child(even) td { background: rgba(251,248,239,0.6); }

.checklist { list-style: none; padding-left: 0; }
.checklist li {
  padding-left: 30px;
  position: relative;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0; top: 4px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--gold-deep);
  border-radius: 4px;
}

/* ---------- Sidebar cards ---------- */
.side-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
}
.side-card h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.side-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 14px; }
.side-card dt { color: var(--ink-soft); }
.side-card dd { margin: 0; font-weight: 600; text-align: right; }

.toc-card ol { margin: 0; padding-left: 18px; font-size: 14px; }
.toc-card li { margin: 5px 0; }
.toc-card a { color: var(--ink-soft); text-decoration: none; }
.toc-card a:hover { color: var(--lapis); text-decoration: underline; }

/* ---------- Share row ---------- */
.share-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 46px 0 8px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.share-row .share-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-right: 4px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.share-btn svg { width: 17px; height: 17px; fill: currentColor; }
.share-btn:hover { background: var(--ink); color: var(--stone); border-color: var(--ink); }
.share-btn.copy { font-family: var(--font-mono); }
.share-btn.copy.copied { background: var(--olive); color: #fff; border-color: var(--olive); }

/* ---------- Related reading ---------- */
.related-reading {
  margin-top: 20px;
}
.related-reading h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.related-reading ul { list-style: none; padding: 0; margin: 0; }
.related-reading li { border-top: 1px solid var(--line); }
.related-reading a {
  display: block;
  padding: 11px 0;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.related-reading a:hover { color: var(--lapis); }

/* =========================================================================
   HOME PAGE
   ========================================================================= */
.home-hero {
  padding: 54px 0 10px;
}
.home-hero .kicker {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.home-hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(36px, 6vw, 62px);
  line-height: 1.03;
  margin: 14px 0 0;
  max-width: 16ch;
}
.home-hero .lede {
  font-size: 19px;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 20px 0 0;
}
.home-hero .cta-row { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary { background: var(--ink); color: var(--stone); }
.btn-primary:hover { background: var(--lapis-deep); color: var(--stone); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 64px 0 22px;
  flex-wrap: wrap;
}
.section-head .eyebrow { margin-top: 0; }
.section-head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin: 4px 0 0;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  align-items: center;
}
.featured-card .fc-frame { aspect-ratio: 8/3; background: var(--stone-dim); }
.featured-card .fc-frame img { width: 100%; height: 100%; object-fit: cover; }
.featured-card[data-hero-missing] .fc-frame { display: none; }
.featured-card .fc-body { padding: 30px 34px 30px 0; }
.featured-card[data-hero-missing] .fc-body { padding-left: 34px; }
.featured-card h3 { font-family: var(--font-display); font-size: 24px; margin: 6px 0 10px; }
.featured-card p { color: var(--ink-soft); margin: 0 0 16px; }

@media (max-width: 760px) {
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .fc-body { padding: 24px !important; }
}

.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin: 24px 0 10px;
}
.principle {
  border-top: 3px solid var(--gold);
}
.principle:nth-child(2) { border-top-color: var(--lapis); }
.principle:nth-child(3) { border-top-color: var(--olive); }
.principle h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 14px 0 6px; }
.principle p { color: var(--ink-soft); font-size: 15px; margin: 0; }

@media (max-width: 760px) {
  .principles-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer {
  background: var(--ink);
  color: rgba(239,232,216,0.82);
  margin-top: 70px;
}
.site-footer .wrap { padding: 46px 24px 30px; }
.site-footer .foot-top {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(239,232,216,0.16);
}
.site-footer .foot-brand { max-width: 340px; }
.site-footer .foot-brand .logo { color: var(--stone); }
.site-footer .foot-brand p { color: rgba(239,232,216,0.62); font-size: 14.5px; margin-top: 10px; }
.site-footer .foot-note {
  padding-top: 22px;
  font-size: 13px;
  color: rgba(239,232,216,0.5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer .foot-note a { color: rgba(239,232,216,0.65); }

/* =========================================================================
   MOBILE DRAWER NAV
   ========================================================================= */
.drawer {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 60;
  padding: 20px 24px;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer .drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.drawer nav { display: flex; flex-direction: column; gap: 4px; }
.drawer nav a {
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-weight: 500;
}
.drawer-close {
  width: 38px; height: 38px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
}
