/* Testamento de hermandad: el artículo como el propio documento, una hoja con varias firmas.
   Se carga después de main.css y solo afecta a páginas con body.hd. */

.hd {
  --hd-s0: 0.9375rem;                      /* 15px: notas */
  --hd-s1: 1.125rem;                       /* 18px: texto */
  --hd-s2: 1.5rem;                         /* 24px: subtítulos y declaraciones */
  --hd-s3: clamp(2rem, 3.2vw, 2.875rem);   /* títulos de sección */
  --hd-s4: clamp(2.5rem, 4vw, 3.75rem);    /* título de la página */
  --hd-gap: clamp(120px, 12vw, 176px);
  --hd-field: #0F2E59;
  --hd-teal: #2C7A80;
}
.hd main h1, .hd main h2, .hd main h3 { font-family: var(--serif); font-style: italic; font-weight: 500; letter-spacing: -0.02em; color: var(--navy); margin: 0; }
.hd main p { margin: 0; }
.hd main ul { margin: 0; }

/* ---------- Portada: la hoja junto al manuscrito ---------- */
.hd-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 16px; }
.hd-sheet { position: relative; z-index: 1; background: var(--paper); display: flex; flex-direction: column; }
.hd-band { display: flex; height: 40px; overflow: hidden; }
.hd-band span { flex: 0 0 28px; background: var(--navy); }
.hd-band span:nth-child(even) { background: var(--paper); }
.hd-sheet-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 24px; padding: 40px 24px 32px; }
.hd-sheet-logo { width: min(56%, 260px); }
.hd-sheet h1 { font-size: clamp(1.6rem, 6.8vw, 3rem); line-height: 1.04; }
.hd-sheet-lead { font-size: var(--hd-s1); line-height: 1.55; max-width: 38ch; color: var(--ink); }
.hd-sheet .btn { min-width: 240px; }
.hd-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; max-width: 420px; margin-top: 12px; }
.hd-sign span { display: block; padding-top: 10px; font-size: var(--hd-s0); color: var(--soft); border-top: 3px solid var(--navy); }
.hd-sheet-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; font-size: var(--hd-s0); }
.hd-sheet-links a { color: var(--navy); }
.hd-photo { position: relative; margin: 0; background: var(--ink); overflow: hidden; height: 48svh; min-height: 300px; }
.hd-photo figure { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1600ms ease; }
.hd-photo figure.is-on { opacity: 1; }
.hd-photo img { width: 100%; height: 100%; object-fit: cover; }
.hd-photo-cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 14px 18px; font-size: var(--hd-s0); color: #fff; background: rgba(15, 20, 35, 0.62); }

@media (min-width: 900px) {
  .hd-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .hd-band { height: 56px; }
  .hd-sheet-body { padding: 56px 48px 40px; min-height: calc(100svh - var(--header-h) - 140px); justify-content: center; }
  .hd-sheet h1 { font-size: clamp(2.5rem, 3.1vw, 3.5rem); }
  .hd-photo { position: sticky; top: calc(var(--header-h) + 12px); height: calc(100svh - var(--header-h) - 24px); }
}

/* ---------- Un documento, varias firmas ---------- */
.hd-intro { padding-top: var(--hd-gap); }
.hd-intro-top { display: grid; gap: 24px; }
.hd-intro h2 { font-size: var(--hd-s3); line-height: 1.05; max-width: 14ch; }
.hd-intro-note { font-size: var(--hd-s1); line-height: 1.6; max-width: 36ch; }
.hd-facts { display: grid; grid-template-columns: 1fr; gap: 36px; margin-top: 72px; padding: 0; list-style: none; }
.hd-facts strong { display: block; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--hd-s3); line-height: 1; color: var(--hd-teal); letter-spacing: -0.02em; }
.hd-facts span { display: block; margin-top: 12px; font-size: var(--hd-s0); line-height: 1.5; color: var(--soft); max-width: 34ch; }
.hd-intro-photo { margin: 56px 0 0; }
.hd-intro-photo img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hd-intro-photo figcaption, .hd-cap { margin-top: 10px; font-size: var(--hd-s0); color: var(--soft); }
@media (min-width: 900px) {
  .hd-intro-top { grid-template-columns: 1fr auto; align-items: end; }
  .hd-facts { grid-template-columns: repeat(3, 1fr); gap: 48px; }
  .hd-intro-wide { display: grid; grid-template-columns: 7fr 5fr; gap: 48px; align-items: end; margin-top: 72px; }
  .hd-intro-wide .hd-facts { margin-top: 0; grid-template-columns: 1fr; gap: 40px; }
  .hd-intro-wide .hd-intro-photo { margin: 0; grid-column: 1; grid-row: 1; }
}

/* ---------- La hoja de texto ---------- */
.hd-doc { margin-top: var(--hd-gap); }
.hd-doc-sheet { background: var(--paper); padding: 48px 24px; display: grid; gap: 88px; }
.hd-part { display: grid; gap: 20px; }
.hd-part h2 { font-size: var(--hd-s3); line-height: 1.05; }
.hd-part-body { display: grid; gap: 20px; font-size: var(--hd-s1); line-height: 1.7; max-width: 66ch; }
.hd-part-body h3 { font-size: var(--hd-s2); line-height: 1.2; margin-top: 12px; }
.hd-part-body ul { padding-left: 1.2em; display: grid; gap: 10px; }
.hd-part-body strong { color: var(--navy); }
@media (min-width: 900px) {
  .hd-doc-sheet { padding: 96px 64px; gap: 120px; }
  .hd-part { grid-template-columns: 4fr 7fr; gap: 56px; }
}

/* ---------- ¿Qué puede hacer el que sobrevive? ---------- */
.hd-tool { background: var(--tone); padding: 28px 24px; display: grid; gap: 20px; border: 0; margin: 12px 0 0; }
.hd-tool legend { float: left; width: 100%; padding: 0; margin-bottom: 16px; font-family: var(--serif); font-style: italic; font-size: var(--hd-s2); color: var(--navy); }
.hd-tool-opts { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.hd-tool-opts label { position: relative; cursor: pointer; }
.hd-tool-opts input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hd-tool-opts span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; background: var(--paper); color: var(--navy); font-size: var(--hd-s0); font-weight: 500; transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out); }
.hd-tool-opts label:hover span { background: #fff; color: var(--plum); }
.hd-tool-opts input:checked + span { background: var(--navy); color: #fff; }
.hd-tool-opts input:focus-visible + span { outline: 2px solid var(--plum); outline-offset: 3px; }
.hd-tool-opts label:active span { transform: scale(0.97); }
.hd-answers { display: grid; gap: 16px; }
.hd-answer { background: var(--paper); padding: 22px 22px 24px; display: grid; gap: 8px; }
.hd-answer b { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--hd-s2); line-height: 1.1; color: var(--hd-teal); }
.hd-answer p { font-size: var(--hd-s1); line-height: 1.6; }
.hd-answer small { font-size: var(--hd-s0); color: var(--soft); }
.hd-tool.is-live .hd-answer { animation: hd-in 420ms var(--ease-out); }

/* ---------- La vida del testamento ---------- */
.hd-moments { margin-top: var(--hd-gap); }
.hd-moments-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.hd-moments h2 { font-size: var(--hd-s3); line-height: 1.05; }
.hd-moments-nav { display: none; gap: 8px; }
.hd-moments-nav button { width: 48px; height: 48px; border: 0; background: var(--navy); color: #fff; font-size: 1.25rem; cursor: pointer; transition: background-color 200ms ease, transform 160ms var(--ease-out); }
.hd-moments-nav button:hover { background: var(--plum); }
.hd-moments-nav button:active { transform: scale(0.94); }
.hd-moments-nav button:disabled { background: var(--tone); color: var(--soft); cursor: default; }
.hd-track { margin-top: 24px; height: 6px; background: var(--tone); }
.hd-track span { display: block; height: 100%; background: var(--navy); transform-origin: left; transform: scaleX(0.08); transition: transform 200ms linear; }
.hd-row { display: flex; gap: 16px; margin: 36px 0 0; padding: 0 0 8px; overflow-x: auto; scroll-snap-type: x mandatory; list-style: none; scrollbar-width: none; }
.hd-row::-webkit-scrollbar { display: none; }
.hd-row li { flex: 0 0 72vw; scroll-snap-align: start; display: flex; flex-direction: column; padding-top: 20px; border-top: 2px solid var(--ink); }
.hd .hd-row h3 { font-family: var(--sans); font-style: normal; font-weight: 600; font-size: var(--hd-s1); letter-spacing: 0; color: var(--ink); }
.hd-row p { margin-top: 8px; font-size: var(--hd-s0); line-height: 1.55; color: var(--soft); }
.hd-row .hd-law { margin-top: 10px; font-size: var(--hd-s0); color: var(--hd-teal); font-weight: 600; }
.hd-row img { margin-top: auto; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.hd-row .hd-block { align-self: flex-start; margin-top: 16px; background: var(--navy); color: #fff; padding: 6px 12px; border-radius: 999px; font-family: var(--sans); font-style: normal; font-weight: 600; font-size: 14px; line-height: 1.3; }
.hd-row .hd-block--teal { background: var(--hd-teal); }
.hd-row .hd-block--plum { background: var(--plum); }
.hd-row .hd-block--ink { background: var(--ink); }
@media (min-width: 900px) {
  .hd-moments-nav { display: flex; }
  .hd-row { gap: 32px; }
  .hd-row li { flex-basis: 280px; }
}

/* ---------- Tres ejemplos: pestañas ---------- */
.hd-examples { margin-top: var(--hd-gap); }
.hd-examples h2 { font-size: var(--hd-s3); line-height: 1.05; }
.hd-deck { margin-top: 40px; display: grid; gap: 12px; }
.hd-card { color: #fff; background: var(--navy); }
.hd-card:nth-child(2) { background: #1D4677; }
.hd-card:nth-child(3) { background: var(--hd-teal); }
.hd-card-spine { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 28px 28px 0; font-family: var(--serif); font-style: italic; font-size: var(--hd-s2); line-height: 1.15; cursor: default; }
.hd-card-body { padding: 16px 28px 32px; display: grid; gap: 14px; font-size: var(--hd-s1); line-height: 1.6; }
.hd-card-body strong { color: #fff; }
/* Con JS: pestañas arriba y el ejemplo elegido debajo, en todos los tamaños */
.hd-deck.is-deck { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; }
.is-deck .hd-card { display: contents; }
.is-deck .hd-card-spine { grid-row: 1; padding: 14px 12px; font-size: var(--hd-s0); font-family: var(--sans); font-style: normal; font-weight: 600; line-height: 1.3; text-align: center; color: var(--ink); background: var(--tone); cursor: pointer; transition: background-color 200ms ease, color 200ms ease; }
.is-deck .hd-card-spine:hover { background: #DEDCD6; }
.is-deck .hd-card-spine:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.is-deck .hd-card.is-open .hd-card-spine { color: #fff; cursor: default; }
.is-deck .hd-card:nth-child(1).is-open .hd-card-spine, .is-deck .hd-card:nth-child(1) .hd-card-body { background: var(--navy); }
.is-deck .hd-card:nth-child(2).is-open .hd-card-spine, .is-deck .hd-card:nth-child(2) .hd-card-body { background: #1D4677; }
.is-deck .hd-card:nth-child(3).is-open .hd-card-spine, .is-deck .hd-card:nth-child(3) .hd-card-body { background: var(--hd-teal); }
.is-deck .hd-card-body { grid-row: 2; grid-column: 1 / -1; display: none; color: #fff; padding: 28px 22px 32px; }
.is-deck .hd-card.is-open .hd-card-body { display: grid; }
@media (min-width: 900px) {
  .is-deck .hd-card-spine { padding: 18px 24px; font-size: var(--hd-s1); }
  .is-deck .hd-card-body { padding: 48px 64px; }
  .is-deck .hd-card-body > * { max-width: 72ch; }
}

/* ---------- Preguntas frecuentes junto al archivo ---------- */
.hd-faq { margin-top: var(--hd-gap); background: var(--tone); }
.hd-faq-grid { display: grid; gap: 40px; padding-top: 72px; padding-bottom: 72px; }
.hd-faq h2 { font-size: var(--hd-s3); line-height: 1.05; }
.hd-faq-facts { display: grid; gap: 6px; margin-top: 20px; font-size: var(--hd-s1); }
.hd-faq-list { margin-top: 32px; display: grid; gap: 24px; }
.hd-faq details summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; align-items: center; min-height: 44px; font-size: 1.25rem; font-weight: 500; color: var(--navy); transition: color 200ms ease; }
.hd-faq details summary::-webkit-details-marker { display: none; }
.hd-faq details summary:hover { color: var(--plum); }
.hd-faq details summary::after { content: ""; flex: 0 0 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 240ms var(--ease-out); }
.hd-faq details[open] summary::after { transform: rotate(-135deg); }
.hd-faq details p { margin-top: 10px; font-size: 1.0625rem; line-height: 1.65; color: var(--ink); }
.hd-faq-actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.hd-faq-pics { position: relative; }
.hd-faq-tall { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.hd-faq-square { position: absolute; right: 16px; bottom: -32px; width: 38%; aspect-ratio: 1; object-fit: cover; border: 6px solid var(--tone); }
@media (min-width: 900px) {
  .hd-faq-grid { grid-template-columns: 5fr 7fr; gap: 72px; padding-top: 120px; padding-bottom: 120px; align-items: start; }
  .hd-faq-text { position: sticky; top: calc(var(--header-h) + 32px); }
  .hd-faq .hd-faq-list { margin-top: 0; }
}

/* ---------- Normativa y fuentes ---------- */
.hd-sources { margin-top: var(--hd-gap); display: grid; gap: 40px; }
.hd-sources h2 { font-size: var(--hd-s3); line-height: 1.05; }
.hd-sources-cols { display: grid; gap: 32px; font-size: var(--hd-s0); line-height: 1.6; }
.hd-sources h3 { font-family: var(--sans) !important; font-style: normal !important; font-weight: 600 !important; font-size: var(--hd-s1) !important; letter-spacing: 0 !important; color: var(--ink) !important; margin-bottom: 10px !important; }
.hd-sources ul { padding-left: 1.1em; display: grid; gap: 8px; }
@media (min-width: 900px) { .hd-sources { grid-template-columns: 4fr 8fr; gap: 56px; } .hd-sources-cols { grid-template-columns: repeat(2, 1fr); gap: 48px; } }

/* ---------- La tarjeta de respuesta ---------- */
.hd-reply { margin-top: var(--hd-gap); background: var(--hd-field); color: #fff; overflow: hidden; }
.hd-reply-grid { display: grid; gap: 40px; padding-top: 80px; padding-bottom: 64px; }
.hd-reply-copy { display: grid; gap: 24px; align-content: start; }
.hd-reply-copy p { font-size: 1.25rem; line-height: 1.5; max-width: 30ch; }
.hd-reply-copy .cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hd-reply-copy a:not(.btn) { color: #fff; }
.hd-card-reply { background: var(--paper); color: var(--ink); padding: 32px 22px 40px; }
.hd .hd-card-reply h2 { font-size: var(--hd-s3); line-height: 1.05; text-align: center; margin: 0 0 32px; }
.hd .hd-reply .cta-mail a { font-size: 1rem; overflow-wrap: anywhere; }
@media (min-width: 600px) { .hd .hd-reply .cta-mail a { font-size: 1.25rem; } }
@media (min-width: 900px) {
  .hd-reply-grid { grid-template-columns: 4fr 8fr; gap: 64px; padding-top: 120px; padding-bottom: 120px; }
  .hd-reply-copy { padding-top: 48px; position: sticky; top: calc(var(--header-h) + 32px); align-self: start; }
  .hd-card-reply { padding: 48px; }
}
.hd .site-footer { position: relative; z-index: 1; }

/* ---------- Movimiento ---------- */
@keyframes hd-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.hd-js [data-hd-rise] > * { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
.hd-js [data-hd-rise].is-in > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .hd-js [data-hd-rise] > * { opacity: 1; transform: none; transition: none; }
  .hd-photo figure { transition: none; }
  .is-deck .hd-card-spine { transition: none; }
}
.hd-answer[hidden] { display: none; }

/* ---------- La ley 199 en lugar de fotografía ---------- */
.hd-law-panel { margin: 0; background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 40px 28px; }
.hd-law-panel blockquote { margin: 0; }
.hd-law-panel blockquote p { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: var(--hd-s2); line-height: 1.3; letter-spacing: -0.01em; }
.hd-law-panel figcaption { font-size: var(--hd-s0); color: #CFE6DE; }
.hd-faq .hd-faq-list details { background: var(--paper); padding: 18px 22px; }

@media (min-width: 900px) {
  .hd-law-panel { position: sticky; top: calc(var(--header-h) + 12px); min-height: calc(100svh - var(--header-h) - 24px); padding: 64px 56px; }
  .hd-law-panel blockquote p { font-size: clamp(1.5rem, 1.9vw, 1.875rem); }
}
.hd-law-num { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: clamp(6rem, 30vw, 9rem); line-height: 0.85; letter-spacing: -0.04em; color: var(--sage); margin: 0; }
@media (min-width: 900px) { .hd-law-num { font-size: clamp(8rem, 15vw, 15rem); } }
@media (max-width: 899px) { .hd-law-num { display: none; } }
.hd main .hd-facts { margin-top: 72px; } @media (min-width: 900px) { .hd main .hd-facts { margin-top: 112px; } }
