/* Despacho Chig Bazúa y Cía. S.C. — "Editorial clásico" */

:root {
  color-scheme: light;

  /* Paleta derivada del logo */
  --red: #b41824;
  --red-deep: #841818;
  --red-bright: #db372d;
  --ink: #191a14;
  --ink-2: #3c3030;
  --muted: #514c4b;

  /* Neutros cálidos */
  --paper: #faf8f4;
  --rule: #e2d9ce;
  --rule-strong: #cfc3b5;

  --display: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --text: "Source Serif 4", "Source Serif Pro", Georgia, serif;

  --gutter: clamp(16px, 4vw, 40px);
  --pad: clamp(3rem, 6vw, 5.25rem);
  --header-h: 72px; /* alto del encabezado fijo (con su borde) */
}
@media (min-width: 37.5em) { :root { --header-h: 80px; } }
@media (min-width: 64em) { :root { --header-h: 88px; } }

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);
  line-height: 1.7;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, dl, dd, address { margin: 0; }
ul { padding: 0; list-style: none; }
address { font-style: normal; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 72rem);
  margin-inline: auto;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Versalitas con mayúscula inicial, como el logo */
.kicker, .tagline, .label, .act-label, .footer-name {
  font-variant-caps: small-caps;
  letter-spacing: 0.06em;
}

/* Saltar al contenido */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: #fff;
  color: var(--red-deep);
  font-weight: 600;
  border: 1px solid var(--red);
  transform: translateY(-120%);
}
.skip-link:focus { transform: translateY(0.75rem); }

/* Botones */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 52px;
  padding: 0.65rem min(1.5rem, 4vw);
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn-outline { background: transparent; color: var(--red-deep); }
.btn-outline:hover { background: #fff; color: var(--red); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-list a, .act-data, .site-header {
    transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
  }
}

/* Encabezado (siempre blanco puro: el logo no tiene transparencia) */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--rule);
}
.site-header.is-scrolled { box-shadow: 0 8px 20px -14px rgba(25, 26, 20, 0.4); }

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: calc(var(--header-h) - 1px);
  padding-block: 8px;
}

.brand { flex: 0 1 auto; min-width: 0; }
.brand img { width: 176px; height: auto; }
@media (min-width: 37.5em) { .brand img { width: 200px; } }
@media (min-width: 64em) { .brand img { width: 220px; } }

.nav-toggle {
  display: none; /* sólo con JS */
  align-items: center;
  flex: none;
  gap: 10px;
  min-height: 48px;
  padding: 0 12px;
  margin-right: -12px;
  background: none;
  border: 0;
  color: var(--ink);
  font: 600 1.0625rem/1 var(--text);
  cursor: pointer;
}
/* Anillo dentro del botón: por fuera se recortaría en el borde de la pantalla */
.nav-toggle:focus-visible { outline-offset: -2px; }
.nav-toggle-icon { position: relative; width: 22px; height: 12px; }
.nav-toggle-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px; /* entero: ambas barras miden igual */
  background: currentColor;
}
.nav-toggle-icon span:first-child { top: 0; }
.nav-toggle-icon span:last-child { bottom: 0; }
.nav-toggle[aria-expanded="true"] { color: var(--red); }
.nav-toggle[aria-expanded="true"] span span:first-child { top: 50%; transform: translateY(-50%) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span span:last-child { bottom: 50%; transform: translateY(50%) rotate(-45deg); }

.nav-list a { display: flex; align-items: center; text-decoration: none; }
.nav-num { color: var(--red); font: 500 1rem/1 var(--display); letter-spacing: 0.06em; }

/* Menú desplegable (móvil y tableta); sin JS queda abierto y en flujo */
@media (max-width: 63.99em) {
  html:not(.js) .site-header { position: static; }
  html:not(.js) .header-inner { flex-wrap: wrap; }
  .nav-panel { flex-basis: 100%; padding-bottom: 1rem; }

  .js .nav-toggle { display: inline-flex; }
  .js .nav-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: calc(-1 * var(--gutter));
    right: calc(-1 * var(--gutter));
    margin-top: 1px;
    padding: 0.375rem var(--gutter) 1.25rem; /* cabe el anillo de foco (5px) */
    background: #fff;
    border-bottom: 1px solid var(--rule);
    box-shadow: 0 18px 30px -22px rgba(25, 26, 20, 0.35);
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
  }
  .js .nav-panel.is-open { display: block; }

  .nav-list li + li { border-top: 1px solid var(--rule); }
  .nav-list a {
    align-items: baseline;
    gap: 1rem;
    min-height: 52px;
    padding: 0.85rem 0;
    font-size: 1.1875rem;
    line-height: 1.3;
    color: var(--ink);
  }
  .nav-num { width: 2.25rem; flex: none; }
  .nav-list a:hover, .nav-list a[aria-current] { color: var(--red-deep); }
  .nav-list a[aria-current] { font-weight: 600; }
  .nav-list a[aria-current]::after {
    content: "";
    width: 6px;
    height: 6px;
    align-self: center;
    margin: 0 0.4rem 0 auto;
    background: var(--red);
    transform: rotate(45deg);
  }

  .nav-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
  }
}

/* Navegación completa */
@media (min-width: 64em) {
  .nav-num, .nav-actions { display: none; }
  .nav-list { display: flex; gap: clamp(1.25rem, 2.2vw, 2.25rem); }
  .nav-list a {
    position: relative;
    min-height: 44px;
    font-size: 1.0625rem;
    color: var(--ink-2);
  }
  .nav-list a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 9px;
    height: 1px;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left;
  }
  .nav-list a:hover, .nav-list a[aria-current] { color: var(--red-deep); }
  .nav-list a:hover::after, .nav-list a[aria-current]::after { transform: scaleX(1); }
}
@media (min-width: 64em) and (prefers-reduced-motion: no-preference) {
  .nav-list a::after { transition: transform 0.25s ease; }
}
/* Colores forzados: los fondos desaparecen */
@media (forced-colors: active) {
  .nav-list a::after, .nav-toggle-icon span { background: CanvasText; forced-color-adjust: none; }
}

/* Portada */

main, .hero { scroll-margin-top: var(--header-h); }
/* El filete superior de la sección queda bajo el borde del encabezado */
.section { scroll-margin-top: calc(var(--header-h) - 1px); }
/* El foco en el contenido nunca queda bajo el encabezado (en el propio
   encabezado no: la página saltaría) */
main :focus { scroll-margin-top: calc(var(--header-h) + 8px); }

.hero { padding-block: clamp(2.75rem, 7vw, 6rem) clamp(3rem, 6vw, 5rem); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem clamp(3rem, 6vw, 6rem);
}

.kicker {
  margin-bottom: 0.9rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.08em;
  color: var(--red);
}

h1, h2, .fact-fig, .sec-num {
  font-family: var(--display);
  font-weight: 500;
  overflow-wrap: break-word;
}

h1 {
  max-width: 16ch;
  font-size: min(clamp(2rem, 1.1rem + 3.4vw, 3.75rem), 12vw);
  line-height: 1.12;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.tagline {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 16px;
  align-items: start;
  margin-top: 1.25rem;
  font-size: min(clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem), 6.4vw);
  text-wrap: balance;
  line-height: 1.35;
  color: var(--red-deep);
}
.tagline::before {
  content: "";
  height: 1px;
  margin-top: 0.7em;
  background: var(--red);
}

.hero-lead {
  max-width: 34rem;
  margin-top: 1.5rem;
  font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 2.25rem;
}

.facts { max-width: 34rem; border-top: 1px solid var(--red); }
.facts li { padding: 1.1rem 0 1.2rem; border-bottom: 1px solid var(--rule); }
.facts li:last-child { border-bottom: 0; }
/* En móvil la cifra queda por debajo del h1 */
.fact-fig {
  display: block;
  font-size: min(clamp(1.6rem, 1rem + 2.5vw, 2.1rem), 10vw);
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: var(--red);
}
.fact-fig-text { font-size: min(1.25rem, 7vw); line-height: 1.3; }
.fact-text {
  display: block;
  margin-top: 0.3rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 37.49em) {
  .hero-actions .btn { flex: 1 1 100%; }
  .contact .btn { width: 100%; }
}

@media (min-width: 64em) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); }
  .facts { align-self: start; margin-top: 0.6rem; }
}

/* Secciones */

.section { padding-bottom: var(--pad); }

.sec-grid {
  display: grid;
  row-gap: 1.75rem;
  padding-top: var(--pad);
  border-top: 1px solid var(--rule);
}

.sec-num {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 1.0625rem;
  line-height: 1;
  letter-spacing: 0.14em;
  color: var(--red);
}
.sec-num::after { content: ""; width: 2.25rem; height: 1px; background: var(--red); }

h2 {
  font-size: min(clamp(1.6rem, 1.3rem + 1vw, 1.95rem), 9vw);
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.sec-body { min-width: 0; }
/* Medida de lectura sólo en párrafos */
.prose > p { max-width: 40rem; }
.service p { max-width: 38rem; }

@media (min-width: 64em) {
  .sec-grid {
    grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
    column-gap: clamp(3rem, 6vw, 6rem);
  }
  .sec-head {
    position: sticky;
    top: calc(var(--header-h) + 2.5rem);
    align-self: start;
    padding-top: 0.3rem;
  }
}

@media (max-width: 37.49em) {
  .prose p, .statement, .service p {
    -webkit-hyphens: auto;
    hyphens: auto;
    hyphenate-limit-chars: 10 4 4;
  }
}

/* Misión */
.statement {
  max-width: 38rem;
  padding-left: clamp(1.25rem, 3vw, 2rem);
  border-left: 1px solid var(--red);
  font-size: clamp(1.1875rem, 1.05rem + 0.55vw, 1.4rem);
  line-height: 1.6;
  color: var(--ink-2);
}

/* Áreas de servicio: dos filas separadas por filete */
.service + .service {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}
.service h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
}

@media (min-width: 40em) {
  .service {
    display: grid;
    grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
    column-gap: 2rem;
    align-items: baseline;
  }
  .service h3 { margin: 0; }
}

/* Rótulos de bloque (Confiabilidad, Contacto) */
.label {
  margin-bottom: 0.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--red);
}

/* Confiabilidad: versalitas sintéticas, el 600 iguala su color al texto */
.sc {
  font-variant-caps: all-small-caps;
  font-size: 1.04em;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.045em;
  -webkit-hyphens: manual;
  hyphens: manual;
}

.creds-title { margin-top: 2.5rem; }
.creds div { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.creds div:last-child { border-bottom: 0; }
.creds dt { font-size: 1rem; line-height: 1.4; color: var(--muted); }
.creds dd { margin-top: 0.1rem; font-size: 1.0625rem; font-weight: 600; line-height: 1.45; }

/* Contacto */
.contact { display: grid; gap: 2.5rem; }
.contact address { margin: 0.75rem 0 1.25rem; font-size: 1.125rem; line-height: 1.7; }

/* Filas de acción (teléfonos y correos) */
.acts { display: grid; border-top: 1px solid var(--rule-strong); }
.acts li { border-bottom: 1px solid var(--rule); }
.acts li:last-child { border-bottom: 0; }
.act {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
  min-height: 4.5rem;
  padding: 0.7rem 0;
  color: var(--ink);
  text-decoration: none;
}
.act .icon { grid-row: span 2; font-size: 1.3rem; color: var(--red); }
.act-label { font-size: 0.9375rem; font-weight: 600; line-height: 1.3; color: var(--muted); }
.act-data {
  font-size: clamp(1.0625rem, 0.7rem + 1.5vw, 1.1875rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.act:hover .act-data {
  color: var(--red);
  text-decoration: underline 1px;
  text-underline-offset: 0.25em;
}

/* Muy angosto: el dato ocupa todo el ancho bajo icono y rótulo */
@media (max-width: 22.49em) {
  .act .icon { grid-row: auto; }
  .act-data { grid-column: 1 / -1; }
}

/* Teléfonos | correos (a 40em el correo no cabe) */
@media (min-width: 45em) {
  .acts {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    grid-template-rows: auto auto;
    grid-auto-flow: column;
    column-gap: 2rem;
  }
  .acts li:nth-child(2) { border-bottom: 0; }
}

/* Pie */

.site-footer {
  background: var(--ink);
  color: #c9c2b8;
  border-top: 3px solid var(--red);
}
.footer-inner { display: grid; gap: 1.5rem; padding-block: 2.75rem; }
.footer-name { font-size: 1.25rem; font-weight: 600; line-height: 1.4; color: #fff; }
.footer-addr, .footer-copy { font-size: 0.9375rem; line-height: 1.6; }
.footer-addr { margin-top: 0.25rem; }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(233, 228, 220, 0.18);
}
.footer-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-decoration-color: var(--red-bright);
  text-underline-offset: 0.35em;
}
.footer-top:focus-visible { outline-color: #fff; }

@media print {
  .site-header { position: static; }
  .nav-toggle, .nav-panel, .skip-link { display: none !important; }
  body { background: #fff; }
}
