/* ==========================================================================
   blondinblue Ghost Theme — screen.css
   Dark classical newspaper / Mackintosh aesthetic
   Fonts: Hill House (display) · EB Garamond (body)
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Self-hosted fonts
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Hill House';
  src: url('../fonts/hill-house.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   1. Reset & box model
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* --------------------------------------------------------------------------
   2. CSS custom properties
   -------------------------------------------------------------------------- */

:root {
  /* Both modes are handled natively — tells browsers & extensions not to override */
  color-scheme: light dark;

  /* Palette — light mode (warm vanilla) */
  --bg:           #f6f1e6;
  --bg-raised:    #ece7db;
  --bg-card:      #eae5d9;
  --ink:          #2c1a0e;
  --ink-dim:      rgba(44, 26, 14, 0.5);
  --ink-muted:    rgba(44, 26, 14, 0.28);
  --rose:         #b05a61;
  --rose-dim:     rgba(176, 90, 97, 0.3);
  --rule:         rgba(44, 26, 14, 0.1);
  --rule-strong:  rgba(44, 26, 14, 0.2);

  /* Typography */
  --font-display: 'Hill House', sans-serif;
  --font-body:    'EB Garamond', 'Georgia', serif;

  /* Layout */
  --max-width:     1280px;
  --content-width: 720px;
  --gutter:        clamp(1.25rem, 4vw, 3rem);
  --col-gap:       clamp(1rem, 2.5vw, 2rem);

  /* Transitions */
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #160408;
    --bg-raised:    #1e080e;
    --bg-card:      #1a060c;
    --ink:          #e8e2d9;
    --ink-dim:      rgba(232, 226, 217, 0.45);
    --ink-muted:    rgba(232, 226, 217, 0.22);
    --rose:         #c4737a;
    --rose-dim:     rgba(196, 115, 122, 0.35);
    --rule:         rgba(232, 226, 217, 0.1);
    --rule-strong:  rgba(232, 226, 217, 0.22);
  }
}

/* --------------------------------------------------------------------------
   3. Base
   -------------------------------------------------------------------------- */

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(17px, 1.2vw, 19px);
  line-height: 1.7;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

#main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
}

/* --------------------------------------------------------------------------
   4. Corner ornaments (shared with landing page)
   -------------------------------------------------------------------------- */

.corner {
  position: absolute;
  width: 52px;
  height: 52px;
  opacity: 0.45;
  pointer-events: none;
}

.corner-tl { top: 1rem; left: 1rem; }
.corner-tr { top: 1rem; right: 1rem; transform: scaleX(-1); }
.corner-bl { bottom: 1rem; left: 1rem; transform: scaleY(-1); }
.corner-br { bottom: 1rem; right: 1rem; transform: scale(-1); }

/* --------------------------------------------------------------------------
   5. Rule system
   -------------------------------------------------------------------------- */

.masthead-rule,
.home-rule,
.footer-rule {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 var(--gutter);
}

.rule-line {
  display: block;
  height: 1px;
  background: var(--rule-strong);
}

.rule-line.rule-thick {
  height: 2px;
  background: var(--ink-dim);
}

.rule-line.rule-thin {
  height: 1px;
  background: var(--rule);
}

.home-rule {
  margin: 2rem var(--gutter);
}

/* --------------------------------------------------------------------------
   6. Site header / masthead
   -------------------------------------------------------------------------- */

.site-header {
  position: relative;
  background: var(--bg);
  overflow: hidden;
  width: 100%;
}

.masthead {
  position: relative;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem var(--gutter) 0;
}

.masthead-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 1rem;
  padding-bottom: 1.25rem;
}

.masthead-meta {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.masthead-meta--right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.masthead-meta a {
  color: var(--ink-dim);
  transition: color var(--transition);
}
.masthead-meta a:hover {
  color: var(--rose);
}

.masthead-title-wrap {
  text-align: center;
}

.masthead-date {
  display: block;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.masthead-title {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
  -webkit-text-stroke: 0.35px var(--ink);
  transition: color var(--transition);
}
.masthead-title:hover {
  color: var(--rose);
  -webkit-text-stroke-color: var(--rose);
}

.masthead-tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-dim);
  letter-spacing: 0.12em;
  margin-top: 0.35rem;
}

/* --------------------------------------------------------------------------
   7. Navigation
   -------------------------------------------------------------------------- */

/* site-nav is the centering flex row; ul + search button are siblings in it */
.site-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: 0.6rem 0 0.75rem;
}

/* Ghost renders <ul class="nav"> from {{navigation}} */
.site-nav .nav,
.site-nav ul {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav .nav li a,
.site-nav ul li a {
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 1.1vw, 0.9rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  position: relative;
  transition: color var(--transition);
}

.site-nav .nav li a::after,
.site-nav ul li a::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -0.25em;
  height: 1px;
  background: var(--rose);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-nav .nav li a:hover,
.site-nav ul li a:hover,
.site-nav .nav .nav-current a,
.site-nav ul .nav-current a {
  color: var(--ink);
}

.site-nav .nav .nav-current a,
.site-nav ul .nav-current a {
  font-weight: 700;
}

.site-nav .nav li a:hover::after,
.site-nav ul li a:hover::after,
.site-nav .nav .nav-current a::after,
.site-nav ul .nav-current a::after {
  transform: scaleX(1);
}

.masthead-rule--bottom {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   8. Section labels
   -------------------------------------------------------------------------- */

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.section-label::before,
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.section-label-text {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rose);
}

/* --------------------------------------------------------------------------
   9. Post cards — shared styles
   -------------------------------------------------------------------------- */

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  transition: border-color var(--transition), transform var(--transition);
  position: relative;
}

.post-card:hover {
  border-color: var(--rose-dim);
  transform: translateY(-2px);
}

/* Expand title link to cover entire card; tag/footer links sit above it */
.post-card-title a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
}

.post-card-image-link,
.post-card-tag,
.post-card-footer a {
  position: relative;
  z-index: 1;
}

.post-card-image-link {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.post-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}


.post-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem 1.4rem 1.4rem;
  gap: 0.5rem;
}

.post-card-tag {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--rose);
  transition: opacity var(--transition);
}
.post-card-tag:hover { opacity: 0.75; }

.post-card-title {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: var(--ink);
  margin-top: 0.15rem;
  text-transform: uppercase;
}

.post-card-title a {
  transition: color var(--transition);
}
.post-card-title a:hover { color: var(--rose); }

.post-card-excerpt {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink-dim);
  line-height: 1.6;
  flex: 1;
}

.post-card-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.post-card-byline a {
  color: var(--ink-dim);
  transition: color var(--transition);
}
.post-card-byline a:hover { color: var(--rose); }

.post-card-footer .post-card-date,
.post-card-footer .post-card-reading-time {
  margin-left: auto;
}
.post-card-footer .post-card-date + .post-card-reading-time {
  margin-left: 0;
}
.post-card-footer > * + *::before {
  content: '·';
  margin-right: 0.4rem;
}

/* --------------------------------------------------------------------------
   10. Featured post card
   -------------------------------------------------------------------------- */

.post-card--featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  min-height: 380px;
}

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

.post-card--featured .post-card-content {
  padding: 2rem 2.25rem 2.25rem;
  justify-content: center;
  gap: 0.75rem;
}

.post-card-title--featured {
  font-size: clamp(1.5rem, 3.5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: 0.06em;
}

.post-card--featured .post-card-excerpt {
  font-size: 1rem;
  line-height: 1.65;
}

.post-card--no-image.post-card--featured {
  grid-template-columns: 1fr;
}

/* --------------------------------------------------------------------------
   11. Homepage grid layouts
   -------------------------------------------------------------------------- */

.home-featured {
  margin-bottom: 2rem;
}

.home-secondary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--col-gap);
  margin-bottom: 2rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
}

/* --------------------------------------------------------------------------
   12. Pagination
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.pagination .older-posts,
.pagination .newer-posts {
  color: var(--ink-dim);
  transition: color var(--transition);
}

.pagination .older-posts:hover,
.pagination .newer-posts:hover {
  color: var(--rose);
}

.pagination .page-number {
  color: var(--ink-muted);
  font-size: 0.7rem;
}

/* --------------------------------------------------------------------------
   13. Single post — header
   -------------------------------------------------------------------------- */

.post-wrap {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.post-section-label {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 1rem;
  transition: opacity var(--transition);
}
.post-section-label:hover { opacity: 0.75; }

.post-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 3.4rem);
  letter-spacing: 0.06em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1rem;
  -webkit-text-stroke: 0.3px var(--ink);
  text-transform: uppercase;
}

.post-standfirst {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  color: var(--ink-dim);
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto 1.25rem;
}

.post-meta-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--rose-dim);
}

.post-meta-rule::before,
.post-meta-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  max-width: 120px;
  background: var(--rule);
}

.rule-ornament {
  font-size: 1rem;
  color: var(--rose);
  opacity: 0.7;
  line-height: 1;
}

.post-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.post-meta a {
  color: var(--ink-dim);
  transition: color var(--transition);
}
.post-meta a:hover { color: var(--rose); }

.post-meta-sep { color: var(--ink-muted); }

/* --------------------------------------------------------------------------
   14. Feature image
   -------------------------------------------------------------------------- */

.post-feature-image {
  max-width: var(--max-width);
  margin: 0 auto 2.5rem;
  border: 1px solid var(--rule);
  overflow: hidden;
}

.post-feature-image img {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: cover;
}

.post-feature-image figcaption {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-align: center;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--rule);
}

/* --------------------------------------------------------------------------
   15. Post content — prose
   -------------------------------------------------------------------------- */

.post-content.gh-content {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.25vw, 1.15rem);
  line-height: 1.8;
  color: var(--ink);
}

/* Drop cap on first paragraph — EB Garamond 800 for a proper press cut */
.post-content.gh-content > p:first-of-type::first-letter {
  font-family: var(--font-body);
  font-size: 4.5em;
  font-weight: 800;
  font-style: normal;
  float: left;
  line-height: 0.8;
  margin: 0.05em 0.1em -0.05em 0;
  color: var(--rose);
  letter-spacing: -0.02em;
}

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

.post-content.gh-content h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 2.25em 0 0.7em;
  line-height: 1.2;
}

.post-content.gh-content h3 {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 2em 0 0.5em;
}

.post-content.gh-content h4,
.post-content.gh-content h5,
.post-content.gh-content h6 {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink-dim);
  margin: 1.75em 0 0.4em;
}

.post-content.gh-content strong {
  font-weight: 600;
  color: var(--ink);
}

.post-content.gh-content em {
  font-style: italic;
  color: var(--ink-dim);
}

.post-content.gh-content a {
  color: var(--rose);
  border-bottom: 1px solid var(--rose-dim);
  transition: border-color var(--transition), color var(--transition);
}
.post-content.gh-content a:hover {
  border-color: var(--rose);
}

.post-content.gh-content ul,
.post-content.gh-content ol {
  list-style: none;
  margin: 1.25em 0;
  padding-left: 1.5rem;
}

.post-content.gh-content ul li,
.post-content.gh-content ol li {
  margin-bottom: 0.5em;
  position: relative;
}

.post-content.gh-content ul li::before {
  content: '—';
  position: absolute;
  left: -1.5rem;
  color: var(--rose);
  font-size: 0.85em;
}

.post-content.gh-content ol {
  counter-reset: ol-counter;
}
.post-content.gh-content ol li {
  counter-increment: ol-counter;
}
.post-content.gh-content ol li::before {
  content: counter(ol-counter) '.';
  position: absolute;
  left: -1.75rem;
  color: var(--ink-dim);
  font-style: italic;
  font-size: 0.85em;
}

.post-content.gh-content hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5em auto;
  width: 40%;
}

.post-content.gh-content blockquote {
  margin: 2em 0;
  padding: 1.25em 1.75em;
  border-left: 2px solid var(--rose);
  background: var(--bg-raised);
  font-style: italic;
  font-weight: 600;
  font-size: 1.15em;
  color: var(--ink-dim);
  line-height: 1.7;
}

.post-content.gh-content blockquote p:last-child {
  margin-bottom: 0;
}

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

.post-content.gh-content figure img {
  border: 1px solid var(--rule);
}

.post-content.gh-content figcaption {
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 0.5em;
}

.post-content.gh-content code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 0.15em 0.4em;
  border-radius: 2px;
  color: var(--rose);
}

.post-content.gh-content pre {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 1.25em 1.5em;
  overflow-x: auto;
  margin: 1.5em 0;
  border-radius: 2px;
}

.post-content.gh-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-dim);
  font-size: 0.82rem;
  line-height: 1.65;
}

/* Ghost cards */
.post-content.gh-content .kg-image-card {
  margin: 2em 0;
}

.post-content.gh-content .kg-width-wide {
  width: calc(100% + 160px);
  margin-left: -80px;
}

.post-content.gh-content .kg-width-full {
  width: calc(100vw - 2 * var(--gutter));
  margin-left: calc(50% - 50vw + var(--gutter));
}

.post-content.gh-content .kg-gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 2em 0;
}

.post-content.gh-content .kg-gallery-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.post-content.gh-content .kg-bookmark-card {
  border: 1px solid var(--rule);
  background: var(--bg-raised);
  margin: 2em 0;
}

.post-content.gh-content .kg-bookmark-container {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 1rem 1.25rem;
  color: inherit;
}

.post-content.gh-content .kg-bookmark-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--ink);
}

.post-content.gh-content .kg-bookmark-description {
  font-size: 0.82rem;
  color: var(--ink-dim);
  margin-top: 0.3em;
}

.post-content.gh-content .kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5em;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.post-content.gh-content .kg-bookmark-thumbnail {
  width: 120px;
  aspect-ratio: 4/3;
  overflow: hidden;
  flex-shrink: 0;
}

.post-content.gh-content .kg-bookmark-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   16. Post footer
   -------------------------------------------------------------------------- */

.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.post-footer-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--rose-dim);
}
.post-footer-rule::before,
.post-footer-rule::after {
  content: '';
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: var(--rule);
}

.post-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.post-tag {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--rule);
  padding: 0.3em 0.8em;
  transition: border-color var(--transition), color var(--transition);
}
.post-tag:hover {
  border-color: var(--rose-dim);
  color: var(--rose);
}

.post-share-link {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--rule);
  padding: 0.45em 1.4em;
  display: inline-block;
  transition: border-color var(--transition), color var(--transition);
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.post-share-link:hover {
  border-color: var(--rose-dim);
  color: var(--rose);
}

/* --------------------------------------------------------------------------
   17. Post navigation
   -------------------------------------------------------------------------- */

.post-nav {
  max-width: var(--content-width);
  margin: 2.5rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.post-nav-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.post-nav-item--next {
  text-align: right;
}

.post-nav-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rose);
}

.post-nav-title {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--ink-dim);
  line-height: 1.4;
  transition: color var(--transition);
}
.post-nav-item:hover .post-nav-title {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   18. Archive pages (tag / author)
   -------------------------------------------------------------------------- */

.archive-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
}

.archive-header {
  text-align: center;
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}

.archive-type {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--rose);
  display: block;
  margin-bottom: 0.75rem;
}

.archive-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 2.75rem);
  letter-spacing: 0.1em;
  color: var(--ink);
}

.archive-description {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-dim);
  max-width: 480px;
  margin: 0.75rem auto 0;
  line-height: 1.6;
}

.archive-author-image {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule);
  margin: 0 auto 0.75rem;
}

/* --------------------------------------------------------------------------
   19. Error page
   -------------------------------------------------------------------------- */

.error-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}

.error-inner {
  max-width: 480px;
}

.error-code {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 400;
  letter-spacing: 0.25em;
  color: var(--rose);
  display: block;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.error-message {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  letter-spacing: 0.1em;
  color: var(--ink);
  margin: 1rem 0 0.75rem;
}

.error-description {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.error-home {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--rule);
  padding: 0.5em 1.5em;
  display: inline-block;
  transition: border-color var(--transition), color var(--transition);
}
.error-home:hover {
  border-color: var(--rose-dim);
  color: var(--rose);
}

/* --------------------------------------------------------------------------
   20. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: auto;
  background: var(--bg);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter) 2rem;
}

.footer-body {
  position: relative;
  text-align: center;
  padding: 2rem 2.5rem;
}

.footer-title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: block;
  margin-bottom: 0.6rem;
  transition: color var(--transition);
}
.footer-title:hover { color: var(--rose); }

.footer-copy {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.footer-copy a {
  color: var(--ink-muted);
  transition: color var(--transition);
}
.footer-copy a:hover { color: var(--rose); }

.footer-powered {
  font-family: var(--font-body);
  font-size: 0.68rem;
  color: var(--rule-strong);
  margin-top: 0.4rem;
}

.footer-powered a {
  color: var(--rule-strong);
  transition: color var(--transition);
}
.footer-powered a:hover { color: var(--ink-muted); }

/* --------------------------------------------------------------------------
   21. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .home-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 860px) {
  .post-card--featured {
    grid-template-columns: 1fr;
  }

  .post-card--featured .post-card-image-link {
    aspect-ratio: 16 / 9;
    min-height: unset;
    height: auto;
  }

  .home-secondary {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .masthead-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.5rem;
    text-align: center;
  }

  .masthead-meta--right {
    align-items: center;
    flex-direction: row;
    gap: 0.75rem;
  }
}

@media (max-width: 768px) {
  .home-secondary,
  .home-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .post-nav-inner {
    grid-template-columns: 1fr;
  }

  .post-nav-item--next {
    text-align: left;
  }

}

/* --------------------------------------------------------------------------
   22. Overflow containment
   -------------------------------------------------------------------------- */

/* Prevent horizontal scroll at the viewport level.
   Only html needs this; applying to body too causes Safari quirks. */
html {
  overflow-x: hidden;
}

/* Grid children: allow columns to shrink below their min-content size,
   preventing a wide child from blowing out a 1fr column. */
.home-secondary > *,
.home-grid > *,
.post-nav-inner > * {
  min-width: 0;
}

/* Display text with large letter-spacing: cap at container width */
.masthead-title,
.footer-title {
  max-width: 100%;
}

/* Post navigation titles: long titles should wrap, not overflow */
.post-nav-title {
  overflow-wrap: break-word;
}

/* Ghost bleed cards: kg-width-wide bleeds 80 px each side of the content
   column. Reset when the viewport is too narrow to absorb that bleed
   (~content-width + 160px + 2×gutter ≈ 960 px). */
@media (max-width: 960px) {
  .post-content.gh-content .kg-width-wide {
    width: 100%;
    margin-left: 0;
  }
}

/* Narrow viewport: reduce masthead font and tighten padding.
   650px covers the dead zone where clamp(2.2rem, 6vw, …) stops scaling
   (~623px) but the 500px breakpoint hasn't yet kicked in. */
@media (max-width: 650px) {
  .masthead-title {
    font-size: clamp(1.5rem, 7.5vw, 2.2rem);
    letter-spacing: clamp(0.08em, 0.5vw, 0.12em);
  }

  .masthead {
    padding-left: clamp(1rem, 5vw, var(--gutter));
    padding-right: clamp(1rem, 5vw, var(--gutter));
  }
}

/* --------------------------------------------------------------------------
   23. Site search button (nav)
   -------------------------------------------------------------------------- */

.site-search-btn {
  background: none;
  border: none;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--ink-dim);
  transition: color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-search-btn:hover { color: var(--rose); }

.site-search-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

/* --------------------------------------------------------------------------
   24. Search modal
   -------------------------------------------------------------------------- */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  padding-left: 1rem;
  padding-right: 1rem;
}

.search-modal[hidden] { display: none; }

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.search-panel {
  position: relative;
  width: min(620px, 100%);
  max-height: 72vh;
  background: var(--bg-raised);
  border: 1px solid var(--rule-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
}

.search-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}

.search-panel-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--ink-dim);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  min-width: 0;
}

.search-input::placeholder { color: var(--ink-muted); }

/* Remove browser-native clear button */
.search-input::-webkit-search-cancel-button { display: none; }

.search-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  flex-shrink: 0;
  transition: color var(--transition);
}

.search-close-btn:hover { color: var(--ink); }

.search-close-btn svg {
  width: 0.8rem;
  height: 0.8rem;
}

.search-results {
  overflow-y: auto;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result {
  display: block;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: background var(--transition);
  outline: none;
}

.search-result:last-child { border-bottom: none; }

.search-result:hover,
.search-result:focus,
.search-result[aria-selected="true"] {
  background: var(--bg-card);
}

.search-result-tag {
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--rose);
  margin-bottom: 0.2rem;
}

.search-result-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.search-result-excerpt {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--ink-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-hint,
.search-empty {
  padding: 1.75rem 1.1rem;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-muted);
  flex-shrink: 0;
}
