/* ==========================================================================
   TONO'S - DAY / NIGHT THEME EXPERIMENT
   Isolated visual layer for branch "dianoche".
   ========================================================================== */

:root {
  color-scheme: dark;
  --theme-focus: rgba(226, 232, 240, 0.42);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #f3f0ea;
  --bg-secondary: #eae6df;
  --bg-card: #faf8f4;
  --bg-card-hover: #f0ece5;

  --silver-bright: #20262c;
  --silver-light: #303940;
  --silver-medium: #4c5862;
  --silver-muted: #68737c;
  --silver-dark: #7b858d;
  --silver-border: rgba(32, 38, 44, 0.14);
  --silver-glow: rgba(32, 38, 44, 0.06);

  --silver-gradient: linear-gradient(135deg, #ffffff 0%, #e8e4dd 55%, #d2ccc3 100%);
  --metallic-border: linear-gradient(135deg, rgba(32, 38, 44, 0.18) 0%, rgba(32, 38, 44, 0.06) 100%);
  --theme-focus: rgba(47, 56, 64, 0.32);
}

html,
body {
  background: var(--bg-primary);
}

body {
  color: var(--silver-light);
}

html.theme-ready body,
html.theme-ready .navbar,
html.theme-ready .top-bar,
html.theme-ready .product-card,
html.theme-ready .lookbook-card,
html.theme-ready .store-card,
html.theme-ready .marroquineria-card,
html.theme-ready .modal-card,
html.theme-ready .cookie-banner,
html.theme-ready .cookie-panel {
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

/* Compact navigation utilities */
.nav-actions {
  gap: 10px;
}

/* Desktop theme control: one icon, with the full choice hidden in a popover. */
.theme-menu {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.theme-menu__trigger {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--silver-medium);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.theme-menu__trigger:hover {
  color: var(--silver-bright);
  border-color: var(--silver-border);
  background: rgba(255, 255, 255, 0.05);
}

.theme-menu__trigger:focus-visible {
  outline: none;
  border-color: var(--silver-medium);
  box-shadow: 0 0 0 3px var(--theme-focus);
}

.theme-menu__popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1200;
  min-width: 148px;
  padding: 6px;
  border: 1px solid var(--silver-border);
  border-radius: 10px;
  background: rgba(22, 25, 32, 0.98);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.theme-menu__popover[hidden] {
  display: none;
}

.theme-menu__option {
  width: 100%;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--silver-light);
  font: inherit;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.theme-menu__option:hover,
.theme-menu__option:focus-visible {
  outline: none;
  background: rgba(226, 232, 240, 0.07);
  color: var(--silver-bright);
}

.theme-menu__check {
  width: 14px;
  flex: 0 0 14px;
  opacity: 0;
  color: var(--silver-medium);
}

.theme-menu__option.is-active .theme-menu__check {
  opacity: 1;
}

/* Mobile keeps the explicit selector inside the drawer. */
.theme-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  color: var(--silver-medium);
}

.theme-picker__select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.theme-picker__select-wrap::after {
  content: '⌄';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-58%);
  color: var(--silver-dark);
  font-size: 0.75rem;
  pointer-events: none;
}

.theme-picker select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 112px;
  height: 36px;
  padding: 0 25px 0 10px;
  border: 1px solid var(--silver-border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--silver-light);
  font: inherit;
  font-size: 0.76rem;
  line-height: 1;
  cursor: pointer;
  outline: none;
}

.theme-picker select:hover {
  border-color: var(--silver-medium);
}

.theme-picker select:focus-visible {
  border-color: var(--silver-medium);
  box-shadow: 0 0 0 3px var(--theme-focus);
}

.theme-picker--mobile {
  display: none;
}

.drawer-theme-row {
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--silver-border);
}

.drawer-theme-label {
  font-size: 0.9rem;
  color: var(--silver-muted);
}

/* Light mode: navigation and general surfaces */
html[data-theme="light"] .top-bar {
  background: #e7e2da;
  color: #626c74;
  border-bottom-color: rgba(32, 38, 44, 0.1);
}

html[data-theme="light"] .top-bar-link {
  color: #38424a;
}

html[data-theme="light"] .top-bar-link:hover {
  color: #161b20;
}

html[data-theme="light"] .navbar {
  background: rgba(248, 246, 242, 0.92);
  border-color: rgba(32, 38, 44, 0.13);
  box-shadow: 0 8px 26px rgba(45, 39, 31, 0.1);
}

html[data-theme="light"] .navbar.scrolled {
  background: rgba(248, 246, 242, 0.97) !important;
  box-shadow: 0 4px 18px rgba(45, 39, 31, 0.12) !important;
}

html[data-theme="light"] .nav-dropdown {
  background: rgba(250, 248, 244, 0.97);
  border-color: rgba(32, 38, 44, 0.12);
  box-shadow: 0 14px 34px rgba(45, 39, 31, 0.14);
}

html[data-theme="light"] .dropdown-link:hover {
  background: rgba(32, 38, 44, 0.055);
}

html[data-theme="light"] .search-box input,
html[data-theme="light"] .theme-picker select {
  background: rgba(255, 255, 255, 0.62);
}

html[data-theme="light"] .search-box input:focus {
  background: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .theme-menu__trigger:hover {
  background: rgba(32, 38, 44, 0.045);
}

html[data-theme="light"] .theme-menu__popover {
  background: rgba(250, 248, 244, 0.98);
  border-color: rgba(32, 38, 44, 0.12);
  box-shadow: 0 14px 32px rgba(45, 39, 31, 0.14);
}

html[data-theme="light"] .theme-menu__option {
  color: var(--silver-light);
}

html[data-theme="light"] .theme-menu__option:hover,
html[data-theme="light"] .theme-menu__option:focus-visible {
  background: rgba(32, 38, 44, 0.055);
  color: var(--silver-bright);
}

html[data-theme="light"] .mobile-drawer {
  background: #f5f2ec;
  box-shadow: -14px 0 34px rgba(45, 39, 31, 0.12);
}

html[data-theme="light"] .mobile-toggle {
  background: rgba(32, 38, 44, 0.035);
}

html[data-theme="light"] .logo-icon {
  filter: drop-shadow(0 2px 4px rgba(31, 36, 41, 0.1));
}

html[data-theme="light"] .logo-icon circle {
  stroke: #626c74;
}

html[data-theme="light"] .logo-icon > path,
html[data-theme="light"] .logo-icon g path {
  fill: #343c43;
}

/* Buttons stay understated in both modes. */
html[data-theme="light"] .btn-silver-solid {
  color: #20262c;
  box-shadow: 0 4px 12px rgba(45, 39, 31, 0.1);
}

html[data-theme="light"] .btn-silver-solid:hover {
  box-shadow: 0 6px 18px rgba(45, 39, 31, 0.16);
  filter: none;
}

html[data-theme="light"] .btn-silver-outline {
  color: #303940;
  border-color: #68737c;
}

html[data-theme="light"] .btn-silver-outline:hover {
  background: rgba(32, 38, 44, 0.06);
  color: #171c21;
  border-color: #303940;
}

/* Keep photographic hero areas cinematic while softening the transition into daylight. */
html[data-theme="light"] .hero-section {
  --silver-bright: #f8fafc;
  --silver-light: #e7edf2;
  --silver-medium: #d3dce4;
  --silver-muted: #b8c3cc;
  --silver-dark: #9eabb6;
  --silver-border: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] .hero-overlay {
  background: linear-gradient(
    180deg,
    rgba(17, 20, 24, 0.28) 0%,
    rgba(17, 20, 24, 0.58) 72%,
    rgba(243, 240, 234, 0.96) 100%
  );
}

html[data-theme="light"] .hero-tag {
  background: rgba(18, 22, 26, 0.46);
}

html[data-theme="light"] .hero-description {
  color: #e1e7ec;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.22);
}

html[data-theme="light"] .hero-section .btn-glass {
  color: #f7f9fb;
  background: rgba(18, 22, 26, 0.34);
  border-color: rgba(255, 255, 255, 0.32);
}

html[data-theme="light"] .scroll-indicator {
  color: #515b63;
}

/* Content surfaces */
html[data-theme="light"] .feature-item:hover,
html[data-theme="light"] .filter-buttons {
  background: rgba(32, 38, 44, 0.035);
}

html[data-theme="light"] .feature-icon {
  background: rgba(32, 38, 44, 0.035);
}

html[data-theme="light"] .feature-icon svg {
  stroke: #56616a;
}

html[data-theme="light"] .filter-btn.active {
  box-shadow: 0 2px 7px rgba(45, 39, 31, 0.12);
}

html[data-theme="light"] .product-card:hover,
html[data-theme="light"] .store-card:hover,
html[data-theme="light"] .store-card.active {
  box-shadow: 0 10px 26px rgba(45, 39, 31, 0.13);
}

html[data-theme="light"] .product-img-box {
  background: #ebe7df;
}

html[data-theme="light"] .product-meta-row,
html[data-theme="light"] .store-actions,
html[data-theme="light"] .footer-bottom {
  border-color: rgba(32, 38, 44, 0.09);
}

html[data-theme="light"] .item-tag,
html[data-theme="light"] .store-badge {
  background: rgba(32, 38, 44, 0.045);
}

/* Image overlays retain dark contrast only where they sit directly on product photography. */
html[data-theme="light"] .product-badge,
html[data-theme="light"] .lookbook-badge,
html[data-theme="light"] .product-stock-overlay,
html[data-theme="light"] .product-detail-tag,
html[data-theme="light"] .product-image-color {
  --silver-bright: #f8fafc;
  --silver-light: #e2e8f0;
  --silver-medium: #cbd5e1;
  --silver-muted: #94a3b8;
  --silver-border: rgba(226, 232, 240, 0.18);
}

/* Advertisement: brighter photography with a lighter, still-readable overlay. */
html[data-theme="light"] .advertisement-card {
  --silver-bright: #f8fafc;
  --silver-light: #e7edf2;
  --silver-medium: #d4dce3;
  --silver-muted: #bec8d0;
  --silver-border: rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 34px rgba(45, 39, 31, 0.13);
}

html[data-theme="light"] .advertisement-background {
  filter: brightness(1.14) contrast(0.96) saturate(0.98);
}

html[data-theme="light"] .advertisement-overlay {
  background: linear-gradient(
    180deg,
    rgba(14, 16, 20, 0.10) 0%,
    rgba(14, 16, 20, 0.38) 100%
  );
}

html[data-theme="light"] .advertisement-content {
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.20);
}

/* Philosophy: genuinely light in day mode, while keeping the background photo visible. */
html[data-theme="light"] .craftsmanship-bg img {
  filter: brightness(0.86) contrast(0.98) saturate(0.96);
}

html[data-theme="light"] .craftsmanship-overlay {
  background: linear-gradient(
    90deg,
    rgba(243, 240, 234, 0.48) 0%,
    rgba(243, 240, 234, 0.20) 100%
  );
}

html[data-theme="light"] .craftsmanship-card {
  background: rgba(250, 248, 244, 0.86);
  border-color: rgba(32, 38, 44, 0.12);
  box-shadow: 0 14px 34px rgba(45, 39, 31, 0.13);
}

/* Store preview: remove the night treatment from both image and overlay card. */
html[data-theme="light"] .store-map-box {
  background: #ebe7df;
  box-shadow: 0 12px 30px rgba(45, 39, 31, 0.10);
}

html[data-theme="light"] .store-map-img {
  filter: brightness(1.06) contrast(0.96) saturate(0.98);
}

html[data-theme="light"] .map-overlay-card {
  background: rgba(250, 248, 244, 0.88);
  border-color: rgba(32, 38, 44, 0.14);
  box-shadow: 0 10px 26px rgba(45, 39, 31, 0.14);
}

html[data-theme="light"] .map-overlay-card h4 {
  color: var(--silver-bright);
}

html[data-theme="light"] .map-overlay-card p {
  color: var(--silver-muted);
}

/* Modal and form surfaces */
html[data-theme="light"] .modal-overlay {
  background: rgba(39, 43, 47, 0.44);
}

html[data-theme="light"] .modal-card {
  box-shadow: 0 22px 52px rgba(45, 39, 31, 0.2);
}

html[data-theme="light"] .form-control {
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="light"] .form-control:focus {
  background: #ffffff;
}

html[data-theme="light"] .modal-close:hover,
html[data-theme="light"] .cookie-close:hover,
html[data-theme="light"] .back-link:hover,
html[data-theme="light"] .sitemap-card a:hover {
  color: #171c21;
}

html[data-theme="light"] .scroll-top-btn {
  background: rgba(250, 248, 244, 0.92);
  box-shadow: 0 7px 18px rgba(45, 39, 31, 0.13);
}

html[data-theme="light"] .scroll-top-btn:hover {
  border-color: #68737c;
  box-shadow: 0 9px 22px rgba(45, 39, 31, 0.17);
}

/* Legal, size guide and sitemap inline styles contain a few dark-only values. */
html[data-theme="light"] .legal-card,
html[data-theme="light"] .size-card,
html[data-theme="light"] .sitemap-card {
  box-shadow: 0 10px 30px rgba(45, 39, 31, 0.1);
}

html[data-theme="light"] .size-table th {
  background: rgba(32, 38, 44, 0.045);
}

html[data-theme="light"] .size-table td {
  border-bottom-color: rgba(32, 38, 44, 0.07);
}

html[data-theme="light"] .size-table tr:hover td {
  background: rgba(32, 38, 44, 0.025);
}

/* Cookie UI follows the selected theme without becoming visually harsh. */
html[data-theme="light"] .cookie-modal {
  background: rgba(39, 43, 47, 0.42);
}

html[data-theme="light"] .cookie-banner {
  box-shadow: 0 12px 34px rgba(45, 39, 31, 0.15);
}

/* Footer intentionally remains charcoal in light mode to close the page visually. */
html[data-theme="light"] .footer,
html[data-theme="light"] .site-footer {
  --silver-bright: #f3f5f7;
  --silver-light: #dfe5ea;
  --silver-medium: #c3ccd4;
  --silver-muted: #9ca8b2;
  --silver-dark: #7f8b96;
  --silver-border: rgba(226, 232, 240, 0.12);
  background: #111318;
  color: var(--silver-muted);
}

html[data-theme="light"] .footer-bottom {
  border-color: rgba(255, 255, 255, 0.07);
}

/* Newsletter remains legible inside the intentionally dark footer. */
html[data-theme="light"] .footer .newsletter-input {
  background: rgba(255, 255, 255, 0.055) !important;
  color: #f3f5f7 !important;
}

html[data-theme="light"] .footer .newsletter-input::placeholder {
  color: rgba(226, 232, 240, 0.58) !important;
}

@media (max-width: 768px) {
  .theme-menu--desktop {
    display: none;
  }

  .theme-picker--mobile {
    display: flex;
  }

  .theme-picker--mobile .theme-picker__select-wrap {
    margin-left: auto;
  }

  .theme-picker--mobile select {
    min-width: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.theme-ready body,
  html.theme-ready .navbar,
  html.theme-ready .top-bar,
  html.theme-ready .product-card,
  html.theme-ready .lookbook-card,
  html.theme-ready .store-card,
  html.theme-ready .marroquineria-card,
  html.theme-ready .modal-card,
  html.theme-ready .cookie-banner,
  html.theme-ready .cookie-panel {
    transition: none;
  }
}
