/* Dark mode tokens, surfaces, frosted glass components, and asset polarity overrides. */
[data-theme="dark"] {
  color-scheme: dark;
  --color-ink: #f3f7ff;
  --color-muted: #9eb0d6;
  --color-blue: #2383ff;
  --color-blue-dark: #0e60e8;
  --color-focus: #5ea5ff;
  --color-page: #050a18;
}

/* Smooth transition applied only during explicit user theme toggle. */
html.is-theme-switching body,
html.is-theme-switching .site-header a,
html.is-theme-switching .theme-toggle,
html.is-theme-switching .nav-toggle,
html.is-theme-switching .header-nav,
html.is-theme-switching .providers,
html.is-theme-switching .feature-card,
html.is-theme-switching .import-window,
html.is-theme-switching .import-provider-list,
html.is-theme-switching .import-item-list,
html.is-theme-switching .import-progress-box,
html.is-theme-switching .free-plan,
html.is-theme-switching .storage-badge {
  transition: background .25s ease, background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}

[data-theme="dark"] body::before {
  background: var(--color-page) url("../public/assets/images/dark/bg-desktop.webp") center / cover no-repeat;
}

@media (max-width: 860px) {
  [data-theme="dark"] body::before {
    background-image: url("../public/assets/images/dark/bg-mobile.webp");
  }
}

/* Invert dark-ink monochrome GitHub mark for crisp dark surfaces. */
[data-theme="dark"] img[src$="github.svg"] {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] .skip-link {
  color: var(--color-ink);
  background: #0d1630;
  border: 1px solid rgba(140, 178, 255, .28);
}

[data-theme="dark"] .eyebrow {
  color: #70b4ff;
  border: 1px solid rgba(110, 165, 255, .24);
  background: linear-gradient(100deg, rgba(22, 54, 125, .48), rgba(45, 36, 108, .44));
}

/* Header & Navigation */
[data-theme="dark"] .header-nav {
  color: #cbd8f6;
}

[data-theme="dark"] .brand img,
[data-theme="dark"] .footer-brand-link img {
  filter: drop-shadow(0 4px 10px rgba(24, 110, 255, .28));
}

[data-theme="dark"] .theme-toggle,
[data-theme="dark"] .nav-toggle {
  color: var(--color-ink);
  border-color: rgba(145, 182, 255, .22);
  background: linear-gradient(145deg, rgba(24, 36, 68, .88), rgba(11, 18, 38, .86));
  box-shadow: 0 8px 18px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .1);
}

@media (hover: hover) {
  [data-theme="dark"] .header-nav a:hover,
  [data-theme="dark"] .provider-trigger:hover {
    color: #5ca6ff;
  }

  [data-theme="dark"] .theme-toggle:hover,
  [data-theme="dark"] .nav-toggle:hover {
    background: linear-gradient(145deg, rgba(32, 48, 88, .94), rgba(15, 24, 50, .92));
    border-color: rgba(165, 200, 255, .36);
    box-shadow: 0 10px 22px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .14);
  }

  [data-theme="dark"] .provider-trigger:hover {
    background: rgba(38, 128, 255, .12);
  }
}

@media (max-width: 760px) {
  [data-theme="dark"] .header-nav {
    border-color: rgba(145, 182, 255, .24);
    background: linear-gradient(155deg, rgba(11, 18, 38, .98), rgba(7, 12, 26, .97));
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    box-shadow: 0 22px 44px rgba(0, 0, 0, .66), inset 0 1px 0 rgba(255, 255, 255, .09);
  }

  [data-theme="dark"] .header-nav a:hover,
  [data-theme="dark"] .header-nav a:focus-visible {
    background: rgba(38, 137, 255, .16);
    color: #6ab2ff;
  }
}

/* Providers Strip */
[data-theme="dark"] .providers {
  border-color: rgba(145, 180, 255, .16);
  background: linear-gradient(115deg, rgba(20, 30, 58, .82), rgba(10, 17, 36, .74));
  box-shadow: 0 18px 36px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .09);
}

[data-theme="dark"] .provider-list li {
  border-inline-start-color: rgba(140, 172, 232, .18);
}

/* Features Bento Grid */
[data-theme="dark"] .feature-card {
  border-color: rgba(140, 175, 255, .18);
  background: linear-gradient(135deg, rgba(20, 30, 56, .84), rgba(10, 16, 33, .78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 16px 32px rgba(0, 0, 0, .4);
}

[data-theme="dark"] .feature-organize {
  background: radial-gradient(ellipse at 90% 10%, rgba(104, 86, 255, .18), transparent 60%), linear-gradient(135deg, rgba(22, 33, 62, .86), rgba(10, 16, 34, .82));
}

[data-theme="dark"] .feature-organize::before {
  background: linear-gradient(180deg, rgba(35, 58, 118, .22), rgba(10, 16, 34, .04));
}

[data-theme="dark"] .feature-preview {
  background: linear-gradient(125deg, rgba(26, 28, 58, .84), rgba(13, 17, 38, .78));
}

[data-theme="dark"] .feature-import {
  background: linear-gradient(125deg, rgba(16, 33, 56, .84), rgba(10, 18, 36, .8));
}

[data-theme="dark"] .feature-share {
  background: linear-gradient(155deg, rgba(19, 31, 58, .84), rgba(10, 17, 35, .8));
}

[data-theme="dark"] .feature-share .feature-art {
  inset-block-end: .15rem;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .48));
}

@media (max-width: 580px) {
  [data-theme="dark"] .feature-share .feature-art {
    inset-block-end: .4rem;
  }
}

[data-theme="dark"] .feature-icon {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 6px 14px rgba(0, 0, 0, .35);
}

[data-theme="dark"] .feature-icon-folder {
  color: #ffb830;
  border: 1px solid rgba(255, 196, 80, .22);
  background: linear-gradient(145deg, rgba(245, 155, 0, .24), rgba(180, 100, 0, .14));
}

[data-theme="dark"] .feature-icon-preview {
  border: 1px solid rgba(182, 134, 255, .24);
  background: linear-gradient(145deg, rgba(164, 102, 255, .28), rgba(110, 52, 230, .16));
}

[data-theme="dark"] .feature-icon-import {
  color: #20e3a5;
  border: 1px solid rgba(46, 224, 168, .22);
  background: linear-gradient(145deg, rgba(14, 189, 137, .24), rgba(8, 120, 88, .14));
}

[data-theme="dark"] .feature-icon-share {
  color: #46a6ff;
  border: 1px solid rgba(92, 168, 255, .24);
  background: linear-gradient(145deg, rgba(8, 107, 255, .26), rgba(8, 70, 195, .15));
}

/* Cloud Import & Free Plan */
[data-theme="dark"] .import-step-icon {
  border-color: rgba(140, 178, 255, .18);
  background: linear-gradient(145deg, rgba(26, 38, 70, .88), rgba(13, 20, 42, .85));
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
}

[data-theme="dark"] .import-step.is-active .import-step-icon {
  border-color: rgba(66, 145, 255, .65);
  box-shadow: 0 8px 22px rgba(24, 109, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .14);
}

[data-theme="dark"] .import-step.is-done .import-step-icon {
  border-color: rgba(92, 160, 255, .45);
  background: linear-gradient(145deg, rgba(24, 48, 98, .9), rgba(13, 24, 54, .88));
}

[data-theme="dark"] .step-arrow {
  color: #7492c8;
  background: rgba(24, 36, 66, .85);
}

[data-theme="dark"] .import-preview::before {
  filter: brightness(.24) saturate(1.4) hue-rotate(8deg);
  opacity: .55;
}

[data-theme="dark"] .import-window {
  border-color: rgba(145, 182, 255, .18);
  background: linear-gradient(145deg, rgba(20, 30, 56, .88), rgba(10, 16, 33, .85));
  box-shadow: 0 22px 44px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .04);
}

[data-theme="dark"] .import-cloud-icon {
  color: #3c98ff;
  background: linear-gradient(145deg, rgba(26, 54, 112, .78), rgba(14, 30, 68, .85));
  box-shadow: 0 6px 14px rgba(0, 0, 0, .3);
}

[data-theme="dark"] .import-preview-close {
  color: #c5d7fb;
  border-color: rgba(140, 175, 255, .2);
  background: rgba(34, 48, 82, .85);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}

[data-theme="dark"] .import-provider-list,
[data-theme="dark"] .import-item-list,
[data-theme="dark"] .import-progress-box {
  border-color: rgba(140, 175, 255, .14);
  background: linear-gradient(135deg, rgba(13, 21, 41, .92), rgba(9, 15, 31, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 8px 18px rgba(0, 0, 0, .3);
}

[data-theme="dark"] .import-provider + .import-provider,
[data-theme="dark"] .import-item + .import-item {
  border-block-start-color: rgba(135, 168, 232, .14);
}

[data-theme="dark"] .preview-radio,
[data-theme="dark"] .preview-check {
  border-color: #415989;
  background: #0c152c;
}

[data-theme="dark"] .preview-radio:checked {
  border-color: #3885ff;
  background: #0871ff;
  box-shadow: inset 0 0 0 2px #0c152c;
}

[data-theme="dark"] .import-provider-pill {
  color: var(--color-ink);
  border-color: rgba(140, 178, 255, .22);
  background: rgba(24, 38, 72, .9);
}

[data-theme="dark"] .import-preview-back {
  color: var(--color-ink);
  border-color: rgba(140, 175, 255, .2);
  background: rgba(30, 44, 78, .85);
}

[data-theme="dark"] .import-progress-track,
[data-theme="dark"] .storage-meter {
  background: rgba(56, 92, 168, .28);
}

[data-theme="dark"] .import-done-chip {
  border-color: rgba(140, 178, 255, .16);
  background: rgba(16, 26, 52, .88);
}

[data-theme="dark"] .import-done-chip span:last-child {
  color: #34d399;
}

@media (hover: hover) {
  [data-theme="dark"] .import-preview-back:hover,
  [data-theme="dark"] .import-preview-close:hover {
    background: rgba(46, 66, 114, .92);
  }
}

[data-theme="dark"] .free-plan {
  border-color: rgba(140, 175, 255, .16);
  background: linear-gradient(120deg, rgba(20, 30, 56, .84), rgba(10, 17, 36, .78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 18px 36px rgba(0, 0, 0, .42);
}

[data-theme="dark"] .free-plan-art {
  border-inline-end-color: rgba(135, 168, 232, .18);
}

[data-theme="dark"] .free-plan-art img {
  width: clamp(7.25rem, 11.4vw, 10.25rem);
  margin-block: 0;
}

@media (max-width: 900px) {
  [data-theme="dark"] .free-plan-art img {
    width: min(100%, 8.25rem);
  }
}

@media (max-width: 760px) {
  [data-theme="dark"] .free-plan-art img {
    width: 8rem;
  }
}

[data-theme="dark"] .storage-badge {
  border-color: rgba(140, 175, 255, .18);
  background: linear-gradient(135deg, rgba(24, 36, 68, .86), rgba(13, 21, 44, .82));
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .07);
}

[data-theme="dark"] .storage-icon {
  color: #3d9bff;
  background: linear-gradient(145deg, rgba(24, 52, 112, .75), rgba(14, 30, 68, .85));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}

/* Closing Card & Footer */
[data-theme="dark"] .closing-card {
  border-color: rgba(140, 190, 255, .28);
  background: radial-gradient(ellipse at 50% 0%, #1651cf, #2366ea 65%, #4a89f5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 22px 46px rgba(4, 24, 78, .55);
}

[data-theme="dark"] .closing-card::before {
  opacity: .42;
  filter: saturate(1.2) brightness(.88);
}

[data-theme="dark"] .button-cta {
  color: #0c173f;
}

[data-theme="dark"] .footer-brand,
[data-theme="dark"] .footer-socials {
  border-color: rgba(135, 168, 232, .2);
}

@media (hover: hover) {
  [data-theme="dark"] .footer-nav a:hover {
    color: #5ea5ff;
  }

  [data-theme="dark"] .footer-social[href]:hover {
    background: rgba(45, 95, 195, .28);
  }
}
