/* =====================================================================
   NEXUS — Core Stylesheet
   Tokens, palettes, layout, components. Mode-specific overrides live in
   dark.css / light.css. Motion lives in animations.css.
   ===================================================================== */

/* ---------- Palette definitions ----------
   Each palette only redefines --accent + its soft/edge variants.
   Backgrounds/text come from the mode files, so palettes work in both. */
:root[data-palette="purple"]{ --accent:#7c5cff; --accent-2:#a78bfa; }
:root[data-palette="blue"]  { --accent:#3b82f6; --accent-2:#60a5fa; }
:root[data-palette="green"] { --accent:#10b981; --accent-2:#34d399; }
:root[data-palette="teal"]  { --accent:#14b8a6; --accent-2:#2dd4bf; }
:root[data-palette="pink"]  { --accent:#ec4899; --accent-2:#f472b6; }
:root[data-palette="orange"]{ --accent:#f59e0b; --accent-2:#fbbf24; }
:root[data-palette="red"]   { --accent:#ef4444; --accent-2:#f87171; }
:root[data-palette="ocean"] { --accent:#0ea5e9; --accent-2:#38bdf8; }

/* ---------- Shared tokens ---------- */
:root{
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  --font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-alt: "Manrope", system-ui, sans-serif;

  --wrap: 1200px;
  --layout-width: 90%;

  --step: 0.9rem;
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);

  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-edge: color-mix(in srgb, var(--accent) 40%, transparent);
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
}

/* ---------- Reset ---------- */
*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}
img{ display:block; max-width:100%; }
a{ color: inherit; text-decoration: none; }
svg{ width:100%; height:100%; fill:none; stroke: currentColor; stroke-width:1.9;
     stroke-linecap:round; stroke-linejoin:round; }
button{ font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- Layout wrapper ---------- */
.wrap{ width: var(--layout-width); max-width: var(--wrap); margin: 0 auto; }
body.boxed .wrap{ max-width: 1080px; }

.layout{
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 26px;
  padding: 30px 0 60px;
  align-items: start;
}
body.no-sidebar .layout{ grid-template-columns: 1fr; }
body.no-sidebar .sidebar{ display: none; }
.content{ min-width: 0; }

/* ===================================================================
   HEADER
   =================================================================== */
.site-header{
  position: sticky; top: 0; z-index: 60;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  transition: background .4s var(--ease), backdrop-filter .4s var(--ease),
              box-shadow .4s var(--ease), border-color .4s var(--ease);
}
.site-header.scrolled{
  background: var(--header-bg-scroll);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 8px 30px rgba(0,0,0,.28);
}
.header-inner{ display:flex; align-items:center; gap:24px; height:66px; }

.brand{ display:flex; align-items:center; gap:10px; font-family: var(--font-display); }
.brand-mark{
  width:30px; height:30px; display:grid; place-items:center;
  border-radius:9px; font-weight:800; font-size:.95rem; color:#fff;
  background: var(--grad);
  box-shadow: 0 4px 16px var(--accent-soft);
}
.brand-name{ font-weight:800; letter-spacing:.14em; font-size:1.05rem; }

.nav{ display:flex; align-items:center; gap:4px; margin-left:8px; }
.nav-link{
  position:relative; padding:8px 14px; border-radius:10px;
  font-size:.92rem; font-weight:500; color: var(--text-dim);
  transition: color .25s, background .25s;
}
.nav-link:hover{ color: var(--text); background: var(--hover); }
.nav-link.is-active{ color: var(--text); }
.nav-link.is-active::after{
  content:""; position:absolute; left:14px; right:14px; bottom:-1px; height:2px;
  border-radius:2px; background: var(--grad);
}
.nav-more{ position:relative; }
.nav-more-btn{ display:inline-flex; align-items:center; gap:5px; }
.chev{ width:15px; height:15px; transition: transform .25s; }
.nav-more[data-open] .chev{ transform: rotate(180deg); }
.nav-more-menu{
  position:absolute; top:calc(100% + 8px); right:0; min-width:150px;
  background: var(--card); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding:6px; display:grid; gap:2px;
  opacity:0; visibility:hidden; transform: translateY(6px);
  transition: all .22s var(--ease); box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
.nav-more[data-open] .nav-more-menu{ opacity:1; visibility:visible; transform:none; }
.nav-more-menu a{ padding:9px 12px; border-radius:9px; font-size:.9rem; color:var(--text-dim); }
.nav-more-menu a:hover{ background: var(--hover); color: var(--text); }

.header-actions{ display:flex; align-items:center; gap:6px; margin-left:auto; }
.icon-btn{
  position:relative; width:38px; height:38px; display:grid; place-items:center;
  border-radius:11px; color: var(--text-dim);
  transition: background .25s, color .25s, transform .25s;
}
.icon-btn svg{ width:19px; height:19px; }
.icon-btn:hover{ background: var(--hover); color: var(--text); transform: translateY(-1px); }
.icon-btn .dot{
  position:absolute; top:9px; right:9px; width:7px; height:7px; border-radius:50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--header-bg);
}
.avatar{
  width:36px; height:36px; border-radius:50%; color:#fff; font-weight:700;
  display:grid; place-items:center; background: var(--grad);
  box-shadow: 0 4px 14px var(--accent-soft); transition: transform .25s;
}
.avatar:hover{ transform: scale(1.06); }
.hamburger{ display:none; flex-direction:column; gap:4px; width:38px; height:38px;
  border-radius:11px; align-items:center; justify-content:center; }
.hamburger span{ width:18px; height:2px; background: var(--text); border-radius:2px;
  transition: transform .3s var(--ease), opacity .3s; }
.hamburger.open span:nth-child(1){ transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2){ opacity:0; }
.hamburger.open span:nth-child(3){ transform: translateY(-6px) rotate(-45deg); }

/* Offcanvas (mobile) */
.offcanvas{
  position: fixed; top:0; right:0; height:100dvh; width:min(78vw,320px); z-index:80;
  background: var(--card); border-left:1px solid var(--border);
  padding: 84px 18px 24px; display:flex; flex-direction:column; gap:6px;
  transform: translateX(100%); transition: transform .38s var(--ease-out);
}
.offcanvas.open{ transform:none; }
.offcanvas .nav-link{ font-size:1.05rem; padding:12px 14px; }
.offcanvas-scrim{
  position: fixed; inset:0; z-index:70; background: rgba(0,0,0,.5);
  opacity:0; visibility:hidden; transition: opacity .35s;
}
.offcanvas-scrim.show{ opacity:1; visibility:visible; }

/* ===================================================================
   HERO
   =================================================================== */
.hero{
  position: relative; overflow: hidden;
  border:1px solid var(--border); border-radius: var(--radius);
  background: var(--hero-bg);
  padding: 46px 44px; margin-bottom: 22px;
  display:grid; grid-template-columns: 1fr auto; align-items:center; gap:30px;
}
.hero::before{
  content:""; position:absolute; inset:0; pointer-events:none;
  background:
    radial-gradient(600px 300px at 78% 40%, var(--accent-soft), transparent 70%);
}
.hero-copy{ position:relative; z-index:1; max-width: 520px; }
.hero-title{
  font-family: var(--font-display); font-weight:800; letter-spacing:-.02em;
  font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin:0 0 12px; line-height:1.1;
}
.grad{ background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub{ color: var(--text-dim); font-size:1.02rem; margin:0 0 24px; }
.hero-cta{ display:flex; gap:12px; flex-wrap:wrap; }

/* Hero visual */
.hero-visual{ position:relative; width:250px; height:250px; z-index:1; }
.hex-glow{
  position:absolute; inset:-10%; border-radius:50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 62%);
  filter: blur(6px);
}
.hex{
  position:absolute; inset:0; margin:auto; width:190px; height:210px;
  clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
  background: linear-gradient(160deg, var(--accent-edge), transparent);
  border: 1px solid var(--accent-edge);
  display:grid; place-items:center;
}
.hex-inner{
  width:172px; height:190px;
  clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
  background: var(--hex-inner);
  display:grid; place-items:center;
}
.hex-inner span{
  font-family: var(--font-display); font-weight:800; font-size:4.6rem;
  background: var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.orb{ position:absolute; border-radius:50%; background: var(--accent); }
.orb-1{ width:8px; height:8px; top:8%; left:-6%; opacity:.85; }
.orb-2{ width:6px; height:6px; bottom:18%; right:-4%; opacity:.65; }
.orb-3{ width:5px; height:5px; top:60%; left:-2%; opacity:.5; }

/* ===================================================================
   ANNOUNCEMENT
   =================================================================== */
.announce{
  display:flex; align-items:center; gap:16px;
  border:1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); padding: 16px 20px; margin-bottom: 30px;
}
.announce-ico{
  width:34px; height:34px; flex:none; display:grid; place-items:center;
  border-radius:10px; color: var(--accent); background: var(--accent-soft);
}
.announce-ico svg{ width:18px; height:18px; }
.announce p{ margin:0; font-size:.94rem; color: var(--text-dim); flex:1; }

/* ===================================================================
   FORUMS
   =================================================================== */
.cat-title{
  font-family: var(--font-alt); font-weight:700; font-size:1rem;
  color: var(--accent-2); letter-spacing:.01em; margin: 26px 0 12px;
}
.cat{ display:flex; flex-direction:column; gap:10px; }

.forum-row{
  position:relative;
  display:grid; grid-template-columns: 52px 1fr auto auto 220px;
  align-items:center; gap:18px;
  padding: 18px 22px;
  border:1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card);
  transition: transform .3s var(--ease), border-color .3s var(--ease),
              box-shadow .3s var(--ease), background .3s var(--ease);
}
.forum-row::after{
  content:""; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
  box-shadow: 0 0 0 1px transparent; transition: box-shadow .3s;
}
.forum-row:hover{
  transform: translateY(-3px);
  border-color: var(--accent-edge);
  background: var(--card-hover);
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
}
.forum-row:hover::after{ box-shadow: 0 0 24px -6px var(--accent-edge) inset; }

.forum-ico{
  width:44px; height:44px; display:grid; place-items:center; border-radius:12px;
  color: var(--accent); background: var(--accent-soft);
  border:1px solid var(--accent-edge);
  transition: transform .4s var(--ease-out);
}
.forum-ico svg{ width:22px; height:22px; }
body.icon-anim .forum-row:hover .forum-ico{ transform: rotate(-8deg) scale(1.08); }

.forum-main h3{ margin:0 0 3px; font-size:1rem; font-weight:600; font-family: var(--font-alt); }
.forum-main p{ margin:0; font-size:.85rem; color: var(--text-mute); }

.forum-stat{ text-align:center; min-width:64px; }
.forum-stat b{ display:block; font-family: var(--font-alt); font-weight:700; font-size:.98rem; }
.forum-stat span{ font-size:.72rem; color: var(--text-mute); text-transform:uppercase; letter-spacing:.05em; }

.forum-last{ display:flex; align-items:center; gap:11px; min-width:0; }
.last-av{ width:38px; height:38px; border-radius:50%; flex:none; border:1px solid var(--border); }
.last-title{ display:block; font-size:.85rem; color: var(--accent-2); font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.forum-last a.last-title:hover{ text-decoration: underline; }
.last-meta{ font-size:.75rem; color: var(--text-mute); }

/* ===================================================================
   PALETTE STRIP
   =================================================================== */
.palette-grid{
  display:grid; grid-template-columns: repeat(8, 1fr); gap:12px;
}
.palette-card{
  border:1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--card); padding:16px 12px; text-align:center;
  cursor:pointer; transition: transform .25s, border-color .25s, box-shadow .25s;
}
.palette-card:hover{ transform: translateY(-3px); box-shadow: 0 14px 30px rgba(0,0,0,.24); }
.palette-card.is-active{ border-color: var(--pc); box-shadow: 0 0 0 1px var(--pc); }
.pc-dots{ display:flex; justify-content:center; gap:5px; margin-bottom:10px; }
.pc-dots i{ width:14px; height:14px; border-radius:50%; }
.palette-card span{ font-size:.8rem; color: var(--text-dim); font-weight:500; }

/* ===================================================================
   SIDEBAR
   =================================================================== */
.sidebar{ display:flex; flex-direction:column; gap:16px; position:sticky; top:88px; }
.widget{
  border:1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); padding:18px;
}
.widget-title{ margin:0 0 14px; font-size:.82rem; text-transform:uppercase;
  letter-spacing:.08em; color: var(--text-mute); font-weight:600; }
.stat-list{ list-style:none; margin:0; padding:0; display:grid; gap:10px; }
.stat-list li{ display:flex; justify-content:space-between; font-size:.9rem; }
.stat-list span{ color: var(--text-dim); }
.stat-list b{ font-family: var(--font-alt); }
.online-avatars{ display:flex; align-items:center; }
.online-avatars img{ width:34px; height:34px; border-radius:50%; margin-left:-8px;
  border:2px solid var(--card); }
.online-avatars img:first-child{ margin-left:0; }
.more-count{ margin-left:10px; font-size:.82rem; color: var(--text-dim); }
.mini-threads{ list-style:none; margin:0; padding:0; display:grid; gap:12px; }
.mini-threads li{ display:flex; justify-content:space-between; gap:10px; align-items:baseline; }
.mini-threads a{ font-size:.88rem; color: var(--text); }
.mini-threads a:hover{ color: var(--accent-2); }
.mini-threads span{ font-size:.75rem; color: var(--text-mute); flex:none; }

/* ===================================================================
   FOOTER
   =================================================================== */
.site-footer{ border-top:1px solid var(--border); background: var(--footer-bg); margin-top:20px; }
.footer-inner{ display:grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap:30px; padding:44px 0 30px; }
.foot-brand p{ color: var(--text-mute); font-size:.9rem; margin:12px 0 0; max-width:260px; }
.foot-col h5{ margin:0 0 14px; font-size:.82rem; text-transform:uppercase;
  letter-spacing:.06em; color: var(--text-dim); }
.foot-col a{ display:block; font-size:.9rem; color: var(--text-mute); margin-bottom:9px;
  transition: color .2s; }
.foot-col a:hover{ color: var(--accent-2); }
.socials{ display:flex; gap:10px; }
.socials a{ width:36px; height:36px; display:grid; place-items:center; border-radius:10px;
  background: var(--hover); color: var(--text-dim); margin:0; }
.socials a svg{ width:18px; height:18px; }
.socials a:hover{ color: var(--accent); background: var(--accent-soft); }
.foot-bottom{ display:flex; justify-content:space-between; padding:18px 0 30px;
  border-top:1px solid var(--border); font-size:.82rem; color: var(--text-mute); }
.foot-bottom b{ color: var(--text-dim); }

/* ===================================================================
   BUTTONS
   =================================================================== */
.btn{
  position:relative; overflow:hidden;
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:11px 20px; border-radius:12px; font-size:.9rem; font-weight:600;
  font-family: var(--font-alt); transition: transform .2s, box-shadow .3s, background .3s;
}
.btn-sm{ padding:8px 15px; font-size:.84rem; }
.btn-block{ width:100%; margin-top:8px; }
.btn-primary{ color:#fff; background: var(--grad); box-shadow: 0 6px 20px var(--accent-soft); }
.btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 10px 28px var(--accent-soft); }
.btn-ghost{ color: var(--text); background: var(--hover); border:1px solid var(--border); }
.btn-ghost:hover{ transform: translateY(-2px); border-color: var(--accent-edge); }
.save-ic{ width:16px; height:16px; }

/* Ripple */
.ripple{ position:absolute; border-radius:50%; transform: scale(0);
  background: rgba(255,255,255,.4); pointer-events:none; animation: ripple .6s var(--ease-out); }

/* ===================================================================
   CUSTOMIZER
   =================================================================== */
.customizer-fab{
  position: fixed; right:22px; bottom:22px; z-index:90;
  width:54px; height:54px; border-radius:16px; color:#fff;
  display:grid; place-items:center; background: var(--grad);
  box-shadow: 0 10px 30px var(--accent-soft);
  transition: transform .3s var(--ease);
}
.customizer-fab svg{ width:24px; height:24px; }
.customizer-fab:hover{ transform: translateY(-3px) rotate(8deg); }

.customizer{
  position: fixed; right:22px; bottom:22px; z-index:95;
  width:340px; max-width: calc(100vw - 32px);
  max-height: min(84vh, 720px); overflow:auto;
  background: var(--card); border:1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 30px 70px rgba(0,0,0,.5);
  transform: translateY(20px) scale(.96); opacity:0; visibility:hidden;
  transition: all .35s var(--ease-out);
}
.customizer.open{ transform:none; opacity:1; visibility:visible; }
.cz-head{ display:flex; align-items:center; gap:12px; padding:20px 20px 6px; }
.cz-icon{ width:34px; height:34px; display:grid; place-items:center; border-radius:11px;
  color: var(--accent); background: var(--accent-soft); }
.cz-icon svg{ width:18px; height:18px; }
.cz-head h3{ margin:0; font-family: var(--font-display); font-weight:700; font-size:1.05rem; flex:1; }
.cz-close{ width:30px; height:30px; border-radius:9px; color: var(--text-mute);
  font-size:.85rem; transition: background .2s, color .2s; }
.cz-close:hover{ background: var(--hover); color: var(--text); }
.cz-body{ padding:14px 20px 22px; }
.cz-group{ margin-bottom:20px; }
.cz-label{ display:block; font-size:.8rem; text-transform:uppercase; letter-spacing:.06em;
  color: var(--text-mute); margin-bottom:10px; font-weight:600; }

.mode-toggle{ display:grid; grid-template-columns:1fr 1fr; gap:4px; padding:4px;
  border:1px solid var(--border); border-radius:12px; background: var(--bg); }
.mode-toggle button{ padding:9px; border-radius:9px; font-size:.88rem; font-weight:600;
  color: var(--text-dim); transition: all .25s; }
.mode-toggle button.is-active{ color: var(--text); background: var(--card-hover);
  border:1px solid var(--accent-edge); box-shadow: 0 0 0 1px var(--accent-soft); }

.swatches{ display:flex; gap:11px; flex-wrap:wrap; }
.swatch{ width:30px; height:30px; border-radius:50%; position:relative;
  transition: transform .2s; box-shadow: 0 0 0 2px transparent; }
.swatch:hover{ transform: scale(1.12); }
.swatch.is-active{ box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px currentColor; }
.swatch.is-active::after{ content:"✓"; position:absolute; inset:0; display:grid;
  place-items:center; color:#fff; font-size:.75rem; font-weight:800; }

.slider-row{ display:flex; align-items:center; gap:14px; }
#widthSlider{ flex:1; -webkit-appearance:none; appearance:none; height:6px; border-radius:6px;
  background: var(--border); outline:none; }
#widthSlider::-webkit-slider-thumb{ -webkit-appearance:none; width:18px; height:18px;
  border-radius:50%; background: var(--accent); cursor:pointer;
  box-shadow: 0 2px 8px var(--accent-soft); }
#widthSlider::-moz-range-thumb{ width:18px; height:18px; border:none; border-radius:50%;
  background: var(--accent); cursor:pointer; }
.slider-val{ font-family: var(--font-alt); font-weight:700; font-size:.9rem; min-width:44px;
  text-align:right; }

.cz-toggles{ display:grid; gap:2px; margin-bottom:8px; }
.toggle-row{ display:flex; align-items:center; justify-content:space-between;
  padding:11px 0; border-bottom:1px solid var(--border); }
.toggle-row:last-child{ border-bottom:none; }
.toggle-row span{ font-size:.9rem; }
.switch{ position:relative; width:44px; height:24px; border-radius:20px; flex:none;
  background: var(--border); transition: background .3s; }
.switch::after{ content:""; position:absolute; top:3px; left:3px; width:18px; height:18px;
  border-radius:50%; background:#fff; transition: transform .3s var(--ease); }
.switch.on{ background: var(--accent); }
.switch.on::after{ transform: translateX(20px); }

/* Reveal-on-scroll base (motion in animations.css) */
.reveal{ opacity:0; transform: translateY(18px); }
.reveal.in{ opacity:1; transform:none; transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }

/* Accessibility */
:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; border-radius:6px; }

/* Compact mode */
body.compact .forum-row{ padding:12px 18px; }
body.compact .hero{ padding:32px 30px; }
body.compact .widget{ padding:14px; }

/* Toggle-driven feature switches */
body.no-particles #particles{ display:none; }
body.no-glow #mouse-glow{ display:none; }
body.no-banner .announce{ display:none; }
body.no-footer-widgets .foot-col:not(.foot-brand){ display:none; }
body.no-gradient .grad{ background:none; color: var(--accent); -webkit-text-fill-color: var(--accent); }
body.flat .forum-row, body.flat .widget, body.flat .hero, body.flat .announce{
  backdrop-filter:none; }
