:root {
  /* ── CharmLand Site: Backgrounds ── */
  --bg: #6b50ff; /* Charple — page background */
  --bg-card: #fffdf5; /* Cream — light cards on purple */
  --bg-card-hover: #fffaef; /* Butter — card hover */
  --bg-elevated: #fffaef; /* Butter */
  --bg-nav: rgba(32, 31, 38, 0.98); /* Pepper alpha */
  --bg-section-alt: #201f26; /* Pepper — alt sections */
  --bg-alt: #201f26; /* Pepper — motto, user header */
  --bg-footer: #fffdf5; /* Cream — inverted footer */

  /* ── CharmLand Site: Text ── */
  --text: #fffdf5; /* Cream — body text on purple */
  --text-light: #bfbcc8; /* Smoke */
  --text-muted: #605f6b; /* Oyster — muted on cream */
  --card-text: #201f26; /* Pepper — text on cream cards */
  --card-title: #6b50ff; /* Charple — card titles */
  --card-title-hover: #fe3e78; /* BurstRed — hover on cream */
  --text-on-cream: #201f26; /* Pepper */
  --text-on-cream-muted: #605f6b; /* Oyster */
  --footer-text: #605f6b; /* Oyster — footer text */
  --footer-link: #ff7bf5; /* LinkPink — footer links */

  /* ── CharmLand Site: Accents ── */
  --accent: #fe3e78; /* BurstRed — primary */
  --accent-hover: #0adcdb; /* Turtle — hover/secondary */
  --accent-green: #00ffb2; /* Julep — badges, success */
  --link-green: #00ffb2; /* Julep — links */
  --accent-yellow: #ecfd65; /* ActiveYellow — experimental */
  --accent-purple: #9671ff; /* AccentPurple — independent status */
  --accent-warm: #ff6daa; /* Tuna — warm accent */
  --card-accent: #ff6daa; /* Tuna — card accent */
  --card-icon-color: #6b50ff; /* Charple — card icon on cream */
  --card-flair: #ff6daa; /* Tuna — card flair text */

  /* ── Buttons ── */
  --btn-bg: #ff6dff; /* ButtonMagenta */
  --btn-text: #fffdf5; /* Cream */
  --btn-outline-color: #fffdf5; /* Cream */

  /* ── Borders ── */
  --border: rgba(255, 253, 245, 0.25); /* Cream alpha — visible on purple */
  --border-accent: rgba(254, 62, 120, 0.3); /* BurstRed alpha */
  --border-hover: #e8fe96; /* Zest — community card hover */
  --border-card: rgba(32, 31, 38, 0.12); /* Pepper alpha — on cream cards */

  /* ── Overlay & interactive alphas ── */
  --hero-overlay: rgba(32, 31, 38, 0.55); /* Pepper alpha */
  --hover-accent-bg: rgba(254, 62, 120, 0.15); /* BurstRed alpha */
  --card-icon-bg: rgba(107, 80, 255, 0.12); /* Charple alpha */
  --shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1rem 1rem rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 0.25rem 0.25rem rgba(0, 0, 0, 0.25);

  /* ── Gradient glow ── */
  --glow-gradient: radial-gradient(
    circle,
    rgba(255, 123, 245, 0.6) 0%,
    rgba(255, 123, 245, 0) 70%
  );

  /* ── Animated gradient text ── */
  --gradient-text: linear-gradient(90deg, #fffdf5, #ff7bf5, #fffdf5);

  /* ── Fonts ── */
  --font-mono:
    'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Menlo',
    'Consolas', monospace;
  --font-sans:
    system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --max-width: 1100px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--glow-gradient);
  background-size: 2400px 2400px;
  background-position: 50% -1600px;
  background-repeat: no-repeat;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: overlay;
}

@keyframes bg-colorcycle {
  0% {
    background-position: 0 0;
  }
  to {
    background-position: 200% 0;
  }
}

a {
  color: var(--link-green);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--card-accent);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Navigation ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.nav-logo:hover {
  color: var(--text);
}

.logo-chest {
  color: var(--text);
}

.logo-tld {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  opacity: 0.7;
}

.nav-links a:hover {
  color: var(--accent-green);
  opacity: 1;
}

.nav-icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  opacity: 0.7;
}

#nav-icons {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-icon-link:hover {
  color: var(--accent-green);
  opacity: 1;
}

.nav-icon-link svg {
  flex-shrink: 0;
}

/* ── Liberapay ── */
/* Hidden until Liberapay account is fully set up.
   To enable: change display to "inline-flex" */
.nav-liberapay {
  display: none;
  align-items: center;
}

.nav-liberapay img {
  height: 28px;
  width: auto;
  border-radius: 4px;
}

/* ── Language Switcher ── */
.lang-switcher {
  position: relative;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lang-btn:hover {
  border-color: var(--link-green);
  color: var(--text);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  list-style: none;
  background: var(--bg-section-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0;
  min-width: 120px;
  box-shadow: var(--shadow-menu);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s;
  z-index: 200;
}

.lang-menu.lang-menu-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu li {
  padding: 0.4rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.section,
.section-alt,
.section-motto {
  border-bottom: 1px solid var(--border);
}

.lang-menu li:hover {
  background: var(--hover-accent-bg);
  color: var(--text);
}

.lang-menu li.lang-active {
  color: var(--link-green);
  font-weight: 700;
}

/* ── Hero ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  filter: saturate(1) contrast(1.1) brightness(0.7);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--hero-overlay);
}

.hero-noise {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.2;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
  max-width: 800px;
}

.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  min-height: 1.3em;
  background-image: var(--gradient-text);
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: 6s linear infinite bg-colorcycle;
}

.cursor {
  color: var(--accent-warm);
  -webkit-text-fill-color: var(--accent-warm);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text);
  opacity: 0.85;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.8rem;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    opacity 0.15s;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: var(--shadow-card);
}

.btn:hover {
  transform: translateY(1px);
  box-shadow: var(--shadow-card-hover);
}

.btn:not(.btn-primary):not(.btn-outline):hover {
  color: var(--link-green);
}

.btn:active {
  transform: translateY(2px);
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: var(--btn-bg);
}

.btn-primary:hover {
  opacity: 0.85;
  color: var(--btn-text);
}

.btn-outline {
  background: transparent;
  color: var(--btn-outline-color);
  border-color: var(--btn-outline-color);
}

.btn-outline:hover {
  background: var(--btn-outline-color);
  color: var(--bg);
}

.btn-small {
  font-size: 0.85rem;
  padding: 0.5rem 1.2rem;
}

/* ── Sections ── */
.section {
  padding: 5rem 0;
}

.section-alt {
  background: var(--bg-section-alt);
}

.section-title {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-sub {
  text-align: center;
  color: var(--text);
  opacity: 0.7;
  max-width: 600px;
  margin: 0 auto 3rem;
  font-size: 1.05rem;
}

.section-alt .section-sub {
  color: var(--text);
  opacity: 0.6;
}

/* ── Card Grid ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 1.5rem;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}

.card:hover {
  border-color: var(--card-accent);
  color: var(--card-text);
  transform: translateY(6px);
  box-shadow: var(--shadow-card-hover);
}

.card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-icon-bg);
  border-radius: 8px;
  color: var(--card-icon-color);
  font-family: var(--font-mono);
}

.card h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--card-title);
  transition: color 0.25s;
}

.card:hover h3 {
  color: var(--card-title-hover);
}

.card-flair {
  color: var(--card-flair);
  font-weight: 400;
  font-style: italic;
}

.card p {
  color: var(--card-text);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ── Feature Grid ── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 2rem;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.feature-card:hover {
  border-color: var(--card-accent);
  transform: translateY(6px);
  box-shadow: var(--shadow-card-hover);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-icon img {
  display: block;
  width: 48px;
  height: 48px;
}

.feature-card h3 {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--card-title);
  transition: color 0.25s;
}

.feature-card:hover h3 {
  color: var(--card-title-hover);
}

.feature-card p {
  color: var(--card-text);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
  flex: 1;
}

.feature-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.badge-version {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-on-cream-muted);
  background: var(--bg-card-hover);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

a .badge-version {
  color: var(--text-on-cream-muted);
}

/* ── Motto ── */
.section-motto {
  text-align: center;
  background: var(--bg-alt);
}

.motto {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.motto-sub {
  max-width: 650px;
  margin: 0 auto;
  color: var(--text);
  opacity: 0.7;
  font-size: 1.1rem;
  line-height: 1.7;
}

/* ── Community Grid ── */
.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.community-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--shadow-card);
}

.community-card:hover {
  border-color: var(--border-hover);
  transform: translateY(6px);
  box-shadow: var(--shadow-card-hover);
}

.community-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--card-accent);
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
}

.community-avatar-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--card-accent);
  background: var(--bg-card-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--card-title);
  margin: 0 auto 1rem;
}

.community-card h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--card-title);
  transition: color 0.25s;
}

.community-card:hover h3 {
  color: var(--card-title-hover);
}

.community-card-tagline {
  color: var(--text-on-cream-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.community-card-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--card-title);
  margin-bottom: 1rem;
}

.community-card .btn {
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
}

.community-card-yours {
  border-style: dashed;
  border-color: var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.community-card-yours .yours-icon {
  font-size: 2rem;
  color: var(--text-on-cream-muted);
  margin-bottom: 0.75rem;
}

.community-card-yours .yours-text {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-on-cream-muted);
  line-height: 1.5;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 3rem 0;
  background: var(--bg-footer);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
}

.footer .logo-chest {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--footer-text);
}

.footer .logo-tld {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--footer-link);
}

.footer-sub {
  color: var(--footer-text);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-links {
    gap: 0.75rem;
    font-size: 0.8rem;
  }

  .lang-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.45rem;
  }

  .hero-content {
    padding: 1rem;
  }

  .card-grid,
  .feature-grid,
  .community-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 3rem 0;
  }
}

/* ── Noise Canvas ── */
#noise canvas {
  width: 100%;
  height: 100%;
}

/* ── RTL Support ── */
body.rtl {
  text-align: right;
}

body.rtl .nav-inner {
  flex-direction: row-reverse;
}

body.rtl .nav-links {
  flex-direction: row-reverse;
}

body.rtl .feature-actions {
  flex-direction: row-reverse;
}

body.rtl .hero-cta {
  flex-direction: row-reverse;
}

body.rtl .card-grid,
body.rtl .feature-grid,
body.rtl .community-grid {
  direction: rtl;
}

body.rtl .lang-menu {
  right: auto;
  left: 0;
}
