/* CTB Explicado — design system */

:root {
  --navy-950: #070f24;
  --navy-900: #0a1a3a;
  --navy-800: #0d2352;
  --navy-700: #12306b;
  --navy-100: #e6ebf5;
  --navy-50: #f4f6fb;
  --gold-500: #d9a441;
  --gold-400: #e8b95c;
  --gold-100: #faf1dd;
  --ink: #1a2033;
  --ink-soft: #4a5170;
  --line: #e2e6f0;
  --paper: #ffffff;
  --bg: #f7f8fc;
  --danger: #b3261e;
  --danger-bg: #fdecea;
  --gravissima: #b3261e;
  --grave: #c15a1f;
  --media: #b8860b;
  --leve: #3a7d3a;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(10, 20, 50, .06), 0 1px 1px rgba(10, 20, 50, .04);
  --shadow-md: 0 6px 20px rgba(10, 20, 50, .08);
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; color: var(--navy-950); }
p { margin: 0 0 1em; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 820px; margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--navy-950); color: #fff;
  padding: 10px 16px; z-index: 200; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  background: var(--navy-950);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.28rem;
  color: #fff;
  margin-right: auto;
  white-space: nowrap;
}
.brand .mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--gold-400), var(--gold-500));
  color: var(--navy-950);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 1.05rem;
}
.brand small { display: block; font-family: var(--font-sans); font-weight: 400; font-size: .62rem; letter-spacing: .08em; color: var(--gold-400); text-transform: uppercase; }

.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { font-size: .93rem; color: rgba(255,255,255,.82); padding: 6px 0; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a.active { color: #fff; border-color: var(--gold-500); }

.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; padding: 6px; }

/* ---------- Buttons / form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.btn-gold { background: linear-gradient(155deg, var(--gold-400), var(--gold-500)); color: var(--navy-950); }
.btn-gold:hover { box-shadow: 0 8px 20px rgba(217, 164, 65, .35); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn-outline:hover { border-color: #fff; }
.btn-navy { background: var(--navy-900); color: #fff; }
.btn-navy:hover { background: var(--navy-800); }

select, input[type="search"], input[type="text"] {
  font-family: inherit; font-size: 1rem; padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #fff; color: var(--ink); width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--gold-500); outline-offset: 1px; }

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(circle at 15% -10%, #16326e 0%, var(--navy-950) 55%), var(--navy-950);
  color: #fff;
  padding: 64px 0 80px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, transparent 2px 64px);
  opacity: .5;
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-400);
  background: rgba(217,164,65,.12); border: 1px solid rgba(217,164,65,.35);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
}
.hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 2.9rem); margin-bottom: .4em; }
.hero p.lede { color: rgba(255,255,255,.78); font-size: 1.15rem; max-width: 620px; }

.finder {
  margin-top: 34px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  color: var(--ink);
}
.finder-tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--navy-50); border-radius: 999px; padding: 4px; width: fit-content; }
.finder-tab {
  border: 0; background: transparent; padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: .88rem;
  color: var(--ink-soft); cursor: pointer;
}
.finder-tab.active { background: var(--navy-950); color: #fff; }
.finder-panel { display: none; }
.finder-panel.active { display: block; }
.finder-row { display: flex; gap: 10px; flex-wrap: wrap; }
.finder-row select { flex: 1; min-width: 200px; }
.finder-row input[type="search"] { flex: 1; min-width: 200px; }
.finder small.hint { display: block; margin-top: 10px; color: var(--ink-soft); font-size: .82rem; }

.hero-stats { display: flex; gap: 30px; margin-top: 30px; flex-wrap: wrap; }
.hero-stats div strong { display: block; font-family: var(--font-serif); font-size: 1.5rem; color: var(--gold-400); }
.hero-stats div span { font-size: .82rem; color: rgba(255,255,255,.65); }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-head { max-width: 620px; margin-bottom: 36px; }
.section-head .eyebrow-line { color: var(--gold-500); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; display: block; }
.section-head p { color: var(--ink-soft); }
.section.alt { background: var(--navy-50); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px; box-shadow: var(--shadow-sm);
}
.card h3 { font-size: 1.05rem; margin-bottom: 10px; }
.card p { color: var(--ink-soft); font-size: .94rem; margin-bottom: 0; }
.card .icn {
  width: 42px; height: 42px; border-radius: 10px; background: var(--gold-100); color: var(--gold-500);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px; font-size: 1.2rem;
}

/* ---------- Chapter / capitulo browse ---------- */
.chapter-list { display: grid; gap: 10px; }
.chapter-item {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px;
}
.chapter-item .num { font-family: var(--font-serif); color: var(--gold-500); font-weight: 700; min-width: 30px; }
.chapter-item .name { flex: 1; font-weight: 600; font-size: .95rem; }
.chapter-item .range { font-size: .8rem; color: var(--ink-soft); }
.chapter-item a.go { color: var(--navy-800); font-weight: 600; font-size: .85rem; }

/* ---------- Article page ---------- */
.article-hero {
  background: var(--navy-950); color: #fff; padding: 36px 0 30px;
}
.breadcrumb { font-size: .82rem; color: rgba(255,255,255,.6); margin-bottom: 14px; }
.breadcrumb a { color: rgba(255,255,255,.85); }
.breadcrumb a:hover { color: var(--gold-400); }
.article-hero .art-num { font-family: var(--font-serif); font-size: .95rem; color: var(--gold-400); letter-spacing: .04em; margin-bottom: 6px; display:block; }
.article-hero h1 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 10px; max-width: 780px; }
.article-hero .meta-path { font-size: .84rem; color: rgba(255,255,255,.6); }

.article-nav-bar {
  background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 68px; z-index: 90;
}
.article-nav-bar .container { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; gap: 14px; flex-wrap: wrap; }
.art-jump { display: flex; align-items: center; gap: 8px; }
.art-jump select { width: 140px; padding: 8px 10px; font-size: .88rem; }
.prevnext { display: flex; gap: 8px; }
.prevnext a {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .84rem; font-weight: 600; color: var(--navy-800);
}
.prevnext a:hover { border-color: var(--navy-800); }
.prevnext a[aria-disabled="true"] { opacity: .35; pointer-events: none; }

.article-body { padding: 40px 0 70px; }
.article-layout { display: grid; grid-template-columns: 1fr 300px; gap: 44px; align-items: start; }

.law-text {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px 34px; box-shadow: var(--shadow-sm);
}
.law-text .item + .item { margin-top: 22px; padding-top: 22px; border-top: 1px dashed var(--line); }
.law-text .item-suffix { font-family: var(--font-serif); font-weight: 700; color: var(--navy-800); font-size: .95rem; margin-bottom: 8px; }
.law-text p { font-family: var(--font-serif); font-size: 1.04rem; color: var(--ink); margin-bottom: .85em; }
.law-text p.penal-line { font-family: var(--font-sans); font-size: .92rem; color: var(--ink-soft); background: var(--navy-50); border-left: 3px solid var(--gold-500); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.law-text p.veto { font-family: var(--font-sans); color: var(--ink-soft); font-style: italic; }

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.badge {
  display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-gravissima { background: var(--danger-bg); color: var(--gravissima); }
.badge-grave { background: #fdf1e6; color: var(--grave); }
.badge-media { background: #fbf3d9; color: var(--media); }
.badge-leve { background: #eaf5ea; color: var(--leve); }
.badge-neutral { background: var(--navy-50); color: var(--navy-800); }

.commentary {
  margin-top: 30px; background: var(--gold-100); border: 1px solid #ecd8ab; border-radius: var(--radius-lg);
  padding: 32px 34px;
}
.commentary .head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.commentary .head img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.commentary .head .who strong { display: block; font-size: .98rem; color: var(--navy-950); }
.commentary .head .who span { font-size: .8rem; color: var(--ink-soft); }
.commentary .body p { margin-bottom: 1em; color: var(--ink); }
.commentary .body p:last-child { margin-bottom: 0; }

.sidebar { position: sticky; top: 140px; display: flex; flex-direction: column; gap: 18px; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; }
.side-card h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-family: var(--font-sans); margin-bottom: 14px; }
.side-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.side-card li a { font-size: .88rem; color: var(--navy-800); display: block; }
.side-card li a:hover { color: var(--gold-500); }
.side-card.author-card { text-align: center; }
.side-card.author-card img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; }
.side-card.author-card strong { display: block; font-size: .95rem; margin-bottom: 2px; }
.side-card.author-card span { font-size: .8rem; color: var(--ink-soft); display: block; margin-bottom: 12px; }

.disclaimer-box {
  font-size: .8rem; color: var(--ink-soft); background: var(--navy-50); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 26px; border: 1px solid var(--line);
}

/* ---------- FAQ ---------- */
.article-faq {
  margin-top: 30px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 32px 34px;
}
.article-faq h2 { font-size: 1.15rem; margin-bottom: 6px; }
.article-faq .faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-item { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 1rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--gold-500); }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin-top: 12px; color: var(--ink-soft); }

/* ---------- Author page ---------- */
.author-hero { display: grid; grid-template-columns: 200px 1fr; gap: 36px; align-items: center; }
.author-hero img { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-md); }
.author-facts { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.author-facts div strong { display: block; font-family: var(--font-serif); font-size: 1.3rem; color: var(--navy-900); }
.author-facts div span { font-size: .8rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-950); color: rgba(255,255,255,.7); padding: 54px 0 26px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; margin-bottom: 36px; }
.footer-grid h5 { color: #fff; font-family: var(--font-sans); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-grid a { font-size: .88rem; color: rgba(255,255,255,.68); }
.footer-grid a:hover { color: var(--gold-400); }
.footer-brand p { font-size: .88rem; color: rgba(255,255,255,.6); max-width: 320px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; font-size: .78rem; color: rgba(255,255,255,.45); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- WhatsApp float ---------- */
.whatsapp-float {
  position: fixed; bottom: 1.6rem; right: 1.6rem; width: 58px; height: 58px; border-radius: 50%;
  background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center; z-index: 900;
  box-shadow: 0 10px 30px -8px rgba(0,0,0,.5); transition: transform .35s ease, box-shadow .35s ease;
  animation: wa-floatpulse 2.6s ease-in-out infinite;
}
.whatsapp-float:hover { transform: scale(1.08); box-shadow: 0 14px 36px -6px rgba(0,0,0,.6); }
@keyframes wa-floatpulse { 0%, 100% { box-shadow: 0 10px 30px -8px rgba(37,211,102,.4); } 50% { box-shadow: 0 10px 30px -8px rgba(37,211,102,.75); } }
@media (max-width: 720px) {
  .whatsapp-float { bottom: 1.1rem; right: 1.1rem; width: 52px; height: 52px; }
}

/* ---------- Search page ---------- */
.search-box-lg { display: flex; gap: 10px; margin-bottom: 30px; }
.search-results { display: flex; flex-direction: column; gap: 14px; }
.result-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.result-item .art-tag { font-size: .75rem; font-weight: 700; color: var(--gold-500); text-transform: uppercase; letter-spacing: .04em; }
.result-item h3 { font-size: 1rem; margin: 6px 0 8px; }
.result-item p { font-size: .88rem; color: var(--ink-soft); margin: 0; }
.result-item mark { background: var(--gold-100); color: var(--navy-950); border-radius: 3px; padding: 0 2px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .author-hero { grid-template-columns: 1fr; text-align: center; }
  .author-hero img { margin: 0 auto; }
  .author-facts { justify-content: center; }
}
@media (max-width: 720px) {
  .main-nav { position: fixed; inset: 68px 0 auto 0; background: var(--navy-950); flex-direction: column; align-items: flex-start; padding: 16px 20px 22px; gap: 4px; transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .18s ease; border-bottom: 1px solid rgba(255,255,255,.08); }
  .main-nav.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .main-nav a { width: 100%; padding: 10px 0; }
  .nav-toggle { display: block; }
  .finder-row { flex-direction: column; }
  .law-text, .commentary { padding: 22px; }
  .footer-grid { grid-template-columns: 1fr; }
}
