/* ── Self-hosted fonts ────────────────────────────────────── */

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/playfair-display-700-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/playfair-display-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Reset & variables ────────────────────────────────────── */

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

:root {
  --navy:       #1d2741;
  --navy-light: #263252;
  --red:        #c83232;
  --red-dark:   #a32828;
  --bg:         #f5f4f0;
  --card-bg:    #ffffff;
  --text:       #1a1a1a;
  --muted:      #666666;
  --muted-lt:   #999999;
  --border:     #ddd;
  --border-lt:  #eee;

  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    Georgia, 'Times New Roman', serif;
  --font-ui:      -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --wrap:    1140px;
  --reading: 740px;
  --gap:     1.5rem;
}

html { scroll-behavior: smooth; }

.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--accent, #000);
  color: #fff;
  font-weight: bold;
  z-index: 9999;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 0;
}

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

img, video, iframe, embed, object, figure { max-width: 100%; }
img { height: auto; display: block; }

/* ── Site-wide wrapper ────────────────────────────────────── */

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

/* ── Header ───────────────────────────────────────────────── */

.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 60px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.site-brand:hover { text-decoration: none; }

.site-logo {
  display: block;
  height: 34px;
  width: auto;
  background: #fff;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  box-sizing: content-box;
}

.site-brand__tag {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: nowrap;
}

.site-nav a {
  color: rgba(255,255,255,0.75);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.site-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────────── */

.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,0.55);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  margin-top: 4rem;
  padding: 1.5rem 0;
  text-align: center;
}

.site-footer a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}
.site-footer a:hover { color: #fff; text-decoration: none; }

.site-footer__links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ── Main content area ────────────────────────────────────── */

.site-main {
  padding: 2rem 0 3rem;
}

/* ── Page title (taxonomy / list pages) ───────────────────── */

.page-header {
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.page-header .page-count {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Beta notice ──────────────────────────────────────────── */

.beta-notice {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.5;
  background: #fff8e5;
  border-left: 4px solid var(--red);
  border-radius: 2px;
  padding: 0.75rem 1rem;
  margin: 0 0 1.5rem;
}

.beta-notice strong {
  color: var(--red-dark);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Homepage ─────────────────────────────────────────────── */

.home-intro {
  text-align: center;
  padding: 1.5rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.home-intro p {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  font-style: italic;
}

/* ── Post card grid ───────────────────────────────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-bottom: 2.5rem;
}

/* Hero card spans full row */
.post-card--hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: stretch;
}

.post-card--hero .card-image-wrap {
  aspect-ratio: unset;
  height: 100%;
  min-height: 280px;
}

.post-card--hero .card-image-wrap img {
  height: 100%;
  object-fit: cover;
}

.post-card--hero .card-body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-card--hero .card-title {
  font-size: 1.6rem;
}

.post-card--hero .card-excerpt {
  display: block;
}

/* Standard card */
.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s;
}

.post-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.card-image-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e0ddd5;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.post-card:hover .card-image-wrap img {
  transform: scale(1.03);
}

.card-body {
  padding: 1rem 1.1rem 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.4rem;
  text-decoration: none;
}
.card-category:hover { text-decoration: underline; }

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

.card-title a {
  color: var(--text);
  text-decoration: none;
}
.card-title a:hover { color: var(--red); text-decoration: none; }

.card-excerpt {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 0.75rem;
  display: none;
  flex: 1;
}

.card-meta {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--muted-lt);
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-meta .card-author { font-weight: 600; color: var(--muted); }
.card-meta time { }

/* ── Post page ────────────────────────────────────────────── */

.post-hero {
  width: 100%;
  max-height: 520px;
  overflow: hidden;
  background: #1a1a1a;
  margin-bottom: 0;
}

.post-hero img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  opacity: 0.9;
}

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

.post-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.post-kicker {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 0.6rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-kicker a {
  color: var(--red);
  text-decoration: none;
}
.post-kicker a:hover { text-decoration: underline; }

.post-kicker .kicker-sep { color: var(--border); font-weight: 400; }

.post-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--text);
}

.post-byline {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-byline .byline-author {
  font-weight: 600;
  color: var(--text);
}

.post-byline .byline-author a {
  color: var(--text);
  text-decoration: none;
}
.post-byline .byline-author a:hover { color: var(--red); }

.byline-sep { color: var(--border); }

.post-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #222;
}

.post-content p { margin: 0 0 1.4em; }

.post-content h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2em 0 0.6em;
  line-height: 1.25;
}

.post-content h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.75em 0 0.5em;
}

.post-content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 3px;
  margin: 1.5em 0;
}

.post-content blockquote {
  border-left: 3px solid var(--red);
  margin: 1.5em 0;
  padding: 0.5em 1.25em;
  color: #444;
  font-style: italic;
}

.post-content a { color: var(--red); }

.post-content figure {
  margin: 1.5em 0;
}

.post-content figcaption {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4em;
  text-align: center;
}

/* ── Post list (taxonomy pages) ───────────────────────────── */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-lt);
}

.post-list-item__thumb {
  flex: 0 0 120px;
  display: block;
}
.post-list-item__thumb img {
  display: block;
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 3px;
}

.post-list-item__body {
  flex: 1 1 0;
  min-width: 0;
}

.post-list-item__excerpt {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
  line-height: 1.5;
}

.post-list-item:first-child { border-top: 1px solid var(--border-lt); }

.post-list-item__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.25rem;
}

.post-list-item__title a {
  color: var(--text);
  text-decoration: none;
}
.post-list-item__title a:hover { color: var(--red); }

.post-list-item__meta {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--muted-lt);
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  align-items: center;
}

.post-list-item__meta > * + *::before {
  content: "·";
  margin: 0 0.4rem;
  color: var(--border);
}

.meta-author { font-weight: 600; color: var(--muted); }

/* ── Taxonomy index pages ─────────────────────────────────── */

.taxonomy-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.taxonomy-grid li {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.taxonomy-grid li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition: background 0.1s;
}

.taxonomy-grid li a:hover {
  background: #f0ede7;
  text-decoration: none;
  color: var(--red);
}

.taxonomy-grid .term-count {
  font-size: 0.78rem;
  color: var(--muted-lt);
  font-weight: 400;
}

/* ── Search ───────────────────────────────────────────────── */

.search-bar { margin-bottom: 1.5rem; }

.search-input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s;
  background: var(--card-bg);
}
.search-input-group:focus-within { border-color: var(--navy); }

#search-input {
  flex: 1;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-family: var(--font-ui);
  border: none;
  background: transparent;
  outline: none;
  min-width: 0;
}

.search-bar button[type="submit"] {
  padding: 0.7rem 1.25rem;
  font-size: 0.9rem;
  font-family: var(--font-ui);
  font-weight: 600;
  background: var(--navy);
  color: #fff;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.search-bar button[type="submit"]:hover { background: var(--navy-light); }

.search-count { font-family: var(--font-ui); font-size: 0.85rem; color: var(--muted); margin: 0 0 0.75rem; }
.search-empty { font-family: var(--font-ui); color: var(--muted); font-style: italic; }
.search-snippet {
  font-family: var(--font-ui);
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.5;
}

mark {
  background: #fff3b0;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Faceted filter ─────────────────────────────────────────── */

#filter-ui {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.75rem;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-lt);
}

.filter-panel-title {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0;
}

.filter-hint {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
}

.filter-group {
  margin-bottom: 1rem;
}
.filter-group:last-child { margin-bottom: 0; }

.filter-group__heading {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-lt);
  margin-bottom: 0.5rem;
}

.filter-group__selects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}

.facet-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.facet-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.facet-select {
  font-size: 0.85rem;
  font-family: var(--font-ui);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
  width: 100%;
  transition: border-color 0.15s;
}
.facet-select:focus { outline: none; border-color: var(--navy); }
.facet-select.is-active {
  border-color: var(--navy);
  background: #f0f3fa;
  font-weight: 600;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

#filter-status { color: var(--muted); }

#clear-filters {
  font-size: 0.78rem;
  font-family: var(--font-ui);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.65rem;
  cursor: pointer;
  color: var(--red);
  font-weight: 600;
}
#clear-filters:hover { background: #fdf0f0; border-color: var(--red); }

.no-results { font-family: var(--font-ui); color: var(--muted); font-style: italic; }
.no-results button {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ── Pagination ───────────────────────────────────────────── */

#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.pag-btn {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  cursor: pointer;
  color: #333;
}
.pag-btn:hover:not(:disabled) { background: #f0ede7; border-color: #bbb; }
.pag-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 900px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .post-card--hero { grid-template-columns: 1fr; }
  .post-card--hero .card-image-wrap { min-height: 200px; height: auto; }
  .post-card--hero .card-excerpt { display: block; }
  .post-title { font-size: 1.7rem; }
}

@media (max-width: 600px) {
  .post-grid { grid-template-columns: 1fr; }
  .site-nav a { padding: 0.4rem 0.4rem; font-size: 0.75rem; }
  .site-logo { height: 24px; padding: 0.25rem 0.35rem; }
  .site-brand { gap: 0.4rem; }
  .site-brand__tag { font-size: 0.95rem; }
  .post-title { font-size: 1.4rem; }
  .post-hero { max-height: 260px; }
  .post-hero img { max-height: 260px; }
  .taxonomy-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Taxonomy pagination ──────────────────────────────────── */

.pagination {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.pagination__prev,
.pagination__next {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--accent);
  text-decoration: none;
}

.pagination__next { margin-left: auto; }

/* ── Full-text search page (/search/) ── */

#search-ui {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.75rem;
}

#search-ui .search-bar { margin-bottom: 0.75rem; }

.search-options { margin: 0 0 0.75rem; }

.search-mode {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
}

.search-mode input { margin: 0; }

.search-options .filter-hint { margin: 0.35rem 0 0; }

.year-filter {
  border-top: 1px solid var(--border-lt);
  padding-top: 0.75rem;
}

.year-filter > summary {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--accent);
  cursor: pointer;
}

.year-filter__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.4rem 0.8rem;
  padding: 0.75rem 0 0.25rem;
}

.year-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  cursor: pointer;
}

.year-option input { margin: 0; }

.year-option__count {
  color: var(--muted-lt);
  font-size: 0.8rem;
}

.search-progress {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

/* Snippet pulled from the article body rather than the excerpt. */
.post-list-item__excerpt--body {
  border-left: 2px solid var(--border-lt);
  padding-left: 0.6rem;
}

@media (max-width: 600px) {
  #search-ui { padding: 0.85rem 1rem 1rem; }
  .year-filter__grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
