/* LocalBrief.news — production-ready brand tokens, components, and layout styles */

:root {
  /* Ink + paper */
  --ink: #0F1A24;
  --ink-2: #1F2B38;
  --ink-3: #3A4654;
  --mute: #5C6773;
  --mute-2: #8C95A1;
  --hair: #E7E3D9;
  --hair-2: #D6D1C2;
  --paper: #FBFAF6;
  --paper-2: #F4F1E8;
  --surface: #FFFFFF;

  /* Civic palette */
  --civic: #1B4A7A;          /* primary trust blue */
  --civic-ink: #0D2D4D;
  --civic-soft: #E8EFF6;
  --river: #3B7FAB;          /* info / link */
  --forest: #2D5F4A;         /* civic / verified */
  --brick: #B8472F;          /* alerts / breaking */
  --sun: #D4943B;            /* sponsored / warm */
  --plum: #6B3A5C;           /* highlight */

  /* Per-city accent (overridable by .city-*) */
  --city: var(--river);
  --city-soft: #E6EEF4;

  /* Type stacks & Ghost Custom Font settings support */
  --gh-font-heading: "Newsreader", "Source Serif 4", "Charter", Georgia, serif;
  --gh-font-body: "Public Sans", "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: var(--gh-font-heading);
  --sans: var(--gh-font-body);
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* ───────── Author Persona Accent Mappings ───────── */
body.author-maria-rivera { --city: #3B7FAB; --city-soft: #E5EEF4; }
body.author-j-okafor     { --city: #2A6FB3; --city-soft: #E4EDF6; }
body.author-l-chen       { --city: #2D5F4A; --city-soft: #E2EBE6; }

/* ───────── Base Reset and Layout ───────── */
body.lb {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.lb *, .lb *::before, .lb *::after { box-sizing: border-box; }
.lb a { color: inherit; text-decoration: none; transition: color 0.12s; }
.lb a:hover { color: var(--city); }
.lb p { margin: 0 0 1.25em; line-height: 1.6; }
.lb h1, .lb h2, .lb h3, .lb h4, .lb h5 { margin: 0; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.lb img { max-width: 100%; height: auto; display: block; }
.lb button { font: inherit; cursor: pointer; border: none; background: none; }

/* Accessibility focus styles */
.lb *:focus-visible {
  outline: 2px solid var(--city);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--city);
  color: white;
  padding: 8px 16px;
  z-index: 100;
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* ───────── Grid Layouts ───────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
}

.grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}
@media (max-width: 900px) {
  .grid-2-1 { grid-template-columns: 1fr; }
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-4 { grid-template-columns: 1fr; }
}

/* ───────── Typographic Atoms ───────── */
.serif { font-family: var(--serif); font-optical-sizing: auto; }
.sans  { font-family: var(--sans); }
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; color: var(--mute); }
.eyebrow.city { color: var(--city); }
.kicker { font-family: var(--sans); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; color: var(--civic); }
.meta { font-family: var(--mono); font-size: 11px; color: var(--mute); letter-spacing: 0.02em; }

/* ───────── Logo and Lockup ───────── */
.lb-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px;
  background: var(--ink); color: var(--paper);
  font-family: var(--sans); font-weight: 800; font-size: 16px; letter-spacing: -0.04em;
  position: relative;
}
.lb-mark::after {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--city);
}
.lb-mark.civic { background: var(--civic); }
.lb-mark.large { width: 56px; height: 56px; border-radius: 9px; font-size: 24px; }
.lb-mark.large::after { width: 6px; height: 6px; top: 9px; right: 9px; }
.lb-mark.xl { width: 96px; height: 96px; border-radius: 14px; font-size: 44px; }
.lb-mark.xl::after { width: 10px; height: 10px; top: 14px; right: 14px; }

.lb-lockup { display: inline-flex; align-items: center; gap: 10px; }
.lb-wordmark {
  font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; line-height: 1;
  color: var(--ink);
}
.lb-wordmark .tld { font-family: var(--mono); font-weight: 500; color: var(--mute); font-size: 0.7em; letter-spacing: 0; }
.lb-wordmark .city-suffix {
  font-family: var(--sans); font-weight: 600; font-size: 0.7em; color: var(--city);
  margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--hair-2);
}

/* ───────── Buttons + Chips ───────── */
.lb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 4px;
  font-family: var(--sans); font-weight: 600; font-size: 13px; letter-spacing: 0;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  transition: background .12s, border-color .12s, color .12s;
  text-decoration: none;
}
.lb-btn:hover { background: var(--ink-2); border-color: var(--ink-2); color: var(--paper); }
.lb-btn.civic { background: var(--civic); border-color: var(--civic); }
.lb-btn.civic:hover { background: var(--civic-ink); border-color: var(--civic-ink); }
.lb-btn.city { background: var(--city); border-color: var(--city); }
.lb-btn.city:hover { filter: brightness(0.9); }
.lb-btn.ghost { background: transparent; color: var(--ink); border-color: var(--hair-2); }
.lb-btn.ghost:hover { background: var(--paper-2); }
.lb-btn.lg { padding: 12px 18px; font-size: 14px; }
.lb-btn.sm { padding: 6px 10px; font-size: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 3px;
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--paper-2); color: var(--ink-3); border: 1px solid var(--hair);
  white-space: nowrap;
}
.chip.live { background: #FCEEEA; color: var(--brick); border-color: #F2D6CC; }
.chip.live::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brick); display: inline-block;
  animation: lbpulse 1.6s ease-in-out infinite;
}
@keyframes lbpulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.chip.civic { background: var(--civic-soft); color: var(--civic); border-color: #CFDCEA; }
.chip.sponsored { background: #FAF1E0; color: #8B6020; border-color: #ECDDB7; }
.chip.update { background: #E9F0EB; color: var(--forest); border-color: #CFDCD3; }
.chip.neighborhood { background: var(--city-soft); color: var(--city); border-color: #CFDCEA; }

/* ───────── Cards & Rules ───────── */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: 6px; }
.card.flat { background: transparent; border: 0; border-top: 1px solid var(--hair); border-radius: 0; }

.dotrule { border: 0; border-top: 1px dotted var(--hair-2); margin: 16px 0; }
.hairline { border: 0; border-top: 1px solid var(--hair); margin: 16px 0; }
.thickrule { border: 0; border-top: 3px solid var(--ink); margin: 16px 0; }

/* ───────── Image Placeholders & Ratios ───────── */
.img-wrapper {
  position: relative;
  width: 100%;
  background: linear-gradient(135deg, var(--paper-2) 0%, var(--hair) 100%);
  overflow: hidden;
  border-radius: 4px;
}
.img-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.imgph {
  background: linear-gradient(135deg, var(--paper-2) 0%, var(--hair) 100%);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--mute); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
}
.imgph.dim::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(15,26,36,.04) 6px 7px);
}
.imgph .ph-cap {
  position: absolute; left: 10px; bottom: 10px; right: 10px;
  font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-transform: none; letter-spacing: 0;
}
.imgph.river { background: linear-gradient(180deg, #C8DCE7 0%, #8DAEC2 60%, #5A8BA8 100%); }
.imgph.bridge { background: linear-gradient(180deg, #D4C9A8 0%, #A89169 60%, #6F5A38 100%); }
.imgph.sunset { background: linear-gradient(180deg, #F5C58A 0%, #D97A4E 50%, #5B3A52 100%); }
.imgph.civic-bg { background: linear-gradient(180deg, #DBE2EC 0%, #8FA1B9 100%); }
.imgph.green { background: linear-gradient(180deg, #C8D5BC 0%, #6E8C5C 100%); }
.imgph.market { background: linear-gradient(180deg, #E8D9C0 0%, #B8866A 100%); }
.imgph.brew { background: linear-gradient(180deg, #D9C9A0 0%, #8C6A3F 100%); }

/* ───────── Icons ───────── */
.ico { width: 16px; height: 16px; flex: 0 0 auto; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; }
.ico-sm { width: 12px; height: 12px; flex: 0 0 auto; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; }
.ico-lg { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; }

/* Utility spacers */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.row-wrap { display: flex; align-items: center; flex-wrap: wrap; }
.gap-2 { gap: 2px } .gap-4 { gap: 4px } .gap-6 { gap: 6px } .gap-8 { gap: 8px } .gap-10 { gap: 10px } .gap-12 { gap: 12px } .gap-16 { gap: 16px } .gap-20 { gap: 20px } .gap-24 { gap: 24px } .gap-32 { gap: 32px } .gap-40 { gap: 40px }
.grow { flex: 1 1 auto; }
.mute { color: var(--mute); }
.mute-2 { color: var(--mute-2); }
.ink3 { color: var(--ink-3); }

/* ───────── Advertising Layout Protection (0 CLS) ───────── */
.ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.ad-label {
  position: absolute;
  top: 4px;
  left: 6px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  color: var(--mute-2);
  text-transform: uppercase;
  pointer-events: none;
  z-index: 2;
}

/* 1. Leaderboard Placement (Above Header Nav) */
.ad-leaderboard {
  width: 100%;
  max-width: 970px;
  margin: 16px auto;
  aspect-ratio: 970 / 90;
  min-height: 90px;
}
@media (max-width: 990px) and (min-width: 768px) {
  .ad-leaderboard {
    max-width: 728px;
    aspect-ratio: 728 / 90;
  }
}
@media (max-width: 767px) {
  .ad-leaderboard {
    max-width: 320px;
    aspect-ratio: 320 / 50;
    min-height: 50px;
    margin: 8px auto;
  }
}

/* 2. Mid-Article Inline Placement (Inside post body) */
.ad-mid-article {
  max-width: 300px;
  width: 100%;
  aspect-ratio: 300 / 250;
  min-height: 250px;
  margin: 32px auto;
  clear: both;
}
@media (min-width: 768px) {
  .ad-mid-article {
    float: right;
    margin: 12px 0 24px 24px;
  }
}

/* 3. Sidebar Ad Placement */
.ad-sidebar {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 300 / 250;
  min-height: 250px;
  margin: 0 auto;
}

/* Ad creative responsive fitting */
.ad-container a, .ad-container img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ad-fallback-text {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
  padding: 20px;
  line-height: 1.4;
}
.ad-fallback-text strong {
  color: var(--civic);
}

/* ───────── Ghost Cards overrides to match Chattanooga designs ───────── */
.kg-card {
  margin-bottom: 24px;
  width: 100%;
}
.kg-image-card img {
  width: 100%;
  border-radius: 4px;
}
.kg-image-card figcaption {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  margin-top: 8px;
  text-align: left;
  line-height: 1.4;
}

/* Koenig Bookmark card */
.kg-bookmark-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 6px;
  overflow: hidden;
}
.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: inherit;
}
@media (max-width: 600px) {
  .kg-bookmark-container { flex-direction: column-reverse; }
}
.kg-bookmark-content {
  flex-grow: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kg-bookmark-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.kg-bookmark-description {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--mute);
  line-height: 1.4;
  margin-bottom: 8px;
}
.kg-bookmark-metadata {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--mute-2);
}
.kg-bookmark-thumbnail {
  flex-basis: 33%;
  flex-shrink: 0;
  position: relative;
  min-height: 120px;
}
.kg-bookmark-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Callout cards styling matching our custom boxes */
.kg-callout-card {
  padding: 20px 22px;
  border-radius: 4px;
  border: 1px solid var(--hair-2);
  margin-bottom: 24px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  display: flex;
  gap: 12px;
}
/* Style mappings based on emoji or text markers for localbrief design */
.kg-callout-card.kg-callout-card-blue {
  background: var(--city-soft);
  border-color: #CFDCEA;
  border-left: 4px solid var(--city);
}
.kg-callout-card.kg-callout-card-green {
  background: #F4F6E8;
  border-color: #DDE0BD;
  border-left: 4px solid var(--forest);
}

.kg-blockquote-alt {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  line-height: 1.4;
  color: var(--ink-2);
  border-left: 3px solid var(--city);
  padding-left: 20px;
  margin: 24px 0;
}

/* REQUIRED Ghost layout width helper classes */
.kg-width-wide {
  max-width: 1040px;
  margin: 0 auto 24px;
}
.kg-width-full {
  max-width: 100vw;
  width: 100vw;
  margin: 0 calc(50% - 50vw) 24px;
}

