/* ══════════════════════════════════════════════════════════════════
   jAvIer Institute — Insights stylesheet
   Tokens, nav, footer & motion are lifted verbatim from index.html so
   /insights is visually identical to the homepage. Article + listing
   styles are appended at the bottom.
   ══════════════════════════════════════════════════════════════════ */

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

/* ── TOKENS ── */
:root {
  --bg:       #05090f;
  --bg2:      #090e18;
  --surface:  #0c1220;
  --border:   rgba(201,168,76,0.13);
  --line:     #141c2a;
  --text:     #e4ddd0;
  --muted:    #637086;
  --soft:     #8a9ab8;
  --gold:     #c9a84c;
  --gold-dim: rgba(201,168,76,0.45);
  --cyan:     #56b0c6;
  --serif:    'Cormorant Garamond', Georgia, serif;
  --sans:     'DM Sans', sans-serif;
  --mono:     'IBM Plex Mono', 'Courier New', monospace;
}

[data-theme="light"] {
  --bg:       #f3efe4;
  --bg2:      #eceae0;
  --surface:  #e6e2d6;
  --border:   rgba(140,100,30,0.18);
  --line:     #ddd8c8;
  --text:     #181c2a;
  --muted:    #7a7a6a;
  --soft:     #5a6070;
  --gold:     #9a7030;
  --gold-dim: rgba(150,110,40,0.35);
  --cyan:     #226a80;
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
  opacity: 0.4;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 2.5rem;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(5,9,15,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
[data-theme="light"] nav { background: rgba(243,239,228,0.92); }

.nav-logo {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  line-height: 1;
}
.nav-logo .cap-A { color: var(--gold); }
.nav-logo .cap-I { color: var(--cyan); }
.nav-logo .inst {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  display: block;
  margin-top: 2px;
}

.nav-right { display: flex; align-items: center; gap: 0.5rem; }
.nav-links { display: flex; gap: 0; list-style: none; margin-right: 1rem; }
.nav-links a {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--soft);
  text-decoration: none;
  padding: 0.3rem 0.85rem;
  border-right: 1px solid var(--line);
  transition: color 0.2s;
}
.nav-links li:first-child a { border-left: 1px solid var(--line); }
.nav-links a:hover { color: var(--text); }
.nav-links a.is-current { color: var(--gold); }

.ctrl {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  padding: 0.28rem 0.6rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}
.ctrl:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ── DIVIDERS ── */
.rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0 2.5rem;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

/* ── FOOTER ── */
footer {
  padding: 2.5rem 2.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: auto;
}
.footer-logo {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.footer-logo .cap-A { color: var(--gold); }
.footer-logo .cap-I { color: var(--cyan); }
.footer-tagline {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.footer-legal {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  opacity: 0.6;
}
.footer-links { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text); }
.footer-links-label {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.5;
  margin-bottom: 0.25rem;
}

/* ── MOTION ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.fade-in.visible { opacity: 1; transform: none; }

/* ══════════════════════════════════════════════════════════════════
   INSIGHTS — listing
   ══════════════════════════════════════════════════════════════════ */
.wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 9rem 2.5rem 5rem;
  flex: 1;
}

.page-head { margin-bottom: 3rem; }
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--text);
}
.page-head h1 em { font-style: italic; color: var(--gold); }
.page-head .lead {
  font-size: 1.02rem;
  color: var(--soft);
  max-width: 560px;
  line-height: 1.75;
  margin-top: 1.25rem;
}

.post-list { list-style: none; border-top: 1px solid var(--line); }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a {
  display: block;
  padding: 1.75rem 0;
  text-decoration: none;
  color: var(--text);
  transition: padding-left 0.25s, background 0.25s;
}
.post-list a:hover { padding-left: 0.75rem; }
.post-meta-row {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  margin-bottom: 0.6rem;
}
.post-date {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}
.voice-tag {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--border);
  color: var(--gold);
}
.voice-tag.is-leonardo { color: var(--cyan); border-color: rgba(86,176,198,0.3); }
.post-list h2 {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--text);
}
.post-list .excerpt {
  font-size: 0.92rem;
  color: var(--soft);
  line-height: 1.7;
  margin-top: 0.6rem;
  max-width: 640px;
}

/* ══════════════════════════════════════════════════════════════════
   ARTICLE
   ══════════════════════════════════════════════════════════════════ */
.article { width: 100%; max-width: 720px; margin: 0 auto; }

.article-header { margin-bottom: 2.5rem; }
.article-eyebrow {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
}
.article-title {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--text);
}
.article-title em { font-style: italic; color: var(--gold); }
.article-sub {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

/* Prose */
.prose { font-size: 1.06rem; line-height: 1.8; color: var(--text); }
.prose > * + * { margin-top: 1.5rem; }
.prose p { color: var(--text); }
.prose h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 3rem;
}
.prose h2 em, .prose h3 em { font-style: italic; color: var(--gold); }
.prose h3 {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2.25rem;
}
.prose strong { font-weight: 500; color: var(--text); }
.prose em { color: inherit; }
.prose a { color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--gold-dim); }
.prose a:hover { border-bottom-color: var(--gold); }

.prose ul, .prose ol { padding-left: 1.4rem; color: var(--text); }
.prose li { margin-top: 0.5rem; line-height: 1.75; }
.prose li::marker { color: var(--gold-dim); }

.prose blockquote {
  border-left: 2px solid var(--gold-dim);
  background: rgba(201,168,76,0.04);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
  color: var(--soft);
  line-height: 1.7;
}
.prose blockquote p { color: var(--soft); margin: 0; }

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}
.prose th {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}
.prose td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.55;
  color: var(--soft);
}
.prose tr:last-child td { border-bottom: none; }

/* Sources block: use a final h3 "Fuentes/Sources" naturally */
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--gold);
}

.back-link {
  display: inline-block;
  margin-top: 4rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 0.5rem 1rem;
  transition: color 0.2s, border-color 0.2s;
}
.back-link:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  nav { padding: 0 1.25rem; }
  .wrap { padding: 8rem 1.25rem 4rem; }
  footer { padding-left: 1.25rem; padding-right: 1.25rem; }
}
@media (max-width: 600px) {
  .nav-links { display: none; }
  .prose table, .prose thead, .prose tbody, .prose th, .prose td, .prose tr { display: block; }
  .prose th { display: none; }
  .prose td { border-bottom: 1px solid var(--line); }
}
