/* Migración Odoo 19 — Hormitec. Patrones de la landing Casas HTC (Tesla-style) */
:root {
  --bg: #0a0a0a;
  --bg-elev: #111;
  --text: #f5f5f5;
  --text-muted: rgba(245,245,245,.68);
  --accent: #D2222A;
  --line: rgba(255,255,255,.12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --nav-h: 56px;
  --measure: 680px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 1rem); }
body {
  margin: 0; font-family: var(--font); font-weight: 400;
  color: var(--text); background: var(--bg);
  font-size: 18px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; }
.skip-link { position: absolute; left: -9999px; top: 0; background: #fff; color: #000; padding: .75rem 1rem; z-index: 1000; }
.skip-link:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* NAV */
.nav {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; padding-top: env(safe-area-inset-top, 0); z-index: 50;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent);
  transition: background .25s ease, backdrop-filter .25s;
}
.nav.is-solid, body.index-open .nav {
  background: rgba(10,10,10,.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-brand { display: flex; align-items: center; text-decoration: none; }
.nav-logo { height: 22px; width: auto; }
.nav-toggle {
  appearance: none; background: transparent; color: var(--text);
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  padding: .4rem 1rem; font-size: .8125rem; font-weight: 500; letter-spacing: .02em; cursor: pointer;
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { border-color: #fff; }
@media (min-width: 1100px) { .nav { padding: 0 2rem; } }

/* ÍNDICE (panel) */
.index {
  position: fixed; inset: var(--nav-h) 0 0 0; z-index: 49;
  background: rgba(10,10,10,.97); overflow-y: auto;
}
.index[hidden] { display: none; }
.index-inner { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
body.index-open { overflow: hidden; }

/* LISTA DE SECCIONES (panel y portada) */
.toc, .index ol { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.toc li, .index li { border-top: 1px solid var(--line); }
.toc li:last-child, .index li:last-child { border-bottom: 1px solid var(--line); }
.toc a, .index a {
  display: flex; gap: 1.25rem; align-items: baseline; padding: 1rem 0;
  text-decoration: none; font-size: 1.05rem; font-weight: 500; line-height: 1.4;
  color: var(--text); opacity: .88; transition: opacity .2s;
}
.toc a:hover, .index a:hover { opacity: 1; }
.num { font-size: .8rem; font-weight: 500; letter-spacing: .12em; color: var(--text-muted); min-width: 1.6rem; font-variant-numeric: tabular-nums; }

/* HERO */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-end; justify-content: center;
  background: radial-gradient(120% 80% at 50% 0%, #1c1c1c 0%, #0a0a0a 60%), var(--bg);
  overflow: hidden;
}
.hero-gradient { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.6), transparent 55%); }
.hero-content {
  position: relative; z-index: 2; text-align: center;
  padding: calc(var(--nav-h) + 3rem) 1.5rem 3rem; max-width: 52rem;
}
.eyebrow {
  font-size: .75rem; font-weight: 500; letter-spacing: .18em;
  text-transform: uppercase; margin: 0 0 1rem; color: var(--text-muted);
}
.hero h1 {
  font-size: clamp(2.4rem, 7.5vw, 4.75rem); font-weight: 600;
  letter-spacing: -.03em; line-height: 1.06; margin: 0;
}
.hero-sub { font-size: clamp(1.05rem, 2.5vw, 1.35rem); font-weight: 300; margin: 1.25rem auto 0; max-width: 38rem; color: var(--text-muted); line-height: 1.5; }
.hero-tag {
  display: inline-block; margin: 1.75rem 0 0; font-size: .8125rem;
  padding: .4rem .95rem; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; letter-spacing: .04em;
}
.scroll-cue {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  margin: 3.5rem auto 0; text-decoration: none; font-size: .75rem;
  letter-spacing: .12em; text-transform: uppercase; opacity: .75;
}
.scroll-cue:hover { opacity: 1; }

/* PORTADA: CONTENIDO */
.toc-section { padding: 6rem 1.5rem; background: var(--bg-elev); }
.toc-inner { max-width: var(--measure); margin: 0 auto; }
.toc-section h2 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.12; margin: 0 0 2.5rem; }

/* CAPÍTULOS */
.chapter { padding: 0 1.5rem 6rem; background: var(--bg); }
.chapter.alt { background: var(--bg-elev); }
.chapter-head {
  min-height: 78vh; min-height: 78svh; max-width: 46rem; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
  padding: 6rem 0 4rem;
}
.chapter-head h2 {
  font-size: clamp(2.2rem, 6.5vw, 4rem); font-weight: 600;
  letter-spacing: -.03em; line-height: 1.08; margin: 0;
}
.chapter-head .eyebrow { color: var(--accent); }
.lede { margin: 1.75rem auto 0; max-width: 36rem; font-size: clamp(1.1rem, 2.4vw, 1.3rem); font-weight: 300; line-height: 1.6; color: var(--text-muted); }

/* TEXTO */
.prose { max-width: var(--measure); margin: 0 auto; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.5rem; color: rgba(245,245,245,.86); }
.prose strong { color: #fff; font-weight: 600; }
.prose h3 {
  font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 600; letter-spacing: -.02em;
  line-height: 1.2; margin: 5rem 0 1.5rem; padding-top: 2.5rem; border-top: 1px solid var(--line);
}
.prose h4 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.35; margin: 3rem 0 1rem; }
.prose ul { list-style: none; margin: 0 0 2rem; padding: 0; }
.prose li { position: relative; padding-left: 1.4rem; margin: 0 0 1.1rem; color: rgba(245,245,245,.86); }
.prose li::before { content: ""; position: absolute; left: 0; top: .78em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.prose li ul { margin: 1rem 0 0; }
.prose li li::before { background: transparent; border: 1px solid var(--text-muted); }
.prose li.check { padding-left: 2rem; }
.prose li.check::before { display: none; }
.chk { position: absolute; left: 0; top: .35em; width: 1.05rem; height: 1.05rem; border: 1.5px solid var(--accent); border-radius: 4px; }

/* TABLAS */
.table-wrap, .diagram-wrap {
  margin: 2rem 0 2.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 12px;
}
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .9rem; line-height: 1.5; }
table.log { min-width: 900px; }
th, td { text-align: left; vertical-align: top; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
thead th { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); background: rgba(255,255,255,.03); }
tbody th { font-weight: 600; color: #fff; }
td { color: rgba(245,245,245,.84); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
td:empty::after { content: "—"; color: rgba(245,245,245,.3); }
@media (min-width: 900px) {
  .table-wrap { margin-left: calc((var(--measure) - 860px) / 2); margin-right: calc((var(--measure) - 860px) / 2); }
}

/* DIAGRAMAS */
.diagram { margin: 0; padding: 1.25rem; font-family: var(--mono); font-size: .78rem; line-height: 1.45; color: rgba(245,245,245,.85); white-space: pre; }
.flow { list-style: none; margin: 2rem 0 2.5rem; padding: 0; counter-reset: f; }
.flow li { counter-increment: f; display: flex; gap: 1rem; align-items: baseline; padding: .8rem 0; border-top: 1px solid var(--line); font-weight: 500; }
.flow li:last-child { border-bottom: 1px solid var(--line); }
.flow li::before { content: counter(f, decimal-leading-zero); font-size: .8rem; letter-spacing: .12em; color: var(--accent); min-width: 1.6rem; }
.agenda { list-style: none; margin: 2rem 0 2.5rem; padding: 0; }
.agenda li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--line); }
.agenda li:last-child { border-bottom: 1px solid var(--line); }
.time { font-size: .85rem; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; padding-top: .1em; }

/* REVEAL */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}
.no-js [data-reveal] { opacity: 1; transform: none; }

/* PIE */
.foot { padding: 4rem 1.5rem calc(4rem + env(safe-area-inset-bottom, 0)); text-align: center; border-top: 1px solid var(--line); color: var(--text-muted); font-size: .875rem; }
.foot img { margin: 0 auto 1.25rem; height: 17px; width: auto; opacity: .85; }
.foot p { margin: 0 0 1rem; }
.foot a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }

@media (max-width: 480px) {
  body { font-size: 17.5px; }
  .chapter-head { min-height: 70svh; }
  .agenda li { grid-template-columns: 5.6rem 1fr; }
}

/* Referencias RACI */
.prose ul.legend { display: flex; flex-wrap: wrap; gap: .5rem .6rem; margin: 2rem 0 0; }
.prose ul.legend li { padding: .35rem .85rem; margin: 0; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--text-muted); }
.prose ul.legend li::before { display: none; }
.key { color: #fff; font-weight: 600; margin-right: .45rem; }
tbody th { min-width: 11rem; }

/* LEER EN VOZ ALTA */
.tts {
  appearance: none; align-self: center; margin: 1.5rem auto 0;
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 40px; padding: .45rem 1.1rem;
  background: transparent; color: var(--text);
  border: 1px solid rgba(210,34,42,.75); border-radius: 999px;
  font-family: var(--font); font-size: .8125rem; font-weight: 500; letter-spacing: .04em;
  cursor: pointer; transition: background .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.tts[hidden] { display: none; }
.tts:hover { border-color: var(--accent); background: rgba(210,34,42,.08); }
.tts[aria-pressed="true"] { border-color: var(--accent); background: rgba(210,34,42,.14); }
.tts[aria-pressed="true"] .tts-ico { animation: tts-pulse 1.2s ease-in-out infinite; }
.tts-ico { color: var(--accent); flex: none; }
@keyframes tts-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .tts[aria-pressed="true"] .tts-ico { animation: none; } }

/* CHECKLIST INTERACTIVO */
.prose li.check { padding-left: 0; }
.cb-row { position: relative; display: flex; gap: .9rem; align-items: flex-start; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cb { position: absolute; opacity: 0; width: 1.4rem; height: 1.4rem; margin: 0; left: 0; top: .2em; cursor: pointer; }
.cb-box {
  flex: none; width: 1.4rem; height: 1.4rem; margin-top: .2em;
  border: 1.5px solid #fff; border-radius: 5px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.cb-box::after {
  content: ""; width: .38rem; height: .7rem; margin-top: -.12rem;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0);
  transition: transform .15s;
}
.cb:checked + .cb-box { background: var(--accent); border-color: var(--accent); }
.cb:checked + .cb-box::after { transform: rotate(45deg) scale(1); }
.cb:focus-visible + .cb-box { outline: 2px solid var(--accent); outline-offset: 3px; }
.cb:checked ~ .cb-text { color: var(--text-muted); }
.cb-row:hover .cb-box { border-color: var(--accent); }

/* AJUSTES DE VOZ */
.nav-actions { display: flex; gap: .5rem; align-items: center; }
.nav-toggle[hidden] { display: none; }
body.voice-open .nav { background: rgba(10,10,10,.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.voice-panel {
  position: fixed; top: var(--nav-h); right: 0; left: 0; z-index: 51;
  background: #0a0a0a; box-shadow: 0 18px 40px rgba(0,0,0,.6); border-bottom: 1px solid var(--line);
}
.voice-panel[hidden] { display: none; }
.voice-inner { max-width: var(--measure); margin: 0 auto; padding: 1.5rem 1.5rem 1.75rem; }
@media (min-width: 720px) {
  .voice-panel { left: auto; right: 1.25rem; width: 22rem; border: 1px solid var(--line); border-radius: 12px; margin-top: .5rem; }
  .voice-inner { padding: 1.25rem 1.25rem 1.4rem; }
}
.vp-label { display: block; margin: 0 0 .5rem; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.vp-select {
  width: 100%; min-height: 44px; margin: 0 0 1.4rem; padding: .55rem 2.2rem .55rem .9rem;
  font: 500 .95rem/1.3 var(--font); color: var(--text);
  background: #111 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right .9rem center;
  border: 1px solid rgba(255,255,255,.25); border-radius: 10px; appearance: none; -webkit-appearance: none;
}
.vp-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vp-select option { background: #111; color: #f5f5f5; }
.vp-rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.vp-rate {
  appearance: none; min-height: 44px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  background: transparent; color: var(--text); font: 500 .875rem var(--font); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.vp-rate:hover { border-color: rgba(255,255,255,.6); }
.vp-rate[aria-checked="true"] { border-color: var(--accent); background: rgba(210,34,42,.16); }
.vp-note { margin: 1rem 0 0; font-size: .8rem; line-height: 1.5; color: var(--text-muted); }

/* TABLAS: encabezado y primera columna fijos */
.table-wrap { max-height: min(78vh, 680px); max-height: min(78svh, 680px); overflow: auto; overscroll-behavior-x: contain; position: relative; }
.table-wrap table { border-collapse: separate; border-spacing: 0; }
.table-wrap thead th { position: sticky; top: 0; z-index: 2; background: #1a1a1a; box-shadow: inset 0 -1px 0 var(--line); border-bottom: 0; }
.table-wrap tbody th { position: sticky; left: 0; z-index: 1; background: #141414; box-shadow: inset -1px 0 0 var(--line); }
.table-wrap thead th:first-child { left: 0; z-index: 3; background: #1a1a1a; box-shadow: inset -1px -1px 0 var(--line); }
.table-wrap td { background: transparent; }
@media (max-width: 600px) { .table-wrap tbody th, .table-wrap thead th:first-child { min-width: 8.5rem; max-width: 9.5rem; } }

/* FRASES ENTRE CAPÍTULOS (fila horizontal con snap) */
.interlude {
  min-height: 42vh; min-height: 42svh; display: flex; flex-direction: column; justify-content: center;
  padding: 4.5rem 0 3rem; background: #000; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.phrase-track {
  list-style: none; margin: 0; padding: 0 7.5vw; display: flex; gap: 0; position: relative;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none;
  scroll-padding: 0 7.5vw;
}
.phrase-track::-webkit-scrollbar { display: none; }
.phrase-track:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }
.phrase {
  flex: 0 0 85vw; max-width: 85vw; scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 1.25rem;
}
@media (min-width: 720px) { .phrase-track { padding: 0 calc(50vw - 17rem); scroll-padding: 0 calc(50vw - 17rem); } .phrase { flex-basis: 34rem; max-width: 34rem; } }
.phrase p {
  max-width: 30rem; margin: 0; text-align: center;
  font-family: var(--font); font-style: normal; font-weight: 400;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem); letter-spacing: -.01em; line-height: 1.45;
  color: rgba(245,245,245,.8);
}
.phrase p::before { content: ""; display: block; width: 1.75rem; height: 1px; margin: 0 auto 1.25rem; background: var(--accent); }
.phrase-nav { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; color: var(--text-muted); font-size: .75rem; letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.phrase-btn {
  appearance: none; width: 36px; height: 36px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--text-muted); border: 1px solid var(--line); font-size: .95rem; line-height: 1;
  transition: color .2s, border-color .2s, opacity .2s;
}
.phrase-btn:hover { color: #fff; border-color: rgba(255,255,255,.4); }
.phrase-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 480px) { .interlude { min-height: 34svh; padding: 3.5rem 0 2.5rem; } }
