/* LegalRepublic.in — core.css
 * Site-wide chrome: header, footer, nav, typography, progress bar, drawer
 * Loaded on every page. Cached after first visit.
 */

/* ============ FONTS ============ */
/* Self-hosted Inter — run scripts/build_fonts.py to populate /assets/fonts/ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/inter-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/assets/fonts/inter-800.woff2') format('woff2');
}

:root {
  --ink: #0A0A0A;
  --brand: #2563EB;
  --paper: #FFFFFF;
  --off-paper: #FAFAF9;
  --rule: #E5E5E5;
  --muted: #6B7280;
  --breaking: #DC2626;
  --editors-gold: #B45309;
  --verified: #15803D;

  --cat-sc: #1E3A8A;
  --cat-hc: #2563EB;
  --cat-trib: #0F766E;
  --cat-everyday: #7C3AED;
  --cat-student: #EA580C;
  --cat-republic: #1F2937;
  --cat-dissent: #7F1D1D;
  --cat-buzz: #DB2777;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }

img, svg { display: block; max-width: 100%; height: auto; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============ LAYOUT ============ */

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.article-container { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ============ PROGRESS BAR ============ */

.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; background: var(--brand);
  width: 0%; z-index: 200; transition: width 0.1s ease-out; will-change: width;
}

/* ============ BREAKING STRIP ============ */

.breaking-strip {
  background: var(--breaking); color: #fff; padding: 8px 0;
  font-size: 13px; font-weight: 600;
}
.breaking-strip .label {
  background: rgba(255,255,255,0.15); padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; margin-right: 12px;
}

/* ============ HEADER ============ */

.header { background: var(--paper); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 100; }
.header-top { padding: 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.logo-link { display: block; flex-shrink: 0; }
.logo-img { height: 48px; width: auto; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.search-btn, .subscribe-btn, .account-btn {
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 18px; border-radius: 6px;
}
.search-btn { background: var(--off-paper); color: var(--ink); border: 1px solid var(--rule); display: flex; align-items: center; gap: 8px; }
.subscribe-btn { background: var(--ink); color: white; }
.subscribe-btn:hover { color: white; background: var(--brand); }
.account-btn { background: var(--off-paper); color: var(--ink); border: 1px solid var(--rule); }
.account-btn:hover { color: var(--brand); border-color: var(--brand); }

.icon-btn {
  display: none; width: 42px; height: 42px;
  align-items: center; justify-content: center;
  border-radius: 6px; background: var(--off-paper); color: var(--ink);
  border: 1px solid var(--rule);
}
.icon-btn svg { width: 20px; height: 20px; }

/* ============ NAV ============ */

.nav { border-top: 1px solid var(--rule); }
.nav-list { display: flex; list-style: none; }
.nav-list a {
  display: block; padding: 14px 22px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.nav-list a:first-child { padding-left: 0; }
.nav-list a:hover, .nav-list a.active { border-bottom-color: var(--brand); color: var(--brand); }

@media (max-width: 900px) {
  .nav { display: none; }
  .icon-btn { display: flex; }
  .search-btn span:not(:first-child), .subscribe-btn { display: none; }
  .account-btn { padding: 9px 12px; }
  .search-btn { padding: 0; width: 42px; height: 42px; justify-content: center; }
  .search-btn span:first-child { font-size: 18px; }
  .logo-img { height: 40px; }
}

/* ============ MOBILE DRAWER ============ */

.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 84%; max-width: 360px; background: var(--paper);
  z-index: 310; transform: translateX(100%); transition: transform 0.25s ease-out;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 20px 24px; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; }
.drawer-header img { height: 36px; }
.drawer-close { width: 36px; height: 36px; }
.drawer-list { list-style: none; padding: 16px 0; }
.drawer-list a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px; font-size: 15px; font-weight: 600;
  border-bottom: 1px solid var(--rule);
}
.drawer-list .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ============ FAB ============ */

.fab {
  display: none; position: fixed; right: 18px; bottom: 18px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: white;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  z-index: 90; transition: background 0.2s;
}
.fab svg { width: 24px; height: 24px; }
.fab.scrolled { background: var(--ink); }

@media (max-width: 900px) {
  .fab { display: flex; }
}

/* ============ FOOTER (light theme) ============ */

.footer {
  background: var(--off-paper);
  color: var(--ink);
  padding: 56px 0 28px;
  margin-top: 64px;
  border-top: 1px solid var(--rule);
}
.footer-top { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 36px; }
.footer-top img { height: 36px; margin-bottom: 14px; }
.footer-top p { font-size: 13px; color: var(--muted); line-height: 1.6; max-width: 320px; }
.footer-top h4 { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 14px; color: var(--ink); }
.footer-top ul { list-style: none; }
.footer-top ul li { padding: 5px 0; font-size: 13px; }
.footer-top ul a { color: var(--muted); }
.footer-top ul a:hover { color: var(--brand); }
.footer-bottom {
  padding-top: 24px; border-top: 1px solid var(--rule);
  font-size: 12px; color: var(--muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

@media (max-width: 700px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-top > div:first-child { grid-column: span 2; }
}

/* ============ CATEGORY BADGES ============ */

.cat-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase;
}
.cat-badge .b { font-family: var(--font-mono); font-weight: 500; }

.cat-sc { color: var(--cat-sc); }
.cat-hc { color: var(--cat-hc); }
.cat-trib { color: var(--cat-trib); }
.cat-everyday { color: var(--cat-everyday); }
.cat-student { color: var(--cat-student); }
.cat-republic { color: var(--cat-republic); }
.cat-dissent { color: var(--cat-dissent); }
.cat-buzz { color: var(--cat-buzz); }

/* ============ NEWSLETTER INLINE ============ */

.nl-inline {
  background: var(--ink);
  color: white;
  padding: 36px;
  border-radius: 8px;
  margin: 48px 0;
}
.nl-inline .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #93C5FD;
  margin-bottom: 14px;
}
.nl-inline h3 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 16px;
}
.nl-inline p { font-size: 14px; color: rgba(255,255,255,0.7); margin-bottom: 20px; }
.nl-inline form { display: flex; gap: 8px; flex-wrap: wrap; }
.nl-inline input {
  flex: 1; min-width: 200px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: white;
  font-family: inherit;
  font-size: 14px;
}
.nl-inline button {
  padding: 12px 20px;
  background: var(--brand);
  color: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}
