/* ContextWindow — child theme stylesheet
   Ported from mockup.html. Preserves CSS variables, fonts, and the
   #E84A1E accent. Selectors adapted to WP template output where needed. */

:root {
  --bg-page: #FAFAF8;
  --bg-surface: #FFFFFF;
  --text-primary: #0A0A0A;
  --text-secondary: #525252;
  --text-muted: #8B8B8B;
  --border: #E8E6E1;
  --border-strong: #D4D2CC;
  --accent: #E84A1E;
  --accent-hover: #C93C13;
  --accent-soft: #FCE5DD;
  --maxw: 1240px;
  --gutter: 32px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: 'Onest', -apple-system, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.display { font-family: 'Unbounded', sans-serif; letter-spacing: -0.02em; }
.mono { font-family: 'JetBrains Mono', monospace; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; height: auto; }

/* ============ HEADER ============ */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-mark {
  width: 24px; height: 24px;
  background: var(--accent);
  display: inline-block;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 5px;
  background: var(--bg-surface);
}
.brand-mark::before {
  content: '';
  position: absolute;
  inset: 9px;
  background: var(--accent);
  z-index: 1;
}
.nav-cats {
  display: flex;
  gap: 28px;
  font-weight: 500;
  font-size: 14.5px;
  list-style: none;
}
.nav-cats a {
  color: var(--text-primary);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.nav-cats a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.nav-cats a.active,
.nav-cats .current-cat a,
.nav-cats .current-menu-item a { border-bottom-color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.search-btn {
  background: none;
  border: 1px solid var(--border-strong);
  padding: 7px 12px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.subscribe-btn {
  background: var(--text-primary);
  color: var(--bg-surface);
  border: none;
  padding: 9px 18px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.subscribe-btn:hover { background: var(--accent); }

/* Inline search panel (toggled by search-btn) */
.search-panel {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 16px var(--gutter);
}
.search-panel.is-open { display: block; }
.search-panel form {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  gap: 8px;
}
.search-panel input[type="search"] {
  flex: 1;
  border: 1px solid var(--border-strong);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 15px;
  background: var(--bg-page);
}
.search-panel button {
  background: var(--text-primary);
  color: var(--bg-surface);
  border: none;
  padding: 0 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

/* ============ AD SLOTS ============ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-align: center;
  line-height: 1.4;
}
.ad-slot:empty { display: none; }
.ad-header { width: 728px; height: 90px; margin: 24px auto; max-width: 100%; }
.ad-in-article { width: 300px; height: 250px; margin: 32px auto; max-width: 100%; }
.ad-sidebar { width: 300px; height: 600px; }
.ad-sticky {
  position: sticky;
  bottom: 16px;
  width: 728px;
  height: 90px;
  margin: 32px auto 16px;
  max-width: calc(100% - 32px);
  z-index: 50;
}
.ad-sticky-wrap { position: relative; }
.ad-sticky-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  background: var(--text-primary);
  color: var(--bg-surface);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  z-index: 51;
}
.ad-sticky.is-dismissed { display: none; }

/* ============ HOMEPAGE LAYOUT ============ */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 32px;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border);
}
.hero-main {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 380px;
  position: relative;
  overflow: hidden;
}
.hero-main::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 180px; height: 180px;
  background: var(--accent);
  transform: translate(50%, -50%);
  border-radius: 50%;
  opacity: 0.08;
}
.hero-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 18px;
  position: relative;
}
.hero-title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
  max-width: 580px;
  position: relative;
}
.hero-title a { color: inherit; }
.hero-title a:hover { color: var(--accent); }
.hero-lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 580px;
  position: relative;
}
.article-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.meta-dot { width: 3px; height: 3px; background: var(--text-muted); border-radius: 50%; display: inline-block; }

.hero-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hero-side-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.hero-side-item .cat-tag { font-size: 10.5px; }
.hero-side-item h3 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 10px 0;
}
.hero-side-item h3 a { color: var(--text-primary); }
.hero-side-item h3 a:hover { color: var(--accent); }

.cat-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 500;
}
.cat-tag a { color: inherit; }

/* ============ FEED ============ */
.feed-section {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  padding: 40px 0;
}
.feed-section h2.section-title,
.feed-section > div > h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text-primary);
}
.feed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.feed-card {
  background: var(--bg-surface);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background 0.15s;
}
.feed-card:hover { background: #fafaf2; }
.feed-card .cat-tag { font-size: 10.5px; }
.feed-card h3 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}
.feed-card h3 a { color: inherit; }
.feed-card h3 a:hover { color: var(--accent); }
.feed-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.feed-card .article-meta { margin-top: auto; font-size: 11px; }

.pagination {
  margin-top: 32px;
  display: flex;
  gap: 8px;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.pagination .current {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }

/* ============ SIDEBAR ============ */
.sidebar { display: flex; flex-direction: column; gap: 28px; }
.sidebar .ad-sidebar { position: sticky; top: 24px; }
.sidebar-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 24px;
}
.sidebar-block h4 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.popular-list { display: flex; flex-direction: column; list-style: none; }
.popular-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.popular-item:last-child { border-bottom: none; }
.popular-num {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
  min-width: 24px;
}
.popular-item .title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
}
.popular-item .title a { color: inherit; }
.popular-item .title a:hover { color: var(--accent); }
.popular-item .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.digest-block {
  background: var(--text-primary);
  color: var(--bg-surface);
  border: none;
}
.digest-block h4 {
  color: var(--bg-surface);
  border-bottom-color: rgba(255,255,255,0.15);
}
.digest-block p {
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 16px;
  color: rgba(255,255,255,0.75);
}
.digest-input {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 10px 12px;
  color: var(--bg-surface);
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 10px;
}
.digest-input::placeholder { color: rgba(255,255,255,0.4); }
.digest-btn {
  width: 100%;
  background: var(--accent);
  color: var(--bg-surface);
  border: none;
  padding: 11px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.digest-block .digest-stub-note {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 8px;
  margin-bottom: 0;
  font-family: 'JetBrains Mono', monospace;
}

/* ============ ARTICLE PAGE ============ */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 56px;
  padding: 36px 0 60px;
}
.article-main { max-width: 720px; min-width: 0; }
.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 28px;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb .sep { margin: 0 8px; color: var(--border-strong); }

.article-title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 22px;
}
.article-lede {
  font-size: 19.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-weight: 400;
  border-left: 3px solid var(--accent);
  padding-left: 20px;
}
.article-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 12px;
}
.article-byline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
}
.byline-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  color: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 13px;
}
.byline-name { font-weight: 600; }
.byline-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.article-body { font-size: 17px; line-height: 1.7; color: var(--text-primary); }
.article-body p { margin-bottom: 22px; }
.article-body h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 44px 0 18px;
}
.article-body a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); }
.article-body a:hover { border-bottom-color: var(--accent); }
.article-body blockquote {
  border-left: 3px solid var(--text-primary);
  padding: 8px 0 8px 24px;
  margin: 28px 0;
  font-style: italic;
  color: var(--text-secondary);
}
.article-body ul, .article-body ol { padding-left: 22px; margin-bottom: 22px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { color: var(--text-primary); }

.tags-row {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  color: var(--text-secondary);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }

.source-attribution {
  margin-top: 28px;
  padding: 16px 18px;
  background: var(--bg-surface);
  border-left: 3px solid var(--text-muted);
  font-size: 13.5px;
  color: var(--text-secondary);
}
.source-attribution strong { color: var(--text-primary); }
.source-attribution a { color: var(--accent); }

/* ============ RELATED ============ */
.related-section {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 2px solid var(--text-primary);
}
.related-section h2 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}
.related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}
.related-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 18px;
}
.related-card:hover { border-color: var(--text-primary); }
.related-card .cat-tag { font-size: 10px; margin-bottom: 10px; display: block; }
.related-card h4 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.related-card h4 a { color: var(--text-primary); }
.related-card h4 a:hover { color: var(--accent); }
.related-card .article-meta { font-size: 10.5px; }

/* ============ CATEGORY / TAG / 404 ============ */
.archive-header {
  padding: 40px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.archive-kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 12px;
}
.archive-title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 42px;
  letter-spacing: -0.03em;
  line-height: 1.08;
}
.archive-description {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 14px;
  max-width: 720px;
}

.notfound {
  padding: 80px 0;
  text-align: center;
}
.notfound .code {
  font-family: 'Unbounded', sans-serif;
  font-size: 96px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.04em;
  line-height: 1;
}
.notfound h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 20px 0 12px;
}
.notfound p { color: var(--text-secondary); max-width: 480px; margin: 0 auto 24px; }
.notfound a.button {
  display: inline-block;
  background: var(--text-primary);
  color: var(--bg-surface);
  padding: 11px 22px;
  font-weight: 600;
  font-size: 14px;
}
.notfound a.button:hover { background: var(--accent); color: var(--bg-surface); }

/* ============ FOOTER ============ */
.footer {
  background: var(--text-primary);
  color: rgba(255,255,255,0.7);
  padding: 48px 0 24px;
  margin-top: 80px;
}
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-brand {
  font-family: 'Unbounded', sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--bg-surface);
  margin-bottom: 12px;
}
.footer p { font-size: 13.5px; line-height: 1.55; max-width: 320px; }
.footer h5 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bg-surface);
  margin-bottom: 14px;
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer ul a { color: rgba(255,255,255,0.65); font-size: 13.5px; }
.footer ul a:hover { color: var(--accent); }
.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .hero, .feed-section, .article-layout { grid-template-columns: 1fr; gap: 24px; }
  .feed-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 28px; }
  .nav-cats { display: none; }
  .hero-title { font-size: 28px; }
  .article-title { font-size: 30px; }
  .ad-header, .ad-sticky { width: 100%; height: auto; padding: 40px 0; max-width: 100%; }
  .ad-sidebar { width: 100%; height: auto; min-height: 250px; }
  .sidebar .ad-sidebar { position: static; }
}

@media (max-width: 480px) {
  :root { --gutter: 18px; }
  .hero-main { padding: 24px; }
  .hero-title { font-size: 24px; }
  .article-title { font-size: 26px; }
  .article-body { font-size: 16px; }
  .article-body h2 { font-size: 22px; }
}
