/* Theme toggle + bright palette (dark = :root / index inline defaults) */

html {
  color-scheme: dark;
}

html[data-theme="bright"] {
  color-scheme: light;

  --background: oklch(0.9911 0 0);
  --foreground: oklch(0.1994 0.0470 270.6494);
  --card: oklch(0.9851 0 0);
  --muted-foreground: oklch(0.1994 0.0470 270.6494);
  --primary: oklch(0.5729 0.2337 264.3664);
  --primary-foreground: oklch(1.0000 0 0);
  --border: oklch(0.9212 0.0033 17.2170);
  --ring: oklch(0.5784 0.2303 263.8862);
  --chart-2: oklch(0.7677 0.1312 194.1427);
  --chart-4: oklch(0.8439 0.1679 169.5646);

  --surface: oklch(1.0000 0 0);
  --surface-foreground: oklch(0.1994 0.0470 270.6494);
  --surface-muted: oklch(0.1994 0.0470 270.6494);
  --surface-border: oklch(0.9212 0.0033 17.2170);
  --surface-primary: oklch(0.5729 0.2337 264.3664);
  --surface-primary-foreground: oklch(1.0000 0 0);
  --surface-card: oklch(1.0000 0 0);
  --surface-secondary: oklch(0.9851 0 0);

  --bg: var(--background);
  --bg-pure: var(--card);
  --text: var(--foreground);
  --text-muted: var(--muted-foreground);
  --accent: var(--primary);
  --accent-soft: var(--ring);
  --blue: var(--primary);
  --pastel-blue: var(--chart-2);
  --pastel-green: var(--chart-4);
  --off-white: var(--muted-foreground);
}

/* Bright theme: Rubik body copy; Inter Tight logo + nav (match dark); Alfa Slab hero + section headings only */
html[data-theme="bright"] body,
html[data-theme="bright"] .contact-form label,
html[data-theme="bright"] .project-meta,
html[data-theme="bright"] .project-desc,
html[data-theme="bright"] .back-link,
html[data-theme="bright"] footer {
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 400;
}

html[data-theme="bright"] .contact-form button {
  font-family: 'Rubik', system-ui, sans-serif;
  font-weight: 900;
}

html[data-theme="bright"] .logo,
html[data-theme="bright"] .main-nav a {
  font-family: 'Inter Tight', sans-serif;
  font-weight: 900;
}

html[data-theme="bright"] .logo {
  letter-spacing: 0em;
}

html[data-theme="bright"] .main-nav a {
  letter-spacing: 0;
}

html[data-theme="bright"] .hero-headline,
html[data-theme="bright"] .work-section h2,
html[data-theme="bright"] .work-card-title,
html[data-theme="bright"] .clients-section h2,
html[data-theme="bright"] .contact-section h2,
html[data-theme="bright"] .sequence-blurb h3,
html[data-theme="bright"] .project-title {
  font-family: 'Alfa Slab One', serif;
  font-weight: 400;
}

html[data-theme="bright"] .hero-headline {
  font-size: clamp(4.921875rem, 1.03125vw + 4.125rem, 6.84375rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}

html[data-theme="bright"] .hero-image-wrap img {
  filter: drop-shadow(0 22px 44px oklch(0.1994 0.047 270.65 / 0.14))
    drop-shadow(0 10px 20px oklch(0.1994 0.047 270.65 / 0.08));
}

html[data-theme="bright"] .hero-cta {
  border-color: #999999;
}

html[data-theme="bright"] .hero-cta:hover {
  border-color: currentColor;
}

/* Logo + theme switch grouped on the left */
.top-bar-start {
  display: flex;
  align-items: center;
  gap: clamp(0.45rem, 1.5vw, 0.65rem);
  min-width: 0;
}

/* Single theme toggle — one icon visible; crossfade + rotate on change */
.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in oklch, var(--foreground) 8%, var(--card));
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition:
    transform 0.42s cubic-bezier(0.34, 1.45, 0.64, 1),
    border-color 0.22s ease,
    color 0.22s ease,
    box-shadow 0.28s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: color-mix(in oklch, var(--primary) 40%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--primary) 22%, transparent);
}

.theme-toggle.theme-toggle--pressed {
  transform: scale(0.9);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.theme-toggle__icons {
  position: relative;
  width: 0.9rem;
  height: 0.9rem;
  display: block;
  pointer-events: none;
}

.theme-toggle__icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transition:
    opacity 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.48s cubic-bezier(0.34, 1.35, 0.64, 1);
}

html[data-theme="dark"] .theme-toggle__icon--moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

html[data-theme="dark"] .theme-toggle__icon--sun {
  opacity: 0;
  transform: rotate(95deg) scale(0.2);
}

html[data-theme="bright"] .theme-toggle__icon--moon {
  opacity: 0;
  transform: rotate(-95deg) scale(0.2);
}

html[data-theme="bright"] .theme-toggle__icon--sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle__icon {
    transition-duration: 0.01ms;
  }

  .theme-toggle.theme-toggle--pressed {
    transform: none;
  }
}

@media (max-width: 768px) {
  .theme-toggle {
    width: 1.96rem;
    height: 1.96rem;
  }

  .theme-toggle__icons {
    width: 0.82rem;
    height: 0.82rem;
  }
}
