/* Visor de presentación · Coopidrogas
   Fondo blanco, tinta navy de la marca. La diapositiva es lo único que lleva sombra. */

:root {
  --ground: #ffffff;
  --tint: #f4f6fb;
  --tint-2: #e6edf9;
  --line: #dde4f0;
  --ink: #14336e;
  --muted: #56637f;
  --blue: #2f73c9;
  --stage: #0b1733;

  --font: Calibri, Carlito, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --shadow-slide: 0 1px 2px rgb(15 23 42 / 0.08), 0 22px 44px -22px rgb(15 23 42 / 0.32);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 72px;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.5;
  font-variant-numeric: tabular-nums; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

::selection { background: #cfe0fa; color: var(--ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
:focus:not(:focus-visible) { outline: none; }

.skip { position: absolute; left: 16px; top: -64px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Cabecera ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--ground); border-bottom: 1px solid var(--line); }
.top-inner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 24px; min-height: 72px; }

.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 700; font-size: 1.25rem; letter-spacing: -0.015em; }
.brand img { width: 38px; height: auto; flex: none; }

.tabs { display: flex; gap: 6px; justify-content: center; overflow-x: auto; scrollbar-width: none; padding: 4px; }
.tabs::-webkit-scrollbar, .subtabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; flex: none;
  border-radius: 999px; font-weight: 600; font-size: 1rem; color: var(--muted); white-space: nowrap;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
.tab:hover { background: var(--tint); color: var(--ink); }
.tab[aria-current="page"] { background: var(--ink); color: #fff; }

.subnav-wrap { padding-bottom: 10px; }
.subnav-wrap[hidden] { display: none; }
.subtabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px 4px 2px 0; }
.subtab {
  display: inline-flex; align-items: center; flex: none; min-height: 40px; padding: 0 16px;
  border-radius: 999px; font-weight: 600; font-size: 0.9375rem; color: var(--muted); white-space: nowrap;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}
.subtab:hover { background: var(--tint); color: var(--ink); }
.subtab[aria-current="page"] { background: var(--tint-2); color: var(--ink); box-shadow: inset 0 0 0 1px #c3d2ee; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 1rem; line-height: 1;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
}
.btn svg { flex: none; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--tint); border-color: #c8d3e6; }
.btn-icon { width: 48px; padding: 0; }
.btn[disabled] { opacity: 0.38; cursor: default; pointer-events: none; }

/* ---------- Inicio y vistas generales: mosaicos ---------- */
.home { padding-block: clamp(36px, 6vw, 88px) clamp(48px, 7vw, 96px); }
.home h1 { font-size: clamp(2rem, 4.2vw, 3.5rem); line-height: 1.05; letter-spacing: -0.035em; font-weight: 700; text-wrap: balance; max-width: 22ch; margin-bottom: clamp(28px, 4vw, 56px); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 2.6vw, 40px); }
.tile { display: block; }
.tile .pic {
  display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: var(--ink);
  border: 1px solid rgb(20 51 110 / 0.12); box-shadow: var(--shadow-slide);
  transition: transform 300ms var(--ease);
}
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover .pic { transform: translateY(-4px); }
.tile .name { display: block; margin-top: 16px; font-size: clamp(1.375rem, 2vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }

/* ---------- Visor ---------- */
.viewer { --w: min(100%, calc((100vh - var(--header-h) - 190px) * 16 / 9)); --w: min(100%, calc((100dvh - var(--header-h) - 190px) * 16 / 9)); width: max(var(--w), min(100%, 560px)); margin-inline: auto; padding-block: clamp(20px, 3vw, 36px) clamp(32px, 5vw, 64px); }

.frame {
  view-transition-name: slide-frame; position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0;
  background: #fff; border: 1px solid rgb(20 51 110 / 0.12); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-slide); cursor: zoom-in;
}
.frame img { width: 100%; height: 100%; object-fit: contain; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.toolbar .pos { font-weight: 700; min-width: 4.5ch; }
.toolbar .spacer { flex: 1; }

.strip { display: flex; gap: 28px; margin-top: 20px; overflow-x: auto; padding: 6px 4px 14px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #c3cde0 transparent; }
.strip::-webkit-scrollbar { height: 8px; }
.strip::-webkit-scrollbar-thumb { background: #c3cde0; border-radius: 8px; }
.group { flex: none; }
.group-name { font-size: 0.875rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; white-space: nowrap; }
.group-thumbs { display: flex; gap: 12px; }
.thumb { flex: none; position: relative; width: 132px; padding: 0; background: none; border: 0; scroll-snap-align: center; border-radius: 8px; }
.thumb .img {
  display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: #fff; border: 1px solid var(--line);
  transition: border-color 180ms var(--ease), transform 180ms var(--ease);
}
.thumb .img img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover .img { border-color: #b9c6de; transform: translateY(-2px); }
.thumb .n {
  position: absolute; left: 6px; bottom: 6px; min-width: 22px; padding: 2px 6px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.3; text-align: center;
}
.thumb[aria-current="true"] .img { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 0; }

/* ---------- Presentación a pantalla completa ---------- */
.stage { --sp: clamp(8px, 2vw, 32px); --bar: 72px; position: fixed; inset: 0; z-index: 50; background: var(--stage); color: #fff; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.stage[hidden] { display: none; }
.stage-view { display: grid; place-items: center; padding: var(--sp); min-height: 0; touch-action: pan-x pan-y pinch-zoom; }
.stage-view img {
  width: min(100%, calc((100vh - var(--bar) - 2 * var(--sp)) * 16 / 9));
  width: min(100%, calc((100dvh - var(--bar) - 2 * var(--sp)) * 16 / 9));
  height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; border-radius: 6px;
}
.stage-bar { display: flex; align-items: center; gap: 12px; min-height: var(--bar); padding: 10px clamp(12px, 2vw, 28px) 14px; transition: opacity 300ms var(--ease); }
.stage.idle .stage-bar { opacity: 0; }
.stage.idle { cursor: none; }
.stage-bar .btn { background: rgb(255 255 255 / 0.1); color: #fff; border-color: rgb(255 255 255 / 0.18); min-height: 44px; }
.stage-bar .btn:hover { background: rgb(255 255 255 / 0.2); }
.stage-bar .btn-icon { width: 44px; }
.stage-bar .meta { flex: 1; min-width: 0; line-height: 1.25; }
.stage-bar .meta b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-bar .meta span { font-size: 0.8125rem; color: #b5c4e6; }
.stage :focus-visible { outline-color: #9ec2f7; }

/* ---------- Movimiento ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.home h1 { animation: rise 600ms var(--ease) both; }
.tile { animation: rise 640ms var(--ease) both; }
.tile:nth-child(2) { animation-delay: 70ms; }
.tile:nth-child(3) { animation-delay: 140ms; }
.tile:nth-child(4) { animation-delay: 200ms; }
.tile:nth-child(5) { animation-delay: 260ms; }
.tile:nth-child(6) { animation-delay: 320ms; }
::view-transition-old(slide-frame) { animation: 130ms ease-in both fade-out; }
::view-transition-new(slide-frame) { animation: 340ms var(--ease) both slide-in; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .top-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding-top: 8px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; margin-inline: -4px; padding-bottom: 10px; }
}
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .top { position: static; }
  .viewer { width: 100%; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .btn .label { display: none; }
  .thumb { width: 112px; }
  .top .btn-ghost { padding: 0 14px; }
}
@media (hover: none) { .thumb:hover .img, .tile:hover .pic { transform: none; } }
