/* =========================================================================
   BASE — mecánica, accesibilidad y layout.
   Los tokens de color/tipografía y el "look" de cada componente viven en tema.css.
   ========================================================================= */

/* ---- Reset mínimo ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
body { margin: 0; min-height: 100vh; }
img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { text-decoration-thickness: from-font; text-underline-offset: .18em; }
:where(ul[class], ol[class]) { list-style: none; margin: 0; padding: 0; } /* :where → especificidad 0, no pisa paddings de componentes */
:focus-visible { outline: 2px solid var(--or-focus, #1F1523); outline-offset: 3px; }

/* ---- Utilidades de accesibilidad ---- */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.or-skip {
  position: fixed; top: -100px; left: 1rem; z-index: 1000;
  background: #fff; color: #111; padding: .75rem 1.25rem; border-radius: .4rem;
  transition: top .15s ease;
}
.or-skip:focus { top: 1rem; }

/* ---- Contenedores ---- */
.or-container { width: 100%; max-width: var(--or-max, 1280px); margin-inline: auto; padding-inline: var(--or-gutter, 1.25rem); }
:root { --or-gutter: 1.25rem; }
@media (min-width: 640px) { :root { --or-gutter: 2rem; } }
@media (min-width: 1080px) { :root { --or-gutter: 3rem; } }

/* ---- Banner de revisión / noindex ---- */
.or-review-banner {
  position: relative; z-index: 60; /* no es sticky: así no tapa el encabezado al hacer scroll */
  display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap;
  font-family: monospace; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  padding: .4rem 1rem; background: #111; color: #fff; text-align: center;
}
.or-review-banner__p { opacity: .7; }

/* ---- Barra de CTA persistente ---- */
.or-cta-bar { display: none; }
@media (max-width: 767px) {
  .or-cta-bar {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    padding: .6rem .9rem calc(.6rem + env(safe-area-inset-bottom));
  }
  .or-cta-bar .or-btn { width: 100%; }
  body { padding-bottom: 4.2rem; }
}

/* ---- Header ---- */
.or-header { position: sticky; top: 0; z-index: 50; }
.or-header__row {
  max-width: var(--or-max, 1280px); margin-inline: auto; padding-inline: var(--or-gutter, 1.25rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: var(--or-header-h, 72px);
}
.or-logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; flex-shrink: 0; }
.or-header__actions { display: flex; align-items: center; gap: .75rem; position: relative; z-index: 60; }
.or-burger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: transparent; border: none; border-radius: .4rem;
}
.or-burger__close { display: none; }
.or-burger[aria-expanded="true"] .or-burger__open { display: none; }
.or-burger[aria-expanded="true"] .or-burger__close { display: block; }

.or-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; }
.or-menu .sub-menu { display: none; }

@media (max-width: 899px) {
  .or-btn.or-header__cta { display: none; }
  /* Panel anclado debajo del encabezado (sticky) para que el botón X nunca quede tapado. */
  .or-nav {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 45;
    max-height: calc(100vh - var(--or-header-h, 72px)); max-height: calc(100dvh - var(--or-header-h, 72px));
    overflow-y: auto; transform: translateY(-8px); opacity: 0; pointer-events: none; visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  .or-nav.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
  body.or-nav-open { overflow: hidden; }
  .or-menu { flex-direction: column; align-items: flex-start; gap: 0; padding: 1rem var(--or-gutter) 7rem; }
  .or-menu > .menu-item { width: 100%; border-bottom: 1px solid rgba(0,0,0,.08); }
  .or-menu > .menu-item > a { display: block; padding: 1rem 0; }
}
@media (min-width: 900px) {
  .or-burger { display: none; }
  .or-nav { display: block; }
}

/* ---- Formularios ---- */
.or-form { display: grid; gap: 1.1rem; max-width: 42rem; }
.or-form__grid { display: grid; gap: 1.1rem; }
@media (min-width: 640px) { .or-form__grid--2 { grid-template-columns: 1fr 1fr; } }
.or-field { display: grid; gap: .4rem; }
.or-field label { font-weight: 600; }
.or-field input:not([type="checkbox"]), .or-field select, .or-field textarea {
  width: 100%; padding: .75rem .9rem; border-radius: .5rem;
  border: 1.5px solid var(--or-borde, #ccc); background: var(--or-campo-bg, #fff);
}
.or-field textarea { resize: vertical; min-height: 8rem; }
.or-field--check { display: flex; align-items: flex-start; gap: .6rem; }
.or-field--check input { margin-top: .3rem; width: 1.1rem; height: 1.1rem; }
.or-field__error { margin: 0; font-size: .85rem; min-height: 1em; }
.or-field[data-invalid="true"] input, .or-field[data-invalid="true"] select, .or-field[data-invalid="true"] textarea { border-color: var(--or-error, #b3261e); }
.or-form-wrap { display: grid; gap: 1.1rem; }
.or-form__status { min-height: 1.4em; font-weight: 600; }
.or-form__status[hidden] { display: none; }
.or-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Botones (forma; el color lo define tema.css) ---- */
.or-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.4rem; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; text-decoration: none; line-height: 1.1;
  transition: transform .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.or-btn--sm { padding: .6rem 1.1rem; font-size: .92rem; }
.or-btn svg { width: 1.1em; height: 1.1em; flex-shrink: 0; }
.or-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
@media (hover: hover) { .or-btn:hover { transform: translateY(-1px); } }

/* ---- Imagen por defecto (pendiente de entregar por el cliente) ---- */
.or-ph { display: block; width: 100%; height: auto; object-fit: cover; }

/* ---- Consentimiento de cookies ---- */
.or-consent {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 80;
  max-width: 40rem; margin-inline: auto; border-radius: .9rem; padding: 1.25rem;
  display: grid; gap: 1rem;
}
.or-consent[hidden] { display: none; }
.or-consent__title { margin: 0 0 .4rem; font-size: 1.05rem; }
.or-consent p { margin: 0; font-size: .92rem; line-height: 1.5; }
.or-consent__actions { display: flex; gap: .75rem; flex-wrap: wrap; }
@media (max-width: 767px) { .or-consent { bottom: 5rem; max-height: calc(100vh - 7rem); overflow-y: auto; } } /* por encima de la barra de CTA */
@media (min-width: 640px) { .or-consent { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; } .or-consent__actions { flex-shrink: 0; } }

/* ---- FAQ (details/summary nativos: accesibles sin JS) ---- */
.or-faq-item { border-top: 1px solid var(--or-linea, #ddd); }
.or-faq-item:last-child { border-bottom: 1px solid var(--or-linea, #ddd); }
.or-faq-item > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 0; font-weight: 700; cursor: pointer; list-style: none;
}
.or-faq-item > summary::-webkit-details-marker { display: none; }
.or-faq-item__icon { flex-shrink: 0; transition: transform .2s ease; }
.or-faq-item[open] .or-faq-item__icon { transform: rotate(45deg); }
.or-faq-item p { margin: 0 0 1.3rem; max-width: 60ch; line-height: 1.6; }

/* ---- Filtro de casos (progressive enhancement) ---- */
.or-filtros { display: flex; flex-wrap: wrap; gap: .6rem; }
.or-filtros__btn { border-radius: 999px; padding: .5rem 1rem; font-size: .88rem; font-weight: 600; border: 1.5px solid var(--or-borde, #ccc); background: transparent; }
[data-caso-item][hidden] { display: none; }

/* ---- Skip básicos de layout compartidos ---- */
.or-visually-hidden-mobile { }
@media (max-width: 639px) { .or-hide-mobile { display: none !important; } }
@media (min-width: 640px) { .or-show-mobile-only { display: none !important; } }

/* ---- Recurso descargable ---- */
.or-recurso { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border-radius: .8rem; }
.or-recurso svg { flex-shrink: 0; }

/* ---- Tarjeta de redes / social ---- */
.or-social { display: flex; gap: .6rem; flex-wrap: wrap; }
.or-social__link { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .8rem; border-radius: 999px; text-decoration: none; font-size: .85rem; font-weight: 600; }

/* ---- Insights: recurso + meta ---- */
.or-meta { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; font-size: .85rem; }

/* ---- Vídeo/embeds responsivos (agenda embebida) ---- */
.or-embed { position: relative; width: 100%; aspect-ratio: 4 / 5; border-radius: 1rem; overflow: hidden; }
.or-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (min-width: 900px) { .or-embed { aspect-ratio: 5 / 4; } }
