/* Graphite theme + solid surfaces (transparency off).
   Kept outside styles.css: scripts/repair-public-css.js truncates the tail of styles.css on deploy. */

html[data-theme="graphite"],
body[data-theme="graphite"] {
  --accent-primary: #5b8cff;
  --accent-secondary: #3f6fe8;
  --accent-rgb: 91, 140, 255;
  --animal-hue: -40deg;
  --animal-sat: 0.9;
  --cyan: #7aa2ff;
  --text-primary: #eceef3;
  --text-secondary: #9aa0ad;
  --text-soft: #7c8290;
  --bg-primary: #0b0c0f;
  --bg-secondary: #111317;
  --card-bg: #15171c;
  --card-border: #23262d;
  --inset-card-bg: #1b1e24;
  --inset-card-border: #2a2e36;
  --shadow-glow: none;
  --body-glow-a: transparent;
  --body-glow-b: transparent;
  --sidebar-bg: #111317;
  --sidebar-border: #23262d;
  --sidebar-shadow: none;
  --scrollbar-track: #0b0c0f;
  --scrollbar-border: #0b0c0f;
  --scrollbar-thumb: #2c3039;
  --scrollbar-thumb-hover: #3a3f4a;
}

body[data-theme="graphite"] {
  background: #0b0c0f;
}

.theme-card[data-theme="graphite"] .theme-card-preview {
  background: linear-gradient(145deg, #15171c 0%, #23262d 55%, #5b8cff 100%);
}

/* ---------- Solid surface tokens ---------- */

html[data-surface="solid"] body {
  --solid-bg: color-mix(in srgb, var(--accent-primary) 3%, #0a0b0d);
  --solid-panel: color-mix(in srgb, var(--accent-primary) 4%, #111317);
  --solid-card: color-mix(in srgb, var(--accent-primary) 4%, #16181d);
  --solid-raised: color-mix(in srgb, var(--accent-primary) 5%, #1b1e24);
  --solid-hover: color-mix(in srgb, var(--accent-primary) 7%, #20232a);
  --solid-border: color-mix(in srgb, var(--accent-primary) 6%, #23262d);
  --solid-border-strong: color-mix(in srgb, var(--accent-primary) 10%, #31353e);
  --card-bg: var(--solid-card);
  --card-border: var(--solid-border);
  --inset-card-bg: var(--solid-raised);
  --inset-card-border: var(--solid-border);
  --sidebar-bg: var(--solid-panel);
  --sidebar-border: var(--solid-border);
  --sidebar-shadow: none;
  --shadow-glow: none;
  --body-glow-a: transparent;
  --body-glow-b: transparent;
  --select-menu-bg: var(--solid-raised);
  --select-menu-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --scrollbar-track: var(--solid-bg);
  --scrollbar-border: var(--solid-bg);
  --scrollbar-thumb: var(--solid-border-strong);
  --scrollbar-thumb-hover: color-mix(in srgb, var(--accent-primary) 40%, #31353e);
  background: var(--solid-bg) !important;
  background-size: auto !important;
  animation: none !important;
}

html[data-surface="solid"] body[data-theme="white"] {
  --solid-bg: #f2f3f6;
  --solid-panel: #ffffff;
  --solid-card: #f7f8fa;
  --solid-raised: #f0f2f5;
  --solid-hover: #e9ecf1;
  --solid-border: #e2e5eb;
  --solid-border-strong: #cfd4dc;
  --select-menu-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  --scrollbar-thumb: #cfd4dc;
  --scrollbar-thumb-hover: #b6bcc7;
}

html[data-surface="solid"] body::before,
html[data-surface="solid"] body::after {
  display: none !important;
}

html[data-surface="solid"] body *,
html[data-surface="solid"] body *::before,
html[data-surface="solid"] body *::after {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* ---------- Surface levels ---------- */

html[data-surface="solid"] .sidebar {
  background: var(--solid-panel) !important;
  border-color: var(--solid-border) !important;
  box-shadow: none !important;
}

html[data-surface="solid"] :is(.card, .discipline-card, .workspace-editor-hero, .prop-landing, .section-header.workspace-editor-hero--prop) {
  background: var(--solid-panel) !important;
  border-color: var(--solid-border) !important;
  box-shadow: none !important;
}

html[data-surface="solid"] :is(.card, .discipline-card) :is(.card, .discipline-card, .workspace-editor-hero, .prop-landing, .settings-toggle-row) {
  background: var(--solid-card) !important;
  border-color: var(--solid-border) !important;
}

html[data-surface="solid"] :is(.card, .discipline-card) :is(.card, .discipline-card) :is(.card, .discipline-card) {
  background: var(--solid-raised) !important;
}

html[data-surface="solid"] :is(.card, .discipline-card, .workspace-editor-hero, .prop-landing)::before,
html[data-surface="solid"] :is(.card, .discipline-card, .workspace-editor-hero, .prop-landing)::after {
  background-image: none !important;
  box-shadow: none !important;
}

html[data-surface="solid"] .prop-landing-orb {
  display: none !important;
}

html[data-surface="solid"] :is(.tab-switcher, .strategy-tabs) {
  background: var(--solid-raised) !important;
  border-color: var(--solid-border) !important;
  box-shadow: none !important;
}

html[data-surface="solid"] :is(.primary-button, .ghost-button) {
  box-shadow: none !important;
}

/* ---------- Sidebar navigation ---------- */

html[data-surface="solid"] .sidebar-nav button {
  position: relative;
}

html[data-surface="solid"] .sidebar-nav button.is-active {
  background: var(--solid-raised) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

html[data-surface="solid"] .sidebar-nav button.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-primary);
}

html[data-surface="solid"] .sidebar-nav button.is-active .nav-icon {
  color: var(--accent-primary);
  opacity: 1;
}

html[data-surface="solid"] .sidebar-nav button:not(.is-active):hover {
  background: var(--solid-hover) !important;
}

/* ---------- Theme picker ---------- */

html[data-surface="solid"] .theme-card {
  border-radius: 12px;
  border-color: var(--solid-border);
  background: var(--solid-raised) !important;
  box-shadow: none !important;
  transform: none !important;
}

html[data-surface="solid"] .theme-card:hover {
  border-color: var(--solid-border-strong);
  background: var(--solid-hover) !important;
}

html[data-surface="solid"] .theme-card.is-active {
  border-color: color-mix(in srgb, var(--text-primary) 55%, transparent);
  background: var(--solid-raised) !important;
}

html[data-surface="solid"] .theme-card-preview {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: none;
}

html[data-surface="solid"] .theme-card {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

html[data-surface="solid"] .theme-card-check {
  border-color: transparent;
}

html[data-surface="solid"] .theme-card.is-active .theme-card-check {
  color: var(--accent-primary);
  background: none;
  border-color: transparent;
  box-shadow: none;
  font-size: 15px;
}

/* ---------- Transparency toggle ---------- */

.settings-theme-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.theme-surface-toggle {
  flex: 0 1 300px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(var(--accent-rgb), 0.05);
  gap: 14px;
  cursor: pointer;
}

.theme-surface-toggle > span {
  display: grid;
  gap: 3px;
}

.theme-surface-toggle strong {
  font-size: 13px;
}

.theme-surface-toggle small {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-secondary);
}

.theme-surface-toggle small.theme-surface-forced {
  display: none;
}

.theme-surface-toggle.is-forced {
  cursor: default;
  opacity: 0.85;
}

.theme-surface-toggle.is-forced small.theme-surface-desc {
  display: none;
}

.theme-surface-toggle.is-forced small.theme-surface-forced {
  display: block;
}

@media (max-width: 720px) {
  .theme-surface-toggle {
    flex-basis: 100%;
  }
}

/* ---------- Welcome: animated flora, marquee, advantages ---------- */

.welcome-flora {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.welcome-flora i { position: absolute; display: block; }

.welcome-flora-img {
  inset: -6%;
  background: url("assets/welcome-hero.jpg") center right / cover no-repeat;
  animation: welcomeFloraDrift 26s ease-in-out infinite alternate;
  transform-origin: 70% 55%;
  will-change: transform, filter;
}

.welcome-flora-glint {
  inset: 0;
  background:
    radial-gradient(ellipse 28% 36% at 68% 42%, rgba(176, 148, 255, 0.28), transparent 70%),
    radial-gradient(ellipse 18% 24% at 80% 62%, rgba(96, 214, 255, 0.18), transparent 70%);
  mix-blend-mode: screen;
  animation: welcomeFloraGlint 9s ease-in-out infinite alternate;
}

.welcome-flora-shade {
  inset: 0;
  background: linear-gradient(105deg, rgba(4, 3, 10, 0.97) 0%, rgba(4, 3, 10, 0.9) 36%, rgba(4, 3, 10, 0.4) 58%, rgba(4, 3, 10, 0.5) 100%);
}

.welcome-flora-pollen { display: none; }

.welcome-hero-stage:has(.welcome-flora) { background-image: none; }
.welcome-hero-stage > .welcome-wizard-card,
.welcome-hero-stage > .welcome-signal-scene { z-index: 2; }
.welcome-hero-stage > .welcome-scroll-cue { z-index: 4; }

@keyframes welcomeFloraDrift {
  0% { transform: scale(1) translate3d(0, 0, 0) rotate(0deg); filter: saturate(1) brightness(1); }
  50% { filter: saturate(1.12) brightness(1.06); }
  100% { transform: scale(1.09) translate3d(-1.6%, -1.2%, 0) rotate(-0.6deg); filter: saturate(1.05) brightness(1.02); }
}

@keyframes welcomeFloraGlint {
  0% { opacity: 0.45; transform: translate3d(0, 0, 0); }
  100% { opacity: 1; transform: translate3d(-2%, 1.5%, 0); }
}

.welcome-wizard-card.is-cta-pulse {
  animation: welcomeCardPulse 1.3s ease-out;
}

@keyframes welcomeCardPulse {
  0% { box-shadow: 0 0 0 0 rgba(169, 156, 255, 0.55); }
  100% { box-shadow: 0 0 0 26px rgba(169, 156, 255, 0); }
}

.welcome-marquee {
  position: relative;
  overflow: hidden;
  padding: 26px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.welcome-marquee-track {
  display: flex;
  align-items: center;
  gap: 34px;
  width: max-content;
  animation: welcomeMarquee 38s linear infinite;
}

.welcome-marquee-track span {
  color: rgba(226, 222, 243, 0.78);
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 650;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.welcome-marquee-track i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a99cff;
  box-shadow: 0 0 14px #8d7cff;
}

@keyframes welcomeMarquee { to { transform: translateX(-50%); } }

.welcome-adv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.welcome-adv {
  position: relative;
  padding: 30px 28px 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.4s ease, background 0.4s ease;
}

.welcome-adv::after {
  content: "";
  position: absolute;
  inset: auto -30% -50% auto;
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 99, 255, 0.22), transparent 68%);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.welcome-adv:hover {
  transform: translateY(-6px);
  border-color: rgba(169, 156, 255, 0.4);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
}

.welcome-adv:hover::after { opacity: 1; }

.welcome-adv-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 26px;
  border: 1px solid rgba(169, 156, 255, 0.28);
  border-radius: 16px;
  color: #c3b8ff;
  background: radial-gradient(circle at 30% 30%, rgba(127, 99, 255, 0.28), rgba(127, 99, 255, 0.06));
}

.welcome-adv-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.welcome-adv h3 {
  margin: 0 0 12px;
  font-size: clamp(19px, 1.6vw, 24px);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.welcome-adv p {
  margin: 0;
  color: rgba(224, 221, 238, 0.67);
  font-size: 14px;
  line-height: 1.65;
}

.welcome-adv:nth-child(2) { transition-delay: 0.08s; }
.welcome-adv:nth-child(3) { transition-delay: 0.16s; }
.welcome-adv:nth-child(5) { transition-delay: 0.08s; }
.welcome-adv:nth-child(6) { transition-delay: 0.16s; }

.welcome-adv-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: clamp(40px, 6vw, 80px);
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.welcome-adv-stats div { display: grid; gap: 6px; }

.welcome-adv-stats strong {
  font-size: clamp(26px, 3vw, 44px);
  font-weight: 680;
  letter-spacing: -0.05em;
  line-height: 1;
  background: linear-gradient(120deg, #f5f3ff, #b4a8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome-adv-stats span {
  color: rgba(224, 221, 238, 0.55);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 1180px) {
  .welcome-adv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome-adv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .welcome-adv-grid, .welcome-adv-stats { grid-template-columns: 1fr; }
  .welcome-flora-img { animation-duration: 40s; }
}

body.reduced-motion .welcome-flora-img,
body.reduced-motion .welcome-flora-glint,
body.reduced-motion .welcome-marquee-track { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  .welcome-flora-img, .welcome-flora-glint, .welcome-marquee-track { animation: none; }
}