/* ═══════════════════════════════════════════════════════
   Compendio Laboral · Farmacia · Neuquén
   main.css — Estilos globales
   Última actualización: abril 2026
   ═══════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────── */
:root {
  --bg:         #f4f0e8;
  --surface:    #fdfaf4;
  --border:     #d8d0be;
  --border-soft:#e8e2d4;
  --ink:        #1c1710;
  --ink-soft:   #5a5244;
  --accent:     #1a3d5c;
  --accent2:    #7b3e19;
  --accent3:    #1e5c2e;
  --gold:       #c09a2e;
  --warn:       #8b2e12;
  --new:        #0f4c35;
  --suspended:  #6b1a1a;
  --highlight:  #fffbe8;
  --r-border:   4px;
  --topbar-h:   52px;
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 300;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
  gap: 12px;
}
.topbar-brand {
  font-family: 'Libre Baskerville', serif;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.topbar-sub {
  font-size: .7rem;
  opacity: .6;
  font-weight: 300;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  padding: 5px 10px;
}
.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: .8rem;
  width: 180px;
  font-family: 'DM Sans', sans-serif;
}
.search-box input::placeholder { color: rgba(255,255,255,.5); }

.btn-print {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: .72rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}
.btn-print:hover { background: rgba(255,255,255,.25); }

/* Hamburger — solo mobile */
.btn-menu {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, #0f2a42 0%, #1a3d5c 55%, #1e5c2e 100%);
  padding: 52px 32px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ccircle cx='40' cy='40' r='1.5' fill='white' fill-opacity='.04'/%3E%3C/svg%3E") repeat;
}
.hero-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(1.6rem, 4.5vw, 2.8rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.hero h1 span { color: #f0d060; }
.hero-sub {
  color: rgba(255,255,255,.65);
  font-size: .88rem;
  max-width: 560px;
  margin: 0 auto 24px;
  position: relative;
  z-index: 1;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  position: relative;
  z-index: 1;
}
.chip {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.85);
  font-size: .72rem;
  padding: 3px 11px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  font-family: 'DM Sans', sans-serif;
}
.chip:hover { background: rgba(255,255,255,.22); color: #fff; }
.chip.new {
  background: rgba(192,154,46,.25);
  border-color: rgba(192,154,46,.5);
  color: #f0d060;
}

/* ── Banners ────────────────────────────────────────── */
.banners-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}
.reforma-banner {
  background: #fffbe8;
  border: 1px solid #e8d870;
  border-left: 5px solid var(--gold);
  padding: 12px 18px;
  margin-top: 20px;
  border-radius: 0 6px 6px 0;
  font-size: .82rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.reforma-banner .rb-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.reforma-banner strong { color: var(--ink); }
.rb-suspended {
  background: #fff5f5;
  border-color: #e8a0a0;
  border-left-color: var(--suspended);
  margin-top: 8px;
}
.rb-update {
  background: #f0f7ff;
  border-color: #a0c8e8;
  border-left-color: var(--accent);
  margin-top: 8px;
}

/* ── Layout ─────────────────────────────────────────── */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 80px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}

/* ── Sidebar (desktop) ──────────────────────────────── */
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 6px);
  padding-top: 24px;
  font-size: .78rem;
  max-height: calc(100vh - var(--topbar-h) - 12px);
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); }

.toc-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.toc-section { margin-bottom: 18px; }
.toc-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.toc-a {
  display: block;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: all .12s;
}
.toc-a:hover { background: var(--border-soft); color: var(--accent); border-left-color: var(--accent); }
.toc-a.active { background: var(--highlight); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-a.sub { padding-left: 16px; font-size: .74rem; }

.toc-badge {
  display: inline-block;
  font-size: .57rem;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.tb-new { background: #0f4c35; color: #fff; }
.tb-warn { background: var(--suspended); color: #fff; }

/* ── Drawer (mobile nav) ─────────────────────────────── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 400;
  opacity: 0;
  transition: opacity .25s;
}
.drawer-overlay.open { opacity: 1; }

.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--surface);
  z-index: 500;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  padding: 0 0 40px;
  box-shadow: 4px 0 24px rgba(0,0,0,.18);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  background: var(--accent);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1;
}
.drawer-title {
  font-family: 'Libre Baskerville', serif;
  font-size: .9rem;
  font-weight: 700;
}
.drawer-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.drawer-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .88rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  outline: none;
}
.drawer-search input:focus { border-color: var(--accent); }

.drawer-toc { padding: 12px 16px; }
.drawer-toc .toc-label { margin-bottom: 12px; }
.drawer-toc .toc-section { margin-bottom: 20px; }
.drawer-toc .toc-a {
  padding: 6px 10px;
  font-size: .84rem;
  border-radius: 6px;
}
.drawer-toc .toc-a.sub {
  padding-left: 22px;
  font-size: .78rem;
}

/* ── Main content ───────────────────────────────────── */
.main { padding-top: 24px; }

/* ── Section ────────────────────────────────────────── */
.section {
  margin-bottom: 44px;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}
.section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.sbadge {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  color: #fff;
  margin-top: 5px;
}
.sb-lct  { background: var(--accent2); }
.sb-ley  { background: var(--accent); }
.sb-cct  { background: var(--accent3); }
.sb-prov { background: #5c1a3a; }
.sb-sind { background: #3a1a5c; }
.sb-refo { background: var(--new); }

.section-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.section-desc { font-size: .78rem; color: var(--ink-soft); font-style: italic; margin-top: 3px; }

/* ── Topic card ─────────────────────────────────────── */
.topic {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-border);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow .18s;
}
.topic:hover { box-shadow: 0 3px 14px rgba(0,0,0,.07); }
.topic.key      { border-left: 3px solid var(--accent2); }
.topic.new2026  { border-left: 3px solid var(--new); }
.topic.warn2026 { border-left: 3px solid var(--suspended); }

.topic-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  -webkit-tap-highlight-color: transparent;
}
.topic-head:hover         { background: #f7f2e8; }
.topic.key      .topic-head { background: #fdf8f2; }
.topic.new2026  .topic-head { background: #f2faf5; }
.topic.warn2026 .topic-head { background: #fdf5f5; }

.topic-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 54px;
  flex-shrink: 0;
}
.topic-title { flex: 1; font-weight: 600; font-size: .88rem; color: var(--ink); }
.topic-tags  { display: flex; gap: 5px; flex-wrap: wrap; flex-shrink: 0; }

.ttag {
  font-family: 'JetBrains Mono', monospace;
  font-size: .58rem;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid;
}
.ttag-key  { border-color: var(--accent2); color: var(--accent2); background: #fff8f5; }
.ttag-new  { border-color: var(--new);     color: var(--new);     background: #f2faf5; }
.ttag-warn { border-color: var(--suspended);color: var(--suspended);background: #fff5f5; }
.ttag-inf  { border-color: var(--accent);  color: var(--accent);  background: #f5f8ff; }
.ttag-cct  { border-color: var(--accent3); color: var(--accent3); background: #f5fff8; }

.toggle-arr { color: var(--ink-soft); font-size: .7rem; transition: transform .2s; flex-shrink: 0; }
.topic.open .toggle-arr { transform: rotate(180deg); }

.topic-body {
  display: none;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: .86rem;
}
.topic.open .topic-body { display: block; }
.topic-body p           { margin-bottom: 9px; line-height: 1.7; }
.topic-body p:last-child{ margin-bottom: 0; }
.topic-body ul          { margin: 8px 0 8px 20px; }
.topic-body li          { margin-bottom: 4px; }

/* ── Callout boxes ──────────────────────────────────── */
.callout {
  padding: 12px 16px;
  border-radius: 5px;
  margin: 10px 0;
  font-size: .82rem;
}
.callout-tip  { background: #f0f7ff; border-left: 3px solid var(--accent); }
.callout-warn { background: #fff5f5; border-left: 3px solid var(--suspended); }
.callout-ok   { background: #f0faf5; border-left: 3px solid var(--accent3); }
.callout-gold { background: var(--highlight); border-left: 3px solid var(--gold); }

.callout-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 5px;
  font-weight: 600;
}
.callout-tip  .callout-title { color: var(--accent); }
.callout-warn .callout-title { color: var(--suspended); }
.callout-ok   .callout-title { color: var(--accent3); }
.callout-gold .callout-title { color: var(--gold); }

/* ── Tables ─────────────────────────────────────────── */
.dtable { width: 100%; border-collapse: collapse; font-size: .82rem; margin: 10px 0; }
.dtable th {
  background: var(--accent);
  color: #fff;
  padding: 7px 11px;
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-size: .68rem;
  letter-spacing: .05em;
}
.dtable td { padding: 7px 11px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.dtable tr:nth-child(even) td { background: #f8f5ee; }
.dtable tr:last-child td { border-bottom: none; }

/* ── Chapter divider ────────────────────────────────── */
.chap { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; }
.chap span {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.chap::before, .chap::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Mod note ───────────────────────────────────────── */
.modnote {
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .67rem;
  color: var(--ink-soft);
  padding: 5px 9px;
  background: #f5f3ee;
  border-radius: 4px;
}

/* ── Footer ─────────────────────────────────────────── */
.site-footer {
  margin-top: 40px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-border);
  font-size: .75rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ── Novedades badge ────────────────────────────────── */
.novedad-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: .65rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

/* ═══ RESPONSIVE — Tablet ════════════════════════════ */
@media (max-width: 860px) {
  .search-box input { width: 130px; }
}

/* ═══ RESPONSIVE — Mobile ════════════════════════════ */
@media (max-width: 720px) {
  /* Topbar */
  .topbar { padding: 0 14px; }
  .topbar-sub { display: none; }
  .topbar-right .btn-print { display: none; }
  .search-box { display: none; }  /* search moves to drawer */
  .btn-menu { display: block; }

  /* Layout: single column, no sidebar */
  .layout { grid-template-columns: 1fr; padding: 0 14px 60px; }
  .sidebar { display: none; }

  /* Hero */
  .hero { padding: 36px 20px 32px; }
  .hero-sub { font-size: .82rem; }

  /* Banners */
  .banners-wrap { padding: 0 14px; }
  .reforma-banner { font-size: .8rem; padding: 10px 14px; gap: 10px; }

  /* Tables: make scrollable */
  .dtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Topic tags: hide on very small screens to save space */
  .topic-tags { display: none; }

  /* Topics: bigger tap targets */
  .topic-head { padding: 13px 14px; }
  .topic-title { font-size: .9rem; }
  .topic-ref { font-size: .7rem; min-width: 46px; }

  /* Section scroll offset accounts for topbar */
  .section { scroll-margin-top: calc(var(--topbar-h) + 8px); }
}

/* ═══ PRINT ══════════════════════════════════════════ */
@media print {
  .topbar, .sidebar, .hero-chips, .banners-wrap,
  .btn-print, .drawer, .drawer-overlay { display: none !important; }
  .topic-body { display: block !important; }
  .layout { grid-template-columns: 1fr; }
  body { font-size: 11pt; }
  .section { break-inside: avoid; }
}
