/* =============================================================
   Casa Garza Jasso — theme v2
   Inspiration: Linear, Vercel Dashboard, Apple Wallet, Superhuman
   Design principles:
   - Generous whitespace · strong typography · subtle gradients
   - Bento-style cards with layered shadows
   - Gold as a HAIRLINE accent, never dominant
   - Theme primary (blue/burgundy) only on interactive surfaces
   ============================================================= */

:root {
  /* Typography — Fraunces for display (variable, elegant-modern),
     Inter for everything else. Both from Google Fonts. */
  --font-display: "Fraunces", "New York", "Iowan Old Style", Georgia, serif;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", Menlo, monospace;

  /* Neutrals — cool Apple-ish off-white */
  --bg-page:     #f5f5f7;
  --bg-card:     #ffffff;
  --bg-card-soft:#fafafb;
  --bg-muted:    #eceef1;
  --bg-code:     #e8eaee;
  --bg-overlay:  rgba(255,255,255,0.72);

  --text-1:      #0a0a0a;   /* display / headings */
  --text-2:      #27272a;
  --text-3:      #52525b;
  --text-4:      #8a8a93;   /* labels / eyebrows */

  --border:       #e4e4e7;
  --border-muted: #ececf0;
  --border-strong:#d0d0d5;
  --border-focus: color-mix(in oklab, var(--primary) 30%, transparent);

  /* Gold — reserved for hairlines + micro-accents only */
  --gold:       #c9a227;
  --gold-deep:  #8f7315;
  --gold-soft:  rgba(201, 162, 39, 0.14);

  /* Signal colors */
  --green:      #16a34a;
  --green-soft: rgba(22,163,74,0.08);
  --red:        #dc2626;
  --red-soft:   rgba(220,38,38,0.08);
  --amber:      #d97706;

  /* Elevation (layered shadows, Apple-style) */
  --shadow-xs: 0 1px 2px rgba(15,15,20,0.04);
  --shadow-sm: 0 1px 2px rgba(15,15,20,0.04), 0 2px 4px rgba(15,15,20,0.03);
  --shadow-md: 0 2px 4px rgba(15,15,20,0.03), 0 8px 16px rgba(15,15,20,0.06);
  --shadow-lg: 0 4px 8px rgba(15,15,20,0.04), 0 24px 48px rgba(15,15,20,0.08);
  --shadow-focus: 0 0 0 3px var(--border-focus);

  /* Radii */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Spacing (4px grid) */
  --s-1:  4px;
  --s-2:  8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ============ THEMES ============ */
:root[data-theme="luis"] {
  --primary:       #1e3a8a;
  --primary-soft:  #2f4fa8;
  --primary-deep:  #14266b;
  --primary-bg:    #eff3fc;
  --primary-bg-2:  #e1e9f8;
  --primary-glow:  rgba(30,58,138,0.18);
}
:root[data-theme="pau"] {
  --primary:       #6b1d3a;
  --primary-soft:  #8b2a4f;
  --primary-deep:  #501227;
  --primary-bg:    #f6ebef;
  --primary-bg-2:  #eed6dd;
  --primary-glow:  rgba(107,29,58,0.18);
}
:root[data-theme="home"] {
  --primary:       #8f7315;     /* gold-deep as primary */
  --primary-soft:  #b8911f;
  --primary-deep:  #6b5610;
  --primary-bg:    #faf3da;
  --primary-bg-2:  #f3e6b8;
  --primary-glow:  rgba(143,115,21,0.18);
}

/* ============ RESET + BASE ============ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 100% -200px, var(--primary-bg) 0%, transparent 70%),
    var(--bg-page);
  background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-1);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 var(--s-3);
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 500; letter-spacing: -0.035em; }
h2 { font-size: 1.5rem; font-weight: 500; margin-top: var(--s-10); }
h3 { font-size: 1.15rem; font-weight: 600; margin-top: var(--s-6); }
h4 { font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600; color: var(--text-2); margin-top: var(--s-4); }

p { margin: 0 0 var(--s-4); color: var(--text-2); }

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity .15s var(--ease);
}
a:hover { opacity: 0.7; }

strong { color: var(--text-1); font-weight: 600; }
em { color: var(--text-2); font-style: italic; }

code {
  background: var(--bg-code);
  padding: 0.1em 0.4em;
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-2);
}
pre {
  background: var(--bg-code);
  padding: var(--s-4);
  border-radius: var(--r-md);
  overflow-x: auto;
  font-size: 0.85em;
  border: 1px solid var(--border-muted);
}
pre code { background: transparent; padding: 0; }

blockquote {
  border-left: 2px solid var(--gold);
  padding: var(--s-2) 0 var(--s-2) var(--s-5);
  margin: var(--s-5) 0;
  color: var(--text-2);
  font-style: italic;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-muted);
  margin: var(--s-10) 0;
}

ul, ol { padding-left: 1.3em; margin: 0 0 var(--s-4); }
li { margin-bottom: 0.2em; color: var(--text-2); }

img { max-width: 100%; height: auto; border-radius: var(--r-sm); }

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: var(--s-4) 0;
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 0.92em;
}
th, td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-muted);
}
th {
  background: var(--bg-muted);
  color: var(--text-3);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: var(--bg-card-soft); }

/* ============ SITE CHROME ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-overlay);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-muted);
}
.site-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-8);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-6);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.site-brand__mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background:
    linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  position: relative;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.site-brand__mark::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 3px;
  background: var(--gold);
  opacity: 0.85;
}

.site-nav {
  display: flex;
  gap: var(--s-1);
  font-size: 0.88rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  padding: var(--s-2) var(--s-3);
  color: var(--text-3);
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: background .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text-1); background: var(--bg-muted); }
.site-nav a.active { color: var(--primary); background: var(--primary-bg); }

.site-switcher {
  display: flex;
  gap: var(--s-2);
  font-size: 0.85rem;
}
.site-switcher a {
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-weight: 500;
  transition: all .15s var(--ease);
}
.site-switcher a:hover { border-color: var(--text-3); color: var(--text-1); }
.site-switcher a.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.breadcrumb {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-8) 0;
  font-size: 0.82rem;
  color: var(--text-4);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.breadcrumb a { color: var(--text-4); font-weight: 500; }
.breadcrumb a:hover { color: var(--text-1); }
.breadcrumb .sep { color: var(--border-strong); }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-8);
}
main.narrow { max-width: 780px; }

.site-footer {
  max-width: 1280px;
  margin: var(--s-20) auto 0;
  padding: var(--s-6) var(--s-8);
  border-top: 1px solid var(--border-muted);
  font-size: 0.78rem;
  color: var(--text-4);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.site-footer a { color: var(--text-4); }
.site-footer a:hover { color: var(--text-2); }

/* ============ HERO (landing) ============ */
.hero {
  padding: var(--s-12) 0 var(--s-10);
  max-width: 780px;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 600;
  padding: 4px 10px;
  background: var(--primary-bg);
  border-radius: var(--r-full);
  margin-bottom: var(--s-4);
}
.hero__eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: var(--r-full);
}
.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  margin-bottom: var(--s-4);
}
.hero__sub {
  font-size: 1.1rem;
  color: var(--text-3);
  max-width: 560px;
  line-height: 1.45;
}

/* ============ BENTO GRID ============ */
.bento {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(120px, auto);
  margin: var(--s-6) 0;
}
.bento > .cell {
  grid-column: span 4;
}
.bento > .cell--lg  { grid-column: span 6; }
.bento > .cell--xl  { grid-column: span 8; }
.bento > .cell--full{ grid-column: span 12; }
.bento > .cell--sm  { grid-column: span 3; }

@media (max-width: 900px) {
  .bento > .cell, .bento > .cell--lg, .bento > .cell--xl, .bento > .cell--sm { grid-column: span 6; }
  .bento > .cell--full { grid-column: span 12; }
}
@media (max-width: 560px) {
  .bento > .cell, .bento > .cell--lg, .bento > .cell--xl, .bento > .cell--sm, .bento > .cell--full {
    grid-column: span 12;
  }
}

/* ============ CARD ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-xs);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  color: var(--text-1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card__eyebrow {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-4);
  font-weight: 600;
  display: flex; align-items: center; gap: var(--s-2);
}
.card__eyebrow .dot {
  width: 6px; height: 6px; border-radius: var(--r-full);
  background: var(--gold);
}
.card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text-1);
  display: flex; align-items: baseline; gap: var(--s-2);
  margin: 0;
}
.card__title .icon { font-size: 1.3rem; }
.card__meta {
  font-size: 0.85rem;
  color: var(--text-3);
  margin-top: auto;
  padding-top: var(--s-2);
}
.card__stat {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  color: var(--text-1);
  line-height: 1.05;
  margin: var(--s-2) 0 var(--s-1);
  font-variant-numeric: tabular-nums;
}
.card__delta {
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 4px;
}
.card__delta--up   { color: var(--green); }
.card__delta--down { color: var(--red); }
.card__delta--flat { color: var(--text-4); }

/* Featured card variation */
.card--featured {
  background:
    linear-gradient(135deg, var(--primary-bg) 0%, var(--bg-card) 60%);
  border-color: var(--primary-glow);
}
.card--featured .card__title { color: var(--primary-deep); }

/* Sparkline SVG */
.sparkline {
  width: 100%;
  height: 36px;
  overflow: visible;
  margin-top: var(--s-2);
}
.sparkline path.line { fill: none; stroke: var(--primary); stroke-width: 1.5; }
.sparkline path.fill { fill: var(--primary); fill-opacity: 0.08; stroke: none; }

/* ============ BADGE + PILL ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--primary-bg);
  color: var(--primary-deep);
  border: 1px solid var(--primary-glow);
  white-space: nowrap;
}
.badge--gold   { background: var(--gold-soft); color: var(--gold-deep); border-color: color-mix(in oklab, var(--gold) 30%, transparent); }
.badge--green  { background: var(--green-soft); color: var(--green); border-color: color-mix(in oklab, var(--green) 25%, transparent); }
.badge--red    { background: var(--red-soft); color: var(--red); border-color: color-mix(in oklab, var(--red) 25%, transparent); }
.badge--amber  { background: rgba(217,119,6,0.1); color: var(--amber); border-color: rgba(217,119,6,0.25); }
.badge--neutral{ background: var(--bg-muted); color: var(--text-3); border-color: var(--border-muted); }

/* ============ UTILITIES ============ */
.stack-sm > * + *  { margin-top: var(--s-2); }
.stack-md > * + *  { margin-top: var(--s-4); }
.stack-lg > * + *  { margin-top: var(--s-8); }

.muted { color: var(--text-4); }
.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-4);
  font-weight: 600;
}

.gold-rule {
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--gold) 20%, var(--gold) 80%, transparent 100%);
  border: 0;
  margin: var(--s-10) 0;
  opacity: 0.6;
}

.tabs {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 3px;
  border-radius: var(--r-md);
  gap: 2px;
  margin-bottom: var(--s-6);
}
.tabs input[type="radio"] { display: none; }
.tabs label {
  padding: 6px 14px;
  border-radius: calc(var(--r-md) - 3px);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.tabs label:hover { color: var(--text-1); }
.tabs input[type="radio"]:checked + label {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* Search input */
.search {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-4);
  margin-bottom: var(--s-6);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.92rem;
  color: var(--text-1);
  font-family: inherit;
}
.search input::placeholder { color: var(--text-4); }
.search__kbd {
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-4);
  background: var(--bg-muted);
  border: 1px solid var(--border-muted);
  border-radius: var(--r-xs);
}

/* Quick-stat strip (hero) */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-6);
  padding: var(--s-6) 0;
  border-top: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
  margin: var(--s-8) 0 var(--s-10);
}
.stat-strip__item {
  display: flex; flex-direction: column; gap: var(--s-1);
}
.stat-strip__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-4);
  font-weight: 600;
}
.stat-strip__value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-1);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  main { padding: var(--s-5); }
  .site-header__inner { padding: var(--s-3) var(--s-4); gap: var(--s-3); }
  .site-switcher { display: none; }
  h2 { font-size: 1.25rem; }
}

/* Print */
@media print {
  body { background: #fff; }
  .site-header, .site-footer, .breadcrumb { display: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
