/* Personalization: wallpapers, text/spacing scale, collapsible sidebar, colour picker, sounds UI, celebration.
   Loaded AFTER styles.css so its tokens win. No inline styles — the JS applies dynamic bits via CSSOM. */

/* ---------- Wallpaper layer (fixed, behind content, above the body gradient) ---------- */
#wallpaper { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center; background-repeat: no-repeat; pointer-events: none; }
#wallpaper::after { content: ''; position: absolute; inset: 0; background: #030c14; opacity: var(--scrim, .6); }
body[data-wallpaper=default] #wallpaper { display: none; }
body[data-wallpaper=none] #wallpaper { background: #050f19; }
body[data-wallpaper=aurora] #wallpaper { background: linear-gradient(135deg, #04212b, #0a3b40 38%, #123a5e 68%, #2a1a4a); }
body[data-wallpaper=deep] #wallpaper { background: radial-gradient(circle at 28% 18%, #0d3350, #020910 62%); }
body[data-wallpaper=nebula] #wallpaper { background: radial-gradient(ellipse at 72% 28%, #3a1a5e, #0b1430 52%, #02060e), radial-gradient(ellipse at 20% 80%, #123a5e55, transparent 50%); }
/* when a wallpaper is on, let it show through the chrome a little */
body:not([data-wallpaper=default]) .topbar { background: transparent; }
body:not([data-wallpaper=default]) .sidebar { background: linear-gradient(180deg, #04111deb, #020910f2); }

/* ---------- Text size (on <html> so rem-based sizes scale too) ---------- */
html[data-text] body { font-size: 1rem; }
html[data-text=small] { font-size: 15px; }
html[data-text=normal] { font-size: 16px; }
html[data-text=large] { font-size: 18px; }
html[data-text=xl] { font-size: 20px; }

/* ---------- Spacing scale (on <body> so it overrides any stale density tokens) ---------- */
body[data-space=compact] { --gap: 14px; --pad: 18px; --pad-sm: 12px; }
body[data-space=normal] { --gap: 20px; --pad: 24px; --pad-sm: 16px; }
body[data-space=cozy] { --gap: 26px; --pad: 30px; --pad-sm: 20px; --radius: 1rem; }
body[data-space=spacious] { --gap: 34px; --pad: 40px; --pad-sm: 26px; --radius: 1.1rem; --radius-sm: 14px; }

/* ---------- Burger button ---------- */
.nav-burger { align-self: center; flex: none; }
.nav-burger .burger-ico { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.nav-burger .burger-ico::before, .nav-burger .burger-ico::after { content: ''; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.nav-burger .burger-ico::before { top: -6px; }
.nav-burger .burger-ico::after { top: 6px; }

/* ---------- Collapsible sidebar — desktop only (mobile uses the bottom bar) ---------- */
@media (min-width: 721px) {
  /* Not on the launcher: it hides the sidebar, so a rail column would leave main as the first grid
     item and squeeze it into 76px. The launcher declares its own single column. */
  body[data-nav=collapsed]:not([data-screen=start]) .app { grid-template-columns: 76px minmax(0, 1fr); }
  body[data-nav=collapsed] .sidebar { padding: 24px 12px 20px; gap: 16px; }
  body[data-nav=collapsed] .brand { justify-content: center; gap: 0; }
  body[data-nav=collapsed] .brand span, body[data-nav=collapsed] .tagline,
  body[data-nav=collapsed] .mainnav a b, body[data-nav=collapsed] .nav-more-btn b,
  body[data-nav=collapsed] .sidebar-foot p { display: none; }
  body[data-nav=collapsed] .mainnav a, body[data-nav=collapsed] .nav-more-btn { justify-content: center; padding: 11px 0; }
  body[data-nav=collapsed] .mainnav a .ico { width: auto; }
  body[data-nav=collapsed] .sidebar-foot { padding: 14px 0 0; text-align: center; }
  body[data-nav=collapsed] .nav-more .menu { left: 0; }
}

/* ---------- Mobile: burger opens a full drawer over the bottom bar ---------- */
@media (max-width: 720px) {
  body.nav-open::before { content: ''; position: fixed; inset: 0; background: #000a; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 48; }
  body.nav-open .sidebar { position: fixed; inset: 0 auto 0 0; height: 100vh; width: min(286px, 84vw); flex-direction: column; gap: 18px; padding: 26px 16px calc(20px + env(safe-area-inset-bottom)); border-right: 1px solid var(--line); border-top: 0; background: #04111df7; overflow-y: auto; z-index: 50; animation: jo-slide-in .24s ease both; }
  body.nav-open .brand, body.nav-open .tagline, body.nav-open .sidebar-foot { display: flex; }
  body.nav-open .tagline { display: block; }
  body.nav-open .mainnav { flex-direction: column; gap: 5px; }
  body.nav-open .mainnav a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px; padding: 10px 12px; font-size: .9rem; text-align: left; }
  body[data-nav=collapsed] .app { grid-template-columns: 1fr; }
}
@keyframes jo-slide-in { from { transform: translateX(-100%); } to { transform: none; } }

/* ---------- Appearance settings controls ---------- */
.look-card { display: flex; flex-direction: column; gap: 14px; }
.color-pick input[type=color] { width: 42px; height: 34px; padding: 2px; border: 1px solid var(--control); border-radius: 8px; background: #040e19; cursor: pointer; vertical-align: middle; }
.scrim-range, input[type=range].scrim-range { -webkit-appearance: none; appearance: none; width: 200px; max-width: 60%; height: 6px; border-radius: 99px; background: #0f2a3d; outline-offset: 4px; vertical-align: middle; }
.scrim-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--deep, #030c14); }
.scrim-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--deep, #030c14); }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
.wp-tile { position: relative; height: 70px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; color: #eaf4ff; background: #071827; padding: 0; }
.wp-tile span { position: absolute; left: 8px; bottom: 6px; z-index: 1; font-size: 11px; font-weight: 600; text-shadow: 0 1px 4px #000c; }
.wp-tile::before { content: ''; position: absolute; inset: 0; }
.wp-tile.wp-default::before { background: radial-gradient(ellipse at 75% 0%, #092036, transparent 46%), linear-gradient(150deg, #030c14, #020910); }
.wp-tile.wp-none::before { background: #050f19; }
.wp-tile.wp-mountains::before { background: linear-gradient(90deg, #030c14cc, #030c1466), url('mountains.jpg') center/cover; }
.wp-tile.wp-aurora::before { background: linear-gradient(135deg, #04212b, #0a3b40 40%, #123a5e 70%, #2a1a4a); }
.wp-tile.wp-deep::before { background: radial-gradient(circle at 28% 18%, #0d3350, #020910 62%); }
.wp-tile.wp-nebula::before { background: radial-gradient(ellipse at 72% 28%, #3a1a5e, #0b1430 52%, #02060e); }
.wp-tile.wp-custom::before { background: repeating-linear-gradient(45deg, #0c2333, #0c2333 8px, #112c40 8px, #112c40 16px); }
.wp-tile:hover { border-color: var(--accent); }
.wp-tile[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.look-range-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Celebration ---------- */
.celebrate-canvas { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }
