/*
Theme Name:   The Displacement Papers
Theme URI:    https://bryancharles.org
Description:  Child theme for The Displacement Papers — bryancharles.org
Author:       Bryan Charles
Template:     twentytwentyfive
Version:      1.0.0
Last updated: 2026-07-08 — mobile hero image placed between standfirst and category/date; hero uses explicit grid/flex placement for 3 sibling blocks.
*/

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Palette — warm light */
  --bg:           #ece5d3;
  --bg-card:      #f7f2e6;
  --bg-hover:     #efe8d6;
  --text:         #27221c;
  --text-muted:   #69604f;
  --text-faint:   #948a76;
  --accent:       #a3791e;
  --accent-dim:   #7a5d18;
  --border:       #d4c8ac;
  --border-light: #e2d9c2;

  /* Typography */
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-serif: 'EB Garamond', Georgia, serif;
  --font-mono:  'JetBrains Mono', 'Courier New', monospace;

  /* Scale */
  --max-w:      680px;
  --max-w-wide: 1100px;
  --radius:     2px;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

img { max-width: 100%; display: block; }

/* ============================================================
   GOOGLE FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.site-header__brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
}

.site-header__title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}

.site-header__tagline {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover,
.site-nav a.current-menu-item {
  color: var(--text);
  background: var(--bg-hover);
}

.site-nav .nav-subscribe {
  color: var(--bg);
  background: var(--accent);
  margin-left: 0.5rem;
  font-weight: 600;
}

.site-nav .nav-subscribe:hover {
  background: var(--accent-dim);
  color: var(--text);
}

/* ============================================================
   TICKER (Latest bar)
   ============================================================ */
.site-ticker {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: 36px;
  display: flex;
  align-items: center;
}

.site-ticker__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 1.25rem;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.site-ticker__track {
  display: flex;
  gap: 0;
  animation: ticker 42s linear infinite;
  white-space: nowrap;
}

.site-ticker__item {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 2rem;
  border-right: 1px solid var(--border-light);
}

.site-ticker__item strong {
  color: var(--text);
  font-weight: 500;
}

@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.site-ticker:hover .site-ticker__track {
  animation-play-state: paused;
}

/* ============================================================
   LAYOUT WRAPPER
   ============================================================ */
.site-main {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* ============================================================
   HERO POST (lead article — homepage)
   ============================================================ */
/* Hero now has THREE direct children — .post-hero__content,
   .post-hero__meta and .post-hero__visual (meta was moved out of
   content on 08 July 2026 so it can be reordered on mobile).
   Desktop: 2-column grid. Left column holds content (row 1) and meta
   (row 2); the visual spans both rows in the right column. */
.post-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  column-gap: 3rem;
  row-gap: 1.5rem;
  align-items: start;
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.post-hero__content { grid-column: 1; grid-row: 1; }
.post-hero__meta    { grid-column: 1; grid-row: 2; }
.post-hero__visual  { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

.post-hero__eyebrow {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.post-hero__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.post-hero__issue {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.post-hero__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.post-hero__title a,
.post-hero__title a:link,
.post-hero__title a:visited {
  color: var(--text) !important;
  text-decoration: none !important;
}

.post-hero__title a:hover,
.post-hero__title a:focus {
  color: var(--accent) !important;
}

.post-hero__excerpt {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1.5rem;
}

.post-hero__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   TAGS / CATEGORY PILLS
   ============================================================ */
.tag-pill {
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

.tag-pill:hover { border-color: var(--accent); color: var(--accent); }

/* Category colour coding */
.tag-pill[data-cat="development"] { border-color: #2f6b45; color: #2f6b45; }
.tag-pill[data-cat="deployment"]  { border-color: #2d4d7c; color: #2d4d7c; }
.tag-pill[data-cat="advantages"]  { border-color: #7c6a3a; color: var(--accent); }
.tag-pill[data-cat="dangers"]     { border-color: #9c2e2e; color: #9c2e2e; }

.post-meta-dot {
  color: var(--text-faint);
  font-size: 0.6rem;
}

.post-meta-date,
.post-meta-read {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============================================================
   HERO VISUAL (right column — homepage featured image)
   ============================================================ */
.post-hero__visual {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Featured image fills the hero visual container */
.post-hero__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Humanoid SVG figure overlay — CSS drawn */
.hero-figure {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-stat {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(28, 24, 18, 0.85);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  text-align: right;
}

.hero-stat__number {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}

.hero-stat__label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.hero-status {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.hero-status__label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
}

.hero-status__value {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ============================================================
   POST GRID (below hero)
   ============================================================ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-left: 1px solid var(--border);
  margin: 3rem 0;
}

.post-card {
  padding: 1.75rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  text-decoration: none;
  display: block;
}

.post-card:hover { background: var(--bg-hover); }

/* ------------------------------------------------------------
   Non-lead card thumbnail layout (added 08 July 2026)
   Cards WITH a featured image become a row: small thumb left,
   text right. Cards without one keep the original block layout.
   ------------------------------------------------------------ */
.post-card__thumb {
  flex: 0 0 84px;              /* fixed small thumb column */
  width: 84px;
  height: 84px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

.post-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.post-card--has-thumb {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.post-card__body { min-width: 0; }   /* allows long titles to wrap inside flex */
/* End non-lead card thumbnail layout */

.post-card__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.post-card__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.post-card a,
.post-card a:link,
.post-card a:visited,
.post-card a:hover {
  color: inherit;
  text-decoration: none;
}

.post-card__excerpt {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.post-card__meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ============================================================
   SINGLE POST
   ============================================================ */
.post-single {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.post-single__eyebrow {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.post-single__title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.post-single__lede {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

/* Featured image — single post (added 22 June 2026) */
.post-single__featured-image {
  margin: 0 0 2.5rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.post-single__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  object-position: center;
}

/* Post body */
.post-body p       { margin-bottom: 1.5rem; }
.post-body h2      { font-family: var(--font-sans); font-size: 1rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 2.5rem 0 1rem; }
.post-body h3      { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 400; color: var(--text); margin: 2rem 0 0.75rem; }
.post-body a       { color: var(--accent); border-bottom: 1px solid var(--accent-dim); }
.post-body a:hover { color: var(--text); border-color: var(--text); }
.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-style: italic;
}
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--bg-card);
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
  color: var(--accent);
}

/* Post navigation (prev / home / next) — added 30 June 2026 */
.post-single__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

.post-single__nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.post-single__nav a:hover {
  color: var(--accent);
}

.post-single__nav-home {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.post-single__nav-prev { text-align: left; flex: 1; }
.post-single__nav-next { text-align: right; flex: 1; }
/* End post navigation */

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  max-width: var(--max-w-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__brand {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-footer__copy {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

/* ============================================================
   404 PAGE
   ============================================================ */
.error-404-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
}

.error-404__inner {
  max-width: var(--max-w);
  width: 100%;
  text-align: center;
}

/* Large muted code number — uses --border so it recedes */
.error-404__code {
  font-family: var(--font-mono);
  font-size: 6rem;
  font-weight: 500;
  color: var(--border);
  line-height: 1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.error-404__heading {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.error-404__body {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.75;
}

/* Primary CTA — matches .nav-subscribe style */
.error-404__home {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s;
  margin-bottom: 2.5rem;
}

.error-404__home:hover {
  background: var(--accent-dim);
  color: var(--bg);
}

.error-404__search {
  margin-top: 2rem;
}

.error-404__search .search-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.error-404__search .search-field {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  width: 280px;
  outline: none;
}

.error-404__search .search-field:focus {
  border-color: var(--accent);
}

.error-404__search .search-submit {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--text-muted);
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.error-404__search .search-submit:hover {
  background: var(--text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .site-header__inner {
    height: auto;
    flex-wrap: wrap;
    padding: 0.75rem 1.5rem;
    row-gap: 0.5rem;
  }
  .site-nav {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
    gap: 0.35rem;
  }
  /* Mobile hero: single column, flex so we can order the three blocks.
     Desired reading order (08 July 2026): headline + standfirst, then
     the image, then the category / date meta. */
  .post-hero {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  .post-hero__content { order: 1; }
  .post-hero__visual  { order: 2; }
  .post-hero__meta    { order: 3; }

  /* Hero featured image shown in full on mobile (fix 08 July 2026):
     no fixed aspect ratio, no crop — the image renders at its own
     proportions so nothing (head/feet) is sliced off. Only the
     decorative SVG-placeholder furniture stays hidden. */
  .post-hero__visual { aspect-ratio: auto; }
  .post-hero__visual img { height: auto; }
  .post-hero__visual .hero-stat,
  .post-hero__visual .hero-status { display: none; }

  .post-grid { grid-template-columns: 1fr 1fr; }
  /* Single post featured image — tighter crop on tablet */
  .post-single__img { max-height: 300px; }
}

@media (max-width: 600px) {
  .site-nav a {
    font-size: 0.62rem;
    padding: 0.35rem 0.55rem;
  }
  .site-nav .nav-subscribe {
    margin-left: 0;
  }
  .site-header__inner { padding: 0 1rem; }
  .site-main { padding: 0 1rem 3rem; }
  .post-grid { grid-template-columns: 1fr; }
  .site-ticker { display: none; }
  /* Single post featured image — portrait constraint on phone */
  .post-single__img { max-height: 240px; }
  /* Post navigation — stack vertically on phone, added 30 June 2026 */
  .post-single__nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .post-single__nav-next { text-align: left; }
}

/* Homepage intro block — added 6 Sept 2026 */
.homepage-intro { margin: 3rem 0 3.5rem; }

/* ============================================================
   NAV SEARCH (icon toggle)
   Last updated: 16 Sept 2026 — collapse search to icon-only toggle
   ============================================================ */
.nav-search-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.nav-search-toggle:hover {
  color: var(--accent);
}

.nav-search-form {
  display: none;
}

.nav-search-form.is-open {
  display: block;
  width: 100%;
  order: 99; /* mobile: drop below the other nav links when wrapped */
  margin-top: 0.5rem;
}

.nav-search-form .search-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.nav-search-form .search-field {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  width: 160px;
  outline: none;
}

.nav-search-form .search-field:focus {
  border-color: var(--accent);
}

.nav-search-form .search-submit {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}

.nav-search-form .search-submit:hover {
  background: var(--accent-dim);
}

@media (max-width: 600px) {
  .nav-search-form .search-field {
    width: 140px;
  }
}