/* =====================================================================
   PakChronicle — main stylesheet
   White ground · dark type · red accent (#D71920) · editorial serif
   ===================================================================== */

:root {
  --red: #D71920;
  --red-dark: #A50F16;
  --ink: #14181f;
  --ink-soft: #3c4452;
  --muted: #6b7280;
  --line: #e6e8ec;
  --line-strong: #d2d6dd;
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --max: 1200px;
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 1px 2px rgba(20,24,31,.06), 0 8px 24px rgba(20,24,31,.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- Breaking ticker ---------- */
.ticker { background: var(--ink); color: #fff; font-size: 14px; }
.ticker-inner { display: flex; align-items: center; gap: 14px; height: 40px; overflow: hidden; }
.ticker-label {
  background: var(--red); color: #fff; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; font-size: 12px; padding: 4px 10px; white-space: nowrap; flex: none;
}
.ticker-track { display: flex; align-items: center; gap: 14px; white-space: nowrap; animation: ticker 40s linear infinite; }
.ticker-track a { color: #fff; opacity: .92; }
.ticker-track a:hover { opacity: 1; color: #fff; }
.ticker-sep { color: var(--red); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker:hover .ticker-track { animation-play-state: paused; }

/* ---------- Masthead ---------- */
.masthead { position: sticky; top: 0; z-index: 200; background: #fff; border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; align-items: center; gap: 14px; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  background: var(--red); color: #fff; font-family: var(--serif); font-weight: 700;
  font-size: 18px; letter-spacing: .02em;
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -.01em; display: block; }
.brand-tag { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.masthead-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn, .nav-toggle {
  background: none; border: 1px solid transparent; color: var(--ink);
  width: 42px; height: 42px; border-radius: 8px; cursor: pointer; display: grid; place-items: center;
}
.icon-btn:hover { background: var(--bg-alt); }
.nav-toggle { display: none; flex-direction: column; gap: 4px; }
.nav-toggle span { width: 20px; height: 2px; background: var(--ink); transition: .2s; }

/* search bar */
.search-bar { border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.search-bar form { display: flex; gap: 8px; padding: 12px 0; }
.search-bar input { flex: 1; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px 14px; font-size: 16px; }
.search-bar button { background: var(--red); color: #fff; border: 0; padding: 0 22px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.search-bar button:hover { background: var(--red-dark); }

/* primary nav */
.primary-nav { border-bottom: 2px solid var(--ink); background: #fff; }
.primary-nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.primary-nav ul::-webkit-scrollbar { display: none; }
.primary-nav a {
  display: block; padding: 13px 14px; font-size: 14px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; color: var(--ink-soft);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.primary-nav a:hover { color: var(--red); text-decoration: none; border-bottom-color: var(--red); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { border-bottom: 1px solid var(--line); background: #fff; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 10px 0; font-size: 13px; color: var(--muted); }
.breadcrumbs li:not(:last-child)::after { content: '/'; margin-left: 8px; color: var(--line-strong); }
.breadcrumbs a:hover { color: var(--red); }

/* ---------- Layout ---------- */
.site-main { padding: 28px 20px 56px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin: 40px 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--ink);
}
.section-head span { font-family: var(--serif); font-size: 22px; font-weight: 700; position: relative; padding-left: 14px; }
.section-head span::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 5px; background: var(--accent, var(--red)); }
.section-more { font-size: 13px; font-weight: 600; color: var(--red); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Home top: lead + trending ---------- */
.home-top { display: grid; grid-template-columns: 2.2fr 1fr; gap: 32px; margin-top: 8px; }
.lead-media { display: block; overflow: hidden; }
.lead-media img { width: 100%; aspect-ratio: 16/9; object-fit: cover; transition: transform .5s ease; }
.lead:hover .lead-media img { transform: scale(1.03); }
.lead-body { padding-top: 16px; }
.lead-title { font-family: var(--serif); font-size: 38px; line-height: 1.12; margin: 8px 0 10px; letter-spacing: -.015em; }
.lead-title a:hover { color: var(--red); text-decoration: none; }
.lead-sub { font-size: 19px; color: var(--ink-soft); margin: 0 0 12px; }

.trending-zone { border-left: 1px solid var(--line); padding-left: 28px; }
.rail-title { font-family: var(--serif); font-size: 20px; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--red); }
.trending-list { list-style: none; margin: 0; padding: 0; counter-reset: t; }
.trending-list li { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.trending-num { font-family: var(--serif); font-weight: 700; font-size: 24px; color: var(--red); line-height: 1; min-width: 24px; }
.trending-list a { font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.trending-list a:hover { color: var(--red); }

/* ---------- Kicker / category label ---------- */
.kicker {
  display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--kicker, var(--red)); margin-bottom: 6px;
}
.kicker:hover { text-decoration: none; filter: brightness(.9); }

/* ---------- Card grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.card { display: flex; flex-direction: column; }
.card-media { overflow: hidden; }
.card-media img { width: 100%; aspect-ratio: 3/2; object-fit: cover; transition: transform .45s ease; background: var(--bg-alt); }
.card:hover .card-media img { transform: scale(1.04); }
.card-body { padding-top: 12px; }
.card-title { font-family: var(--serif); font-size: 19px; line-height: 1.25; margin: 4px 0 8px; letter-spacing: -.01em; }
.card-title a:hover { color: var(--red); text-decoration: none; }
.card-summary { font-size: 14.5px; color: var(--ink-soft); margin: 0 0 10px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); }
.card-meta span, .card-meta time { position: relative; }

.card-grid .card-lead { grid-column: span 2; }

/* ---------- Single article ---------- */
.article-page .site-main { max-width: 760px; }
.single-head { margin-bottom: 18px; }
.single-head h1 { font-family: var(--serif); font-size: 40px; line-height: 1.13; letter-spacing: -.02em; margin: 8px 0 12px; }
.single-sub { font-size: 21px; color: var(--ink-soft); line-height: 1.45; margin: 0 0 16px; }
.single-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; color: var(--muted); padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.byline { color: var(--ink); font-weight: 600; }
.single-figure { margin: 24px 0; }
.single-figure img { width: 100%; }
.single-figure figcaption { font-size: 13px; color: var(--muted); padding-top: 8px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.single-body { font-size: 19px; line-height: 1.75; color: #1f2530; }
.single-body p { margin: 0 0 22px; }
.single-body h2 { font-family: var(--serif); font-size: 26px; margin: 34px 0 12px; }
.single-body h3 { font-family: var(--serif); font-size: 22px; margin: 28px 0 10px; }
.single-body a { color: var(--red); text-decoration: underline; text-underline-offset: 2px; }
.single-body blockquote { margin: 24px 0; padding: 6px 0 6px 22px; border-left: 4px solid var(--red); font-family: var(--serif); font-size: 22px; font-style: italic; color: var(--ink); }
.single-body img { margin: 20px 0; }
.single-body ul, .single-body ol { margin: 0 0 22px; padding-left: 24px; }
.single-body li { margin-bottom: 8px; }

.share-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 36px 0 8px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.share-bar span { font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .08em; color: var(--muted); }
.share-bar a, .share-copy { font-size: 13px; font-weight: 600; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: #fff; color: var(--ink); cursor: pointer; }
.share-bar a:hover, .share-copy:hover { background: var(--ink); color: #fff; border-color: var(--ink); text-decoration: none; }

.related { max-width: var(--max); margin: 0 auto; }

/* ---------- Archive / search ---------- */
.archive-head { margin: 8px 0 24px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.archive-head h1 { font-family: var(--serif); font-size: 34px; margin: 0 0 6px; position: relative; padding-left: 16px; }
.archive-head h1::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 6px; background: var(--accent, var(--red)); }
.archive-head p { color: var(--muted); margin: 0; }
.search-page-form { display: flex; gap: 8px; margin-top: 14px; max-width: 520px; }
.search-page-form input { flex: 1; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px 14px; font-size: 16px; }
.search-page-form button { background: var(--red); color: #fff; border: 0; padding: 0 22px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.search-count { margin-top: 12px; color: var(--muted); font-size: 14px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 36px 0 0; }
.pager a { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 8px; font-weight: 600; font-size: 14px; }
.pager a:hover { background: var(--bg-alt); text-decoration: none; }
.pager a.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Static & error pages ---------- */
.static-page, .error-page { max-width: 760px; margin: 0 auto; }
.static-page h1 { font-family: var(--serif); font-size: 36px; margin: 8px 0 20px; }
.static-body { font-size: 18px; line-height: 1.75; color: #1f2530; }
.static-body h2 { font-family: var(--serif); font-size: 24px; margin: 28px 0 10px; }
.static-body p { margin: 0 0 18px; }
.static-body a { color: var(--red); text-decoration: underline; }

.contact-form, .static-body form { margin-top: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px 14px; font-size: 16px; font-family: inherit; }
.field textarea { resize: vertical; }
.contact-form button, .static-body form button { background: var(--red); color: #fff; border: 0; padding: 12px 26px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: 16px; }
.contact-form button:hover { background: var(--red-dark); }
.form-status { margin-top: 12px; font-size: 14px; font-weight: 600; }
.form-status.ok { color: #0B6B3A; }
.form-status.err { color: var(--red); }

.error-page { text-align: center; padding: 60px 0; }
.error-code { font-family: var(--serif); font-size: 80px; font-weight: 700; color: var(--red); margin: 0; }
.btn-primary { display: inline-block; background: var(--red); color: #fff; padding: 12px 26px; border-radius: 8px; font-weight: 600; margin-top: 14px; }
.btn-primary:hover { background: var(--red-dark); text-decoration: none; }

.empty { color: var(--muted); padding: 16px 0; grid-column: 1 / -1; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #cfd4dc; margin-top: 56px; padding: 48px 0 28px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1.4fr; gap: 30px; }
.footer-brand .brand-name { color: #fff; font-size: 24px; }
.footer-tag { color: var(--red); font-weight: 600; margin: 6px 0 10px; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.footer-about { color: #98a0ae; line-height: 1.6; }
.footer-col h3 { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 9px; }
.footer-col a:hover { color: #fff; }
.footer-newsletter p { color: #98a0ae; margin: 0 0 12px; }
.nl-row { display: flex; gap: 8px; }
.nl-row input { flex: 1; border: 1px solid #394150; background: #1c2230; color: #fff; border-radius: 8px; padding: 11px 12px; font-size: 15px; }
.nl-row button { background: var(--red); color: #fff; border: 0; padding: 0 18px; border-radius: 8px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.nl-row button:hover { background: var(--red-dark); }
.nl-status { font-size: 13px; margin-top: 8px; min-height: 18px; }
.nl-status.ok { color: #5fd08a; }
.nl-status.err { color: #ff8a8a; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 36px; padding-top: 20px; border-top: 1px solid #2a3140; color: #7c8595; font-size: 13px; }
.footer-legal a:hover { color: #fff; }

/* ---------- Back to top ---------- */
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 150; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; }
.to-top:hover { background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .home-top { grid-template-columns: 1fr; gap: 24px; }
  .trending-zone { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .lead-title { font-size: 30px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: flex; }
  .primary-nav { position: fixed; inset: 0 0 0 auto; width: min(80vw, 320px); transform: translateX(100%); transition: transform .25s ease; background: #fff; z-index: 300; border-left: 1px solid var(--line); border-bottom: 0; box-shadow: var(--shadow); overflow-y: auto; }
  .primary-nav.open { transform: translateX(0); }
  .primary-nav ul { flex-direction: column; padding: 16px; gap: 0; }
  .primary-nav a { border-bottom: 1px solid var(--line); margin: 0; }
  .single-head h1 { font-size: 30px; }
  .single-body { font-size: 17.5px; }
  .lead-title { font-size: 26px; }
}

@media (max-width: 560px) {
  .card-grid { grid-template-columns: 1fr; }
  .card-grid .card-lead { grid-column: span 1; }
  .footer-grid { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
  .section-head { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}

/* ---- JS state classes (progressive enhancement) -------------------- */
.form-status.is-pending,
.nl-status.is-pending { color: var(--muted, #6b7280); }
.share-copy.is-copied { background: #0B6B3A; color: #fff; border-color: #0B6B3A; }
.nav-toggle.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
