/* =========================================================
   Wire & Signal — main stylesheet
   Design language: a modern wire-service dispatch board.
   Signature element: the perforated "tape" divider under the
   masthead and the breaking-news ticker, evoking telegraph tape.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root{
  --ink:        #14171F;
  --paper:      #F5F3EE;
  --paper-dim:  #E7E3D8;
  --signal:     #D62839;
  --signal-dim: #B0202F;
  --steel:      #2E4057;
  --gold:       #B08A2E;
  --card-bg:    #FFFFFF;
  --border:     #D8D3C4;
  --text:       #1B1E27;
  --text-dim:   #5B5F6B;
  --link:       #2E4057;

  --font-display: 'Newsreader', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 3px;
  --shadow: 0 1px 3px rgba(20,23,31,0.08), 0 1px 2px rgba(20,23,31,0.06);
  color-scheme: light;

  /* Fixed light color for text/icons on bars that are dark in BOTH themes
     (utility bar, footer). Deliberately not redefined under [data-theme="dark"]
     below, since --paper itself flips to a dark value there. */
  --on-dark: #F5F3EE;
}

html[data-theme="dark"]{
  --ink:        #EDEBE3;
  --paper:      #14171F;
  --paper-dim:  #1B2028;
  --card-bg:    #1C202A;
  --border:     #2C313C;
  --text:       #EDEBE3;
  --text-dim:   #A2A6B3;
  --link:       #8FB3E3;
  --signal:     #E8495B;
  --gold:       #D9B65C;
  color-scheme: dark;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

a{ color: var(--link); text-decoration: none; }
a:hover{ text-decoration: underline; }
img{ max-width: 100%; display:block; }

:focus-visible{
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.container{
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Utility bar (date + social) ---------------- */
.utility-bar{
  background: var(--ink);
  color: var(--on-dark);
}
html[data-theme="dark"] .utility-bar{ background:#0B0D12; }
.utility-bar .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-top:8px;
  padding-bottom:8px;
  font-size: 12.5px;
}
.utility-date{
  font-family: var(--font-mono);
  letter-spacing: .03em;
  opacity:.9;
}
.utility-right{ display:flex; align-items:center; gap:16px; }
.social-icons{ display:flex; gap:12px; align-items:center; }
.social-icons a{
  color: var(--on-dark);
  opacity:.85;
  display:inline-flex;
  width:22px; height:22px;
  align-items:center; justify-content:center;
}
.social-icons a:hover{ opacity:1; text-decoration:none; color: var(--gold); }
.social-icons svg{ width:16px; height:16px; fill:currentColor; }
.social-icons a i{ font-size: 16px; }

.theme-toggle{
  border:1px solid rgba(245,243,238,0.3);
  background:transparent;
  color: var(--on-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-body);
  cursor:pointer;
  display:flex; align-items:center; gap:6px;
}
.theme-toggle:hover{ border-color: var(--gold); color: var(--gold); }

/* Show exactly one icon at a time, driven purely by data-theme on <html> —
   not by JS toggling classes on a shared element, which is fragile (e.g.
   bfcache restores, double-init) and can leave both icons visible at once,
   widening/heightening the button and shifting the page underneath it. */
.theme-toggle .icon-sun{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-moon{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-sun{ display:inline-block; }

/* ---------------- Masthead ---------------- */
.masthead{
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.masthead .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-top: 22px;
  padding-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.site-title{
  font-family: var(--font-display);
  font-weight:700;
  font-size: 2.6rem;
  letter-spacing: -0.01em;
  margin:0;
  color: var(--text);
}
.site-title a{ color:inherit; }
.site-title a:hover{ text-decoration:none; }
.site-tagline{
  font-size: .8rem;
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--font-display);
  margin-top: 2px;
}

/* perforated tape divider — the signature element */
.tape-divider{
  height: 10px;
  background-image: radial-gradient(circle, var(--paper) 2px, transparent 2.4px);
  background-size: 14px 10px;
  background-position: 0 center;
  background-color: var(--gold);
}

nav.site-nav{
  background: var(--steel);
}
html[data-theme="dark"] nav.site-nav{ background:#232A38; }

/* Scoped to the direct top-level list only — NOT ".nav-dropdown", which is
   also a <ul> nested one level deeper. A bare "nav.site-nav ul" selector
   here would out-specificity ".nav-dropdown{ display:none }" below and
   force the dropdown permanently open. */
nav.site-nav > .container > ul{
  list-style:none; margin:0; padding:0;
  display:flex; gap: 4px;
}
nav.site-nav a{
  display:block;
  color:#F5F3EE;
  padding: 12px 16px;
  font-size: .85rem;
  font-weight:600;
  letter-spacing:.03em;
  text-transform: uppercase;
}
nav.site-nav a:hover{ background: rgba(245,243,238,0.12); text-decoration:none; }

.nav-has-dropdown{ position: relative; }
nav.site-nav .nav-dropdown{
  display:none;
  position:absolute;
  top: 100%; left:0;
  min-width: 200px;
  list-style:none;
  margin:0; padding:6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 20;
}
.nav-has-dropdown:hover .nav-dropdown,
.nav-has-dropdown:focus-within .nav-dropdown{ display:block; }
.nav-dropdown li a{
  color: var(--text);
  text-transform:none;
  font-weight:500;
  padding: 8px 10px;
  border-radius: 3px;
}
.nav-dropdown li a:hover{ background: var(--paper-dim); }

.nav-toggle{ display:none; }

/* ---------------- Breaking news banner ---------------- */
.breaking-banner{
  background: var(--signal);
  color:#fff;
  position: relative;
}
.breaking-banner .container{
  display:flex;
  align-items:center;
  gap:14px;
  padding-top:10px;
  padding-bottom:10px;
}
.breaking-banner--steel{ background: var(--steel); }
/* Fixed hex, not var(--ink) — var(--ink) intentionally flips to a LIGHT
   color in dark mode (it's reused as the dark-mode "ink" foreground), which
   would put white banner text on a light banner background. This style is
   meant to always render as a near-black bar regardless of site theme. */
.breaking-banner--dark{ background: #14171F; }
.breaking-banner--gold{ background:#8A6A1E; }

.breaking-label{
  flex: 0 0 auto;
  background: rgba(0,0,0,0.22);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Fixed-height viewport that clips the link — this element (not the link
   itself) owns the flex sizing and overflow clipping, so the animated link
   inside is never squeezed by flex-shrink math. */
.ticker-viewport{
  flex: 1 1 auto;
  min-width: 0;
  height: 1.4em;
  line-height: 1.4em;
  position: relative;
  overflow: hidden;
}

.breaking-banner a.breaking-link{
  color:#fff;
  font-weight:600;
  white-space: nowrap;
  text-decoration: none;
}
.breaking-banner a.breaking-link:hover{ text-decoration: underline; }

/* Static (non-ticker) banners: the link fills the viewport and truncates
   normally with an ellipsis. */
.ticker-viewport a.breaking-link{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ticker banners: the link is pulled out of flow and animated across the
   fixed-width viewport. Because it's absolutely positioned, its box sizes
   to its own text content (shrink-to-fit) instead of the flex column width,
   so translateX(100%)/(-100%) — relative to the link's OWN width — always
   carries it fully off-screen right/left rather than overlapping the
   "Breaking" label or the close button. */
.breaking-banner.is-ticker .ticker-viewport a.breaking-link{
  display: inline-block;
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  animation: ticker-scroll 18s linear infinite;
  will-change: transform;
}
@keyframes ticker-scroll{
  0%{ transform: translateX(100%); }
  100%{ transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce){
  .breaking-banner.is-ticker .ticker-viewport a.breaking-link{
    animation: none;
    position: static;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.breaking-close{
  background:transparent;
  border:none;
  color:#fff;
  opacity:.8;
  cursor:pointer;
  font-size:1.1rem;
  line-height:1;
  padding:2px 6px;
}
.breaking-close:hover{ opacity:1; }

/* ---------------- Ad slots ---------------- */
.ad-slot{
  margin: 24px 0;
  text-align:center;
}
.ad-slot--sidebar{ margin: 0 0 24px; }

/* ---------------- Layout ---------------- */
.page-wrap{ padding: 32px 0 60px; }
.layout-grid{
  display:grid;
  grid-template-columns: 2.4fr 1fr;
  gap: 40px;
  align-items:start;
}
@media (max-width: 860px){
  .layout-grid{ grid-template-columns: 1fr; }
}

.section-heading{
  display:flex;
  align-items:baseline;
  gap:10px;
  border-bottom: 2px solid var(--ink);
  margin: 0 0 20px;
  padding-bottom: 8px;
}
html[data-theme="dark"] .section-heading{ border-bottom-color: var(--border); }
.section-heading h2{
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin:0;
}
.section-heading .eyebrow{
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--signal);
}

/* Article grid / cards */
.article-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  margin-bottom: 40px;
}
@media (max-width: 640px){ .article-grid{ grid-template-columns: 1fr; } }

.article-card{
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.article-card:hover{ transform: translateY(-2px); box-shadow: var(--shadow); }
.article-card--lead{ grid-column: 1 / -1; display:grid; grid-template-columns: 1.2fr 1fr; }
@media (max-width: 640px){ .article-card--lead{ grid-template-columns: 1fr; } }
.article-card .thumb{ aspect-ratio: 16/10; overflow:hidden; background: var(--paper-dim); }
.article-card--lead .thumb{ aspect-ratio: auto; height:100%; }
.article-card .thumb img{ width:100%; height:100%; object-fit:cover; }
.article-card .body{ padding: 16px 18px 20px; display:flex; flex-direction:column; gap:8px; flex:1; }
.article-card--lead .body{ padding: 20px 24px; justify-content:center; }
.article-card h3{
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin:0;
  line-height:1.3;
}
.article-card--lead h3{ font-size: 1.9rem; }
.article-card h3 a{ color: var(--text); }
.article-card h3 a:hover{ text-decoration:underline; }
.article-card p{ margin:0; color: var(--text-dim); font-size: .92rem; }
.article-meta{
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Headlines (RSS) list */
.headline-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:16px; }
.headline-item{ display:flex; gap:12px; align-items:flex-start; }
.headline-thumb{
  flex: 0 0 84px;
  width:84px; height:60px;
  background: var(--paper-dim);
  border-radius: var(--radius);
  overflow:hidden;
}
.headline-thumb img{ width:100%; height:100%; object-fit:cover; }
.headline-item h4{ margin:0 0 4px; font-size: .95rem; font-family: var(--font-body); font-weight:600; line-height:1.35; }
.headline-item h4 a{ color: var(--text); }
.headline-meta{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.headline-source{
  font-size:.68rem;
  font-weight:700;
  letter-spacing:.03em;
  text-transform:uppercase;
  color: var(--steel);
  background: var(--paper-dim);
  padding: 2px 7px;
  border-radius: 999px;
}
.headline-item .headline-date{ font-size:.72rem; color: var(--text-dim); font-family: var(--font-mono); }

/* Sidebar */
.sidebar-box{
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 26px;
}
.sidebar-box h3{ font-family: var(--font-display); margin: 0 0 12px; font-size: 1.05rem; }

/* ---------------- Single article ---------------- */
.article-header{ margin-bottom: 22px; }
.article-header h1{
  font-family: var(--font-display);
  font-size: 2.3rem;
  line-height:1.2;
  margin: 10px 0;
}
.article-hero{ border-radius: var(--radius); overflow:hidden; margin-bottom: 20px; border:1px solid var(--border); }
.article-body{ font-size: 1.08rem; line-height:1.75; }
.article-body p{ margin: 0 0 1.2em; }
.back-link{ display:inline-block; margin-bottom: 18px; font-size:.85rem; font-family: var(--font-mono); }

/* ---------------- Archive ---------------- */
.archive-search{
  display:flex; gap:10px; margin-bottom: 30px;
}
.archive-search input[type="search"]{
  flex:1;
  padding: 11px 14px;
  border:1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: .95rem;
}
.archive-list{ list-style:none; margin:0 0 30px; padding:0; display:flex; flex-direction:column; }
.archive-row{
  display:flex; gap:16px; align-items:center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.archive-row .thumb{ flex:0 0 120px; width:120px; height:80px; border-radius:var(--radius); overflow:hidden; background:var(--paper-dim); }
.archive-row .thumb img{ width:100%; height:100%; object-fit:cover; }
.archive-row h3{ margin:0 0 4px; font-family: var(--font-display); font-size:1.1rem; }
.archive-row h3 a{ color: var(--text); }
.archive-row p{ margin:0; color: var(--text-dim); font-size:.9rem; }

.pagination{ display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.pagination a, .pagination span{
  min-width: 36px; height:36px;
  display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size:.85rem;
  color: var(--text);
}
.pagination a:hover{ background: var(--paper-dim); text-decoration:none; }
.pagination .current{ background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------------- Static pages / forms ---------------- */
.page-title{ font-family: var(--font-display); font-size: 2.1rem; margin: 0 0 20px; }
.prose{ font-size: 1.05rem; line-height:1.75; }
.prose p{ margin: 0 0 1.1em; }

form.stacked-form{ display:flex; flex-direction:column; gap:16px; max-width: 560px; }
.form-row label{ display:block; font-size:.85rem; font-weight:600; margin-bottom:6px; }
.form-row input, .form-row textarea{
  width:100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: .95rem;
}
.form-row textarea{ min-height: 160px; resize: vertical; }
.form-hint{ font-size:.78rem; color: var(--text-dim); margin-top:4px; }
.btn{
  display:inline-block;
  background: var(--signal);
  color:#fff;
  border:none;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight:600;
  font-size:.95rem;
  cursor:pointer;
  align-self:flex-start;
}
.btn:hover{ background: var(--signal-dim); text-decoration:none; }
.alert{
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size:.9rem;
  margin-bottom: 18px;
}
.alert-success{ background:#DDF3E4; color:#1E5631; border:1px solid #b9e3c5; }
.alert-error{ background:#FBE0E2; color:#8A1F27; border:1px solid #f2b7bc; }
html[data-theme="dark"] .alert-success{ background:#16321F; color:#8fd6a5; border-color:#1f4a2c; }
html[data-theme="dark"] .alert-error{ background:#3A1A1D; color:#f2a4a9; border-color:#5a2126; }

/* honeypot field — hidden from real users */
.hp-field{ position:absolute; left:-9999px; top:-9999px; }

/* ---------------- Footer ---------------- */
footer.site-footer{
  background: var(--ink);
  color: var(--on-dark);
  margin-top: 40px;
}
html[data-theme="dark"] footer.site-footer{ background:#0B0D12; }
footer.site-footer .container{ padding-top: 34px; padding-bottom: 26px; }
.footer-top{
  display:flex; justify-content:space-between; align-items:center;
  flex-wrap:wrap; gap:16px;
  padding-bottom: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(245,243,238,0.15);
}
.footer-brand{ font-family: var(--font-display); font-size:1.3rem; font-weight:700; }
footer .footer-links{ list-style:none; display:flex; gap:18px; padding:0; margin:0; flex-wrap:wrap; }
footer .footer-links a{ color: var(--on-dark); opacity:.85; font-size:.88rem; }
footer .footer-links a:hover{ opacity:1; }
.footer-bottom{ display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; font-size:.78rem; opacity:.7; }

/* =========================================================
   Icons & effects
   Font Awesome baseline alignment + subtle, consistent hover/
   transition polish. Kept intentionally light (small lift,
   color shift, ~150-200ms ease) per the site's design direction.
   ========================================================= */

/* Nudge Font Awesome glyphs to sit on the text baseline correctly */
.fa-solid, .fa-regular, .fa-brands{ vertical-align: -0.06em; }

footer .footer-links a i,
nav.site-nav a i,
.sidebar-box h3 i,
.section-heading h2 i,
.admin-sidebar a i,
.admin-topline h1 i,
.card h3 i,
.page-title i{ width: 1.1em; text-align: center; }

.section-icon{ color: var(--signal); }

/* Image placeholder shown when an article/headline has no thumbnail */
.thumb-placeholder{
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  background: var(--paper-dim);
  color: var(--text-dim);
  font-size: 1.4rem;
}

/* Arrow-nudge link style used for "read more" / "browse" links */
.link-arrow i{ transition: transform .15s ease; }
.link-arrow:hover i{ transform: translateX(3px); }

.external-icon{ font-size: .7em; opacity:.6; margin-left: 2px; }

/* About page feature row */
.about-features{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 22px 0;
}
.about-feature{
  display:flex; align-items:center; gap:10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .88rem;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.about-feature:hover{ transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--signal); }
.about-feature i{ color: var(--signal); font-size: 1.1rem; flex: 0 0 auto; }

/* Search input with a leading icon */
.search-input-wrap{ position:relative; flex:1; display:flex; align-items:center; }
.search-input-wrap .search-input-icon{
  position:absolute; left:13px;
  color: var(--text-dim);
  pointer-events:none;
  font-size: .85rem;
}
.search-input-wrap input[type="search"]{ padding-left: 36px; }

/* ---------------- Subtle hover/transition polish ---------------- */

nav.site-nav a{ transition: background-color .15s ease, color .15s ease; }

.nav-caret{ font-size: .65em; margin-left: 2px; transition: transform .15s ease; }
.nav-has-dropdown:hover .nav-caret{ transform: rotate(180deg); }

.social-icons a{ transition: color .15s ease, transform .15s ease; }
.social-icons a:hover{ transform: translateY(-2px); }

.theme-toggle{ transition: border-color .15s ease, color .15s ease, transform .15s ease; }
.theme-toggle:hover{ transform: translateY(-1px); }
.theme-toggle-icon{ transition: transform .3s ease; }

.btn{ transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.btn:hover{ transform: translateY(-1px); box-shadow: 0 3px 8px rgba(20,23,31,0.18); }
.btn:active{ transform: translateY(0); }

.article-card{ transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.article-card:hover{ border-color: var(--signal); }
.article-card .thumb img{ transition: transform .3s ease; }
.article-card:hover .thumb img{ transform: scale(1.04); }

.archive-row{ transition: background-color .15s ease; }
.archive-row:hover{ background: var(--paper-dim); }
.archive-row .thumb img{ transition: transform .3s ease; }
.archive-row:hover .thumb img{ transform: scale(1.05); }

.headline-item{ transition: transform .15s ease; }
.headline-item:hover{ transform: translateX(2px); }
.headline-item .headline-thumb img{ transition: transform .3s ease; }
.headline-item:hover .headline-thumb img{ transform: scale(1.05); }

.sidebar-box{ transition: box-shadow .15s ease, border-color .15s ease; }
.sidebar-box:hover{ box-shadow: var(--shadow); }

.pagination a{ transition: background-color .15s ease, border-color .15s ease, transform .15s ease; }
.pagination a:hover{ transform: translateY(-1px); border-color: var(--signal); }

.form-row input, .form-row textarea{ transition: border-color .15s ease, box-shadow .15s ease; }
.form-row input:focus, .form-row textarea:focus{
  border-color: var(--steel);
  box-shadow: 0 0 0 3px rgba(46,64,87,0.15);
  outline: none;
}
html[data-theme="dark"] .form-row input:focus, html[data-theme="dark"] .form-row textarea:focus{
  box-shadow: 0 0 0 3px rgba(143,179,227,0.2);
}

.breaking-close{ transition: opacity .15s ease, transform .15s ease; }
.breaking-close:hover{ transform: scale(1.1); }

@media (prefers-reduced-motion: reduce){
  .btn:hover, .theme-toggle:hover, .social-icons a:hover,
  .archive-row:hover .thumb img, .article-card:hover .thumb img,
  .headline-item:hover .headline-thumb img, .pagination a:hover,
  .about-feature:hover{ transform: none; }
}

/* ---------------- Responsive nav ---------------- */
@media (max-width: 680px){
  .site-title{ font-size: 2rem; }
  nav.site-nav > .container > ul{ flex-wrap: wrap; }
  .article-card--lead{ grid-template-columns: 1fr; }
}
