/* ============================================================
   uCan — United Citizens' Action Network
   style.css  |  v2.0  |  Mobile-first, responsive
   ============================================================ */

/* ── 1. Design tokens ─────────────────────────────────────── */
:root {
  /* Brand colors — deep navy, flag red, parchment */
  --color-navy:        #1a2744;
  --color-navy-dark:   #0f1929;
  --color-navy-light:  #243460;
  --color-red:         #b0232a;
  --color-red-hover:   #8c1a21;
  --color-gold:        #c8922a;
  --color-parchment:   #f7f4ef;
  --color-parchment-dk:#ede9e1;
  --color-white:       #ffffff;
  --color-text:        #1e1e1e;
  --color-text-muted:  #555555;
  --color-border:      #d0ccc4;
  --color-link:        #1a2744;
  --color-link-hover:  #b0232a;

  /* Typography */
  --font-serif:  'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-sans:   'Source Sans 3', 'Segoe UI', Arial, sans-serif;

  /* Sizes */
  --max-width:   1100px;
  --radius:      4px;
  --radius-lg:   8px;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-12: 3rem;

  /* Transitions */
  --trans: 160ms ease;
}

/* ── 2. Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-parchment);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { display: block; max-width: 100%; height: auto; }

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: color var(--trans), text-decoration-color var(--trans);
}
a:hover, a:focus-visible {
  color: var(--color-link-hover);
  text-decoration-color: currentColor;
}
a:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── 3. Layout helpers ────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--sp-6);
}

/* ── 4. Skip link (accessibility) ─────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  z-index: 9999;
  background: var(--color-gold);
  color: var(--color-navy-dark);
  padding: var(--sp-2) var(--sp-4);
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}
.skip-link:focus { top: 0; }

/* ── 5. Site header ───────────────────────────────────────── */
.site-header {
  background: var(--color-navy);
  color: var(--color-white);
  border-bottom: 3px solid var(--color-red);
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 68px;
  flex-wrap: wrap;
}

/* Brand ─────────────────── */
.site-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  color: var(--color-white);
  flex-shrink: 0;
}
.site-brand:hover { color: var(--color-parchment); }
.site-brand:focus-visible { outline-color: var(--color-gold); }

.site-logo {
  width: 54px;
  height: auto;
  border-radius: var(--radius);
}

.site-title-group {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.site-name-short {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--color-white);
  display: none; /* shown at large sizes via media query */
}

.site-name-full {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: .04em;
  color: #afc0e0;
  text-transform: uppercase;
}

/* Primary nav ─────────────────── */
.nav-primary {
  margin-left: auto;
}

.nav-primary ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  list-style: none;
  align-items: center;
}

.nav-primary a {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  color: #c8d8f0;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: .03em;
  border-radius: var(--radius);
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
}

.nav-primary a:hover,
.nav-primary a:focus-visible,
.nav-primary a[aria-current="page"] {
  background: var(--color-red);
  color: var(--color-white);
}

/* Hamburger (mobile) ─────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  margin-left: auto;
}

.hamburger-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: transform var(--trans), opacity var(--trans);
}

.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── 6. Quote ribbon ──────────────────────────────────────── */
.quote-ribbon {
  background: var(--color-navy-dark);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: var(--sp-2) 0;
}

.quote-link {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  text-decoration: none;
  color: #b0c4e8;
  flex-wrap: wrap;
}
.quote-link:hover { color: var(--color-parchment); }

.quote-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-gold);
  white-space: nowrap;
  flex-shrink: 0;
}

.quote-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.82rem;
  line-height: 1.5;
}

.quote-text p { display: inline; }

.quote-text footer {
  display: inline;
  margin-left: var(--sp-2);
  font-style: normal;
  font-size: 0.78rem;
  color: var(--color-gold);
}

/* ── 7. Topics navigation ─────────────────────────────────── */
.topics-nav {
  background: var(--color-parchment-dk);
  border-bottom: 2px solid var(--color-border);
}

.topics-nav ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topics-nav ul::-webkit-scrollbar { display: none; }

.topics-nav a {
  display: block;
  padding: var(--sp-3) var(--sp-3);
  color: var(--color-navy);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .01em;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color var(--trans), border-color var(--trans), background var(--trans);
}

.topics-nav a:hover,
.topics-nav a:focus-visible {
  color: var(--color-red);
  border-bottom-color: var(--color-red);
  background: rgba(176,35,42,.06);
}

.topics-nav a[aria-current="page"] {
  color: var(--color-red);
  border-bottom-color: var(--color-red);
  font-weight: 700;
}

/* ── 8. Main content area ─────────────────────────────────── */
.site-main {
  flex: 1;
  padding: var(--sp-8) 0 var(--sp-12);
}

.content-area {
  /* Single-column on mobile, can extend for sidebar layouts */
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-8);
}

/* ── 9. Article typography ────────────────────────────────── */
.page-article {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) clamp(var(--sp-4), 5vw, var(--sp-12));
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.page-article h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.2;
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 2px solid var(--color-red);
}

.page-article h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: 700;
  color: var(--color-navy);
  margin-top: var(--sp-8);
  margin-bottom: var(--sp-3);
  padding-left: var(--sp-3);
  border-left: 4px solid var(--color-gold);
}

.page-article h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-navy);
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-2);
}

.page-article p {
  margin-bottom: var(--sp-4);
  max-width: 70ch;
}

.page-article ul,
.page-article ol {
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-4);
}

.page-article li {
  margin-bottom: var(--sp-2);
}

.page-article strong {
  color: var(--color-navy);
}

.page-article a {
  color: var(--color-red);
}
.page-article a:hover {
  color: var(--color-red-hover);
}

/* Blockquote inside article */
.page-article blockquote {
  margin: var(--sp-6) 0;
  padding: var(--sp-4) var(--sp-6);
  background: var(--color-parchment);
  border-left: 4px solid var(--color-gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-text-muted);
}

/* Divider helper */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--sp-8) 0;
}

/* ── 10. Sidebar (optional layout) ────────────────────────── */
/* Uncomment and use class="content-area has-sidebar" on .content-area */
/*
@media (min-width: 760px) {
  .content-area.has-sidebar {
    grid-template-columns: 1fr 260px;
  }
}
.sidebar { ... }
*/

/* ── 11. Footer ───────────────────────────────────────────── */
.site-footer {
  background: var(--color-navy-dark);
  color: #8aa0c8;
  border-top: 3px solid var(--color-red);
  padding: var(--sp-8) 0;
  margin-top: auto;
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  text-align: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--color-parchment);
  font-family: var(--font-serif);
  font-size: 1rem;
}

.footer-logo {
  width: 38px;
  height: auto;
  opacity: .85;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1) var(--sp-4);
}

.footer-nav a {
  color: #8aa0c8;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-decoration: none;
}
.footer-nav a:hover {
  color: var(--color-parchment);
  text-decoration: underline;
}

.footer-copy {
  font-size: 0.78rem;
  color: #607090;
}

/* ── 12. Utility classes ──────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* Button style */
.btn {
  display: inline-block;
  padding: var(--sp-2) var(--sp-6);
  background: var(--color-red);
  color: var(--color-white);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: .04em;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans), color var(--trans);
}
.btn:hover, .btn:focus-visible {
  background: var(--color-red-hover);
  color: var(--color-white);
}
.btn-outline {
  background: transparent;
  border-color: var(--color-navy);
  color: var(--color-navy);
}
.btn-outline:hover {
  background: var(--color-navy);
  color: var(--color-white);
}

/* Alert / callout boxes */
.callout {
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--radius);
  border-left: 4px solid;
  margin-bottom: var(--sp-4);
}
.callout-info    { background: #eef4ff; border-color: #4077c8; color: #1a3060; }
.callout-warning { background: #fff8e6; border-color: var(--color-gold); color: #5a3a00; }

/* ── 13. Responsive breakpoints ───────────────────────────── */

/* ---- Tablet 640px ---- */
@media (min-width: 640px) {
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}

/* ---- Desktop 900px ---- */
@media (min-width: 900px) {
  .site-name-short { display: block; }
  .site-name-full  { display: none; }

  .topics-nav a {
    padding: var(--sp-3) var(--sp-4);
    font-size: 0.88rem;
  }
}

/* ── 14. Mobile-specific overrides (max-width) ─────────────── */
@media (max-width: 680px) {

  /* Show hamburger, hide primary nav by default */
  .nav-toggle  { display: flex; }
  .nav-primary {
    display: none;
    width: 100%;
    order: 3;
    padding-bottom: var(--sp-3);
    border-top: 1px solid rgba(255,255,255,.1);
    margin-left: 0;
  }
  .nav-primary.is-open { display: block; }
  .nav-primary ul { flex-direction: column; gap: var(--sp-1); }
  .nav-primary a  { padding: var(--sp-3) var(--sp-4); font-size: 1rem; }

  /* Quote wraps cleanly */
  .quote-link { flex-direction: column; gap: var(--sp-1); }

  /* Topics scroll horizontally */
  .topics-nav ul { flex-wrap: nowrap; }

  /* Reduce article padding */
  .page-article { padding: var(--sp-6) var(--sp-4); }
}

/* ── 15. Print styles ─────────────────────────────────────── */
@media print {
  .site-header, .topics-nav, .site-footer { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
  .page-article { border: none; box-shadow: none; padding: 0; }
}

.full-essay-box {
  background: var(--color-navy);
  color: #c8d8f0;
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin-top: var(--sp-10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.full-essay-box p {
  margin: 0;
  font-size: 0.9rem;
}

.full-essay-box strong {
  color: var(--color-white);
}

.full-essay-box a.btn {
  background: var(--color-red);
  color: var(--color-white) !important;
  text-decoration: none !important;
  white-space: nowrap;
  flex-shrink: 0;
}