/* =========================================================
   Informe COSO – Criptografía
   Paleta: azul oscuro, gris claro, blanco, verde
   ========================================================= */

:root {
  --blue: #1e3a8a;
  --blue-deep: #172554;
  --blue-soft: #dbeafe;
  --gray: #f3f4f6;
  --white: #ffffff;
  --green: #10b981;
  --green-dark: #059669;
  --green-soft: #d1fae5;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --shadow: 0 12px 32px rgba(30, 58, 138, 0.1);
  --radius: 16px;
  --nav-h: 64px;
  --font: "Inter", Arial, sans-serif;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: var(--gray);
}

button {
  font-family: inherit;
}

/* ---------- Layout ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0;
  background: linear-gradient(90deg, var(--green), #34d399);
  z-index: 50;
  transition: width 0.4s ease;
}

.deck {
  position: relative;
  height: 100%;
  width: 100%;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(48px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
  overflow: hidden;
}

.slide.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 2;
}

.slide.is-prev {
  transform: translateX(-48px);
}

.slide-inner {
  height: 100%;
  padding: 0.85rem 2.1rem calc(var(--nav-h) + 0.7rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.slide:not(.slide--cover) .kicker,
.slide:not(.slide--cover) h2,
.slide:not(.slide--cover) .lead {
  padding-right: 4.4rem;
}

.logo-corner {
  position: fixed;
  top: 0.7rem;
  right: 1rem;
  height: 52px;
  width: auto;
  z-index: 36;
  object-fit: contain;
  pointer-events: none;
}

body:has(.slide--cover.active) .logo-corner {
  opacity: 0;
  visibility: hidden;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  margin-bottom: 0.2rem;
  align-self: flex-start;
}

.slide h1,
.slide h2 {
  color: var(--blue-deep);
  line-height: 1.15;
}

.slide h2 {
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  font-weight: 800;
  margin-bottom: 0.1rem;
}

.lead {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.15rem;
  max-width: 78ch;
  line-height: 1.35;
}

.visual-strip {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #f8fafc;
  border: 1px solid rgba(30, 58, 138, 0.06);
  flex: 0 1 20vh;
  min-height: 72px;
  max-height: 160px;
  display: flex;
  flex-direction: column;
}

.visual-strip img {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  height: auto;
  object-fit: contain;
  object-position: center;
  background: #f8fafc;
}

.visual-strip figcaption {
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0.18rem 0.65rem 0.28rem;
  flex: 0 0 auto;
  line-height: 1.25;
}

.split-visual {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.75rem;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.split-visual .visual-strip {
  margin: 0;
  height: 100%;
  max-height: none;
  flex: 1;
}

.split-visual .visual-strip img {
  flex: 1;
  min-height: 0;
  object-fit: contain;
}

.slide-inner > .grid-2,
.slide-inner > .grid-4,
.slide-inner > .grid-5,
.slide-inner > .case,
.slide-inner > .pillars,
.slide-inner > .biblio {
  flex: 1;
  min-height: 0;
}

.slide--dark .visual-strip {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.slide--dark .visual-strip figcaption {
  background: transparent;
  color: #bfdbfe;
}

/* ---------- Cover ---------- */
.slide--cover {
  background: radial-gradient(1200px 700px at 80% -10%, #2563eb 0%, transparent 50%),
    radial-gradient(900px 500px at -10% 110%, #0f766e 0%, transparent 45%),
    linear-gradient(160deg, var(--blue-deep) 0%, var(--blue) 55%, #1d4ed8 100%);
  color: var(--white);
}

.slide--cover .slide-inner {
  display: grid;
  place-items: center;
  text-align: center;
}

.cover {
  position: relative;
  z-index: 1;
  max-width: 860px;
}

.cover-logo {
  display: block;
  width: auto;
  height: clamp(88px, 13vh, 132px);
  margin: 0 auto 0.2rem;
  object-fit: contain;
}

.cover-institute {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e2e8f0;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.7rem;
}

.cover-subject {
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #bfdbfe;
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.cover h1 {
  color: var(--white);
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.cover-title {
  font-size: clamp(0.98rem, 1.8vw, 1.25rem);
  color: var(--green);
  font-weight: 600;
  margin-bottom: 0.9rem;
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.cover-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.meta-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 0.85rem 1.15rem;
  min-width: 220px;
  text-align: left;
}

.meta-card span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 0.25rem;
}

.meta-card strong {
  font-size: 0.98rem;
  font-weight: 600;
}

.cover-bg-icon {
  position: absolute;
  right: -4%;
  bottom: -8%;
  width: min(42vw, 420px);
  opacity: 0.07;
  color: var(--white);
  pointer-events: none;
}

/* ---------- Cards & grids ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
}

.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(30, 58, 138, 0.06);
  padding: 0.7rem 0.75rem;
  min-height: 0;
}

.card h3 {
  font-size: 0.92rem;
  color: var(--blue);
  margin: 0.3rem 0 0.2rem;
}

.card p,
.card li {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-wrap svg {
  width: 16px;
  height: 16px;
}

.callout {
  margin-top: 0;
  background: var(--white);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}

.callout strong {
  color: var(--blue);
  font-size: 0.78rem;
}

.callout p {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- COSO interactive ---------- */
.coso-card {
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  border: 2px solid transparent;
}

.coso-card:hover {
  transform: translateY(-2px);
}

.coso-card.is-on {
  border-color: var(--green);
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.16);
}

.coso-num {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--green-dark);
}

.icon-wrap.green {
  background: var(--green-soft);
  color: var(--green-dark);
}

.detail-panel {
  margin-top: 0;
  min-height: 0;
  background: var(--blue);
  color: var(--white);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  flex: 0 0 auto;
}

.detail-panel p {
  font-size: 0.8rem;
  line-height: 1.35;
  color: #e0e7ff;
}

.detail-panel strong {
  color: var(--white);
}

/* ---------- Mapping rows ---------- */
.map-list {
  display: grid;
  gap: 0.4rem;
}

.map-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0.7rem;
  align-items: center;
  background: var(--white);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  box-shadow: var(--shadow);
}

.map-label {
  font-weight: 700;
  color: var(--blue);
  font-size: 0.82rem;
}

.map-row p {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Case studies ---------- */
.case-visual {
  margin-bottom: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #f8fafc;
  border: 1px solid rgba(30, 58, 138, 0.08);
  flex: 0 1 16vh;
  min-height: 72px;
  max-height: 140px;
  display: flex;
  flex-direction: column;
}

.case-visual img {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  background: #f8fafc;
}

.case-visual figcaption {
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--white);
  padding: 0.18rem 0.65rem 0.25rem;
  flex: 0 0 auto;
}

.case {
  display: grid;
  grid-template-columns: 1.3fr 0.85fr;
  gap: 0.65rem;
  min-height: 0;
}

.case > div {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  min-height: 0;
}

.case .card {
  margin: 0 !important;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.fact {
  background: var(--white);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  box-shadow: var(--shadow);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}

.stat {
  background: var(--blue);
  color: var(--white);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.stat-item h3 {
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  color: var(--green);
  line-height: 1;
}

.stat-item p {
  color: #bfdbfe;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.lesson {
  margin-top: 0;
  background: var(--green-soft);
  color: #065f46;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  flex: 0 0 auto;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.5rem;
}

.badge.ok {
  background: var(--green-soft);
  color: #065f46;
}

/* ---------- Quote / conclusion ---------- */
.slide--dark {
  background: linear-gradient(145deg, var(--blue-deep), var(--blue));
  color: var(--white);
}

.slide--dark h2,
.slide--dark .lead {
  color: var(--white);
}

.slide--dark .lead {
  color: #bfdbfe;
}

.fact strong {
  display: block;
  color: var(--blue);
  font-size: 0.72rem;
  margin-bottom: 0.1rem;
}

.pillars {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.7rem;
  align-items: stretch;
  margin: 0.2rem 0;
}

.pillar {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.quote {
  font-size: clamp(0.95rem, 1.7vw, 1.25rem);
  font-style: italic;
  font-weight: 600;
  line-height: 1.35;
  color: var(--white);
  border-left: 4px solid var(--green);
  padding-left: 0.85rem;
  flex: 0 0 auto;
}

.biblio {
  list-style: none;
  display: grid;
  gap: 0.32rem;
}

.biblio li {
  background: var(--white);
  border-radius: 10px;
  padding: 0.42rem 0.75rem 0.42rem 2.6rem;
  position: relative;
  box-shadow: var(--shadow);
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.3;
}

.biblio li::before {
  content: attr(data-n);
  position: absolute;
  left: 0.6rem;
  top: 0.38rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.benefit p {
  min-height: 0;
}

.hint {
  display: none;
}

.pillar h3 {
  color: var(--green);
  margin-bottom: 0.25rem;
}

.pillar p {
  color: #dbeafe;
  font-size: 0.88rem;
}

.plus {
  align-self: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.4rem;
  z-index: 40;
}

.nav-btn {
  background: var(--blue);
  color: var(--white);
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1.15rem;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  min-width: 120px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.nav-btn:hover:not(:disabled) {
  background: var(--blue-deep);
  transform: translateY(-1px);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.dots {
  display: flex;
  gap: 0.38rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 0;
  background: #cbd5e1;
  cursor: pointer;
}

.dot.is-on {
  background: var(--green);
  transform: scale(1.2);
}

.counter {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

/* ---------- Stagger when active ---------- */
.slide.active .card,
.slide.active .map-row,
.slide.active .biblio li,
.slide.active .pillar {
  animation: rise 0.35s ease both;
}

.slide.active .card:nth-child(2),
.slide.active .map-row:nth-child(2),
.slide.active .biblio li:nth-child(2) { animation-delay: 0.06s; }
.slide.active .card:nth-child(3),
.slide.active .map-row:nth-child(3),
.slide.active .biblio li:nth-child(3) { animation-delay: 0.12s; }
.slide.active .card:nth-child(4),
.slide.active .map-row:nth-child(4),
.slide.active .biblio li:nth-child(4) { animation-delay: 0.18s; }
.slide.active .card:nth-child(5),
.slide.active .map-row:nth-child(5),
.slide.active .biblio li:nth-child(5) { animation-delay: 0.24s; }
.slide.active .biblio li:nth-child(6) { animation-delay: 0.3s; }
.slide.active .biblio li:nth-child(7) { animation-delay: 0.36s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .slide,
  .card,
  .map-row,
  .biblio li,
  .pillar {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1024px) {
  .case,
  .facts,
  .pillars,
  .map-row,
  .grid-2,
  .split-visual {
    grid-template-columns: 1fr;
  }

  .slide-inner {
    padding: 0.7rem 1rem calc(var(--nav-h) + 0.6rem);
  }

  .logo-corner {
    height: 44px;
    top: 0.5rem;
    right: 0.55rem;
  }

  .plus {
    display: none;
  }
}

@media (max-height: 820px) {
  .visual-strip figcaption,
  .case-visual figcaption {
    display: none;
  }

  .visual-strip,
  .case-visual {
    max-height: 108px;
  }

  .cover-logo {
    height: clamp(72px, 11vh, 110px);
  }
}
