/* Escriba de la Marca — Estructura: página, barra de pestañas, paneles, grupos, filas, diálogo y avisos */


/* ---------- Layout ---------- */
.view {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px 0 16px; }
.view-head p { margin: .25rem 0 0; font-size: .95rem; }
.loading { padding: 30vh 0; text-align: center; color: var(--muted); font-style: italic; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 48px;
  justify-content: center;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font: 600 min(.72rem, 13px) var(--font-ui);   /* la barra no crece con la letra grande: no cabría */
  position: relative;
}
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active svg { transform: translateY(-1px); }
.tabbar .tab-scan svg { width: 28px; height: 28px; }
@media (min-width: 760px) {
  .tabbar { max-width: 520px; left: 50%; transform: translateX(-50%); bottom: 16px; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding-bottom: 6px; }
}

/* ---------- Groups & cards ---------- */
.group { margin-bottom: 14px; }
.group summary {
  list-style: none; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 2px; cursor: pointer; font: 700 1.02rem var(--font-display); letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
}
.group summary::-webkit-details-marker { display: none; }
.group summary::before { content: '▸'; margin-right: 8px; color: var(--purple); transition: transform .15s; }
.group[open] summary::before { transform: rotate(90deg); }
.group summary > span:first-child { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; padding-top: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); } }
.card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.card:active .cover { transform: scale(.97); }
.card-title { font-size: .88rem; line-height: 1.25; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font: .72rem var(--font-ui); color: var(--muted); }
.card.missing .cover { filter: grayscale(1); opacity: .45; }
.card.missing .card-title { color: var(--muted); }
.cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px 10px 10px 6px; box-shadow: var(--shadow); background: var(--surface-2); transition: transform .12s ease; }
.cover-ph {
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 35%, #8a4aa3, #5e2c72 80%);
  border-left: 6px solid #45205a;
}
.cover-ph span { font: 700 1.6rem var(--font-display); color: #f3c02f; text-shadow: 0 2px 0 rgb(0 0 0 / .3); }
.cover-xs { width: 40px; flex: none; }
.cover-xs.cover-ph span { font-size: .8rem; }
.cover-sm { width: 88px; flex: none; }
.cover-lg { width: min(180px, 45vw); }
/* Descatalogado: ribete rojo en diagonal sobre la esquina superior derecha de la portada */
.cover-box { position: relative; display: block; overflow: hidden; border-radius: 6px 10px 10px 6px; container-type: inline-size; }
.cover-box > .cover { display: block; width: 100%; }
.oop-ribbon { position: absolute; top: 0; right: 0; width: 75%; aspect-ratio: 1; overflow: hidden; pointer-events: none; }
.oop-ribbon span {
  position: absolute; top: 31%; right: -38%; width: 150%; transform: rotate(45deg); padding: .3em 0;
  background: #9b1c14; color: #fff; border-block: 1px solid #f3c02f; box-shadow: 0 1px 3px rgb(0 0 0 / .4);
  font: 700 6.4cqw/1 var(--font-ui); letter-spacing: .03em; text-transform: uppercase; text-align: center;
}
/* En miniatura (filas) no cabe el texto: solo la franja */
.cover-box.cover-xs .oop-ribbon span { font-size: 0; padding: 0; height: 6px; top: 30%; }

/* ---------- Rows (catálogo) ---------- */
.rows { list-style: none; margin: 0; padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
.row-title { flex: 1; color: var(--ink); text-decoration: none; font-size: .95rem; line-height: 1.3; min-width: 0; }
.row-title small { display: block; font: .75rem var(--font-ui); color: var(--muted); }
.toggle {
  flex: none; min-height: 36px; padding: 0 12px; border-radius: 99px; cursor: pointer;
  font: 600 .8rem var(--font-ui); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.toggle.on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.pending { background: var(--warn-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.pending h2 { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.pending .row { flex-wrap: wrap; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 8px; }
.panel p { margin: .4rem 0; }
.panel.owned { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.teaser { display: block; text-decoration: none; color: var(--ink); background: var(--gold-soft); border-color: transparent; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 48px 8px; }
.empty-icon { font-size: 3rem; margin-bottom: 8px; }
.empty h2 { margin-bottom: 6px; }

/* ---------- Dialog ---------- */
dialog {
  width: min(560px, 100%); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink);
  box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
}
dialog[open] { animation: sheet .22s ease-out; }
dialog::backdrop { background: rgb(20 12 8 / .5); }
@media (min-width: 600px) { dialog { margin: auto; border-radius: 20px; } }
@keyframes sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet { padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.sheet-title { margin-bottom: 4px; }
.sheet-msg { font-size: 1.05rem; margin: 0 0 6px; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 50; pointer-events: none;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
}
/* La barra de pestañas flota a 16px del borde en pantallas anchas */
@media (min-width: 760px) { .toasts { bottom: calc(var(--tabbar-h) + 40px); } }
body.landing .toasts { bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }
/* Colores fijos (no dependen del tema) para mantener el contraste en claro y oscuro */
.toast {
  max-width: min(440px, 100%); padding: 12px 16px; border-radius: 12px;
  background: #2b1a12; color: #f5efe3; font: 600 .9rem/1.35 var(--font-ui);
  box-shadow: 0 6px 20px rgb(0 0 0 / .28); animation: rise .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast-ok { background: #2f6b3a; color: #fff; }
.toast-error { background: #a3261f; color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Revisión (admin) ---------- */
.tabbar.has-admin { grid-template-columns: repeat(6, 1fr); }
.tabbar.has-admin a span { font-size: min(.64rem, 11.5px); }
.tab-badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--accent); color: var(--accent-ink);
  font: 700 min(.66rem, 11px)/18px var(--font-ui); text-align: center;
}

/* ---------- Marcas de Mecenas y de administración ---------- */
#nav a[data-admin-tab].active { color: var(--admin); }
#nav a.is-supporter::after {
  content: ''; position: absolute; top: 1px; left: calc(50% + 6px); width: 15px; height: 15px; border-radius: 50%;
  background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3.2l2.6 5.5 6 .8-4.4 4.1 1.1 5.9L12 16.6l-5.3 2.9 1.1-5.9L3.4 9.5l6-.8z' fill='%233b2a05'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* ---------- Pestaña Perfil de un Mecenas: icono dorado con estrella ---------- */
#nav a.is-supporter svg { color: var(--gold); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--gold) 55%, transparent)); }

/* Aviso con acción («Deshacer») */
.toast-action { display: flex; align-items: center; gap: 14px; pointer-events: auto; }
.toast-action span { flex: 1; }
.toast-action button {
  flex: none; background: none; border: 0; padding: 4px 2px; cursor: pointer;
  color: #f3c02f; font: 800 .9rem var(--font-ui); text-transform: uppercase; letter-spacing: .04em;
}
