/* ================================================
   blog-base.css
   Shared stylesheet for Dr. Rodrigo Gribosi — Blog Clínico
   Brand: Navy #0B1A3A | Gold #BFA85F | Paper #FBFAF6
   ================================================ */

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

:root {
  --navy:        #0B1A3A;
  --navy-800:    #162347;
  --navy-700:    #1E3060;
  --gold:        #BFA85F;
  --gold-400:    #D4BE7A;
  --gold-200:    #EDE0B6;
  --paper:       #FBFAF6;
  --paper-dark:  #F3F1E9;
  --text:        #1A1F2E;
  --muted:       #5A6070;
  --border:      #DDD8C8;

  --danger:      #9A3B3B;
  --danger-soft: #F5E4E4;
  --success:     #3F7A5C;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Manrope', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  --radius:      6px;
  --radius-lg:   12px;
  --transition:  0.22s ease;
  --max-w:       1160px;
  --prose-w:     740px;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--paper);
}

/* ── Container ──────────────────────────────────── */
.b-container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.b-prose {
  width: 100%;
  max-width: var(--prose-w);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* ── Navigation ─────────────────────────────────── */
.b-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 250, 246, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.b-nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 68px;
}

.b-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--navy);
  flex-shrink: 0;
}

.b-wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.b-wordmark b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--navy);
}

.b-wordmark small {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.b-nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.b-nav-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.b-nav-link:hover,
.b-nav-link.active {
  color: var(--navy);
  background: var(--paper-dark);
}

.b-btn-cta {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  background: var(--gold);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background var(--transition), transform var(--transition);
}
.b-btn-cta:hover { background: var(--gold-400); transform: translateY(-1px); }

/* ── Blog index hero ────────────────────────────── */
.b-hero {
  background: var(--navy);
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(2.5rem, 5vw, 4rem);
}

.b-hero-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
}

.b-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-400);
}

.b-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  font-weight: 400;
  line-height: 1.1;
  color: #fff;
}

.b-hero h1 em { font-style: italic; color: var(--gold-400); }

.b-hero-sub {
  font-size: 0.97rem;
  line-height: 1.65;
  color: #A8B8D4;
  max-width: 52ch;
}

/* ── Tag filter bar ─────────────────────────────── */
.b-filter {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  background: var(--paper);
  position: sticky;
  top: 68px;
  z-index: 80;
}

.b-filter-inner {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.b-tag-btn {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 100px;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: all var(--transition);
  text-decoration: none;
}

.b-tag-btn:hover,
.b-tag-btn.active {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--gold-400);
}

/* ── Article grid ───────────────────────────────── */
.b-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  padding: clamp(2rem, 4vw, 3.5rem) 0;
}

/* ── Article card ───────────────────────────────── */
.b-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.b-card:hover {
  box-shadow: 0 8px 32px rgba(11, 26, 58, 0.1);
  transform: translateY(-3px);
  border-color: var(--gold-200);
}

.b-card-thumb {
  aspect-ratio: 16 / 9;
  background: var(--navy);
  overflow: hidden;
  flex-shrink: 0;
  line-height: 0;
}

.b-card-thumb svg {
  width: 100%;
  height: 100%;
  display: block;
}

.b-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  display: block;
}

.b-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.25rem;
  flex: 1;
}

.b-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.b-card-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.b-card-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.7;
}

.b-card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--navy);
  transition: color var(--transition);
}

.b-card:hover h2 { color: var(--navy-700); }

.b-card-excerpt {
  font-size: 0.87rem;
  line-height: 1.65;
  color: var(--muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.b-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.b-read-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.b-card-arrow {
  font-size: 1rem;
  color: var(--gold);
  transition: transform var(--transition);
}

.b-card:hover .b-card-arrow {
  transform: translateX(4px);
}

/* ── Featured (first) card ──────────────────────── */
.b-card-featured {
  grid-column: 1 / -1;
  flex-direction: row;
}

.b-card-featured .b-card-thumb {
  width: 420px;
  aspect-ratio: auto;
  flex-shrink: 0;
}

.b-card-featured .b-card-body {
  padding: 2rem;
}

.b-card-featured h2 {
  font-size: 1.7rem;
}

.b-card-featured .b-card-excerpt {
  -webkit-line-clamp: 4;
  font-size: 0.93rem;
}

/* ── Post page hero ─────────────────────────────── */
.b-post-hero {
  background: var(--navy);
  padding: clamp(3rem, 6vw, 5rem) 0 0;
}

.b-post-hero-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: var(--prose-w);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  padding-bottom: clamp(2rem, 4vw, 3.5rem);
}

.b-post-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(191, 168, 95, 0.15);
  border: 1px solid rgba(191, 168, 95, 0.35);
  color: var(--gold-400);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 100px;
  align-self: flex-start;
}

.b-post-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  color: #fff;
}

.b-post-hero h1 em { font-style: italic; color: var(--gold-400); }

.b-post-lead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: #A8B8D4;
}

.b-post-byline {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.b-post-byline-name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.8);
}

.b-post-byline-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
}

/* ── Post illustration banner ───────────────────── */
.b-post-banner {
  background: var(--navy-800);
  height: 280px;
  overflow: hidden;
  line-height: 0;
}

.b-post-banner svg {
  width: 100%;
  height: 100%;
}

.b-post-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

/* ── Post body ──────────────────────────────────── */
.b-post-body {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

.b-post-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--navy);
  line-height: 1.2;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.b-post-body h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--navy);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.b-post-body p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.b-post-body ul,
.b-post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.b-post-body li {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.b-post-body strong { color: var(--navy); }

.b-post-body a {
  color: var(--navy-700);
  text-decoration: underline;
  text-decoration-color: var(--gold-200);
  text-underline-offset: 3px;
  transition: color var(--transition);
}
.b-post-body a:hover { color: var(--gold); }

/* ── Callout box ────────────────────────────────── */
.b-callout {
  padding: 1.25rem 1.5rem;
  background: var(--paper-dark);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.75rem 0;
}

.b-callout p {
  margin-bottom: 0 !important;
  font-size: 0.95rem !important;
}

.b-callout-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  display: block;
  margin-bottom: 0.5rem;
}

.b-callout.b-callout-warn {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}
.b-callout.b-callout-warn .b-callout-label { color: var(--danger); }

.b-figure.b-figure-warn .b-figure-box {
  background: var(--danger-soft);
  border-left-color: var(--danger);
}

.b-figure-box img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}
.b-figure-box.b-img-fill { padding: 0; }
.b-figure-box.b-img-fill img { border-radius: 0; }
.b-figure-box.b-img-dark { background: var(--navy); padding: 1rem; }
.b-figure-box.b-img-dark img { border-radius: 2px; }

/* ── Motivos circles (3-up visual index) ────────── */
.b-motivos {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
  padding: 0.5rem 0;
}
.b-motivo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  max-width: 160px;
}
.b-motivo-tile {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-dark);
}
.b-motivo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.b-motivo-tile img.b-contain {
  object-fit: contain;
  padding: 18%;
}
.b-motivo-nm {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--navy);
  text-align: center;
  line-height: 1.25;
}

/* ── Technical block (evidence/references) ──────── */
.b-technical {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 2rem 0;
}

.b-technical h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: 1rem;
}

.b-technical p {
  font-size: 0.9rem !important;
  line-height: 1.7;
  color: #A8B8D4 !important;
  margin-bottom: 0.75rem !important;
}

.b-technical ul {
  padding-left: 1.25rem;
  margin-bottom: 0 !important;
}

.b-technical li {
  font-size: 0.88rem !important;
  color: #A8B8D4 !important;
  margin-bottom: 0.3rem !important;
}

/* ── Info table ─────────────────────────────────── */
.b-table-wrap {
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.b-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.b-table th {
  background: var(--navy);
  color: var(--gold-400);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  text-align: left;
}

.b-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
  color: var(--text);
}

.b-table tr:last-child td { border-bottom: none; }
.b-table tr:nth-child(even) td { background: var(--paper-dark); }

/* ── Post footer / next article ─────────────────── */
.b-post-nav {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.b-post-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.b-back-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--transition);
}
.b-back-link:hover { color: var(--navy); }

.b-next-post {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  text-decoration: none;
}

.b-next-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.b-next-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--navy);
  transition: color var(--transition);
}
.b-next-post:hover .b-next-title { color: var(--gold); }

/* ── CTA strip ──────────────────────────────────── */
.b-cta {
  background: var(--gold);
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

.b-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.b-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 400;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.b-cta p {
  font-size: 0.95rem;
  color: rgba(11, 26, 58, 0.7);
  max-width: 46ch;
}

.b-btn-primary {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background var(--transition), transform var(--transition);
}
.b-btn-primary:hover { background: var(--navy-800); transform: translateY(-2px); }

/* ── Footer ─────────────────────────────────────── */
.b-footer {
  background: var(--navy);
  padding: 1.5rem 0;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.45);
}

.b-footer .b-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.b-footer a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color var(--transition);
}
.b-footer a:hover { color: var(--gold-400); }

/* ── Figure blocks (inline illustrations) ──────── */
.b-figure {
  margin: 2.5rem 0 2.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.b-figure-box {
  width: 100%;
  background: var(--paper-dark);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  border-left: 2px solid var(--gold);
}

.b-figure.b-figure-dark .b-figure-box {
  background: var(--navy);
  border-left-color: var(--gold-400);
}

.b-figure-box svg {
  width: 100%;
  height: auto;
  display: block;
  max-height: 400px;
}

.b-figure-caption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  max-width: 58ch;
  line-height: 1.55;
}

.b-figure-caption b {
  color: var(--navy-800);
  font-weight: 500;
  font-family: var(--font-display);
  font-size: 0.87rem;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
}

/* ── SVG utility classes (used inside figure SVGs) ─ */
.svg-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: #5A6070;
}

.svg-label-dark { fill: #D2BC7A; }
.svg-label-warn { fill: #9A3B3B; }

.svg-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 18px;
  font-style: italic;
  font-weight: 500;
  fill: #0B1A3A;
}

.svg-name-dark { fill: #fff; }

.stroke-navy   { stroke: #0B1A3A; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.stroke-gold   { stroke: #A89055; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.stroke-danger { stroke: #9A3B3B; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fill-navy     { fill: #0B1A3A; }
.fill-gold     { fill: #BFA85F; }
.fill-danger   { fill: #9A3B3B; }

/* ── Reveal animation ───────────────────────────── */
.b-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.b-reveal.visible { opacity: 1; transform: none; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .b-grid { grid-template-columns: repeat(2, 1fr); }
  .b-card-featured { flex-direction: column; }
  .b-card-featured .b-card-thumb { width: 100%; aspect-ratio: 16 / 9; }
}

@media (max-width: 640px) {
  .b-grid { grid-template-columns: 1fr; }
  .b-nav-link { display: none; }
  .b-card-featured h2 { font-size: 1.35rem; }
  .b-cta-inner { flex-direction: column; text-align: center; align-items: center; }
  .b-post-nav-inner { flex-direction: column; align-items: flex-start; }
  .b-next-post { align-items: flex-start; }
  .b-footer .b-container { flex-direction: column; text-align: center; }
}
