/* ============================================================
   CA Toolbox — Shared Stylesheet for Updates, News & Tools Directory
   Matches toolbox.css tokens; zero external CSS/font dependencies.
   Responsive down to 360px.
   ============================================================ */

:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --alert: #b91c1c;
  --alert-bg: #fef2f2;
  --alert-border: #fecaca;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ── Top Header & Navigation ── */
.site-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}
.brand-wrap:hover { text-decoration: none; }

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.15;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  border: 1px solid transparent;
}
.nav-link:hover {
  background: var(--surface-alt);
  text-decoration: none;
  color: var(--ink);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: #bfdbfe;
}

.header-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: 7px;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.cta-sub {
  font-size: 11.5px;
  color: var(--muted);
}

/* ── Hero / Filter Strip ── */
.hero-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.hero-top h1 {
  margin: 0 0 4px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero-top p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.search-input {
  width: 260px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-alt);
}
.search-input:focus {
  outline: 2px solid #93c5fd;
  border-color: var(--accent);
  background: var(--surface);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font);
}
.pill:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}
.pill.active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

/* ── Main Two-Column Hub Grid ── */
.hub-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
  align-items: start;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.date-group-title {
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.date-group-title:first-child { margin-top: 0; }

/* ── News Cards ── */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.news-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.badge-authority {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: #bfdbfe;
}

.badge-alert {
  background: var(--alert-bg);
  color: var(--alert);
  border-color: var(--alert-border);
}

.badge-effective {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: #a7f3d0;
}

.news-card h2,
.news-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.news-card h2 a,
.news-card h3 a { color: var(--ink); }
.news-card h2 a:hover,
.news-card h3 a:hover { color: var(--accent); text-decoration: none; }

.news-summary {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.read-more {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Sidebar ── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.side-box h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.side-desc {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.side-tool-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-tool-item a {
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--ink);
}
.side-tool-item a:hover {
  border-color: #93c5fd;
  background: var(--accent-soft);
  text-decoration: none;
}

.side-tool-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.side-tool-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.btn-outline {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.btn-outline:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

.archive-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
}

.archive-links li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.archive-count {
  color: var(--muted);
  font-size: 12px;
}

/* ── Article Page ── */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

.article-wrap {
  max-width: 780px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
}

.article-title {
  margin: 10px 0 12px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.article-byline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}

.answer-box {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 15px;
  color: var(--ink);
}

.facts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 13.5px;
}
.facts-table th,
.facts-table td {
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.facts-table th {
  width: 32%;
  background: var(--surface-alt);
  color: var(--ink-2);
  font-weight: 600;
}

.article-body h2 {
  margin: 22px 0 8px;
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
}
.article-body p { margin: 0 0 12px; color: var(--ink-2); }
.article-body ul,
.article-body ol {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--ink-2);
}
.article-body li { margin-bottom: 6px; }
.article-body code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}

.qa-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.qa-section h2 { margin: 0 0 12px; font-size: 18px; }
.qa-item { margin-bottom: 14px; }
.qa-q { font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.qa-a { margin: 0; color: var(--ink-2); font-size: 14.5px; }

.source-box {
  margin-top: 22px;
  padding: 12px 15px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13.5px;
}

.disclaimer-box {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}

/* ── Tools Directory Grid (/tools/) ── */
.tools-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.tool-card p {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
}

.state-box {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
}

/* ── Footer ── */
.site-footer {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 10px 0;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

.footer-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted-light);
}

.empty-note {
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.hidden { display: none !important; }

/* ── Responsive Breakpoints (tested down to 360px) ── */
@media (max-width: 900px) {
  .hub-grid { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .container { padding: 12px 12px 28px; }
  .site-header, .hero-strip { padding: 14px; }
  .header-cta { align-items: flex-start; width: 100%; }
  .search-input { width: 100%; }
  .tools-grid { grid-template-columns: 1fr; }
  .article-wrap { padding: 18px 15px; }
  .article-title { font-size: 21px; }
  .facts-table th { width: 38%; }
}

@media print {
  .site-header, .hero-strip, .sidebar, .site-footer { display: none; }
  body { background: #ffffff; }
  .article-wrap { border: 0; padding: 0; max-width: 100%; }
}
