/* ===== VAKIL.ONE — css/vakil.css · SOVEREIGN DESIGN TOKEN FOUNDATION (light canvas) =====
   Loaded by index.html, privacy.html, terms.html and every infographic page.
   WHY: single source of truth for the public PWA. Holds the "Vakil-One Master
   Spec" palette (authority navy #1E3A8A + trust gold #B45309), the legacy
   token aliases (--brand-navy, --badge-*, --shadow-*) and the shared
   button/modal/badge/grid primitives. index.html's inline <style> adds ONLY
   tokens missing here — keep the token store here, do not re-declare tokens
   on the page. Fonts: EB Garamond (headings) · Lato (body) · JetBrains Mono (data).
   Breakpoint: single mobile collapse @ max-width:768px + reduced-motion a11y.
   Z-index tiers: navbar 1000 · user-dropdown 1001 · tooltip 1000 ·
   modal-overlay 9998 · inline overlays 99999 · UPI retainer 999999 ·
   toast 100000. (index.html inline styles override the navbar to 100 and add
   the 99999 overlay tier — keep new chrome at or below the modal tier.)
============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:wght@400;500;600;700&family=Lato:wght@300;400;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* ===== COLOR TOKENS (Vakil-One Master Spec) ===== */
  --color-primary: #1E3A8A;
  --color-on-primary: #FFFFFF;
  --color-secondary: #1E40AF;
  --color-on-secondary: #FFFFFF;
  --color-accent: #B45309;
  --color-on-accent: #FFFFFF;
  --color-background: #F8FAFC;
  --color-foreground: #0F172A;
  --color-card: #FFFFFF;
  --color-card-foreground: #0F172A;
  --color-muted: #E9EEF5;
  --color-muted-foreground: #475569;
  --color-border: #CBD5E1;
  --color-destructive: #DC2626;
  --color-on-destructive: #FFFFFF;
  --color-ring: #1E3A8A;

  /* ===== LEGACY TOKENS (backward compatibility — mapped to the new palette) ===== */
  --bg-base: var(--color-background);
  --bg-surface: var(--color-card);
  --bg-surface-elevated: var(--color-card);
  --bg-input: var(--color-card);
  --bg-subtle: var(--color-muted);
  /* V1-27 FIX: --bg-card was consumed ~23x (chamber merit/finance renderers,
     cause-list dashboard) but never defined, so those 'card' panels silently
     fell back to transparent. Map it to the card surface token. */
  --bg-card: var(--color-card);
  /* V1-27 FIX: --font-body consumed by the cause-list dashboard renderer but
     undefined; alias it to the site body stack so the panel stays type-consistent. */
  --font-body: 'Lato', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --border-subtle: #E2E8F0;
  --border-card: var(--color-border);
  --border-hover: #64748B;
  --border-focus: var(--color-ring);

  --text-primary: var(--color-foreground);
  --text-secondary: #334155;
  --text-muted: var(--color-muted-foreground);

  --brand-navy: var(--color-primary);
  --brand-navy-hover: var(--color-secondary);
  --brand-navy-light: var(--color-muted);

  --accent-gold: var(--color-accent);
  --accent-gold-bg: #FEF3C7;
  --accent-gold-border: #FDE68A;

  --badge-blue-bg: #EFF6FF;
  --badge-blue-text: var(--color-secondary);
  --badge-blue-border: #BFDBFE;

  --badge-green-bg: #F0FDF4;
  --badge-green-text: #166534;
  --badge-green-border: #BBF7D0;

  /* ===== SPACING TOKENS =====
     Only --space-lg is consumed (counsel/firm cards); the rest of the
     scale was never wired up — pages use literal px — so the unused
     rungs were removed. */
  --space-lg: 24px;

  /* ===== SHADOW TOKENS ===== */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* ===== MOTION & RADIUS ===== */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --radius-md: 8px;
  --radius-lg: 12px;
  --focus-ring: 0 0 0 3px rgba(30, 58, 138, 0.2);
}

/* ===== BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Lato', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--color-background);
  color: var(--color-foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
  font-family: 'EB Garamond', 'Plus Jakarta Sans', Georgia, serif;
  color: var(--color-foreground);
}
.font-serif { font-family: 'EB Garamond', 'Plus Jakarta Sans', Georgia, serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
a { text-decoration: none; color: inherit; }
a:hover { transition: color var(--transition-fast); }

/* ===== VISUAL & INPUT FOCUS (a11y — visible rings, 44px touch targets) ===== */
.btn:focus-visible,
button:focus-visible,
.mode-tab-btn:focus-visible,
.quick-pill:focus-visible,
.feed-tab:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.modal-close:focus-visible,
.dropdown-item:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all var(--transition-base);
  font-family: inherit;
}
.btn-primary {
  background: var(--color-accent); color: var(--color-on-accent);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover {
  background: #934608; border-color: #934608;
  transform: translateY(-1px); box-shadow: var(--shadow-lg);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: var(--color-card); color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--color-muted); border-color: var(--color-secondary);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.btn-secondary:active { transform: translateY(0); }
.btn-outline {
  background: transparent; color: var(--color-primary); border-color: var(--color-border);
}
.btn-outline:hover {
  background: var(--color-muted); border-color: var(--color-primary); color: var(--color-primary);
}
.btn-sm { padding: 7px 15px; font-size: 12px; border-radius: 10px; font-weight: 700; cursor: pointer; transition: all var(--transition-base); }
.btn-google {
  background: var(--color-card); border: 1.5px solid var(--color-border);
  color: var(--color-foreground);
  box-shadow: var(--shadow-sm); font-weight: 600;
}
.btn-google:hover {
  background: var(--color-background); border-color: var(--color-primary);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.btn-google:active { transform: translateY(0); }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--color-card); border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 1000;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px; background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.brand-title { font-size: 20px; font-weight: 700; color: var(--color-primary); letter-spacing: -0.01em; line-height: 1.1; font-family: 'EB Garamond', Georgia, serif; }
.brand-suffix { color: var(--color-accent); }
.brand-sub { font-size: 10.5px; color: var(--color-muted-foreground); font-weight: 500; letter-spacing: 0.02em; }

/* ===== HERO ===== */
.hero { padding: 48px 0 40px; position: relative; }
.hero-banner {
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 20px;
  padding: 48px 40px;
  box-shadow: var(--shadow-xl);
  position: relative; overflow: hidden;
}
.hero-banner::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 50%, var(--color-accent) 100%);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 15px;
  border-radius: 20px; background: var(--color-muted); border: 1px solid var(--color-border);
  color: var(--color-primary); font-size: 11.5px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; margin-bottom: 20px;
  text-transform: uppercase; letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
}
.hero-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 40px; font-weight: 600; line-height: 1.18; letter-spacing: -0.01em;
  color: var(--color-primary); margin-bottom: 16px;
}
.hero-sub { font-size: 15.5px; color: var(--text-secondary); max-width: 820px; line-height: 1.65; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hero-compliance-callout {
  margin-top: 28px; padding: 12px 18px; border-radius: 10px; background: var(--color-muted);
  border-left: 3px solid var(--color-primary); font-size: 12px; color: var(--text-secondary);
  line-height: 1.5; display: flex; align-items: center; gap: 10px;
}

/* ===== SECTIONS ===== */
section { padding: 48px 0 72px; }
.section-head { margin-bottom: 32px; }
.section-tag {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-primary);
  font-weight: 700; font-family: 'JetBrains Mono', monospace; margin-bottom: 8px;
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  background: var(--color-muted); border: 1px solid var(--border-subtle);
}
.section-heading {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 30px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--color-primary); margin-bottom: 8px;
}
.section-desc { font-size: 14px; color: var(--color-muted-foreground); max-width: 760px; line-height: 1.6; }

/* ===== DISCOVERY BOX ===== */
.discovery-box {
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 16px;
  padding: 26px; box-shadow: var(--shadow-lg);
  margin-bottom: 32px;
}
.mode-nav-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 16px; margin-bottom: 20px; }
.mode-tab-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px;
  border-radius: 8px; border: 1.5px solid var(--color-border); background: var(--color-card);
  color: var(--text-secondary); font-size: 12.5px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: all var(--transition-base);
}
.mode-tab-btn:hover {
  background: var(--color-background); border-color: var(--color-primary);
  color: var(--color-primary); transform: translateY(-1px);
}
.mode-tab-btn.active {
  background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary);
  box-shadow: var(--shadow-md);
}

.quick-pills-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.quick-pill-label { font-size: 11px; font-weight: 700; color: var(--color-muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; }
.quick-pill {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--color-border);
  background: var(--color-card); color: var(--text-secondary); font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: all var(--transition-base);
}
.quick-pill:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-muted); }
.quick-pill.active { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }

.filter-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; }
.search-input-wrapper { position: relative; }
.search-input-wrapper input {
  width: 100%; padding: 10px 14px 10px 36px; background: var(--color-card);
  border: 1px solid var(--color-border); border-radius: 8px; font-size: 14px;
  color: var(--color-foreground); outline: none;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  font-family: inherit;
}
.search-input-wrapper input:focus { border-color: var(--color-ring); box-shadow: var(--focus-ring); }
.search-input-wrapper svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-muted-foreground); }
.filter-select {
  width: 100%; padding: 10px 14px; background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 8px; font-size: 14px; color: var(--color-foreground); outline: none; cursor: pointer;
  transition: border-color var(--transition-base), box-shadow var(--transition-base); font-family: inherit;
}
.filter-select:focus { border-color: var(--color-ring); box-shadow: var(--focus-ring); }

/* ===== DIRECTORY GRID ===== */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
.counsel-card,
.firm-card {
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-lg); box-shadow: var(--shadow-sm);
  transition: all var(--transition-base); cursor: pointer;
}
.counsel-card:hover,
.firm-card:hover {
  border-color: var(--color-primary); box-shadow: var(--shadow-lg); transform: translateY(-2px);
}
.firm-affiliation-box {
  background: var(--color-muted); border: 1px solid var(--border-subtle); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; transition: all var(--transition-base);
}
.firm-affiliation-box:hover { border-color: var(--color-primary); background: var(--color-background); }

/* ===== CARDS ===== */
.m-card {
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}
.m-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* ===== BADGES ===== */
.badge-tag {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; background: var(--color-muted); color: var(--color-muted-foreground);
  border: 1px solid var(--color-border); white-space: nowrap;
  transition: all var(--transition-fast);
}
.badge-bci {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px;
  font-size: 10.5px; font-weight: 700; background: var(--badge-blue-bg); color: var(--badge-blue-text);
  border: 1px solid var(--badge-blue-border); font-family: 'JetBrains Mono', monospace;
  transition: all var(--transition-fast);
}
.badge-active {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px;
  font-size: 10.5px; font-weight: 700; background: var(--badge-green-bg); color: var(--badge-green-text);
  border: 1px solid var(--badge-green-border);
  transition: all var(--transition-fast);
}

/* ===== MODALS ===== */
.modal-overlay {
  display: none !important; position: fixed; inset: 0; z-index: 9998;
  background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open, .modal-overlay.active, .modal-overlay.show {
  display: flex !important;
  animation: fadeIn 0.3s ease;
}
.modal-box {
  background: var(--color-card); border-radius: 16px; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto; position: relative;
  box-shadow: var(--shadow-xl);
  animation: fadeInUp 0.3s ease;
}
.modal-box-lg { max-width: 900px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border-radius: 8px; border: 1px solid var(--border-subtle); background: var(--color-card);
  color: var(--color-muted-foreground); font-size: 18px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; z-index: 10;
  transition: all var(--transition-base);
}
.modal-close:hover { background: var(--color-muted); color: var(--color-primary); }

/* ===== USER DROPDOWN ===== */
.user-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 260px; z-index: 1001;
  padding: 8px 0;
}
.user-dropdown.open { display: block; animation: fadeInUp 0.2s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 16px;
  border: none; background: none; color: var(--text-secondary); font-size: 13px;
  font-weight: 500; cursor: pointer; text-align: left;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.dropdown-item:hover { background: var(--color-muted); color: var(--color-primary); }

/* ===== TOOLTIP ===== */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); padding: 4px 8px; background: var(--color-primary);
  color: var(--color-on-primary); font-size: 11px; border-radius: 4px; white-space: nowrap;
  z-index: 1000; margin-bottom: 4px;
}

/* ===== TOAST ===== */
#vakilToast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100000;
  padding: 12px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--color-foreground); color: var(--color-on-primary);
  box-shadow: var(--shadow-xl); font-family: inherit;
  animation: fadeInUp 0.3s ease;
}

/* ===== PROFILE / FEED ===== */
.profile-hero-banner {
  width: 100%; height: 200px; border-radius: 12px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 55%, #0F172A 100%);
}
.profile-headshot {
  width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--color-card);
  box-shadow: var(--shadow-md); object-fit: cover;
  margin-top: -48px; position: relative; z-index: 2; background: var(--color-card);
}
.merit-gauge { position: relative; width: 120px; height: 60px; overflow: hidden; }
/* profiles.js renders only the gauge bg ring + text + label; a separate
   -fill arc path never exists in the DOM, so no fill rule is needed. */
.merit-gauge-bg { fill: none; stroke: var(--border-subtle); stroke-width: 8; }
.merit-gauge-text { font-family: 'EB Garamond', Georgia, serif; font-size: 22px; font-weight: 600; fill: var(--color-primary); }
.merit-gauge-label { font-size: 9px; fill: var(--color-muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; }

/* Individual tab pills for the legal-feed modal (index.html). The tab
   container bar is styled inline; this rule owns the pill look + active
   underline. */
.feed-tab {
  padding: 10px 20px; font-size: 13px; font-weight: 700; color: var(--color-muted-foreground);
  border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition-base); font-family: inherit;
}
.feed-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.feed-tab:hover { color: var(--color-primary); }

.feed-post {
  background: var(--color-card); border: 1px solid var(--color-border); border-radius: 14px;
  padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}
.feed-post:hover { box-shadow: var(--shadow-md); }
.feed-post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.feed-post-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--color-primary);
  color: var(--color-on-primary); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.feed-post-body { font-size: 14px; line-height: 1.65; color: var(--text-secondary); margin-bottom: 14px; }
.feed-post-actions { display: flex; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.feed-action-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: none; background: none; color: var(--color-muted-foreground); font-size: 13px;
  font-weight: 600; cursor: pointer; border-radius: 6px;
  transition: all var(--transition-base);
  font-family: inherit;
}
.feed-action-btn:hover { background: var(--color-muted); color: var(--color-primary); }
.feed-action-btn.liked { color: var(--color-destructive); }

/* ===== V1-30 FIX: trust-ledger mobile. The 8-column ledger grid (~769px
   min) clipped horizontally inside the 960px chamber modal on phones.
   Below 640px, rows stack into label/value cards. ===== */
@media (max-width: 640px) {
  .trust-ledger-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .trust-ledger-row > * { min-width: 0; }
  .trust-ledger-row > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
  }
  .trust-ledger-row > div br { display: none; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .filter-grid { grid-template-columns: 1fr; }
  .dir-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 30px; }
  .hero-banner { padding: 28px 20px; }
  .section-heading { font-size: 24px; }
}

/* ===== V1-27 FIX: card class bases. .discovery-card / .user-avatar-btn /
   .precedent-card / .clause-card are consumed by index.html renderers with
   inline styles but had NO base rule, so hover/active states were
   inconsistent. Add minimal shared card affordances. */
.discovery-card,
.precedent-card,
.clause-card,
.user-avatar-btn {
  border: 1px solid var(--color-border);
  transition: all var(--transition-base);
}
.discovery-card:hover,
.precedent-card:hover,
.clause-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ===== ANIMATIONS ===== */

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.fade-in { animation: fadeInUp 0.3s ease; }

/* ===== REDUCED MOTION (a11y) ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
