/* ═══════════════════════════════════════════════════════════
   themes.css — Skin system (runtime-swappable themes).

   Colors are injected via JS into :root (see js/theme.js).
   This file only carries the STRUCTURAL deltas that can't be
   expressed as token overrides — extra rules that activate via
   html[data-theme="..."] when the matching skin is selected.

   Baseline (retro-mario) owns style.css; no rule here matches it.
   ═══════════════════════════════════════════════════════════ */


/* ══════════════════════════════════
   Home paint-palette button
   ══════════════════════════════════ */
.hub-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface);
  color: var(--dark);
  border: var(--px-border);
  box-shadow: var(--px-shadow-s);
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  margin-right: var(--sp-2);
}
.hub-theme-btn:hover  { transform: translateY(-1px); }
.hub-theme-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 0 var(--dark); }
.hub-theme-btn svg    { width: 22px; height: 22px; display: block; }


/* ══════════════════════════════════
   Picker sheet (reuses .gm-overlay + .gm-modal from style.css)
   ══════════════════════════════════ */
.theme-picker-modal {
  max-width: 560px;
  padding-top: var(--sp-5);
}
.theme-picker-hint {
  text-align: center;
  margin-bottom: var(--sp-4);
}
.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
@media (min-width: 640px) {
  .theme-picker-grid { grid-template-columns: repeat(4, 1fr); }
}

.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface);
  border: var(--px-border);
  box-shadow: var(--px-shadow-s);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: transform .12s ease, box-shadow .12s ease;
  font: inherit;
  color: inherit;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.selected {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}
.theme-card-preview {
  position: relative;
  height: 72px;
  border-radius: var(--radius-s);
  overflow: hidden;
  border: 1px solid var(--gray-4);
}
.theme-card-preview .tp-card {
  position: absolute; top: 10px; left: 10px; right: 10px; height: 22px;
  border-radius: 4px;
}
.theme-card-preview .tp-btn {
  position: absolute; bottom: 10px; left: 10px; width: 28px; height: 16px;
  border-radius: 3px;
}
.theme-card-preview .tp-line {
  position: absolute; bottom: 14px; height: 3px; border-radius: 2px;
}
.theme-card-preview .tp-line-1 { left: 46px; width: 40%; background: rgba(0,0,0,.25); }
.theme-card-preview .tp-line-2 { left: 46px; bottom: 22px; width: 28%; background: rgba(0,0,0,.15); }

/* Per-theme preview swatches — static, don't depend on current :root */
.theme-preview-retro-mario       { background: #F5F5F7; }
.theme-preview-retro-mario .tp-card { background: #FFFFFF; border: 2px solid #1D1D1F; box-shadow: 3px 3px 0 0 #1D1D1F; }
.theme-preview-retro-mario .tp-btn  { background: #F8B800; border: 2px solid #1D1D1F; box-shadow: 2px 2px 0 0 #1D1D1F; }

.theme-preview-modern-minimal    { background: #FAFAF9; }
.theme-preview-modern-minimal .tp-card { background: #FFFFFF; border: 1px solid #E4E4E7; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.theme-preview-modern-minimal .tp-btn  { background: #18181B; }

.theme-preview-glass             { background: linear-gradient(135deg, #667EEA, #F093FB 50%, #4FACFE); }
.theme-preview-glass .tp-card    { background: rgba(255,255,255,.28); border: 1px solid rgba(255,255,255,.5); backdrop-filter: blur(10px); }
.theme-preview-glass .tp-btn     { background: rgba(255,255,255,.85); }
.theme-preview-glass .tp-line-1  { background: rgba(255,255,255,.7); }
.theme-preview-glass .tp-line-2  { background: rgba(255,255,255,.45); }

.theme-preview-neon              { background: #0A0A18; }
.theme-preview-neon .tp-card     { background: #14142B; border: 1px solid #FF3DCB; box-shadow: 0 0 10px rgba(255,61,203,.5); }
.theme-preview-neon .tp-btn      { background: #00E5FF; box-shadow: 0 0 8px rgba(0,229,255,.6); }
.theme-preview-neon .tp-line-1   { background: rgba(0,229,255,.6); }
.theme-preview-neon .tp-line-2   { background: rgba(255,61,203,.5); }

.theme-card-label {
  font-weight: 800;
  font-size: .95rem;
  color: var(--dark);
}
.theme-card-desc {
  font-size: .78rem;
  color: var(--gray-2);
  line-height: 1.35;
}
.theme-card-check {
  position: absolute;
  top: var(--sp-2); right: var(--sp-2);
  width: 22px; height: 22px;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  font-size: .85rem;
  line-height: 22px;
  text-align: center;
  font-weight: 900;
  opacity: 0;
  transition: opacity .15s ease;
}
.theme-card.selected .theme-card-check { opacity: 1; }

.theme-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

@media (prefers-reduced-motion: reduce) {
  .theme-card, .hub-theme-btn { transition: none !important; }
}


/* ══════════════════════════════════════════════════════════════
   THEME: modern-minimal  — hairline borders, soft shadows, slim fonts
   ══════════════════════════════════════════════════════════════ */
html[data-theme="modern-minimal"] body {
  -webkit-font-smoothing: antialiased;
}
html[data-theme="modern-minimal"] .hub-wordmark,
html[data-theme="modern-minimal"] .app-title,
html[data-theme="modern-minimal"] .gm-title,
html[data-theme="modern-minimal"] .settings-card-title {
  font-weight: 700;
  letter-spacing: -.01em;
}
html[data-theme="modern-minimal"] .nav-btn {
  background: var(--surface);
  color: var(--dark);
  border: 1px solid var(--gray-4);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border-radius: 14px;
}
html[data-theme="modern-minimal"] .nav-btn:active {
  transform: scale(.96);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
/* Drop the mario block-bump animation; use a subtle scale press instead */
html[data-theme="modern-minimal"] .nav-btn.block-hit {
  animation: none;
  transform: scale(.94);
  transition: transform .18s ease;
}
/* Soften the retro "4px 4px 0" offset shadows everywhere */
html[data-theme="modern-minimal"] .subject-card,
html[data-theme="modern-minimal"] .unit-card,
html[data-theme="modern-minimal"] .quote-card,
html[data-theme="modern-minimal"] .settings-card,
html[data-theme="modern-minimal"] .gm-modal,
html[data-theme="modern-minimal"] .btn-primary,
html[data-theme="modern-minimal"] .btn-ghost {
  box-shadow: var(--px-shadow);
}
/* Remove the yellow/red star ribbons — too retro for minimal */
html[data-theme="modern-minimal"] .gm-modal::before,
html[data-theme="modern-minimal"] .gm-modal::after { content: none; }
html[data-theme="modern-minimal"] .gm-title { text-shadow: none; }
/* Quote card: softer surface, not pitch-black */
html[data-theme="modern-minimal"] .quote-card {
  background: var(--dark);
  color: var(--surface);
}


/* ══════════════════════════════════════════════════════════════
   THEME: glass  — gradient body, frosted translucent cards
   ══════════════════════════════════════════════════════════════ */
html[data-theme="glass"] body {
  background: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--dark);
}
/* The fixed gradient should show through every screen. Screens in
   style.css default to the --bg token; since --bg is now a gradient,
   setting background: transparent keeps the body's gradient visible. */
html[data-theme="glass"] .screen,
html[data-theme="glass"] .hub-shell,
html[data-theme="glass"] .screen-inner {
  background: transparent;
}
/* Frost every major surface */
html[data-theme="glass"] .subject-card,
html[data-theme="glass"] .unit-card,
html[data-theme="glass"] .quote-card,
html[data-theme="glass"] .settings-card,
html[data-theme="glass"] .gm-modal,
html[data-theme="glass"] .btn-primary,
html[data-theme="glass"] .btn-ghost,
html[data-theme="glass"] .nav-btn,
html[data-theme="glass"] .hub-theme-btn,
html[data-theme="glass"] .theme-card {
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
}
/* Text on gradient needs a little pop for legibility */
html[data-theme="glass"] .hub-wordmark,
html[data-theme="glass"] .hub-tagline,
html[data-theme="glass"] .app-title,
html[data-theme="glass"] .app-subtitle,
html[data-theme="glass"] .hub-section-label,
html[data-theme="glass"] .gm-title,
html[data-theme="glass"] .quote-text,
html[data-theme="glass"] .settings-card-title {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
html[data-theme="glass"] .quote-card {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.25);
}
/* Scanlines clash with glass — remove */
html[data-theme="glass"] .gm-modal {
  background-image: none;
  background: rgba(255,255,255,.22);
}
html[data-theme="glass"] .gm-modal::before,
html[data-theme="glass"] .gm-modal::after { content: none; }
html[data-theme="glass"] .gm-title { text-shadow: 0 1px 3px rgba(0,0,0,.25); }

/* Preview swatches in the picker should stay legible on glass bg too */
html[data-theme="glass"] .theme-card-label { color: #fff; }
html[data-theme="glass"] .theme-card-desc  { color: rgba(255,255,255,.85); }


/* ══════════════════════════════════════════════════════════════
   THEME: neon  — deep indigo, pink/cyan glow, mono headings
   ══════════════════════════════════════════════════════════════ */
html[data-theme="neon"] body {
  background: var(--bg);
  color: var(--dark);
}
html[data-theme="neon"] .hub-wordmark,
html[data-theme="neon"] .app-title,
html[data-theme="neon"] .gm-title,
html[data-theme="neon"] .hub-section-label,
html[data-theme="neon"] .settings-card-title {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-shadow: 0 0 10px var(--red), 0 0 2px var(--blue);
}
html[data-theme="neon"] .hub-go { color: var(--blue); text-shadow: 0 0 8px var(--blue); }
html[data-theme="neon"] .quote-card {
  background: var(--surface);
  color: var(--dark);
  border: 2px solid var(--blue);
  box-shadow: 0 0 14px rgba(0,229,255,.3);
}
html[data-theme="neon"] .quote-ornament,
html[data-theme="neon"] .quote-author { color: var(--red); }
html[data-theme="neon"] .subject-card,
html[data-theme="neon"] .unit-card,
html[data-theme="neon"] .settings-card,
html[data-theme="neon"] .gm-modal,
html[data-theme="neon"] .theme-card {
  background: var(--surface);
  border: 2px solid var(--red);
  box-shadow: 0 0 12px rgba(255,61,203,.35), 0 0 4px rgba(0,229,255,.25);
}
html[data-theme="neon"] .nav-btn {
  background: var(--surface);
  color: var(--blue);
  border: 2px solid var(--blue);
  box-shadow: 0 0 12px rgba(0,229,255,.5);
}
html[data-theme="neon"] .btn-primary {
  background: var(--red);
  color: #fff;
  border: 2px solid var(--red);
  box-shadow: 0 0 16px rgba(255,61,203,.6);
  text-shadow: 0 0 6px rgba(255,255,255,.5);
}
html[data-theme="neon"] .btn-ghost {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
}
/* Soften the modal ribbons — retain some nod to retro via pink ribbon */
html[data-theme="neon"] .gm-modal::before { color: var(--blue); text-shadow: 0 0 6px var(--blue); }
html[data-theme="neon"] .gm-modal::after  { color: var(--red);  text-shadow: 0 0 6px var(--red); }
html[data-theme="neon"] .gm-title { text-shadow: 0 0 10px var(--red), 0 0 2px var(--blue); }

/* Preview card text on dark neon bg */
html[data-theme="neon"] .theme-card-label { color: var(--dark); }
html[data-theme="neon"] .theme-card-desc  { color: var(--gray-2); }
