/* ==========================================================================
   Avezz Broadsheet Layout System (css/pages/newspaper.css)
   1:1 UI/newspaper.html + Auto-Themed Global Nav (Light & Dark Newsprint)
   ========================================================================== */

:root {
  /* Vintage Newsprint Palette (Light) */
  --paper: #f4efe4;
  --paper-alt: #ebe4d4;
  --paper-hover: #efe9dc;
  --paper-elevated: #faf6ec;
  --ink: #1a1714;
  --ink-body: #2c2620;
  --ink-muted: #5e5549;
  --rule: #c6bca8;
  --rule-strong: #231e19;
  --news-accent: #8b261d;
  --news-like: #1f6f4a;
  --news-dislike: #8b261d;
  --serif: Georgia, "Times New Roman", "Liberation Serif", Times, serif;
  --display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;

  /* Auto-Theme Global Nav & Shell Tokens to Match Newsprint */
  --bg: #f4efe4;
  --surface: #faf6ec;
  --surface-subtle: #f4efe4;
  --surface-muted: #ebe4d4;
  --surface-alt: #ebe4d4;
  --surface-hover: #e3dac6;
  --border: #c6bca8;
  --border-strong: #231e19;
  --text: #1a1714;
  --text-secondary: #5e5549;
  --text-muted: #5e5549;
  --text-tertiary: #7c7161;
  --accent: #8b261d;
  --accent-hover: #701d15;
  --accent-soft: rgba(139, 38, 29, 0.12);
  --accent-ring: rgba(139, 38, 29, 0.25);
  --pill-active-bg: #1a1714;
  --pill-active-text: #faf6ec;
  --positive: #1f6f4a;
  --negative: #8b261d;
}

[data-theme="dark"] {
  /* Dark Newsprint Palette */
  --paper: #161412;
  --paper-alt: #1f1c18;
  --paper-hover: #24201b;
  --paper-elevated: #1c1915;
  --ink: #f0e9db;
  --ink-body: #d8cfc0;
  --ink-muted: #9e9382;
  --rule: #3a332a;
  --rule-strong: #6e6253;
  --news-accent: #d95d4e;
  --news-like: #3fb97d;
  --news-dislike: #e06455;

  /* Auto-Theme Global Nav & Shell Tokens (Dark Newsprint) */
  --bg: #161412;
  --surface: #1c1915;
  --surface-subtle: #161412;
  --surface-muted: #24201b;
  --surface-alt: #24201b;
  --surface-hover: #2e2923;
  --border: #3a332a;
  --border-strong: #6e6253;
  --text: #f0e9db;
  --text-secondary: #a89d8c;
  --text-muted: #9e9382;
  --text-tertiary: #756b5d;
  --accent: #d95d4e;
  --accent-hover: #e67365;
  --accent-soft: rgba(217, 93, 78, 0.16);
  --accent-ring: rgba(217, 93, 78, 0.3);
  --pill-active-bg: #f0e9db;
  --pill-active-text: #161412;
  --positive: #3fb97d;
  --negative: #e06455;
}

/* Newsprint Paper Grain on Page Background */
body {
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(120, 100, 70, 0.045) 1px, transparent 0),
    radial-gradient(rgba(120, 100, 70, 0.03) 1px, transparent 0);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}

.nav-shell {
  background: var(--paper-elevated);
  border-bottom: 1.5px solid var(--rule-strong);
}

.cat-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

/* Broadsheet Container */
.broadsheet {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 14px 48px;
  font-family: var(--serif);
  color: var(--ink-body);
  line-height: 1.46;
}

/* Edition Toolbar (Sub-Types, Sort) */
.news-edition-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0 10px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--rule-strong);
}

.news-edition-bar--with-cats {
  margin-bottom: 0;
  border-bottom: 1px solid var(--rule);
}

.news-edition-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.news-edition-tabs::-webkit-scrollbar { display: none; }

.news-edition-tab {
  padding: 5px 11px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.news-edition-tab:hover { color: var(--ink); }
.news-edition-tab[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--news-accent);
}

.news-edition-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.news-edition-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.news-select {
  height: 30px;
  padding: 0 10px;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  cursor: pointer;
}

.news-select:focus {
  outline: none;
  border-color: var(--rule-strong);
}

.news-sort-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--paper-elevated);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.news-sort-wrap:hover,
.news-sort-wrap:focus-within {
  border-color: var(--rule-strong);
  background: var(--paper-alt);
}

/* Broadsheet Newspaper Category / Tag Strip (below Article Types) */
.broadsheet .cat-bar {
  max-width: 100%;
  margin: 0 0 14px;
  padding: 6px 0;
  background: transparent;
  border-bottom: 2px solid var(--rule-strong);
}

.broadsheet .cat-pills {
  gap: 5px;
  padding: 2px 34px 2px 0;
}

.broadsheet .cat-pill {
  height: 25px;
  padding: 0 9px;
  border-radius: 2px;
  background: var(--paper-elevated);
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  box-shadow: none;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.broadsheet .cat-pill:hover {
  background: var(--paper-alt);
  color: var(--ink);
  border-color: var(--rule-strong);
}

.broadsheet .cat-pill[aria-current="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.broadsheet .cat-fade {
  top: 0;
  bottom: 0;
  width: 44px;
}

.broadsheet .cat-fade--right {
  right: 0;
  background: linear-gradient(to right, transparent, var(--paper) 62%);
}

.broadsheet .cat-fade--left {
  left: 0;
  background: linear-gradient(to left, transparent, var(--paper) 62%);
}

.broadsheet .cat-arrow {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  background: var(--paper-elevated);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  box-shadow: none;
}

.broadsheet .cat-arrow:hover {
  background: var(--ink);
  color: var(--paper);
}

.edition-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 13px;
  border: 1.5px solid var(--rule-strong);
  background: var(--paper-elevated);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.edition-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.hub-form-drawer { margin-bottom: 16px; }
.hub-form-drawer.hide { display: none; }

/* =====================================================================
   LEVEL 1: MACRO CATEGORY SHEET PARTITIONER (NYT Reference Topology)
   ===================================================================== */
.newspaper-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-upper {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: 2px;
  background: var(--rule-strong);
  border: 1.5px solid var(--rule-strong);
}

.sheet-left-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--rule-strong);
}

.sheet-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2px;
  background: var(--rule-strong);
  border: 1.5px solid var(--rule-strong);
}

.cat-block {
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cat-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px 5px;
  background: var(--paper-alt);
  border-bottom: 1.5px solid var(--rule-strong);
}

.cat-block-head h2 {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
}

.cat-block-head a {
  color: inherit;
  text-decoration: none;
}

.cat-block-head a:hover { color: var(--news-accent); }

.cat-block-head span {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* =====================================================================
   LEVEL 2: INNER POST GRID (Hairline 12-Col Packing)
   ===================================================================== */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  flex: 1 1 auto;
}

.news-card {
  position: relative;
  grid-column: span var(--post-span, 12);
  background: var(--paper);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  transition: background-color 0.14s ease;
}

.news-card:hover { background: var(--paper-hover); }
.news-card:hover .post-title { color: var(--news-accent); }
.news-card.has-open-menu { z-index: 30; }

/* Full-card clickable overlay link */
.news-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.news-card-body {
  position: relative;
  z-index: 0;
}

/* Typography & Editorial Plates */
.kicker {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--news-accent);
  margin-bottom: 3px;
}

.post-title {
  font-family: var(--display);
  font-weight: 800;
  line-height: 1.14;
  color: var(--ink);
  margin: 0;
  transition: color 0.14s ease;
}

.tier-hero .post-title { font-size: clamp(22px, 2.4vw, 31px); }
.tier-large .post-title { font-size: clamp(18px, 1.8vw, 23px); }
.tier-medium .post-title { font-size: 16.5px; }
.tier-small .post-title { font-size: 14.5px; }

.post-deck {
  margin-top: 4px;
  font-size: 13.5px;
  font-style: italic;
  line-height: 1.35;
  color: var(--ink-muted);
}

.post-byline {
  font-family: var(--sans);
  font-size: 9.5px;
  color: var(--ink-muted);
  margin: 4px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.post-byline strong {
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dateline {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

.post-text {
  font-size: 13px;
  line-height: 1.44;
  text-align: justify;
  hyphens: auto;
  color: var(--ink-body);
}

.post-text p { margin: 0; }
.post-text p + p {
  margin-top: 6px;
  text-indent: 1.1em;
}

.drop-cap::first-letter {
  float: left;
  font-family: var(--display);
  font-size: 2.85em;
  line-height: 0.82;
  font-weight: 700;
  padding: 2px 5px 0 0;
  color: var(--ink);
}

/* Editorial Image Plate */
.plate-wrap {
  border: 1px solid var(--rule-strong);
  background: var(--paper-alt);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.plate-wrap--pano { aspect-ratio: 21 / 8; }
.plate-wrap--portrait { aspect-ratio: 4 / 5; height: 100%; min-height: 170px; }
.plate-wrap--square { aspect-ratio: 4 / 3; }

.plate-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.08) sepia(14%);
  transition: filter 0.3s ease, transform 0.35s ease;
}

.news-card:hover .plate-wrap img {
  filter: grayscale(10%) contrast(1.03) sepia(4%);
  transform: scale(1.02);
}

/* =====================================================================
   PREDEFINED OLD-NEWSPAPER POST LAYOUTS (10 Archetypes)
   ===================================================================== */

/* 1. Panorama Hero */
.layout-panorama-hero .plate-wrap { margin-bottom: 8px; }
.layout-panorama-hero .pano-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
}

/* 2. Multi-Column Grid with Inset Image */
.layout-multi-col-inset .inset-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.layout-multi-col-inset .inset-col {
  padding-right: 10px;
  border-right: 1px solid var(--rule);
}
.layout-multi-col-inset .inset-col:last-child { padding-right: 0; border-right: 0; }
.layout-multi-col-inset .inset-mid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 3. Tall Twin-Col / Mid-Embedded Image */
.layout-tall-mid-img .mid-plate { margin: 8px 0; }

/* 4. Image Left + Text Right */
.layout-img-left .split-lr {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  gap: 10px;
  align-items: start;
  margin-top: 6px;
}

/* 5. Text Left + Large Portrait Image Right */
.layout-img-right .split-rl {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 12px;
  align-items: stretch;
  margin-top: 4px;
}

/* 6. Long Horizontal Ribbon */
.layout-long-horizontal .ribbon-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(0, 0.75fr);
  gap: 12px;
  align-items: center;
}
.layout-long-horizontal .ribbon-mid {
  padding: 0 12px;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}

/* 7. Text-Only Newspaper Columns */
.layout-text-columns .cols-2 {
  column-count: 2;
  column-gap: 14px;
  column-rule: 1px solid var(--rule);
  margin-top: 6px;
}

/* 8. Wire / Index List */
.layout-wire-list .wire-ul {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.layout-wire-list .wire-ul li {
  padding: 4px 0;
  border-bottom: 1px dotted var(--rule);
  font-size: 12px;
  line-height: 1.35;
}
.layout-wire-list .wire-ul li:last-child { border-bottom: 0; }

/* 9. Quote Box Feature */
.layout-quote-box .pull-quote {
  margin: 6px 0;
  padding: 7px 9px;
  border-top: 1.5px solid var(--rule-strong);
  border-bottom: 1.5px solid var(--rule-strong);
  background: var(--paper-elevated);
  font-style: italic;
  font-size: 13px;
  line-height: 1.36;
  text-align: center;
  color: var(--ink);
}

/* 10. Mini Brief */
.layout-mini-brief .post-text { font-size: 12.2px; line-height: 1.4; }

/* Vintage Card Footer & Full Avezz Actions */
.card-meta-bar {
  position: relative;
  z-index: 2;
  margin-top: 8px;
  padding-top: 5px;
  border-top: 1px dotted var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 10px;
  color: var(--ink-muted);
}

.news-meta-author {
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.news-meta-author:hover { color: var(--ink); }

.news-card .card-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.news-card .action-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.news-card .action-btn .action-icon,
.news-card .action-btn .icon {
  width: 13px;
  height: 13px;
}

.news-card .action-btn:hover {
  color: var(--ink);
  border-color: var(--rule);
  background: var(--paper-elevated);
}

.news-card .action-btn.like.active {
  color: var(--news-like);
  border-color: var(--news-like);
  background: rgba(31, 111, 74, 0.1);
}

.news-card .action-btn.deslike.active {
  color: var(--news-dislike);
  border-color: var(--news-dislike);
  background: rgba(139, 38, 29, 0.1);
}

.news-card .action-btn.share.active {
  color: var(--star);
  border-color: var(--star);
}

/* Empty State & Pagination */
.news-empty-state {
  padding: 40px 20px;
  text-align: center;
  border: 1.5px dashed var(--rule-strong);
  background: var(--paper-elevated);
}

.news-empty-state h3 {
  font-family: var(--display);
  font-size: 19px;
  color: var(--ink);
  margin: 0 0 6px;
}

.news-empty-state p {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 12px;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .sheet-upper { grid-template-columns: 1fr; }
  .sheet-row > .cat-block { grid-column: span 12 !important; }
  .layout-multi-col-inset .inset-grid { grid-template-columns: 1fr 1fr; }
  .layout-multi-col-inset .inset-col:last-child { grid-column: span 2; border-right: 0; padding-right: 0; }
  .layout-long-horizontal .ribbon-row { grid-template-columns: 1fr 1fr; }
  .layout-long-horizontal .ribbon-mid { border-right: 0; padding-right: 0; }
}

@media (max-width: 720px) {
  .broadsheet { padding: 10px 8px 32px; }
  .news-card { grid-column: span 12 !important; }
  .layout-panorama-hero .pano-lower,
  .layout-multi-col-inset .inset-grid,
  .layout-img-left .split-lr,
  .layout-img-right .split-rl,
  .layout-long-horizontal .ribbon-row { grid-template-columns: 1fr; }
  .layout-multi-col-inset .inset-col { border-right: 0; padding-right: 0; }
  .layout-long-horizontal .ribbon-mid { border: 0; padding: 0; }
  .layout-text-columns .cols-2 { column-count: 1; }
}
