html[data-theme="light"] {
  color-scheme: light;
  background: var(--media-surface);
}

html[data-theme="dark"] {
  color-scheme: dark;
  background: var(--void);
}

.catalog-page,
.catalog-page main,
.product-page,
.product-page .product-main {
  transition: background-color var(--fast) ease, color var(--fast) ease;
}

/* Shared theme switch. The moving marker keeps the state visible without color. */

.theme-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--fast) ease, color var(--fast) ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--graphite);
  color: var(--white);
}

.theme-toggle-track {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  border: 1px solid currentColor;
  background: var(--graphite);
}

.theme-toggle-track svg {
  position: absolute;
  z-index: 2;
  top: 4px;
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: opacity var(--fast) ease;
}

.theme-icon-sun {
  right: 5px;
  opacity: 1;
}

.theme-icon-moon {
  left: 5px;
  opacity: 0;
}

.theme-toggle-knob {
  position: absolute;
  z-index: 1;
  top: 2px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--white);
  transition: background-color var(--fast) ease, transform var(--fast) var(--ease-out);
}

.theme-toggle[aria-checked="true"] .theme-toggle-knob {
  background: var(--cyan);
  transform: translateX(15px);
}

.theme-toggle[aria-checked="true"] .theme-icon-sun {
  opacity: 0;
}

.theme-toggle[aria-checked="true"] .theme-icon-moon {
  opacity: 1;
}

.preference-controls {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
}

/* Commerce navigation styles target every button. Keep preference switches
   self-contained so their tracks never collapse to the button's padded box. */
.preference-controls > .theme-toggle,
.preference-controls > .motion-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  place-items: center;
}

.theme-toggle-track,
.motion-toggle-track {
  border-radius: 999px;
}

.theme-toggle-knob,
.motion-toggle-knob {
  border-radius: 50%;
}

.motion-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--fast) ease, color var(--fast) ease;
}

.motion-toggle:hover,
.motion-toggle:focus-visible {
  background: var(--graphite);
  color: var(--white);
}

.motion-toggle-track {
  position: relative;
  display: block;
  width: 36px;
  height: 20px;
  border: 1px solid currentColor;
  background: var(--graphite);
}

.motion-toggle-knob {
  position: absolute;
  top: 2px;
  left: 3px;
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  background: var(--white);
  color: var(--black);
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  transition: background-color var(--fast) ease, transform var(--fast) var(--ease-out);
}

.motion-toggle[aria-checked="true"] .motion-toggle-knob {
  background: var(--cyan);
  transform: translateX(15px);
}

html[data-theme="light"] body.commerce-page {
  --void: #f5f7f8;
  --graphite: #ffffff;
  --graphite-raised: #e9edef;
  --white: #010304;
  --muted: rgba(1, 3, 4, 0.72);
  --subtle: rgba(1, 3, 4, 0.62);
  --line: rgba(1, 3, 4, 0.15);
  --line-strong: rgba(1, 3, 4, 0.32);
  --cyan-soft: rgba(0, 88, 102, 0.12);
  --accent-text: #005f73;
  --commerce-success-text: #176b4b;
  --commerce-danger-text: #9b2f35;
  --commerce-warning-text: #795300;
  --focus-ring: var(--petrol);
  background: var(--void);
  color: var(--white);
  color-scheme: light;
}

html[data-theme="dark"] body.commerce-page {
  --void: #010304;
  --graphite: #091113;
  --graphite-raised: #0d191c;
  --white: #f5f7f8;
  --muted: rgba(245, 247, 248, 0.74);
  --subtle: rgba(245, 247, 248, 0.62);
  --line: rgba(0, 200, 219, 0.22);
  --line-strong: rgba(0, 200, 219, 0.42);
  --cyan-soft: rgba(0, 200, 219, 0.13);
  --accent-text: var(--brand-blue-bright);
  --commerce-success-text: var(--commerce-success);
  --commerce-danger-text: var(--commerce-danger);
  --commerce-warning-text: #e8c880;
  --focus-ring: var(--cyan-bright);
  background: var(--void);
  color: var(--white);
  color-scheme: dark;
}

/* Native option popups do not consistently inherit the page palette on
   Windows. Give both rows and the selected row an explicit contrast pair. */
html[data-theme="light"] select {
  color-scheme: light;
}

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

html[data-theme="light"] select option {
  background: #ffffff;
  color: #010304;
}

html[data-theme="dark"] select option {
  background: #091113;
  color: #f5f7f8;
}

html[data-theme] select option:checked {
  background-color: #8ad5e8 !important;
  color: #061013 !important;
  box-shadow: 0 0 0 100vmax #8ad5e8 inset;
  -webkit-text-fill-color: #061013;
}

body.commerce-page .commerce-main {
  background: var(--void);
  color: var(--white);
  transition: background-color var(--fast) ease, color var(--fast) ease;
}

body.checkout-page .commerce-panel,
body.checkout-page .delivery-method,
body.checkout-page .commerce-field input,
body.checkout-page .commerce-field select,
body.checkout-page .commerce-field textarea {
  transition: background-color var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease;
}

html[data-theme="light"] .commerce-main .auth-login-heading .auth-context,
html[data-theme="light"] .commerce-main .auth-field-heading > a,
html[data-theme="light"] .commerce-main .auth-switch a {
  color: #005f73;
}

html[data-theme="light"] .commerce-main .form-message {
  color: #a12622;
}

html[data-theme="light"] .commerce-main .auth-login-panel .form-message:not(:empty) {
  border-color: #bd413a;
  background: #fff3f2;
}

.commerce-page .app-header,
.commerce-page .commerce-footer {
  --black: #000000;
  --void: #010304;
  --graphite: #091113;
  --white: #f5f7f8;
  --muted: rgba(245, 247, 248, 0.74);
  --subtle: rgba(245, 247, 248, 0.62);
  --line: rgba(0, 200, 219, 0.22);
  --line-strong: rgba(0, 200, 219, 0.42);
  --accent-text: var(--brand-blue-bright);
  --commerce-success-text: var(--commerce-success);
  --commerce-danger-text: var(--commerce-danger);
  --commerce-warning-text: #e8c880;
  color-scheme: dark;
}

html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@keyframes gamimarket-rise {
  from { opacity: 0; filter: blur(1px); transform: translate3d(0, 10px, 0); }
  to { opacity: 1; filter: blur(0); transform: translate3d(0, 0, 0); }
}

@keyframes gamimarket-insert {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

html[data-motion="on"] .reveal-on-load {
  animation: gamimarket-rise 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--reveal-order, 0) * 24ms);
}

html[data-motion="on"] .reveal-inserted {
  animation: gamimarket-insert 210ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--reveal-order, 0) * 18ms);
}

html[data-motion="on"] .is-content-loading {
  opacity: 0.58;
  filter: saturate(0.72);
  transform: translate3d(0, 2px, 0);
  transition: opacity 140ms ease, filter 140ms ease, transform 140ms ease;
}

/* Product page theme roles. Brand chrome and media stay stable; dialogs follow
   the selected theme. */

html[data-theme="light"] .product-page {
  --void: #f5f7f8;
  --graphite: var(--media-surface);
  --graphite-raised: #e9edef;
  --white: #010304;
  --muted: rgba(1, 3, 4, 0.7);
  --subtle: rgba(1, 3, 4, 0.62);
  --line: rgba(1, 3, 4, 0.16);
  --line-strong: rgba(1, 3, 4, 0.32);
  --cyan-soft: rgba(0, 88, 102, 0.12);
  --accent-text: #005f73;
  --focus-ring: var(--petrol);
  background: var(--void);
  color: var(--white);
  color-scheme: light;
}

html[data-theme="dark"] .product-page {
  --accent-text: var(--cyan-bright);
  --focus-ring: var(--cyan-bright);
  color-scheme: dark;
}

.product-page .app-header,
.product-page .site-footer {
  --black: #000000;
  --void: #010304;
  --graphite: #091113;
  --graphite-raised: #0d191c;
  --white: #f5f7f8;
  --muted: rgba(245, 247, 248, 0.74);
  --subtle: rgba(245, 247, 248, 0.62);
  --line: rgba(0, 200, 219, 0.22);
  --line-strong: rgba(0, 200, 219, 0.42);
  --cyan-soft: rgba(0, 200, 219, 0.13);
  --accent-text: var(--cyan-bright);
  --focus-ring: var(--cyan-bright);
  color-scheme: dark;
}

.product-page .viewer-dialog,
.product-page .viewer-topbar,
.product-page .viewer-panel {
  transition: background-color var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease;
}

/* The photo viewer follows the selected theme; its floating controls stay dark. */

html[data-theme="light"] .product-page .photo-viewer-dialog {
  color: var(--white);
  color-scheme: light;
}

html[data-theme="light"] .product-page .photo-viewer-topbar {
  background: var(--graphite);
}

html[data-theme="light"] .product-page .photo-viewer-arrow {
  color: #f5f7f8;
}

html[data-theme="light"] .product-page .photo-viewer-help {
  color: rgba(245, 247, 248, 0.74);
}

html[data-theme="light"] .product-page .photo-viewer-zoom-controls button:hover,
html[data-theme="light"] .product-page .photo-viewer-toolbar > button:hover,
html[data-theme="light"] .product-page .photo-viewer-toolbar form button:hover {
  color: var(--petrol);
}

html[data-theme="light"] .product-page .photo-viewer-thumbnail.is-active {
  border-color: var(--petrol);
}

html[data-theme="light"] .product-page .size-request-field input {
  background: var(--graphite);
}

.product-page .gallery-photo-hint,
.product-page .gallery-counter,
.product-page .gallery-arrow,
.product-page .gallery-3d-button {
  color: #f5f7f8;
}

/* Product page receives the same navigation shell as the catalogue. */

.product-page .app-header {
  min-height: 88px;
  border-bottom: 1px solid var(--line);
  background: var(--black);
  color: var(--white);
  backdrop-filter: none;
}

.product-page .header-inner {
  display: grid;
  position: relative;
  width: min(calc(100% - 60px), 1860px);
  min-height: 88px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  margin-inline: auto;
}

.product-page .header-nav {
  display: flex;
  min-width: 0;
  align-items: stretch;
  align-self: stretch;
  gap: 26px;
}

.product-page .header-nav a {
  display: inline-flex;
  position: relative;
  min-height: 88px;
  align-items: center;
  padding: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 740;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: color var(--fast) ease;
}

.product-page .header-nav a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: transparent;
  content: "";
}

.product-page .header-nav a:hover,
.product-page .header-nav a:focus-visible,
.product-page .header-nav a.is-current {
  color: var(--white);
}

.product-page .header-nav a.is-current::after {
  background: var(--cyan);
}

.product-page .brand {
  grid-column: 2;
  justify-self: center;
  color: var(--white);
}

.product-page .brand-word {
  font-size: 1.18rem;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.product-page .header-actions {
  display: flex;
  min-width: 0;
  grid-column: 3;
  align-items: center;
  justify-self: end;
  gap: 8px;
}

.product-page .header-search-link {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  place-items: center;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--fast) ease, color var(--fast) ease;
}

.product-page .header-search-link:hover,
.product-page .header-search-link:focus-visible,
.product-page .header-search-link[aria-expanded="true"] {
  background: var(--graphite);
  color: var(--white);
}

.product-page .header-search-link svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.product-page .selection-button {
  min-height: 44px;
  padding: 0 7px 0 12px;
  border-radius: 0;
  margin-left: 0;
  background: transparent;
}

.product-page .selection-button strong {
  border-radius: 0;
}

.product-page .header-search-panel {
  position: absolute;
  z-index: calc(var(--z-header) - 1);
  top: 100%;
  right: 0;
  left: 0;
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 12px;
  padding: 16px max(30px, calc((100vw - 1860px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--black);
  color-scheme: dark;
}

.product-page .product-header-search-form {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 12px;
  margin: 0;
}

.product-page .product-header-search-form .search-field {
  min-width: 0;
  flex: 1;
}

.product-page .header-search-panel .search-field {
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--graphite);
}

.product-page .header-search-panel .search-field input {
  color: var(--white);
}

.product-page .header-search-panel .search-field input::placeholder {
  color: var(--muted);
}

.product-page .header-search-close {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
}

.product-page .header-search-submit {
  min-width: 82px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: var(--black);
  cursor: pointer;
  font-weight: 750;
}

.product-page .header-search-submit:hover,
.product-page .header-search-submit:focus-visible {
  border-color: var(--cyan-bright);
  background: var(--cyan-bright);
}

.product-page .header-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 11px 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.product-page .header-menu-toggle span {
  display: block;
  width: 24px;
  height: 1px;
  margin: 5px 0;
  background: var(--white);
  transition: opacity var(--fast) ease, transform var(--fast) var(--ease-out);
}

.product-page .header-menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.product-page .header-menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.product-page .header-menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Full product footer mirrors the catalogue structure. */

.product-page .site-footer {
  display: block;
  position: relative;
  width: 100%;
  min-height: 0;
  max-width: none;
  overflow: hidden;
  padding: 64px 30px 56px;
  border-top: 1px solid var(--line);
  margin: 64px 0 0;
  background: var(--black);
  color: var(--white);
}

.product-page .site-footer::before {
  content: none;
}

.product-page .footer-grid {
  position: relative;
  z-index: 1;
  width: min(100%, 1860px);
  margin-inline: auto;
}

.product-page .footer-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.72fr 1fr 1fr;
  gap: 48px;
}

.product-page .footer-brand strong {
  display: inline-flex;
  color: var(--white);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.product-page .footer-brand strong span {
  color: var(--cyan);
}

.product-page .footer-brand p,
.product-page .footer-action p {
  max-width: 32ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.product-page .footer-column {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
}

.product-page .footer-column > strong {
  margin-bottom: 8px;
  color: var(--subtle);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-page .footer-column a,
.product-page .footer-column span {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.product-page .footer-column a:hover,
.product-page .footer-column a:focus-visible {
  color: var(--white);
}

.product-page .footer-action > a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 12px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  color: var(--white);
  font-weight: 700;
}

.product-page .footer-action > a:hover,
.product-page .footer-action > a:focus-visible {
  border-color: var(--cyan);
  background: var(--graphite);
}

.product-page .footer-action > a span {
  color: var(--cyan);
  font-size: 1rem;
}

@media (max-width: 1180px) {
  .product-page .header-nav {
    gap: 12px;
  }

  .product-page .header-nav a {
    font-size: 0.8rem;
    font-weight: 700;
  }

  .product-page .footer-grid {
    grid-template-columns: 1fr 0.7fr 1fr 1fr;
    gap: 30px;
  }
}

@media (max-width: 1080px) {
  .product-page .header-inner {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .product-page .header-menu-toggle {
    display: block;
    grid-column: 1;
  }

  .product-page .brand {
    grid-column: 2;
    justify-self: start;
  }

  .product-page .header-actions {
    grid-column: 3;
  }

  .product-page .header-nav {
    display: none;
    position: absolute;
    top: 88px;
    right: -30px;
    left: -30px;
    min-height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 12px 30px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--black);
  }

  .product-page .header-nav.is-open {
    display: grid;
  }

  .product-page .header-nav a {
    min-height: 48px;
    border-bottom: 1px solid var(--line);
    font-size: 0.88rem;
    font-weight: 740;
  }

  .product-page .header-nav a::after {
    display: none;
  }

  .product-page .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .product-page .app-header,
  .product-page .header-inner {
    min-height: 67px;
  }

  .product-page .header-inner {
    width: calc(100% - 30px);
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 5px;
  }

  .product-page .header-menu-toggle {
    width: 36px;
    padding-inline: 1px;
  }

  .product-page .header-nav {
    top: 67px;
    right: -15px;
    left: -15px;
    padding-inline: 15px;
  }

  .product-page .brand-word {
    font-size: 0.92rem;
  }

  .product-page .header-actions {
    gap: 4px;
  }

  .product-page .selection-button {
    min-height: 44px;
    padding: 0 4px;
    border: 0;
  }

  .product-page .selection-button > span {
    display: none;
  }

  .product-page .selection-button strong {
    min-width: 22px;
    height: 22px;
  }

  .product-page .header-search-panel {
    min-height: 74px;
    padding: 12px 15px;
  }

  .product-page .header-search-close {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .product-page .header-search-submit {
    min-width: 68px;
    min-height: 44px;
    padding-inline: 12px;
  }

  .product-page .site-footer {
    min-height: 0;
    padding: 48px 15px 44px;
    margin-top: 48px;
  }

  .product-page .footer-grid {
    display: block;
  }

  .product-page .footer-brand {
    padding-bottom: 30px;
  }

  .product-page .footer-brand p {
    max-width: 38ch;
  }

  .product-page .footer-column {
    display: flex;
    min-height: 142px;
    justify-content: center;
    padding: 24px 0;
    border-top: 1px solid var(--line);
  }

  .product-page .footer-column.footer-action {
    min-height: 180px;
  }

}

@media (max-width: 420px) {
  .catalog-page .header-actions,
  .product-page .header-actions {
    gap: 2px;
  }

  .catalog-page .theme-toggle,
  .product-page .theme-toggle,
  .catalog-page .header-search-link,
  .product-page .header-search-link {
    width: 42px;
    flex-basis: 42px;
  }

  .catalog-page .selection-button {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="on"]) .catalog-page,
  html:not([data-motion="on"]) .catalog-page main,
  html:not([data-motion="on"]) .product-page,
  html:not([data-motion="on"]) .product-page .product-main,
  html:not([data-motion="on"]) .theme-toggle,
  html:not([data-motion="on"]) .theme-toggle-track svg,
  html:not([data-motion="on"]) .theme-toggle-knob {
    transition: none;
  }
}

@media (forced-colors: active) {
  .theme-toggle {
    border: 1px solid ButtonText;
  }

  .theme-toggle-track,
  .theme-toggle-knob {
    forced-color-adjust: none;
  }
}
