:root {
  --bg-primary: #FBF5EE;
  --bg-surface: #F3E7D8;
  --text-primary: #2C1608;
  --text-muted: #5E3419;
  --accent-primary: #9E1B24;
  --gold-leaf: #C59B27;
  --border-cocoa: #CBB292;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.62;
  overflow-x: clip;
  position: relative;
}

#cocoa-particles-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

h1, h2, h3, h4, .maison-name {
  font-family: 'Playfair Display', Georgia, serif;
  margin-top: 0;
}

.maison-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2.6rem);
  background: rgba(251, 245, 238, 0.95);
  border-bottom: 2px solid var(--gold-leaf);
  backdrop-filter: blur(8px);
}

.maison-emblem {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.wax-seal-mini {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid var(--gold-leaf);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
}

.maison-sub {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--accent-primary);
  font-weight: 700;
}

.maison-name {
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
}

.maison-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.maison-link {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-cocoa);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s;
}

.maison-link:hover,
.maison-link:focus-visible {
  background: var(--bg-surface);
  transform: translateY(-2px);
}

.mobile-toggle {
  display: none;
}

/* Botones con forma de tabletas de chocolate */
.tablet-btn {
  appearance: none;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.68rem 1.15rem;
  min-height: 45px;
  border-radius: 6px;
  border: 2px solid #4A2511;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.24), 0 3px 0 #2C1608;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.16s;
}

.tablet-btn:hover {
  transform: translateY(-2px);
}

.tablet-btn:active {
  transform: translateY(1px);
}

.tablet-btn:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
}

.tablet-cherry {
  background: var(--accent-primary);
  color: #FBF5EE;
  border-color: #6B1117;
}

.tablet-cocoa {
  background: var(--text-primary);
  color: #FBF5EE;
}

.tablet-gold {
  background: var(--gold-leaf);
  color: #2C1608;
  border-color: #8E6E16;
}

.tablet-outline {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.maison-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2.4rem) clamp(1rem, 2.5vw, 2rem) 2rem;
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
}

/* Fichas de recetario con esquinas recortadas */
.bevel-card {
  background: rgba(255, 252, 247, 0.94);
  border: 2px solid var(--gold-leaf);
  padding: clamp(1.25rem, 2.8vw, 2.1rem);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  box-shadow: 0 14px 32px rgba(44, 22, 8, 0.09);
  position: relative;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1), transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-editorial-split {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 1.8rem;
  align-items: center;
}

.wax-seal-pill {
  display: inline-block;
  background: var(--accent-primary);
  color: #FBF5EE;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.hero-editorial-text h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.85rem);
  line-height: 1.15;
  margin-bottom: 0.8rem;
}

.editorial-intro {
  color: var(--text-muted);
  font-size: 1.06rem;
  margin-bottom: 1.15rem;
}

.batch-ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.ledger-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-cocoa);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
}

.ledger-cell span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  font-weight: 700;
}

.tablet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.editorial-plate {
  margin: 0;
  background: var(--bg-surface);
  padding: 0.65rem;
  border: 1px solid var(--border-cocoa);
  border-radius: 12px;
}

.editorial-plate img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

.editorial-plate figcaption {
  font-size: 0.84rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
  text-align: center;
}

/* Teoría literal */
.editorial-heading-row {
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-cocoa);
  padding-bottom: 0.65rem;
}

.chapter-ribbon {
  display: inline-block;
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

.literal-lead {
  background: var(--bg-surface);
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--gold-leaf);
  border-radius: 6px;
}

.recipe-two-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin: 1.1rem 0;
}

.parchment-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-cocoa);
  border-radius: 10px;
  padding: 1.05rem;
}

.clean-ledger-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.clean-ledger-list li {
  background: var(--bg-surface);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  font-size: 0.94rem;
}

.seal-approval-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  background: var(--bg-surface);
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--gold-leaf);
}

/* Mosaico 2x2 de los 4 juegos */
.batch-games-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.4rem;
}

.station-recipe-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.seal-corner {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-leaf);
  color: var(--text-primary);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.card-desc {
  color: var(--text-muted);
  font-size: 0.94rem;
  margin: 0;
}

.status-banner {
  background: var(--text-primary);
  color: #FBF5EE;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

.dosage-controls {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dosage-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent-primary);
}

.changeover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem;
}

.trays-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.tray-chip {
  background: var(--bg-surface);
  border: 2px solid var(--border-cocoa);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  min-height: 46px;
}

.tray-chip.selected {
  border-color: var(--accent-primary);
  background: #FDE8E9;
}

.molds-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.mold-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-cocoa);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mini-feedback {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin: 0;
}

.card-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: auto;
}

/* Cámara Chef horizontal PC / vertical móvil sin distorsión */
.compact-ledger {
  margin-top: 0.9rem;
}

.cacao-cam-frame {
  width: 100%;
  max-width: 860px;
  margin: 0.9rem auto 0;
  aspect-ratio: 16 / 9;
  background: #2C1608;
  border: 3px solid var(--gold-leaf);
  border-radius: 14px;
  overflow: hidden;
}

.cacao-cam-frame.portrait-cam {
  max-width: 420px;
  aspect-ratio: 3 / 4;
}

#cacao-cam-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.seals-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 1.2rem;
}

.batch-seal {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-cocoa);
  font-weight: 700;
  font-size: 0.86rem;
}

.batch-seal.earned {
  background: var(--accent-primary);
  color: #FBF5EE;
  border-color: var(--gold-leaf);
}

/* Ondas SVG de chocolate fundido */
.melted-chocolate-waves {
  width: 100%;
  height: 95px;
  overflow: hidden;
  line-height: 0;
}

.melted-chocolate-waves svg {
  width: 115%;
  height: 100%;
  animation: waveSlide 9s ease-in-out infinite alternate;
}

.wave-back { fill: #5E3419; }
.wave-front { fill: #2C1608; }

@keyframes waveSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-8%); }
}

.maison-footer {
  background: #2C1608;
  color: #FBF5EE;
  text-align: center;
  padding: 1.4rem 1rem 2rem;
  font-size: 0.92rem;
}

.maison-dialog {
  max-width: 580px;
  width: calc(100% - 2rem);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 3px solid var(--gold-leaf);
  border-radius: 14px;
  padding: 1.5rem;
}

.maison-dialog::backdrop {
  background: rgba(44, 22, 8, 0.72);
}

@media (max-width: 900px) {
  .hero-editorial-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .mobile-toggle {
    display: inline-flex;
  }
  .maison-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .maison-nav.open {
    display: flex;
  }
  .trays-grid {
    grid-template-columns: 1fr;
  }
  .cacao-cam-frame {
    max-width: 410px;
    aspect-ratio: 3 / 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
