/* ========================================
   VENARY — Design System & Global Styles
   ======================================== */

:root {
  /* Color Palette - Premium Fluid & Glass */
  --bg-primary: #05060A;
  --bg-secondary: #0A0C14;
  --bg-tertiary: #121520;
  --bg-card: rgba(10, 12, 20, 0.75);
  --bg-card-hover: rgba(18, 21, 32, 0.85);
  --bg-glass: rgba(5, 6, 10, 0.8);
  --bg-input: rgba(10, 12, 20, 0.85);

  /* Modern Accents */
  --neon-cyan: #29b6f6;
  --neon-magenta: #ab47bc;
  --neon-pink: #ec407a;
  --neon-green: #66bb6a;
  --neon-orange: #ffa726;
  --neon-yellow: #ffee58;
  --neon-blue: #42a5f5;
  --status-online: #39FF14;

  /* Gradient Combos */
  --gradient-primary: linear-gradient(135deg, #29b6f6 0%, #ab47bc 100%);
  --gradient-secondary: linear-gradient(135deg, #ab47bc 0%, #ec407a 100%);
  --gradient-accent: linear-gradient(135deg, #66bb6a 0%, #29b6f6 100%);
  --gradient-warm: linear-gradient(135deg, #ffa726 0%, #ec407a 100%);
  --gradient-dark: linear-gradient(135deg, #05060A 0%, #121520 100%);

  /* Text Colors */
  --text-primary: #f0f2f5;
  --text-secondary: #a3abb8;
  --text-muted: #6b7280;
  --text-highlight: #29b6f6;

  /* Borders - Refined Glass Edge */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(41, 182, 246, 0.4);

  /* Shadows - Modern Soft Depth */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-neon: 0 0 24px rgba(41, 182, 246, 0.2);
  --shadow-neon-strong: 0 0 40px rgba(41, 182, 246, 0.35);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-display: 'Orbitron', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-nav: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-particle: -1;

  /* Layout */
  --nav-width: 260px;
  --nav-collapsed: 72px;

  /* Nav Background — each theme overrides these for a distinct sidebar */
  --nav-bg: linear-gradient(180deg, rgba(5,6,10,0.88) 0%, rgba(10,12,20,0.85) 100%);
  --nav-border-glow: rgba(41, 182, 246, 0.12);
}

/* ========== Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
  line-height: 1.6;
}

a {
  color: var(--neon-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--neon-magenta);
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

::selection {
  background: rgba(0, 240, 255, 0.3);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 240, 255, 0.4);
}

/* ========== Particle & WebGL Canvas ========== */
#particle-canvas,
#webgl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ========== Utility Classes ========== */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ========== Animations ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes glowPulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(41, 182, 246, 0.15);
  }

  50% {
    box-shadow: 0 0 24px rgba(41, 182, 246, 0.3), 0 0 48px rgba(41, 182, 246, 0.1);
  }
}

@keyframes neonFlicker {

  0%,
  100% {
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.8), 0 0 12px rgba(41, 182, 246, 0.6), 0 0 24px rgba(41, 182, 246, 0.4);
  }

  50% {
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.5), 0 0 8px rgba(41, 182, 246, 0.3), 0 0 16px rgba(41, 182, 246, 0.2);
  }
}

@keyframes borderGlow {

  0%,
  100% {
    border-color: rgba(41, 182, 246, 0.2);
  }

  50% {
    border-color: rgba(41, 182, 246, 0.5);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal) ease-out;
}

.animate-fade-up {
  animation: fadeInUp var(--transition-slow) ease-out;
}

.animate-scale-in {
  animation: scaleIn var(--transition-normal) ease-out;
}

.animate-slide-right {
  animation: slideInRight var(--transition-slow) ease-out;
}

/* Staggered children animation */
.stagger-children>* {
  animation: fadeInUp 0.4s ease-out both;
}

.stagger-children>*:nth-child(1) {
  animation-delay: 0.05s;
}

.stagger-children>*:nth-child(2) {
  animation-delay: 0.1s;
}

.stagger-children>*:nth-child(3) {
  animation-delay: 0.15s;
}

.stagger-children>*:nth-child(4) {
  animation-delay: 0.2s;
}

.stagger-children>*:nth-child(5) {
  animation-delay: 0.25s;
}

.stagger-children>*:nth-child(6) {
  animation-delay: 0.3s;
}

.stagger-children>*:nth-child(7) {
  animation-delay: 0.35s;
}

.stagger-children>*:nth-child(8) {
  animation-delay: 0.4s;
}

.stagger-children>*:nth-child(9) {
  animation-delay: 0.45s;
}

.stagger-children>*:nth-child(10) {
  animation-delay: 0.5s;
}

/* ── Donation Rank Badge (inline, global) ── */
.rank-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  border: 1px solid;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ========== Media & Galleries ========== */
.post-image {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
}

.post-image img {
  width: 100%;
  height: auto;
  display: block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.post-image img:hover {
  transform: scale(1.02);
}

.post-gallery {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.gallery-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  color: #fff;
  pointer-events: none;
}

/* Grid Layouts */
.post-gallery.one-img {
  grid-template-columns: 1fr;
}

.post-gallery.two-imgs {
  grid-template-columns: 1fr 1fr;
  height: 300px;
}

.post-gallery.three-imgs {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 400px;
}

.post-gallery.three-imgs .gallery-item:first-child {
  grid-row: span 2;
}

.post-gallery.four-plus-imgs {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 400px;
}

@media (max-width: 600px) {

  .post-gallery.two-imgs,
  .post-gallery.three-imgs,
  .post-gallery.four-plus-imgs {
    height: 250px;
  }
}

.youtube-embed {
  position: relative;
  padding-bottom: 56.25%;
  /* 16:9 */
  height: 0;
  overflow: hidden;
}

.gallery-item iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gallery-item video {
  background: #000;
}

/* ========== Layout Modifiers ========== */
html.layout-wide .feed-page {
  max-width: 850px;
}

html.layout-wide .post-gallery.two-imgs,
html.layout-wide .post-gallery.three-imgs,
html.layout-wide .post-gallery.four-plus-imgs {
  height: 480px;
}

html.layout-compact {
  --space-sm: 4px;
  --space-md: 10px;
  --space-lg: 16px;
  --space-xl: 20px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  font-size: 14px;
}

html.layout-compact .post-card,
html.layout-compact .post-composer {
  padding: var(--space-md);
}

html.layout-compact .composer-textarea {
  min-height: 40px;
}

/* ========== Top Navbar Layout ========== */
@media (min-width: 769px) {
  html.layout-top-nav .main-nav {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 68px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 var(--space-xl);
    z-index: var(--z-nav);
    overflow: visible;
  }

  html.layout-top-nav .nav-brand {
    margin-bottom: 0;
    padding: 0;
    width: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-md);
  }

  html.layout-top-nav .nav-user {
    position: relative;
    top: auto; transform: none;
    margin-top: 0; border-top: none; border-left: none; padding: 0;
    margin-left: 0; flex-shrink: 0;
    display: flex; align-items: center; gap: var(--space-sm);
  }

  html.layout-top-nav .page-container,
  html.layout-top-nav .page-container.full-width {
    margin-left: 0;
    padding-top: calc(68px + var(--space-xl));
  }

  /* ─── Center link row ─── */
  html.layout-top-nav .nav-center-links {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
  }

  html.layout-top-nav .nav-links,
  html.layout-top-nav .ext-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide mobile button */
  html.layout-top-nav .mobile-only-nav-btn { display: none !important; }

  /* ─── Individual Nav Items ─── */
  html.layout-top-nav .nav-link {
    flex-shrink: 0;
    width: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 4px;
    margin: 0 2px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    position: relative;
    transition: background 0.2s, color 0.2s;
    height: 60px;
  }

  html.layout-top-nav .nav-link span {
    font-size: 0.79rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 96px;
    text-align: center;
  }

  html.layout-top-nav .nav-link.active {
    color: var(--neon-cyan);
    background: linear-gradient(180deg, transparent 0%, rgba(41,182,246,0.12) 100%);
  }

  html.layout-top-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 12%;
    width: 76%; height: 2.5px;
    border-radius: 99px 99px 0 0;
    background: var(--gradient-primary);
    box-shadow: 0 0 10px var(--neon-cyan);
  }

  html.layout-top-nav .nav-link.active::before { display: none; }

  /* ─── "More" overflow trigger ─── */
  html.layout-top-nav .nav-more-btn {
    display: none; /* JS shows this when items > 5 */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 80px;
    height: 60px;
    padding: 6px 4px;
    margin: 0 2px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.79rem;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
  }

  html.layout-top-nav .nav-more-btn:not(.hidden) { display: flex; }

  html.layout-top-nav .nav-more-btn:hover {
    background: rgba(41,182,246,0.08);
    color: var(--text-primary);
  }

  /* Portal Dropdown */
  html.layout-top-nav .dropdown-menu {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    box-shadow: var(--shadow-md);
    margin-top: 0;
  }

  /* ─── Dropdown group: behave like a peer nav-link in top-nav ─── */
  html.layout-top-nav .nav-dropdown-group {
    /* Row item in the flex bar — same height as other nav items */
    flex-direction: row;
    align-items: center;
    height: 68px;
    flex-shrink: 0;
  }

  /* Toggle button: column layout, centred — identical to <a class="nav-link"> */
  html.layout-top-nav .dropdown-toggle {
    width: 108px;
    height: 60px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 4px;
    margin: 0 2px;
    /* Remove sidebar overrides */
    justify-content: center !important;
  }

  /* Chevron: in column layout margin-left:auto pushes it nowhere useful; reset it */
  html.layout-top-nav .dropdown-chevron {
    margin-left: 0;
    /* Scale down slightly so all three elements fit in 60px */
    width: 12px;
    height: 12px;
  }
}

@media (max-width: 1080px) and (min-width: 769px) {
  html.layout-top-nav .nav-link { width: 88px; font-size: 0.75rem; }
  html.layout-top-nav .nav-link span { font-size: 0.72rem; max-width: 76px; }
}

/* ========== Nav Overflow Side Panel ========== */
.nav-overflow-panel {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  visibility: hidden;
}

.nav-overflow-panel.open {
  pointer-events: all;
  visibility: visible;
}

.nav-overflow-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
}

.nav-overflow-panel.open .nav-overflow-backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

.nav-overflow-drawer {
  position: absolute;
  top: 68px;
  right: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: var(--space-md) var(--space-sm);
  gap: var(--space-xs);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.nav-overflow-panel.open .nav-overflow-drawer {
  transform: translateX(0);
}

.nav-overflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-sm);
}

.nav-overflow-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.nav-overflow-close {
  padding: 4px;
  color: var(--text-secondary);
  line-height: 1;
}

.nav-overflow-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}

/* Nav links inside the overflow panel render as sidebar-style rows */
.nav-overflow-list .nav-link,
.nav-overflow-list .nav-dropdown-group .nav-link {
  width: 100% !important;
  height: auto !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  gap: var(--space-sm) !important;
  padding: 10px var(--space-sm) !important;
  margin: 0 !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.88rem !important;
  text-align: left;
}

.nav-overflow-list .nav-link span {
  font-size: 0.88rem !important;
  max-width: none !important;
  text-align: left !important;
}

.nav-overflow-list .nav-link.active::after { display: none; }

.nav-overflow-list .dropdown-menu {
  position: static !important;
  display: none;
  flex-direction: column;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 0 0 var(--space-lg) !important;
  margin: 0 !important;
}

.nav-overflow-list .nav-dropdown-group.open .dropdown-menu { display: flex; }


.appearance-tabs {
  display: flex;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}

.appearance-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 600;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.appearance-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
}

.appearance-pane {
  display: none;
  animation: fadeIn 0.3s ease;
  min-height: 250px;
}

.appearance-pane.active {
  display: block;
}

/* Card Grid for Layouts & Backgrounds */
.appearance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: var(--space-md);
}

.appearance-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-sm);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  overflow: hidden;
}

.appearance-card:hover {
  border-color: var(--border-primary);
  transform: translateY(-2px);
}

.appearance-card.selected {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.appearance-card.selected::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

.appearance-card .card-preview {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.appearance-card span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.appearance-card.selected span {
  color: var(--neon-cyan);
}

/* Swatches for Colors */
.swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.color-swatch-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
}

.color-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.color-swatch-wrapper:hover .color-swatch {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.color-swatch-wrapper.selected .color-swatch {
  border-color: #fff;
  transform: scale(1.1);
}

.color-swatch-wrapper span {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 60px;
  line-height: 1.2;
}

.color-swatch-wrapper.selected span {
  color: var(--text-primary);
}

/* Base Radius Styles toggled by JS */
html.style-radius-sharp {
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --radius-full: 0px;
  /* except maybe real circles */
}

html.style-radius-pill {
  --radius-sm: 12px;
  --radius-md: 24px;
  --radius-lg: 32px;
}

/* ========== Cyber-Float Sidebar Layout ========== */
@media (min-width: 769px) {
  html.layout-cyber-float .main-nav {
    left: 20px;
    top: 20px;
    height: calc(100vh - 40px);
    border-radius: 20px;
    background: rgba(10, 15, 25, 0.6);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(var(--neon-cyan-rgb, 0, 240, 255), 0.1);
    transition: all 0.3s ease;
    z-index: 1000;
  }
  
  html.layout-cyber-float .page-container {
    margin-left: 280px; /* 20px offset + 240px width + 20px margin */
    padding-top: 20px;
  }

  html.layout-cyber-float .nav-link {
    position: relative;
    border-radius: 12px;
    margin: 4px 10px;
    overflow: hidden;
    transition: transform 0.2s ease, background 0.3s ease;
  }

  html.layout-cyber-float .nav-link:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.05);
  }

  html.layout-cyber-float .nav-link::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 12px;
    padding: 2px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  html.layout-cyber-float .nav-link:hover::before {
    opacity: 1;
    animation: borderTrace 2s linear infinite;
  }

  html.layout-cyber-float .nav-link.active {
    background: linear-gradient(90deg, rgba(41,182,246, 0.2) 0%, transparent 100%);
    box-shadow: inset 3px 0 0 var(--neon-cyan);
    animation: neonPulse 2s infinite alternate;
  }
  
  html.layout-cyber-float .nav-link.active::before {
      display: none;
  }
}

/* ========== Neon-Bar Top Navbar Layout ========== */
@media (min-width: 769px) {
  html.layout-neon-bar .main-nav {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 72px;
    flex-direction: row;
    background: rgba(5, 5, 10, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    padding: 0 var(--space-xl);
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
  }

  html.layout-neon-bar .nav-brand {
    margin-bottom: 0; padding: 0; width: auto; flex-shrink: 0;
    display: flex; flex-direction: row; align-items: center;
  }

  html.layout-neon-bar .nav-user {
    position: relative; top: auto; transform: none; margin-top: 0;
    border-top: none; border-left: none; padding: 0; margin-left: 0;
    flex-shrink: 0; display: flex; align-items: center; gap: var(--space-sm);
  }

  html.layout-neon-bar .page-container,
  html.layout-neon-bar .page-container.full-width {
    margin-left: 0;
    padding-top: calc(72px + var(--space-xl));
  }

  html.layout-neon-bar .nav-center-links {
    flex: 1; min-width: 0; display: flex; flex-direction: row;
    align-items: center; justify-content: center; height: 100%;
    overflow: visible;
  }

  html.layout-neon-bar .nav-links,
  html.layout-neon-bar .ext-nav {
    display: flex; flex-direction: row; align-items: center;
    flex-shrink: 0; border: none !important; margin: 0; padding: 0; height: 100%;
  }

  html.layout-neon-bar .mobile-only-nav-btn { display: none !important; }

  html.layout-neon-bar .nav-link,
  html.layout-neon-bar .dropdown-toggle {
    flex-shrink: 0; width: 110px; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; color: var(--text-secondary); font-size: 0.79rem;
    border-radius: 0; margin: 0; padding: 0; transition: color 0.3s ease;
    position: relative;
  }

  html.layout-neon-bar .nav-link span {
    font-size: 0.79rem; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 96px; font-weight: 500;
  }

  html.layout-neon-bar .nav-link:hover,
  html.layout-neon-bar .dropdown-toggle:hover {
    color: #fff;
    background: transparent;
  }

  html.layout-neon-bar .nav-link.active {
    color: var(--neon-cyan);
    background: transparent;
  }

  html.layout-neon-bar .nav-link::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px;
    background: var(--gradient-primary); transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: center;
    box-shadow: 0 -2px 10px var(--neon-cyan);
  }

  html.layout-neon-bar .nav-link:hover::after,
  html.layout-neon-bar .nav-link.active::after {
    transform: scaleX(1);
  }

  html.layout-neon-bar .nav-more-btn {
    display: none; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; width: 110px; height: 100%; cursor: pointer; color: var(--text-secondary);
    background: transparent; border: none; font-family: inherit; font-size: 0.79rem;
    transition: color 0.3s ease;
  }
  
  html.layout-neon-bar .nav-more-btn:not(.hidden) { display: flex; }
  html.layout-neon-bar .nav-more-btn:hover { color: #fff; }

  html.layout-neon-bar .nav-dropdown-group {
    flex-direction: row; align-items: center; height: 100%; flex-shrink: 0; position: relative;
  }

  html.layout-neon-bar .dropdown-menu {
    background: rgba(10, 15, 25, 0.95); backdrop-filter: blur(20px);
    border: 1px solid var(--border-accent); border-radius: var(--radius-md);
    padding: var(--space-sm); top: calc(100% + 5px); min-width: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    animation: slideDown 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  }
  
  html.layout-neon-bar .dropdown-chevron { margin-left: 0; width: 12px; height: 12px; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes borderTrace {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@keyframes neonPulse {
  0% { box-shadow: inset 3px 0 0 var(--neon-cyan), 0 0 5px rgba(41, 182, 246, 0.2); }
  100% { box-shadow: inset 3px 0 0 var(--neon-cyan), 0 0 15px rgba(41, 182, 246, 0.6); }
}

/* ========== Personalization Modifiers (Glass & Borders) ========== */
html.glass-solid {
  --bg-card: var(--bg-secondary) !important;
}
html.glass-solid .post-card, html.glass-solid .appearance-card, html.glass-solid .dropdown-menu {
  backdrop-filter: none !important;
}
html.glass-heavy {
  --bg-card: rgba(5, 10, 15, 0.4) !important;
}
html.glass-heavy .post-card, html.glass-heavy .appearance-card, html.glass-heavy .dropdown-menu, html.glass-heavy .main-nav {
  backdrop-filter: blur(40px) !important;
}
html.glass-light {
  --bg-card: rgba(15, 20, 25, 0.85) !important;
}
html.glass-light .post-card, html.glass-light .appearance-card, html.glass-light .dropdown-menu, html.glass-light .main-nav {
  backdrop-filter: blur(8px) !important;
}

html.border-hidden .post-card, 
html.border-hidden .appearance-card, 
html.border-hidden .admin-stat-card, 
html.border-hidden .ext-card, 
html.border-hidden .comment,
html.border-hidden .input-field,
html.border-hidden .dropdown-menu {
  border-color: transparent !important;
}

html.border-glow .post-card,
html.border-glow .appearance-card,
html.border-glow .admin-stat-card,
html.border-glow .ext-card,
html.border-glow .comment,
html.border-glow .dropdown-menu {
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 15px rgba(41, 182, 246, 0.15) !important;
}
html.border-glow .input-field:focus {
  border-color: var(--neon-magenta) !important;
  box-shadow: 0 0 15px rgba(171, 71, 188, 0.3) !important;
}

/* ========== Nav Background Style Modifiers ========== */

/* Flat/Solid — replaces per-theme gradient with flat bg-secondary */
html.nav-solid .main-nav {
  background: var(--bg-secondary) !important;
  border-right-color: var(--border-light) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}

/* Accent-Top — flat background + colored bar across the top of the nav */
html.nav-accent .main-nav {
  background: var(--bg-secondary) !important;
  border-right-color: var(--border-light) !important;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
}
html.nav-accent .main-nav::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 0 0 2px 2px;
  z-index: 1;
}

/* ========== Card Settings Button (Customise bg) ========== */
.appearance-card {
  position: relative;
}
.card-settings-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.55);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast);
  z-index: 2;
}
.card-settings-btn:hover {
  background: var(--neon-cyan);
  color: #000;
  border-color: var(--neon-cyan);
}