/* ============================================================
   THE HERODOT — Shared Stylesheet
   Inspired by The New York Times: clean rules, tight typography,
   monochrome palette, Cheltenham-style serif headlines.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,700;0,900;1,400;1,700&display=swap');

:root {
  --serif-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --serif-body: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --black: #121212;
  --dark: #333;
  --gray: #5a5a5a;
  --mid: #888;
  --light: #999;
  --faint: #bbb;
  --rule: #e2e2e2;
  --rule-dark: #ccc;
  --bg: #fff;
  --bg-alt: #f7f7f5;
  --link: #326891;
  --accent: #722F37;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--serif-body);
  color: var(--black);
  background: var(--bg);
  margin: 0;
  padding: 0;
  line-height: 1.62;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ========================
   TOP BAR  (date + login)
   ======================== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 20px;
  font-family: var(--sans);
  font-size: 0.6875rem;
  color: var(--gray);
  letter-spacing: 0.02em;
}
.top-bar a { color: var(--gray); }
.top-bar a:hover { color: var(--black); text-decoration: none; }

/* ========================
   HEADER / MASTHEAD
   ======================== */
.site-header {
  text-align: center;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.masthead {
  padding: 18px 0 6px;
  border-bottom: 2px solid var(--black);
}
.masthead h1 {
  font-family: var(--serif-display);
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--black);
  margin: 0;
}
.masthead h1 a { color: var(--black); text-decoration: none; }
.masthead h1 a:hover { text-decoration: none; }
.masthead .tagline {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--gray);
  margin: 5px 0 0;
}

/* ========================
   NAVIGATION
   ======================== */
nav.site-nav {
  padding: 9px 0;
}
nav.site-nav .nav-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}
nav.site-nav a {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dark);
  text-decoration: none;
  padding: 3px 14px;
  transition: color 0.15s;
}
nav.site-nav a:hover { color: var(--black); text-decoration: none; }
nav.site-nav a.active {
  color: var(--black);
  font-weight: 700;
  border-bottom: 2px solid var(--black);
  padding-bottom: 1px;
}

/* ========================
   CONTENT WRAPPER
   ======================== */
.content-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========================
   HOMEPAGE — FRONT PAGE
   ======================== */

/* Section label */
.section-rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0;
}
.section-rule-heavy {
  border: none;
  border-top: 3px solid var(--black);
  margin: 0;
}

/* Epigraph / edition header */
.edition-header {
  text-align: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
  background: var(--bg-alt);
}
.edition-header .epigraph {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--gray);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* Lead story */
.lead-story {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--rule);
}
.lead-story .lead-main {
  flex: 3;
  padding: 1.75rem 2rem 1.75rem 0;
  border-right: 1px solid var(--rule);
}
.lead-story .lead-sidebar {
  flex: 2;
  padding: 1.75rem 0 1.75rem 2rem;
}

.story-label {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 2px 0 6px;
}

.lead-main h2 {
  font-family: var(--serif-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 0.5rem;
}
.lead-main h2 a { color: var(--black); }
.lead-main h2 a:hover { text-decoration: underline; }

.lead-main .lede {
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--dark);
  margin-bottom: 0.6rem;
}

.story-byline {
  font-family: var(--sans);
  font-size: 0.6875rem;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Sidebar story items */
.sidebar-story {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.sidebar-story:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.sidebar-story h3 {
  font-family: var(--serif-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.3rem;
}
.sidebar-story h3 a { color: var(--black); }
.sidebar-story h3 a:hover { text-decoration: underline; }
.sidebar-story .subtitle {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--gray);
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

/* Desk grid (lower section) */
.desk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.desk-card {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--rule);
}
/* vertical rules between columns */
.desk-card:nth-child(3n+2) {
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}
.desk-card .desk-name {
  font-family: var(--sans);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 2px 0 6px;
}
.desk-card h3 {
  font-family: var(--serif-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.35rem;
}
.desk-card h3 a { color: var(--black); }
.desk-card h3 a:hover { text-decoration: underline; }
.desk-card .subtitle {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--gray);
  line-height: 1.35;
  margin: 0 0 0.35rem;
}
.desk-card .story-byline {
  margin-top: 4px;
}

/* About / intro */
.about-section {
  padding: 2rem 0;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.about-section h3 {
  font-family: var(--serif-display);
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.about-section p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--dark);
  margin-bottom: 0.8rem;
}
.about-section .pronunciation {
  font-size: 0.8125rem;
  color: var(--light);
  margin-top: 1rem;
}

/* ========================
   ARTICLE PAGE
   ======================== */
.article-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 20px 3rem;
}

.article-header {
  margin-bottom: 1.5rem;
}
.article-header .desk-label {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.article-header .desk-label a { color: var(--gray); }
.article-header .desk-label a:hover { color: var(--black); text-decoration: underline; }

.article-header h1 {
  font-family: var(--serif-display);
  font-size: 2.375rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.005em;
  margin: 0.5rem 0;
  color: var(--black);
}

.article-header .subtitle {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 1.1875rem;
  color: var(--gray);
  line-height: 1.35;
  margin: 0 0 1rem;
}

.article-header .byline {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--mid);
  padding: 0.65rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.article-body {
  margin-top: 1.5rem;
}
.article-body p {
  margin-bottom: 1.25rem;
}
.article-body a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--rule-dark);
  text-underline-offset: 2px;
}
.article-body a:hover {
  text-decoration-color: var(--link);
}
.article-body blockquote {
  border-left: 3px solid var(--rule-dark);
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--dark);
  font-style: italic;
}
.article-body pre {
  background: var(--bg-alt);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  border: 1px solid var(--rule);
  line-height: 1.5;
}
.article-body code {
  font-size: 0.9em;
}
.article-body h2 {
  font-family: var(--serif-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
}

.article-sources {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.article-sources h3 {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--light);
  margin-bottom: 0.5rem;
}
.article-sources ul { padding-left: 1.2rem; }
.article-sources li { margin-bottom: 0.35rem; font-size: 0.9375rem; }
.article-sources a { color: var(--link); }

.article-nav {
  margin-top: 2rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--mid);
  display: flex;
  gap: 1.5rem;
}
.article-nav a { color: var(--link); }

/* ========================
   DESK PAGE (redirect shell)
   ======================== */
.desk-loading {
  max-width: 680px;
  margin: 5rem auto;
  padding: 0 20px;
  text-align: center;
  color: var(--light);
  font-style: italic;
}

/* Hidden article list (data for redirect JS) */
.desk-data { display: none; }

/* Empty desk state */
.empty-desk {
  max-width: 680px;
  margin: 4rem auto;
  padding: 0 20px;
  text-align: center;
  color: var(--mid);
  font-style: italic;
  font-size: 1.0625rem;
}

/* ========================
   ARCHIVE PAGE
   ======================== */
.archive-wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 20px 3rem;
}
.archive-header {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--black);
}
.archive-header h2 {
  font-family: var(--serif-display);
  font-size: 2rem;
  font-weight: 700;
}

.search-bar {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--serif-body);
  font-size: 1rem;
  border: 1px solid var(--rule-dark);
  border-radius: 0;
  margin-bottom: 0.75rem;
  background: var(--bg);
  -webkit-appearance: none;
}
.search-bar:focus { outline: none; border-color: var(--black); }

.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--rule-dark);
  background: var(--bg);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dark);
  border-radius: 0;
  transition: all 0.15s;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--black);
  color: #fff;
  border-color: var(--black);
}

/* Archive uses same classes the publish script injects */
.article-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.article-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.article-list .article-meta {
  font-family: var(--sans);
  font-size: 0.6875rem;
  color: var(--light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.article-list .desk-tag {
  display: inline-block;
  background: var(--bg-alt);
  padding: 1px 6px;
  margin-left: 4px;
  font-size: 0.625rem;
}
.article-list .article-title {
  font-family: var(--serif-display);
  font-size: 1.1875rem;
  font-weight: 700;
  margin: 4px 0;
  line-height: 1.3;
}
.article-list .article-title a { color: var(--black); }
.article-list .article-title a:hover { color: var(--link); text-decoration: underline; }
.article-list .article-subtitle {
  font-style: italic;
  color: var(--gray);
  font-size: 0.9375rem;
  line-height: 1.35;
  margin: 2px 0;
}

/* Also style desk page article entries (same classes injected by publish script) */
.article-list .article-date {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================
   FOOTER
   ======================== */
footer {
  text-align: center;
  padding: 1.75rem 20px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.6875rem;
  color: var(--light);
  letter-spacing: 0.02em;
  margin-top: 2rem;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 900px) {
  .lead-story {
    flex-direction: column;
  }
  .lead-story .lead-main {
    padding: 1.5rem 0;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }
  .lead-story .lead-sidebar {
    padding: 1.5rem 0;
  }
  .desk-grid {
    grid-template-columns: 1fr 1fr;
  }
  .desk-card:nth-child(3n+2) {
    border-left: none;
    border-right: none;
  }
  .desk-card:nth-child(odd) {
    border-right: 1px solid var(--rule);
  }
}

@media (max-width: 600px) {
  .masthead h1 { font-size: 2rem; }
  .masthead .tagline { font-size: 0.75rem; }
  nav.site-nav a { padding: 3px 8px; font-size: 0.625rem; }
  .edition-header .epigraph { font-size: 0.9375rem; }
  .lead-main h2 { font-size: 1.5rem; }
  .desk-grid { grid-template-columns: 1fr; }
  .desk-card:nth-child(odd) { border-right: none; }
  .desk-card:nth-child(3n+2) { border-left: none; border-right: none; }
  .article-header h1 { font-size: 1.75rem; }
  .article-header .subtitle { font-size: 1.0625rem; }
  .top-bar { flex-direction: column; gap: 2px; text-align: center; }
}
