/* Visor del Reporte de Sostenibilidad Inchalam
   Valores tomados del CSS compilado de la landing (Tailwind v4). */

@font-face {
  font-family: PlusJakartaSans;
  src: url(./fonts/PlusJakartaSans-Regular.ttf) format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: PlusJakartaSans;
  src: url(./fonts/PlusJakartaSans-Medium.ttf) format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: PlusJakartaSans;
  src: url(./fonts/PlusJakartaSans-Bold.ttf) format("truetype");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-blue: #173d68;
  --brand-cyan: #00aebf;
  --gray-100: oklch(96.7% 0.003 264.542);
  --gray-200: oklch(92.8% 0.006 264.531);
  --white: #fff;
}

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

html {
  -webkit-text-size-adjust: 100%;
  line-height: 1.5;
}

body {
  font-family: PlusJakartaSans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--brand-blue);
  background: var(--white);
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

svg {
  display: block;
}

.icon-sm {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  stroke-width: 2;
}
.icon-md {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 2;
}

.container {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 0.5rem;
}

/* ---------- CTA ---------- */
.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-block: 2rem;
}
.cta-icon {
  width: 3rem;
  height: 3rem;
}
.cta-text {
  display: flex;
  flex-direction: column;
  text-align: center;
  text-transform: uppercase;
}
.cta-text h2 {
  font-size: 1.125rem;
  line-height: 1.556;
  font-weight: 600;
}

/* ---------- Visor ---------- */
.mobile-title {
  background: var(--gray-200);
  display: flex;
  justify-content: center;
  padding-block: 1rem;
}
.mobile-title span {
  font-weight: 600;
  text-transform: uppercase;
}

.mobile-nav {
  background: var(--brand-blue);
  color: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  font-weight: 600;
}
.mobile-nav button {
  flex-shrink: 0;
  padding: 0.25rem;
}
#chapter-counter {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}
#chapter-counter .chapter-number {
  font-size: 1.25rem;
  font-weight: 600;
}

.viewer-grid {
  display: grid;
  grid-template-columns: 1fr;
}

#chapters-panel {
  display: none;
  background: var(--gray-100);
}

.chapters-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--gray-100);
  border-bottom: 1px solid var(--brand-blue);
  padding-block: 1rem;
}
.chapters-header p {
  font-size: 1.5rem;
  line-height: 1.333;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
}

#chapters-list {
  list-style: none;
}
#chapters-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1rem;
  text-align: left;
  color: var(--brand-blue);
  transition: background-color 0.15s, color 0.15s;
}
#chapters-list button:hover {
  background: var(--gray-200);
}
#chapters-list .chapter-number {
  font-size: 1.25rem;
  font-weight: 600;
}
#chapters-list li.is-active button {
  background: var(--brand-blue);
  color: var(--white);
}

button:focus-visible,
.canvas-wrap:focus-visible {
  outline: 2px solid var(--brand-cyan);
  outline-offset: -2px;
}

.canvas-wrap {
  position: relative;
  min-height: 12rem;
  background: var(--white);
}
#the-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-weight: 500;
  background: color-mix(in oklab, var(--white) 70%, transparent);
  pointer-events: none;
}
.status[hidden] {
  display: none;
}
.status.is-error {
  pointer-events: auto;
  background: var(--gray-100);
}
.status a {
  color: var(--brand-blue);
  font-weight: 600;
}

.page-indicator {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  color: var(--white);
  background: rgb(0 0 0 / 0.4);
}
.page-indicator:empty {
  display: none;
}

.page-btn {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--white);
  color: var(--white);
  background: rgb(0 0 0 / 0.3);
  transition: background-color 0.15s;
}
.page-btn:hover {
  background: rgb(0 0 0 / 0.5);
}
.page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.page-btn--prev {
  left: 0.5rem;
}
.page-btn--next {
  right: 0.5rem;
}

/* ---------- Descarga ---------- */
.download {
  background: rgb(23 61 104 / 0.9);
  color: var(--white);
}
.download-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-block: 3rem;
  text-align: center;
}
.download-inner h2 {
  font-size: 1.125rem;
  font-weight: 600;
  text-transform: uppercase;
}
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--white);
  border-radius: 9999px;
  padding: 0.5rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.download-btn:hover {
  background: var(--white);
  color: var(--brand-blue);
}

/* ---------- Escritorio (>= 768px) ---------- */
@media (width >= 48rem) {
  .cta {
    flex-direction: row;
    justify-content: center;
  }
  .cta-icon {
    width: 5rem;
    height: 5rem;
  }
  .cta-text {
    text-align: left;
  }
  .cta-text h2,
  .download-inner h2 {
    font-size: 1.5rem;
  }
  .mobile-title,
  .mobile-nav {
    display: none;
  }
  .viewer-grid {
    grid-template-columns: 1fr 3fr;
  }
  #chapters-panel {
    display: block;
    min-height: 0;
    overflow-y: auto;
  }
  .page-btn {
    width: 2.5rem;
    height: 2.5rem;
  }
  .download-inner {
    flex-direction: row;
    justify-content: center;
    gap: 2rem;
  }
}
