/* ================================================================
   nav.css — shared site navigation
   Loaded by every page. Fixed height: 60px always.
   ================================================================ */

#site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--toolbar-border);
  flex-shrink: 0;
}

/* Logo */
#site-nav .nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 20px;
  text-decoration: none;
}
#site-nav .nav-logo img,
#site-nav .nav-logo svg {
  height: 40px;
  display: block;
  width: auto;
}

/* Page title (shown on sub-pages like Wordle) */
#site-nav .nav-page-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--purple);
  letter-spacing: -.02em;
  margin-right: 16px;
  flex-shrink: 0;
}

/* Left links (About etc.) */
#site-nav .nav-left {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

/* Right links (Join, Teacher, CTA) */
#site-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* Base link style */
#site-nav a,
#site-nav button.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 7px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s, color .12s;
  white-space: nowrap;
  line-height: 1;
}
#site-nav a:hover,
#site-nav button.nav-link:hover {
  background: none;
  color: var(--text-muted);
}

/* Active page indicator */
#site-nav a.nav-active {
  color: var(--purple);
  font-weight: 600;
  background: var(--purple-light);
}

/* Separator */
#site-nav .nav-sep {
  width: 1px;
  height: 20px;
  background: var(--toolbar-border);
  margin: 0 6px;
  flex-shrink: 0;
}

/* Signed-in user name pill */
#site-nav .nav-user {
  font-size: 13px;
  font-weight: 600;
  color: var(--btn-text);
  padding: 6px 10px;
  border-radius: 7px;
  white-space: nowrap;
}

/* CTA button */
#site-nav .nav-cta {
  font-size: 13px;
  font-weight: 600;
  color: #fff !important;
  background: var(--purple) !important;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  text-decoration: none;
  transition: background .12s !important;
}
#site-nav .nav-cta:hover {
  background: var(--purple-dark) !important;
}

/* More dropdown */
#site-nav .nav-dropdown {
  position: relative;
}
#site-nav .nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
}
#site-nav .nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--toolbar-border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  padding: 6px;
  z-index: 600;
}
#site-nav .nav-dropdown.open .nav-dropdown-menu {
  display: block;
}
#site-nav .nav-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
#site-nav .nav-dropdown-menu a:hover {
  background: var(--btn-hover);
  color: var(--btn-text);
}
#site-nav .nav-dropdown-menu a.nav-dd-active {
  color: var(--purple);
  font-weight: 600;
  background: var(--purple-light);
}
#site-nav .nav-dropdown-menu.nav-dd-right {
  left: auto;
  right: 0;
}
.nav-dd-sep {
  height: 1px;
  background: var(--toolbar-border);
  margin: 4px 6px;
}
.nav-dd-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 12px 2px;
  opacity: 0.6;
}

/* Buy Me a Coffee — subtle yellow tint */
#site-nav .nav-coffee {
  font-size: 13px;
  color: #92680a !important;
  background: #FEF3C7;
  border-radius: 7px;
  padding: 6px 11px;
}
#site-nav .nav-coffee:hover {
  background: #FDE68A !important;
  color: #78500a !important;
}

/* ── Footer ───────────────────────────────────────────────── */
#site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 48px;
  background: var(--surface);
  border-top: 1px solid var(--toolbar-border);
  flex-shrink: 0;
}
#site-footer .footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}
#site-footer .footer-links {
  display: flex;
  align-items: center;
  gap: 2px;
}
#site-footer a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}
#site-footer a:hover {
  color: var(--btn-text);
}

/* Mobile — collapse left links, keep right */
@media (max-width: 700px) {
  #site-nav { padding: 0 16px; }
  #site-nav .nav-left { display: none; }
  #site-nav .nav-logo { margin-right: 0; }
}
@media (max-width: 480px) {
  #site-nav .nav-sep { display: none; }
  #site-nav .nav-right a:not(.nav-cta) { display: none; }
}

/* ── Other Projects side drawer ───────────────────────────── */
.proj-tab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  background: var(--purple);
  color: #fff;
  padding: 18px 10px;
  border-radius: 0 10px 10px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 820;
  border: none;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background .15s, padding-left .15s;
  box-shadow: 2px 0 12px rgba(83,74,183,.2);
}
.proj-tab:hover { background: var(--purple-dark); padding-left: 14px; }


.proj-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1005;
  display: none;
}
.proj-backdrop.show { display: block; }

.proj-drawer {
  position: fixed;
  left: -300px;
  top: 0;
  height: 100%;
  width: 272px;
  background: var(--surface);
  border-right: 1px solid var(--toolbar-border);
  box-shadow: 8px 0 32px rgba(0,0,0,.12);
  z-index: 1010;
  transition: left .25s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  padding: 0;
}
.proj-drawer.open { left: 0; }

.proj-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
}

.proj-drawer .proj-panel { padding: 16px 20px 20px; }
.proj-drawer-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.proj-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--btn-border);
  background: none;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
  padding: 0;
}
.proj-close:hover { background: var(--btn-hover); color: var(--btn-text); }

.proj-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--toolbar-border);
  background: var(--bg);
  text-decoration: none;
  color: var(--btn-text);
  margin-bottom: 10px;
  transition: border-color .12s, background .12s, transform .12s;
}
.proj-item:hover {
  border-color: var(--purple);
  background: var(--purple-light);
  transform: translateX(2px);
}
.proj-item-icon {
  font-size: 22px;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--purple-light);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.proj-item-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.proj-item-desc { font-size: 12px; color: var(--text-muted); }

.proj-item--featured {
  border-color: var(--purple);
  background: var(--purple-light);
}
.proj-item--featured:hover { background: #dddcf8; }
.proj-item--featured .proj-item-icon { background: var(--purple); color: #fff; }

.proj-item-divider {
  border: none;
  border-top: 1px solid var(--toolbar-border);
  margin: 4px 0 12px;
}

/* ── Game Menu — categorized icon grid ──────────────────────── */
:root {
  --cat-maths:    #2d7dd2;
  --cat-words:    #D97706;
  --cat-logic:    #3e9a4a;
  --cat-creative: #D946A0;
}
.proj-cat { margin-bottom: 18px; }
.proj-cat:last-child { margin-bottom: 0; }
.proj-cat-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  padding: 0 2px;
}
.proj-cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.proj-cat-name {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.proj-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.proj-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.proj-tile-icon {
  width: 100%;
  aspect-ratio: 1;
  border: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--tile-accent) 16%, var(--surface-2));
  transition: transform .12s, background .12s;
}
.proj-tile:hover .proj-tile-icon { transform: translateY(-1px); }
.proj-tile:active .proj-tile-icon { transform: scale(.94); }
.proj-tile-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: none;
  color: var(--btn-text);
  text-align: center;
  line-height: 1.25;
}

/* ── Sidebar mode (home page) ─────────────────────────────── */
/* Shifts page content right so the drawer is a real column,  */
/* not an overlay. Nav bar sits in the right column above it. */
body.proj-sidebar {
  margin-left: 272px;
}
body.proj-sidebar .proj-drawer {
  z-index: 900;        /* below site-nav (1000) so nav overlaps at top */
  transition: none;    /* no slide animation — always open */
  box-shadow: 1px 0 0 var(--toolbar-border);
}
body.proj-sidebar .proj-tab      { display: none !important; }
body.proj-sidebar .proj-backdrop { display: none !important; }

@media (max-width: 700px) {
  /* On mobile, revert to normal drawer behaviour */
  body.proj-sidebar { margin-left: 0; }
  body.proj-sidebar .proj-drawer { z-index: 1010; transition: left .25s cubic-bezier(.4,0,.2,1); }
  body.proj-sidebar .proj-tab    { display: flex !important; }
}

/* ── Theme picker ──────────────────────────────────────────── */
.nav-theme-wrap {
  position: relative;
  flex-shrink: 0;
}
.nav-theme-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--toolbar-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 9100;
  min-width: 130px;
}
.nav-theme-menu.open { display: block; }
.nav-theme-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.theme-swatches {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
  background: var(--sw1);
  border-radius: 20px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,.15);
}
.theme-swatches span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  flex-shrink: 0;
}

/* Swatch colors — update these when a theme's palette changes */
.nav-theme-opt[data-theme="light"]  { --sw1: #f0eee8; --sw2: #534AB7; }
.nav-theme-opt[data-theme="dark"]   { --sw1: #111318; --sw2: #7B74D8; }
.nav-theme-opt[data-theme="ocean"]  { --sw1: #0b1e35; --sw2: #4BAED6; }
.nav-theme-opt[data-theme="forest"] { --sw1: #141f14; --sw2: #5EC05E; }
.nav-theme-opt[data-theme="rose"]   { --sw1: #fdf2f5; --sw2: #D946A0; }
.nav-theme-opt[data-theme="sand"]   { --sw1: #faf5ec; --sw2: #D97706; }
.nav-theme-opt[data-theme="sky"]    { --sw1: #eff6ff; --sw2: #2d7dd2; }
.nav-theme-opt[data-theme="slate"]  { --sw1: #1e2433; --sw2: #8899dd; }
.nav-theme-opt[data-theme="dusk"]   { --sw1: #12101e; --sw2: #C084FC; }
.theme-swatches span { background: var(--sw2); }
.nav-theme-opt:hover {
  background: var(--btn-hover);
  color: var(--btn-text);
}
.nav-theme-opt.active {
  color: var(--purple);
  font-weight: 600;
}

/* ── Info dropdown ─────────────────────────────────────────── */
.nav-info-wrap {
  position: relative;
  flex-shrink: 0;
}
.nav-info-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--toolbar-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 9100;
  min-width: 150px;
}
.nav-info-menu.open { display: block; }
.nav-info-opt {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-info-opt:hover {
  background: var(--btn-hover);
  color: var(--btn-text);
}


/* ── Site QR modal ──────────────────────────────────────────── */
#nav-qr-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9500;
}
#nav-qr-modal {
  background: var(--surface); border-radius: 18px; padding: 36px 40px;
  text-align: center; width: 320px; max-width: 92vw;
  box-shadow: 0 24px 60px rgba(0,0,0,.2); position: relative;
}
#nav-qr-close {
  position: absolute; top: 14px; right: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--btn-border); background: var(--surface);
  font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  color: var(--btn-text);
}
#nav-qr-close:hover { background: #FCEBEB; border-color: #E24B4A; color: #A32D2D; }
#nav-qr-modal h2 { font-size: 17px; font-weight: 700; color: var(--btn-text); margin-bottom: 4px; }
.nav-qr-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
#nav-qr-canvas { display: flex; justify-content: center; margin-bottom: 16px; }
#nav-qr-canvas img, #nav-qr-canvas canvas { border-radius: 8px; border: 4px solid var(--surface); box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.nav-qr-url { font-size: 11px; color: var(--text-muted); word-break: break-all; margin-bottom: 18px; line-height: 1.5; }
.nav-qr-copy-btn {
  width: 100%; padding: 10px; background: var(--purple); color: #fff;
  border: none; border-radius: 9px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background .12s;
}
.nav-qr-copy-btn:hover { background: var(--purple-dark); }
