/* Shared theme tokens and the site-wide theme switch. */
html {
  --theme-surface-card: rgba(23, 25, 37, .72);
  --theme-surface-soft: rgba(23, 25, 37, .6);
  --theme-surface-popover: #1b1e2e;
  --theme-control-bg: rgba(255, 255, 255, .03);
  --theme-control-hover: rgba(244, 242, 237, .07);
  --theme-hover-border: rgba(244, 242, 237, .32);
  --theme-focus: rgba(244, 242, 237, .48);
  --theme-selection: rgba(201, 243, 106, .22);
  --theme-scroll-track: rgba(244, 242, 237, .14);
  --theme-scroll-thumb: rgba(244, 242, 237, .45);
  --theme-scroll-thumb-active: rgba(244, 242, 237, .7);
  --theme-popover-shadow: rgba(0, 0, 0, .5);
  --theme-card-shadow: rgba(0, 0, 0, .2);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5ef;
  --panel: #ffffff;
  --text: #20232d;
  --muted: #626775;
  --line: rgba(32, 35, 45, .14);
  --lime: #526b20;
  --theme-surface-card: rgba(255, 255, 255, .88);
  --theme-surface-soft: rgba(255, 255, 255, .78);
  --theme-surface-popover: #ffffff;
  --theme-control-bg: rgba(255, 255, 255, .76);
  --theme-control-hover: rgba(32, 35, 45, .055);
  --theme-hover-border: rgba(32, 35, 45, .32);
  --theme-focus: rgba(82, 107, 32, .72);
  --theme-selection: rgba(82, 107, 32, .2);
  --theme-scroll-track: rgba(32, 35, 45, .12);
  --theme-scroll-thumb: rgba(32, 35, 45, .38);
  --theme-scroll-thumb-active: rgba(32, 35, 45, .62);
  --theme-popover-shadow: rgba(28, 37, 48, .16);
  --theme-card-shadow: rgba(28, 37, 48, .08);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 88% 4%, rgba(201, 243, 106, .16), transparent 27rem),
    radial-gradient(circle at 4% 42%, rgba(130, 119, 255, .075), transparent 25rem),
    var(--bg);
}

html[data-theme="light"] .brand-logo {
  filter: brightness(0);
}

html[data-theme="light"] .promo-card,
html[data-theme="light"] .app,
html[data-theme="light"] .next,
html[data-theme="light"] .news-placeholder,
html[data-theme="light"] .pp-card {
  background: var(--theme-surface-card);
  border-color: var(--line);
  box-shadow: 0 18px 48px var(--theme-card-shadow);
}

/* The device promo is a transparent PNG; give it a visible stage in light mode. */
html[data-theme="light"] .promo-card {
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255, 255, 255, .72), transparent 48%),
    radial-gradient(circle at 82% 14%, rgba(201, 243, 106, .4), transparent 31%),
    linear-gradient(145deg, #e2e8d9 0%, #e8e7f0 54%, #dce8e4 100%);
  border-color: rgba(82, 107, 32, .2);
  box-shadow: 0 24px 58px rgba(28, 37, 48, .13), inset 0 1px 0 rgba(255, 255, 255, .88);
}

html[data-theme="light"] .promo-card img {
  filter: drop-shadow(0 14px 20px rgba(31, 39, 52, .2));
}

html[data-theme="light"] .appvisual {
  background: linear-gradient(145deg, #e7e9f2 0%, #e5ebdd 56%, #deebe6 100%);
}

html[data-theme="light"] .promise {
  background: linear-gradient(135deg, #ffffff 0%, #f0f4e7 100%);
  border-color: rgba(82, 107, 32, .2);
  box-shadow: 0 22px 60px var(--theme-card-shadow);
}

html[data-theme="light"] .lang-panel {
  background: var(--theme-surface-popover);
  box-shadow: 0 18px 50px var(--theme-popover-shadow);
}

html[data-theme="light"] .lang-select-wrap {
  background: var(--theme-control-bg);
}

html[data-theme="light"] .tag-proof-tags span {
  background: var(--theme-surface-soft);
}

.theme-toggle {
  display: inline-grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--theme-control-bg);
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  color: var(--lime);
  border-color: var(--theme-hover-border);
  background: var(--theme-control-hover);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0) scale(.96);
}

.theme-toggle svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

html[data-theme="dark"] .theme-icon--moon,
html[data-theme="light"] .theme-icon--sun {
  display: none;
}

html[data-theme="light"] .theme-toggle[aria-pressed="true"] {
  color: #435919;
  border-color: rgba(82, 107, 32, .24);
  background: rgba(201, 243, 106, .28);
}

html[data-theme="light"] .theme-toggle:hover {
  color: #344813;
  border-color: rgba(82, 107, 32, .38);
  background: rgba(201, 243, 106, .4);
}

html[data-theme="light"] .lang-select-wrap:hover,
html[data-theme="light"] .outline-link:hover,
html[data-theme="light"] .pp-links a:hover,
html[data-theme="light"] .news-cta:hover,
html[data-theme="light"] .tag-showcase-link:hover,
html[data-theme="light"] .tester-button:hover {
  border-color: var(--theme-hover-border);
}

html[data-theme="light"] .lang-list button:hover,
html[data-theme="light"] .lang-list button:focus-visible {
  background: var(--theme-control-hover);
}

html[data-theme="light"] .lang-panel:focus-within {
  border-color: rgba(32, 35, 45, .24);
}

html[data-theme="light"] .lang-list::-webkit-scrollbar-thumb {
  background: rgba(32, 35, 45, .22);
}

html[data-theme="light"] .gallery-scroll::before {
  background: var(--theme-scroll-track);
}

html[data-theme="light"] .gallery-scroll-thumb {
  background: var(--theme-scroll-thumb);
}

html[data-theme="light"] .gallery-scroll-thumb:hover,
html[data-theme="light"] .gallery-scroll:active .gallery-scroll-thumb {
  background: var(--theme-scroll-thumb-active);
}

/* Keep Gallery Plus screenshots on a light, clearly separated stage. */
html[data-theme="light"] .gallery-shell {
  background: #e8ece5;
  border-color: rgba(32, 35, 45, .12);
  box-shadow: 0 18px 42px rgba(28, 37, 48, .1), inset 0 1px 0 rgba(255, 255, 255, .78);
}

html[data-theme="light"] .gallery-card-frame {
  background: #f4f5ef;
  border-color: rgba(32, 35, 45, .14);
  box-shadow: 0 12px 26px rgba(28, 37, 48, .12);
}

html[data-theme="light"] .gallery-card-frame:hover {
  border-color: rgba(32, 35, 45, .3);
}

html[data-theme="light"] .button:hover {
  border-color: var(--theme-hover-border);
  background-color: var(--theme-control-hover);
}

html[data-theme="light"] .news-section .notice-scrollbar {
  background: var(--theme-scroll-track);
}

html[data-theme="light"] .news-section .notice-scrollbar-thumb {
  background: var(--theme-scroll-thumb);
}

html[data-theme="light"] .news-section .notice-list:focus-visible {
  outline-color: var(--theme-focus);
}

html[data-theme="light"] a:focus-visible,
html[data-theme="light"] button:focus-visible,
html[data-theme="light"] input:focus-visible {
  outline-color: var(--theme-focus);
}

html[data-theme="light"] ::selection {
  background: var(--theme-selection);
  color: var(--text);
}

body,
.promo-card,
.app,
.next,
.news-placeholder,
.pp-card,
.promise,
.lang-select-wrap,
.lang-panel {
  transition: color .22s ease, background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

@media (max-width: 520px) {
  .theme-toggle {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  body,
  .promo-card,
  .app,
  .next,
  .news-placeholder,
  .pp-card,
  .promise,
  .lang-select-wrap,
  .lang-panel {
    transition-duration: .01ms;
  }
}
