:root {
  --ccica-red: #c1293c;
  --ccica-red-dark: #8a1a29;
  --ccica-red-soft: #d33f52;
  --ccica-black: #1c1714;
  --ccica-ink: #241d19;
  --ccica-white: #fbfaf8;
  --ccica-cream: #f5efe4;
  --ccica-gold: #c9a24b;
  --ccica-gold-light: #e4c574;
  --ccica-yellow: #f2c230;
  --ccica-muted: #6b6058;
  --shadow-soft: 0 12px 32px rgba(28, 23, 20, 0.1);
  --shadow-lift: 0 16px 40px rgba(28, 23, 20, 0.18);
}

* {
  box-sizing: border-box;
}

*, *::before, *::after {
  transition: none !important;
  animation: none !important;
  scroll-behavior: auto !important;
}

body {
  background-color: var(--ccica-white);
  color: var(--ccica-ink);
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.05rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: clip;
}

.btn {
  min-height: 44px;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  font-size: 1rem;
}

.btn-sm {
  min-height: 38px;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  font-size: 0.875rem;
}

body > main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--ccica-black);
}

a {
  color: var(--ccica-red-dark);
}

/* ---------- Navbar ---------- */

.navbar-ccica {
  background-color: rgba(28, 23, 20, 0.97);
  border-bottom: 1px solid rgba(201, 162, 75, 0.35);
  flex-shrink: 0;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  backdrop-filter: blur(6px);
}

.navbar-ccica .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ccica-white) !important;
  letter-spacing: 0.01em;
  font-weight: 700;
  font-size: 1rem;
  white-space: normal;
  line-height: 1.15;
}

.navbar-ccica .navbar-brand img {
  height: 38px;
  width: 38px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--ccica-gold);
}

.navbar-ccica .navbar-brand .brand-zh {
  color: var(--ccica-gold-light);
  font-size: 0.78rem;
  display: block;
  font-weight: 400;
  letter-spacing: 0.08em;
}

@media (max-width: 420px) {
  .navbar-ccica .navbar-brand .brand-name {
    display: none;
  }
}

.navbar-ccica .nav-link {
  color: rgba(251, 250, 248, 0.85) !important;
  letter-spacing: 0.02em;
  font-weight: 500;
  position: relative;
}

.navbar-ccica .nav-link:hover,
.navbar-ccica .nav-link:focus {
  color: var(--ccica-gold-light) !important;
}

.navbar-ccica .nav-link.active {
  color: var(--ccica-gold-light) !important;
}

.navbar-ccica .nav-divider {
  border-top: 1px solid rgba(201, 162, 75, 0.3);
  margin: 0.4rem 0;
}

@media (min-width: 992px) {
  .navbar-ccica .navbar-nav {
    gap: 0.25rem;
  }

  .navbar-ccica .nav-divider {
    border-top: 0;
    border-left: 1px solid rgba(201, 162, 75, 0.3);
    align-self: stretch;
    margin: 0.4rem 0.5rem;
  }

  .navbar-ccica .navbar-brand .brand-name {
    display: block;
    max-width: 260px;
  }
}

section[id] {
  scroll-margin-top: 80px;
}

.navbar-ccica .navbar-toggler {
  border-color: rgba(201, 162, 75, 0.5);
}

.navbar-ccica .navbar-toggler-icon {
  filter: invert(1);
}

.btn-ccica {
  background-color: var(--ccica-red);
  border: 1px solid var(--ccica-gold);
  color: var(--ccica-white);
  font-weight: 600;
  border-radius: 0.5rem;
}

.btn-ccica:hover {
  background-color: var(--ccica-red-dark);
  color: var(--ccica-gold-light);
  box-shadow: 0 4px 12px rgba(193, 41, 60, 0.3);
}

/* ---------- Hero ---------- */

.hero-ccica {
  position: relative;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(135deg, var(--ccica-black) 0%, var(--ccica-ink) 45%, var(--ccica-red-dark) 130%);
  background-size: 24px 24px, cover;
  color: var(--ccica-white);
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem clamp(3rem, 7vw, 5.5rem);
  text-align: center;
  overflow: hidden;
}

.hero-ccica::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(201, 162, 75, 0.18), transparent 60%);
  pointer-events: none;
}

.hero-banner-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin: 0 auto 1.75rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(201, 162, 75, 0.5);
  box-shadow: var(--shadow-lift);
}

.hero-banner-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-ccica .hero-title {
  color: var(--ccica-white);
  font-weight: 700;
  font-size: clamp(1.4rem, 3.2vw, 2.1rem);
  line-height: 1.25;
  max-width: 760px;
  margin: 0 auto 0.9rem;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(255, 255, 255, 0.7);
}

.hero-ccica .hero-lead {
  color: rgba(251, 250, 248, 0.85);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  max-width: 640px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-actions .btn {
  padding: 0.7rem 1.6rem;
  font-size: 1rem;
}

/* ---------- Sedes ---------- */

.venue-region {
  font-size: 1.15rem;
  color: var(--ccica-red-dark);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 2.5rem 0 1.25rem;
}

.venue-region:first-of-type {
  margin-top: 0.5rem;
}

.venue-card {
  overflow: hidden;
  text-align: left;
}

.venue-image {
  width: 100%;
  height: auto;
  display: block;
}

.venue-photo-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.photo-viewer .modal-content {
  background-color: rgba(12, 10, 9, 0.96);
  border: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 0.5rem 2.5rem;
}

.photo-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.photo-viewer-close,
.photo-viewer-nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(251, 250, 248, 0.35);
  border-radius: 50%;
  background-color: rgba(28, 23, 20, 0.7);
  color: var(--ccica-white);
  font-size: 2rem;
  line-height: 1;
}

.photo-viewer-close {
  top: 0.75rem;
  right: 0.75rem;
}

.photo-viewer-nav {
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

.photo-viewer.has-many .photo-viewer-nav {
  display: flex;
}

.photo-viewer-prev {
  left: 0.5rem;
}

.photo-viewer-next {
  right: 0.5rem;
}

.photo-viewer-count {
  position: absolute;
  bottom: 0.75rem;
  margin: 0;
  color: rgba(251, 250, 248, 0.8);
  font-size: 0.95rem;
}

.venue-carousel .carousel-item {
  aspect-ratio: 4 / 5;
  background-color: var(--ccica-cream);
}

.venue-carousel .venue-image {
  height: 100%;
  object-fit: contain;
}

.venue-carousel .carousel-control-prev,
.venue-carousel .carousel-control-next {
  width: 15%;
}

.venue-carousel .carousel-control-prev-icon,
.venue-carousel .carousel-control-next-icon {
  background-color: rgba(28, 23, 20, 0.45);
  border-radius: 50%;
  background-size: 55%;
  width: 2.25rem;
  height: 2.25rem;
}

.venue-body {
  padding: 1.25rem 1.4rem 1.5rem;
}

.venue-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.venue-body p {
  color: var(--ccica-muted);
}

.venue-body > p:last-child {
  margin-bottom: 0;
}

/* ---------- Páginas internas (Clases Online, Biblioteca) ---------- */

.page-hero {
  background: linear-gradient(135deg, var(--ccica-black) 0%, var(--ccica-ink) 55%, var(--ccica-red-dark) 140%);
  color: var(--ccica-white);
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem;
}

.page-hero .section-kicker {
  color: var(--ccica-gold-light);
}

.page-hero-title {
  color: var(--ccica-white);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0;
}

.article-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.article-card-title {
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
}

.article-date {
  color: var(--ccica-muted);
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.article-inner {
  max-width: 760px;
  margin: 0 auto;
}

.article-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  margin-bottom: 1.5rem;
}

.article-image {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin-bottom: 1.75rem;
}

.rich-text > :last-child {
  margin-bottom: 0;
}

.rich-text h2 {
  font-size: 1.4rem;
  margin-top: 1.75rem;
}

.rich-text h3 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
}

.rich-text blockquote {
  border-left: 3px solid var(--ccica-gold);
  padding-left: 1rem;
  color: var(--ccica-muted);
  font-style: italic;
}

.venue-body .rich-text {
  color: var(--ccica-muted);
}

/* ---------- Contacto ---------- */

.contact-card {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.contact-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Sections ---------- */

.section-ccica {
  padding: clamp(3rem, 7vw, 5.5rem) 1.5rem;
}

.section-ccica.bg-cream {
  background-color: var(--ccica-cream);
}

.section-inner {
  max-width: 1140px;
  margin: 0 auto;
}

.section-kicker {
  color: var(--ccica-red);
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--ccica-muted);
  max-width: 640px;
  margin: 0 auto 2.5rem;
  font-size: 1.05rem;
}

.text-center .section-subtitle {
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Cards ---------- */

.card-ccica {
  border: 1px solid rgba(28, 23, 20, 0.08);
  border-top: 3px solid var(--ccica-red);
  border-radius: 0.75rem;
  background-color: var(--ccica-white);
}

a .card-ccica:hover,
.card-ccica:hover {
  box-shadow: var(--shadow-soft);
}

.discipline-card {
  padding: 2rem 1.5rem;
  height: 100%;
  text-align: center;
}

.discipline-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ccica-red), var(--ccica-red-dark));
  color: var(--ccica-white);
  font-size: 1.6rem;
}

.discipline-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.discipline-card p {
  color: var(--ccica-muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

.discipline-styles {
  list-style: none;
  text-align: left;
  padding: 0;
  margin: 0.9rem 0 0;
  border-top: 1px solid rgba(28, 23, 20, 0.08);
  padding-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--ccica-ink);
}

.discipline-styles li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.35rem;
}

.discipline-styles li:last-child {
  margin-bottom: 0;
}

.discipline-styles li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ccica-gold);
}

/* ---------- Social ---------- */

.social-icons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: rgba(28, 23, 20, 0.06);
  color: var(--ccica-red-dark);
  border: 1px solid rgba(28, 23, 20, 0.1);
  text-decoration: none;
}

.social-icons a:hover {
  background-color: var(--ccica-red);
  color: var(--ccica-white);
}

.venue-social {
  justify-content: flex-start;
  margin-top: 1rem;
}

/* ---------- Footer ---------- */

.footer-ccica {
  background-color: var(--ccica-black);
  color: rgba(251, 250, 248, 0.75);
  padding: 3rem 0 1.25rem;
  border-top: 3px solid var(--ccica-gold);
  flex-shrink: 0;
}

.footer-ccica h5 {
  color: var(--ccica-white);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.footer-ccica a {
  color: rgba(251, 250, 248, 0.75);
  text-decoration: none;
}

.footer-ccica a:hover {
  color: var(--ccica-gold-light);
}

.footer-ccica .footer-brand {
  color: var(--ccica-white);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.footer-ccica hr {
  border-color: rgba(251, 250, 248, 0.15);
  margin: 2rem 0 1.25rem;
}

.footer-ccica .footer-bottom {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(251, 250, 248, 0.55);
}

/* ---------- Formularios ---------- */

.form-label {
  font-weight: 600;
  color: var(--ccica-ink);
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  min-height: 46px;
  padding: 0.55rem 0.9rem;
  font-size: 1rem;
  border: 1px solid rgba(28, 23, 20, 0.18);
  border-radius: 0.55rem;
  background-color: var(--ccica-white);
  color: var(--ccica-ink);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ccica-gold);
  box-shadow: 0 0 0 0.2rem rgba(201, 162, 75, 0.25);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%236b6058' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
}

textarea.form-control {
  min-height: 92px;
}

/* ---------- Pestañas (panel de alumno) ---------- */

.tabs-ccica {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid rgba(28, 23, 20, 0.1);
  flex-wrap: wrap;
}

.tab-ccica {
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  color: var(--ccica-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-ccica:hover {
  color: var(--ccica-red-dark);
}

.tab-ccica.active {
  color: var(--ccica-red);
  border-bottom-color: var(--ccica-red);
}

/* ---------- Selector de actividades (alta pública) ---------- */

.activity-picker {
  border: 1px solid rgba(28, 23, 20, 0.15);
  border-radius: 0.5rem;
  padding: 0.6rem 0.9rem;
}

.activity-picker[open] {
  padding-bottom: 0.9rem;
}

.activity-picker-summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ccica-red-dark);
}

.activity-choice-card {
  display: flex;
  flex-direction: column;
  border: 2px solid rgba(28, 23, 20, 0.12);
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  background-color: var(--ccica-white);
  height: 100%;
}

.activity-choice-card:hover {
  border-color: var(--ccica-gold);
}

.activity-choice-card:has(.activity-choice-footer input:checked) {
  border-color: var(--ccica-red);
  box-shadow: 0 0 0 2px rgba(193, 41, 60, 0.15);
}

.activity-picker-grid {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.activity-choice-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.activity-choice-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ccica-cream);
  color: var(--ccica-muted);
  font-size: 0.8rem;
}

.activity-choice-footer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
}

.activity-choice-name {
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------- Badges ---------- */

.badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4em 0.7em;
}

.badge-status-active {
  background-color: #1c7c3f;
}

.badge-status-pending {
  background-color: var(--ccica-gold);
  color: var(--ccica-black);
}

.badge-status-suspended {
  background-color: var(--ccica-red);
}

.badge-status-muted {
  background-color: rgba(28, 23, 20, 0.12);
  color: var(--ccica-ink);
}

.badge-sm {
  font-size: 0.72rem;
  padding: 0.3em 0.55em;
}

/* ---------- Tablas ---------- */

.table {
  font-size: 0.95rem;
}

.table th {
  color: var(--ccica-muted);
  font-weight: 600;
  border-bottom-width: 2px;
}

/* ---------- Panel de gestión (admin) ---------- */

.tab-count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0.05rem 0.4rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background-color: var(--ccica-gold);
  color: var(--ccica-black);
  font-size: 0.75rem;
  text-align: center;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.month-nav .btn {
  min-width: 2.1rem;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.3rem 0.55rem;
}

.month-nav-label {
  min-width: 9.5rem;
  text-align: center;
  font-weight: 700;
}

.admin-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-filters .form-control,
.admin-filters .form-select {
  width: auto;
  min-width: 12rem;
  flex: 1 1 12rem;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(28, 23, 20, 0.15);
  border-radius: 999px;
  color: var(--ccica-ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  background-color: var(--ccica-white);
}

.status-chip span {
  color: var(--ccica-muted);
  font-weight: 500;
}

.status-chip:hover {
  border-color: var(--ccica-gold);
  color: var(--ccica-ink);
}

.status-chip.active {
  background-color: var(--ccica-ink);
  border-color: var(--ccica-ink);
  color: var(--ccica-white);
}

.status-chip.active span {
  color: var(--ccica-gold-light);
}

.status-chip.tone-active::before,
.status-chip.tone-pending::before,
.status-chip.tone-suspended::before,
.status-chip.tone-muted::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}

.status-chip.tone-active::before { background-color: #1c7c3f; }
.status-chip.tone-pending::before { background-color: var(--ccica-gold); }
.status-chip.tone-suspended::before { background-color: var(--ccica-red); }
.status-chip.tone-muted::before { background-color: rgba(28, 23, 20, 0.25); }

.admin-table th,
.admin-table td {
  padding: 0.65rem 0.9rem;
}

.admin-table th {
  white-space: nowrap;
}

.admin-table .row-pending > td {
  background-color: rgba(201, 162, 75, 0.1);
}

.sort-link {
  color: inherit;
  text-decoration: none;
}

.sort-link:hover,
.sort-link.active {
  color: var(--ccica-red-dark);
}

.status-select {
  width: auto;
  min-width: 14.5rem;
  font-weight: 600;
}

.status-select.tone-active {
  border-color: #1c7c3f;
  color: #1c7c3f;
  background-color: rgba(28, 124, 63, 0.07);
}

.status-select.tone-pending {
  border-color: var(--ccica-gold);
  color: #7a5c14;
  background-color: rgba(201, 162, 75, 0.12);
}

.status-select.tone-suspended {
  border-color: var(--ccica-red);
  color: var(--ccica-red-dark);
  background-color: rgba(193, 41, 60, 0.07);
}

.saved-flash {
  display: inline-block;
  color: #1c7c3f;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  animation: saved-fade 3s forwards;
}

@keyframes saved-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

.notes-cell {
  max-width: 16rem;
}

.admin-edit-link {
  color: var(--ccica-muted);
  text-decoration: none;
  font-size: 1.05rem;
}

.admin-edit-link:hover {
  color: var(--ccica-red);
}

/* ---------- Course banner ---------- */

.course-banner {
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  height: clamp(160px, 30vw, 280px);
}

.course-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Campo de contraseña con botón "ojo" ---------- */

.password-field {
  position: relative;
}

.password-field > input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  border: 0;
  background: transparent;
  color: var(--ccica-muted);
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--ccica-red);
}

/* ---------- Libros (venta del libro digital) ---------- */

.book-draft-note {
  background-color: var(--ccica-yellow);
  color: var(--ccica-black);
  text-align: center;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
}

.book-draft-note a {
  color: var(--ccica-black);
  font-weight: 600;
}

/* Tapa: la imagen cargada o una provisoria con el título. --w es el ancho. */
.book-cover {
  --w: 200px;
  position: relative;
  overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  background-color: var(--ccica-red-dark);
}

.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover.flat {
  width: var(--w);
  height: calc(var(--w) * 1.5);
  flex-shrink: 0;
  box-shadow: 0 10px 24px rgba(28, 23, 20, 0.28);
}

.book-cover-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12% 12% 14% 16%;
  color: var(--ccica-white);
  background:
    radial-gradient(120% 70% at 85% 8%, rgba(228, 197, 116, 0.2), transparent 55%),
    linear-gradient(160deg, #9c1f30 0%, #701322 58%, #4d0b16 100%);
}

.book-cover-ph::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8%;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.38), rgba(255, 255, 255, 0.1) 65%, rgba(0, 0, 0, 0.18));
}

.book-cover-ph-author {
  font-size: calc(var(--w) * 0.05);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ccica-gold-light);
  line-height: 1.3;
}

.book-cover-ph-title {
  font-size: calc(var(--w) * 0.09);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.1;
  border-top: 2px solid var(--ccica-gold);
  padding-top: 0.5em;
}

.book-3d-stage {
  perspective: 1400px;
  display: flex;
  justify-content: center;
  position: relative;
}

.book-3d {
  --w: 190px;
  --t: 20px;
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.5);
  transform-style: preserve-3d;
  transform: rotateY(-26deg) rotateX(3deg);
  flex-shrink: 0;
}

.book-3d > .book-cover {
  position: absolute;
  inset: 0;
  transform: translateZ(calc(var(--t) / 2));
}

/* Canto de las hojas. */
.book-3d::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: var(--t);
  height: calc(100% - 8px);
  transform: translateX(calc(var(--w) - var(--t) / 2 - 4px)) rotateY(90deg);
  background: repeating-linear-gradient(90deg, #fdfaf3 0 2px, #e3d9c5 2px 3px);
}

/* Contratapa (y sombra). */
.book-3d::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateZ(calc(var(--t) / -2));
  background: linear-gradient(90deg, #e3d9c5, #fdfaf3 92%, #6e1220 92%);
  border-radius: 2px 5px 5px 2px;
  box-shadow: -22px 18px 44px rgba(0, 0, 0, 0.45);
}

.book-hero {
  position: relative;
  overflow: hidden;
  color: var(--ccica-white);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, var(--ccica-black) 0%, var(--ccica-ink) 50%, var(--ccica-red-dark) 135%);
  background-size: 24px 24px, cover;
  padding: clamp(2rem, 5vw, 4rem) 1.5rem clamp(2.5rem, 6vw, 4.5rem);
}

.book-hero-grid {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.book-hero-grid > * {
  min-width: 0;
}

.book-hero .book-3d-stage {
  padding: 0.5rem 1.5rem 1.5rem;
}

.book-hero .book-3d-stage::before {
  content: "";
  position: absolute;
  inset: -10% 0;
  background: radial-gradient(closest-side, rgba(201, 162, 75, 0.28), transparent 75%);
}

.book-hero .section-kicker {
  color: var(--ccica-gold-light);
}

.book-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(251, 250, 248, 0.62);
  margin-bottom: 1.25rem;
}

.book-crumbs a {
  color: rgba(251, 250, 248, 0.85);
  text-decoration: none;
}

.book-crumbs a:hover {
  color: var(--ccica-gold-light);
}

.book-title {
  color: var(--ccica-white);
  font-size: clamp(2rem, 4.8vw, 3.1rem);
  font-weight: 800;
  line-height: 1.08;
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

.book-byline {
  color: rgba(251, 250, 248, 0.85);
  margin-bottom: 1.25rem;
}

.book-byline strong {
  color: var(--ccica-gold-light);
  font-weight: 600;
}

.book-lead {
  color: rgba(251, 250, 248, 0.85);
  max-width: 36em;
  font-size: 1.08rem;
  margin-bottom: 1.75rem;
}

.book-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin-bottom: 1rem;
}

.book-price {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.book-price-note {
  color: rgba(251, 250, 248, 0.62);
  font-size: 0.95rem;
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.book-transfer-note {
  color: rgba(251, 250, 248, 0.85);
  font-size: 0.95rem;
  margin: 1rem 0 1.25rem;
}

.book-transfer-note strong {
  color: var(--ccica-white);
}

.book-pay-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.book-pay-chips li {
  font-size: 0.8rem;
  color: rgba(251, 250, 248, 0.85);
  border: 1px solid rgba(201, 162, 75, 0.4);
  border-radius: 999px;
  padding: 3px 12px;
}

.book-soon {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ccica-gold-light);
}

@media (min-width: 992px) {
  .book-hero-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: 3rem;
  }

  .book-hero .book-3d {
    --w: 250px;
    --t: 22px;
  }
}

.book-facts {
  background-color: var(--ccica-cream);
  border-bottom: 1px solid rgba(28, 23, 20, 0.1);
  padding: 0 1.5rem;
}

.book-facts dl {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
  padding: 1.6rem 0;
}

.book-facts dt {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ccica-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.book-facts dd {
  margin: 0;
  font-weight: 600;
  color: var(--ccica-black);
  line-height: 1.35;
}

@media (min-width: 576px) {
  .book-facts dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 992px) {
  .book-facts dl {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.book-main-grid {
  display: grid;
  gap: 3rem;
}

.book-main-grid > * {
  min-width: 0;
}

.book-prose {
  max-width: 40em;
}

.book-toc {
  border: 1px solid rgba(28, 23, 20, 0.1);
  border-radius: 0.75rem;
  background-color: rgba(245, 239, 228, 0.5);
  padding: 1.25rem 1.4rem;
  margin-top: 1rem;
}

.book-buy-card {
  display: none;
  align-self: start;
  position: sticky;
  top: 96px;
  background-color: #ffffff;
  border: 1px solid rgba(28, 23, 20, 0.08);
  border-top: 3px solid var(--ccica-red);
  border-radius: 0.75rem;
  padding: 1.4rem;
  box-shadow: var(--shadow-soft);
}

.book-buy-card-head {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.1rem;
}

.book-buy-card-head h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.book-buy-card-head p {
  font-size: 0.85rem;
  color: var(--ccica-muted);
  margin: 0;
}

.book-buy-card .book-price {
  display: block;
  color: var(--ccica-black);
  font-size: 1.8rem;
  margin-bottom: 0.9rem;
}

.book-buy-card ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--ccica-muted);
  display: grid;
  gap: 6px;
}

.book-buy-card li::before {
  content: "✓";
  color: var(--ccica-red);
  font-weight: 700;
  margin-right: 8px;
}

@media (min-width: 992px) {
  .book-main-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 4rem;
  }

  .book-buy-card {
    display: block;
  }
}

.book-author-grid {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  align-items: start;
}

.book-author-grid > * {
  min-width: 0;
}

.book-author-photo {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 1px solid rgba(201, 162, 75, 0.5);
}

.book-author-name {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
}

.book-tags-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ccica-muted);
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.book-tags {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.book-tags li {
  background-color: #ffffff;
  border: 1px solid rgba(28, 23, 20, 0.1);
  border-radius: 0.5rem;
  padding: 0.5rem 0.9rem;
  line-height: 1.3;
}

.book-tags strong {
  display: block;
  font-weight: 600;
  color: var(--ccica-black);
  font-size: 0.95rem;
}

.book-tags span {
  font-size: 0.8rem;
  color: var(--ccica-muted);
}

.book-tags li.is-more {
  display: flex;
  align-items: center;
  background-color: transparent;
  border-style: dashed;
  border-color: rgba(107, 96, 88, 0.45);
  color: var(--ccica-muted);
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .book-author-grid.has-photo {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 3rem;
  }
}

.book-steps {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  gap: 1.5rem;
}

.book-steps li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 1rem;
  align-items: start;
}

.book-step-n {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--ccica-gold);
  color: var(--ccica-red-dark);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.book-steps h3 {
  font-size: 1.1rem;
  margin: 0.4rem 0 0.35rem;
}

.book-steps p {
  color: var(--ccica-muted);
  margin: 0;
}

@media (min-width: 768px) {
  .book-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
  }
}

.book-faq {
  max-width: 46em;
  margin-top: 1.5rem;
}

.book-faq details {
  border-bottom: 1px solid rgba(28, 23, 20, 0.1);
}

.book-faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 2rem 1rem 0;
  font-weight: 600;
  color: var(--ccica-black);
  position: relative;
}

.book-faq summary::-webkit-details-marker {
  display: none;
}

.book-faq summary::after {
  content: "+";
  position: absolute;
  right: 0.25rem;
  top: 0.85rem;
  font-size: 1.3rem;
  color: var(--ccica-red);
  font-weight: 500;
}

.book-faq details[open] summary::after {
  content: "−";
}

.book-faq details p {
  color: var(--ccica-muted);
  padding-right: 2rem;
}

.book-cta {
  background: linear-gradient(135deg, var(--ccica-black) 0%, var(--ccica-ink) 55%, var(--ccica-red-dark) 150%);
  color: var(--ccica-white);
  padding: 2.5rem 1.5rem;
}

.book-cta-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
}

.book-cta h2 {
  color: var(--ccica-white);
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  margin-bottom: 0.3rem;
}

.book-cta p {
  color: rgba(251, 250, 248, 0.62);
  margin: 0;
  font-size: 0.95rem;
}

.book-cta-action {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
}

@media (min-width: 768px) {
  .book-cta-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 2rem;
  }

  .book-cta-action {
    grid-column: auto;
  }
}

.book-buybar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1020;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: #ffffff;
  border-top: 1px solid rgba(28, 23, 20, 0.1);
  box-shadow: 0 -8px 24px rgba(28, 23, 20, 0.12);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

.book-buybar strong {
  display: block;
  font-size: 1.2rem;
  color: var(--ccica-black);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.book-buybar span {
  font-size: 0.8rem;
  color: var(--ccica-muted);
}

@media (max-width: 991.98px) {
  .book-buybar {
    display: flex;
  }

  body:has(.book-buybar) {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* Tarjeta destacada en la Biblioteca. */
.book-featured {
  display: grid;
  gap: 1.5rem;
  text-decoration: none;
  color: var(--ccica-white);
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(120deg, var(--ccica-black) 0%, var(--ccica-ink) 60%, #3a1118 100%);
  background-size: 20px 20px, cover;
  border-top: 3px solid var(--ccica-gold);
  border-radius: 0.75rem;
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.book-featured:hover {
  color: var(--ccica-white);
  box-shadow: var(--shadow-lift);
}

.book-featured:hover .btn-ccica {
  background-color: var(--ccica-red-dark);
  color: var(--ccica-gold-light);
}

.book-featured .book-3d-stage {
  padding: 0.5rem 1rem;
}

.book-featured .book-3d {
  --w: 140px;
  --t: 14px;
}

.book-featured .section-kicker {
  color: var(--ccica-gold-light);
}

.book-featured h2 {
  color: var(--ccica-white);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin-bottom: 0.3rem;
}

.book-featured-author {
  color: var(--ccica-gold-light);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}

.book-featured-summary {
  color: rgba(251, 250, 248, 0.85);
  max-width: 34em;
}

.book-featured-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: 0.5rem;
}

.book-featured .book-price {
  font-size: 1.6rem;
}

@media (min-width: 768px) {
  .book-featured {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: center;
    padding: 2rem 2.25rem;
  }
}

.book-list-title {
  font-size: 1.3rem;
  margin: 3rem 0 1.25rem;
}

/* Compra, pedido, descarga y gestión: una tarjeta centrada. */
.book-panel {
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2rem);
}

.book-panel h1 {
  font-size: 1.45rem;
}

.book-panel-book {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0.9rem;
  background-color: var(--ccica-cream);
  border-radius: 0.6rem;
  margin-bottom: 1.25rem;
}

.book-panel-book > div {
  min-width: 0;
}

.book-panel-book-title {
  display: block;
  color: var(--ccica-black);
  line-height: 1.3;
}

.book-panel-book-meta {
  font-size: 0.85rem;
  color: var(--ccica-muted);
}

.book-pay-opts {
  display: grid;
  gap: 10px;
  margin: 0.4rem 0 1.25rem;
}

.book-pay-opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  border: 1px solid rgba(28, 23, 20, 0.18);
  border-radius: 0.6rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.book-pay-opt:has(input:checked) {
  border-color: var(--ccica-red);
  background-color: #fdf5f5;
  box-shadow: 0 0 0 1px var(--ccica-red);
}

.book-pay-opt input {
  accent-color: var(--ccica-red);
  width: 18px;
  height: 18px;
  margin: 0;
  grid-row: span 2;
}

.book-pay-opt-name {
  font-weight: 600;
  color: var(--ccica-black);
}

.book-pay-opt-amount {
  grid-row: span 2;
  font-weight: 700;
  color: var(--ccica-black);
  font-variant-numeric: tabular-nums;
}

.book-pay-opt small {
  color: var(--ccica-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.book-status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  background-color: var(--ccica-cream);
  color: var(--ccica-red-dark);
}

.book-status-icon.is-ok {
  background-color: #e9f4ec;
  color: #2e7d4a;
}

.book-transfer-box {
  background-color: var(--ccica-cream);
  border-radius: 0.6rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
}

.book-transfer-box code {
  font-size: 1.05rem;
  color: var(--ccica-black);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.book-manage-table th {
  color: var(--ccica-muted);
  font-weight: 500;
  width: 38%;
}

/* ---------- Misc ---------- */

