/* iAparts · temas compartidos oscuro/claro (móvil y escritorio) */

:root {
  color-scheme: dark;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1ec;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-soft: #faf8f4;
  --border-soft: #d9dce2;
  --text-main: #111827;
  --text-muted: #5f6875;
  --primary-soft: rgba(194, 106, 16, 0.14);
  --shadow-soft: 0 20px 55px rgba(45, 37, 28, 0.12);
}

html[data-theme="light"] body {
  background: #f4f1ec !important;
  color: var(--text-main, #111827);
}

html[data-theme="light"] .topbar-shell {
  background: linear-gradient(
    to bottom,
    rgba(244, 241, 236, 0.98),
    rgba(244, 241, 236, 0.93),
    rgba(244, 241, 236, 0.78),
    transparent
  ) !important;
  border-bottom-color: rgba(17, 24, 39, 0.08) !important;
}

html[data-theme="light"] :is(.contact-card, .summary-card, .info-card, .cta-register-card, .location-card, .desktop-card) {
  background: linear-gradient(145deg, #ffffff, #f8f5f0) !important;
  border-color: rgba(17, 24, 39, 0.12) !important;
  color: #111827;
  box-shadow: 0 16px 42px rgba(45, 37, 28, 0.08);
}

html[data-theme="light"] :is(.contact-meta, .summary-text, .summary-meta, .info-text, .info-list, .info-note, .location-list, .desktop-card p) {
  color: #5f6875 !important;
}

html[data-theme="light"] :is(.summary-pill, .chip, .filter, .filter-button) {
  border-color: rgba(17, 24, 39, 0.16) !important;
}

html[data-theme="light"] :is(.gallery-item, .map-figure, .card) {
  border-color: rgba(17, 24, 39, 0.12) !important;
}

html[data-theme="light"] :is(.btn-chip:not(.phone), .back-home-btn, .summary-pill) {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #111827 !important;
}

html[data-theme="light"] .footer {
  color: #687180;
}

html[data-theme="light"] .footer strong {
  color: #293241;
}

/* La fotografía y el mapa conservan capas oscuras para que sus textos sigan legibles. */
html[data-theme="light"] :is(.hero-main, .hero-card, .hero-main-content, .hero-content) {
  color: #f8fafc;
}

/* Guía de delivery, diseñada originalmente solo en claro. */
html[data-theme="dark"] body.theme-delivery {
  --ink: #f5f5f7;
  --paper: #07090c;
  --cream: #11151b;
  --muted: #a5adb8;
  --line: rgba(255, 255, 255, 0.14);
  background: #07090c !important;
  color: #f5f5f7;
}

html[data-theme="dark"] body.theme-delivery .hero {
  background: #11151b !important;
  color: #f5f5f7 !important;
}

html[data-theme="dark"] body.theme-delivery .hero :is(h1, .hero-note strong) {
  color: #f5f5f7 !important;
}

html[data-theme="dark"] body.theme-delivery :is(.search, .card) {
  background: #11151b;
  color: #f5f5f7;
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 15px 42px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] body.theme-delivery :is(.filter, .channel, .action) {
  border-color: rgba(255, 255, 255, 0.15);
}

html[data-theme="dark"] body.theme-delivery :is(.channel, .action:not(.whatsapp):not(.wide)) {
  background: #171c23;
  color: #eef2f7;
}

html[data-theme="dark"] body.theme-delivery .action.wide {
  background: #050608;
  color: #ffffff;
}

html[data-theme="dark"] body.theme-delivery :is(.filter:hover, .filter.active) {
  background: #f5f5f7;
  color: #11151b;
  border-color: #f5f5f7;
}

html[data-theme="dark"] body.theme-delivery .legend {
  background: #15191f;
  color: #f5f5f7;
}

html[data-theme="dark"] body.theme-delivery .legend p {
  color: #a5adb8;
}

html[data-theme="dark"] body.theme-delivery .brand-mark {
  background: #f5f5f7;
  color: #11151b;
}

/* Guía gastronómica de Chillán, diseñada originalmente solo en claro. */
html[data-theme="dark"] body.theme-chillan-food {
  --ink: #f4f5f7;
  --muted: #a6aeba;
  --paper: #07090c;
  --card: #11151b;
  --line: rgba(255, 255, 255, 0.14);
  --orange-soft: rgba(242, 122, 25, 0.14);
  --shadow: 0 20px 58px rgba(0, 0, 0, 0.34);
  background: #07090c !important;
  color: #f4f5f7;
}

html[data-theme="dark"] body.theme-chillan-food .site-header {
  background: rgba(7, 9, 12, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] body.theme-chillan-food :is(.back-link, .language-picker, .discovery-bar, .restaurant-card, .uber-note) {
  background: #11151b;
  color: #f4f5f7;
  border-color: rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] body.theme-chillan-food :is(.search-field, .filter-button) {
  background: #171c23;
  color: #eef2f7;
  border-color: rgba(255, 255, 255, 0.13);
}

html[data-theme="dark"] body.theme-chillan-food input {
  color: #f4f5f7;
}

html[data-theme="dark"] body.theme-chillan-food input::placeholder {
  color: #8f98a5;
}

html[data-theme="dark"] body.theme-chillan-food :is(.brand img, .footer-brand img) {
  filter: invert(1) brightness(1.35);
}

html[data-theme="dark"] body.theme-chillan-food .button-light {
  background: #f4f5f7;
  color: #11151b !important;
  border-color: #f4f5f7;
}

html[data-theme="dark"] body.theme-chillan-food .button-ghost {
  background: rgba(7, 9, 12, 0.34);
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.46);
}

/* Guía editorial oscura de Rancagua: tema claro equivalente. */
html[data-theme="light"] body.theme-rancagua-food {
  --ink: #211913;
  --muted: #6e6257;
  --line: rgba(33, 25, 19, 0.14);
  --panel: #ffffff;
  --bg: #f5f0e8;
  background: #f5f0e8 !important;
  color: #211913;
}

html[data-theme="light"] body.theme-rancagua-food .top {
  background: rgba(245, 240, 232, 0.9);
}

html[data-theme="light"] body.theme-rancagua-food :is(.card, .note, .occasion-item, .flavour, .route) {
  background: #ffffff !important;
  color: #211913;
  border-color: rgba(33, 25, 19, 0.14) !important;
}

html[data-theme="light"] body.theme-rancagua-food :is(.chip, .card p, .note, .occasion-item p, .route p, details p) {
  color: #6e6257;
}

html[data-theme="light"] body.theme-rancagua-food .card-actions .uber {
  border-color: #211913;
  color: #211913;
}

/* Controles editoriales e inputs en el tema claro general. */
html[data-theme="light"] body.page-guide:not(.theme-rancagua-food) :is(.topbar, .site-header) {
  color: #111827;
}

html[data-theme="light"] body.page-guide:not(.theme-rancagua-food) :is(input, select) {
  color: #111827;
}

/* Selector compartido. */
.iaparts-theme-toggle-global {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.46);
  background: rgba(15, 23, 42, 0.82);
  color: #f8fafc;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  font: 18px/1 system-ui, sans-serif;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.iaparts-theme-toggle-global:hover,
.iaparts-theme-toggle-global:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(245, 132, 18, 0.78);
  outline: none;
}

.iaparts-theme-toggle-global.is-floating {
  position: fixed;
  left: 18px;
  bottom: 20px;
  z-index: 9998;
}

html[data-theme="light"] .iaparts-theme-toggle-global {
  background: rgba(255, 255, 255, 0.94);
  color: #18202b;
  border-color: rgba(17, 24, 39, 0.17);
  box-shadow: 0 8px 24px rgba(45, 37, 28, 0.14);
}

@media (max-width: 620px) {
  .iaparts-theme-toggle-global {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 16px;
  }

  .iaparts-theme-toggle-global.is-floating {
    left: 12px;
    bottom: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .iaparts-theme-toggle-global {
    transition: none;
  }
}
