/* styles.css — MineralWild shared styles (index, privacy, terms, sources, 404) */

/* === CSS Variables === */
:root {
  /* Background layers */
  --bg-primary: #0D0D0D;
  --bg-secondary: #1A1A1A;
  --bg-tertiary: #222222;
  --border: #2A2A2A;

  /* Text layers */
  --text-primary: #E8E8E8;
  --text-secondary: #888888;
  --text-dim: #555555;

  /* Accent colors (mineral palette) */
  --accent: #C4A265;
  --accent-blue: #4A90A4;
  --accent-green: #2D8B6F;
  --accent-purple: #7B68AE;
  --error: #C45B4A;

  /* Radii */
  --radius-card: 6px;
  --radius-button: 6px;
  --radius-photo: 4px;
  --radius-chip: 4px;

  /* Fonts */
  --font-en: 'Space Grotesk', -apple-system, sans-serif;
  --font-cn: 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
}

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

/* === Base === */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-en);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

html[lang="zh-CN"] body {
  font-family: var(--font-cn);
}

/* === Typography === */
h1, h2, h3 {
  color: var(--text-primary);
  line-height: 1.2;
}
h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover {
  opacity: 0.8;
}

/* Shared typography classes */
.headline {
  font-weight: 700;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.subheadline {
  font-size: clamp(17px, 2.5vw, 21px);
  line-height: 1.6;
  color: var(--text-secondary);
  font-weight: 300;
  max-width: 560px;
}

.feature-title {
  font-weight: 600;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.feature-desc {
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.7;
  color: var(--text-secondary);
  font-weight: 300;
}

/* Legal page typography */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
th {
  color: var(--text-primary);
  font-weight: 600;
}

ul, ol {
  padding-left: 1.5rem;
  color: var(--text-secondary);
}
li {
  margin-bottom: 0.5rem;
}

/* === Button System === */
.btn-primary {
  display: inline-block;
  padding: 14px 32px;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-button);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:hover {
  opacity: 0.9;
  transform: scale(0.98);
  color: var(--bg-primary);
}

.btn-secondary {
  display: inline-block;
  padding: 14px 32px;
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 400;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s;
}
.btn-secondary:hover {
  border-color: var(--text-dim);
  color: var(--text-primary);
}

.nav-cta {
  padding: 7px 18px;
  font-size: 13px;
}

/* === Navigation === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  z-index: 100;
  font-size: 13px;
}

.nav-logo {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-button);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s;
}
.lang-toggle:hover {
  border-color: var(--text-dim);
  color: var(--text-primary);
}

/* === Footer === */
.footer {
  padding: 48px 24px 32px;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.footer-content {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-brand {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-dim);
  transition: color 0.2s;
}
.footer-links a:hover {
  color: var(--text-secondary);
  opacity: 1;
}

/* === Contact Tooltip === */
.contact-wrap {
  position: relative;
  display: inline-block;
}

.footer-contact-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}
.footer-contact-btn:hover {
  color: var(--text-secondary);
}

.contact-tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 210px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  pointer-events: none;
}

.contact-tooltip.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.contact-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.contact-tooltip a,
.contact-tooltip button {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.2s;
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.contact-tooltip a:hover,
.contact-tooltip button:hover {
  color: var(--accent);
  opacity: 1;
}

/* === Community Discord Button === */
.community-discord {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: none;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.community-discord:hover {
  border-color: var(--text-dim);
  color: var(--text-primary);
  opacity: 1;
}

/* === Section Divider === */
.section-divider {
  width: 48px;
  height: 1px;
  background: var(--border);
  margin: 0 auto 40px;
}

/* === Scroll-to-Light System === */
.js .lit-section {
  filter: grayscale(1) brightness(0.5);
  opacity: 0.35;
  transition: filter 1s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.js .lit-section.lit {
  filter: grayscale(0) brightness(1);
  opacity: 1;
}

/* Gold bloom line between sections */
.js .lit-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
  z-index: 1;
}

.js .lit-section.lit::after {
  width: min(600px, 80%);
}

/* Last section and sections that shouldn't have the line */
.js .lit-section:last-of-type::after {
  display: none;
}

/* Sections need position: relative for the ::after line */
.lit-section {
  position: relative;
}

/* === Sub-element stagger (triggered by parent .lit) === */
.js .lit-section .fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.js .lit-section.lit .fade-in {
  opacity: 1;
  transform: translateY(0);
}

.js .lit-section.lit .fade-in-delay-1 { transition-delay: 0.15s; }
.js .lit-section.lit .fade-in-delay-2 { transition-delay: 0.30s; }
.js .lit-section.lit .fade-in-delay-3 { transition-delay: 0.45s; }

/* === Scroll Hint === */
.scroll-hint {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 1s ease 1.2s;
  z-index: 1;
}

.js .lit-section.lit .scroll-hint {
  opacity: 0.5;
}

.scroll-hint span {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: pulse-line 2s ease-in-out infinite;
}

@keyframes pulse-line {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* === Collection Counter === */
.collection-counter {
  position: fixed;
  bottom: 28px;
  right: 28px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-dim);
  z-index: 99;
  opacity: 0.4;
  transition: opacity 0.5s ease, color 0.5s ease;
}

.collection-counter.complete {
  color: var(--accent);
  opacity: 0.8;
}

/* === Ambient Gold Glow === */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.5s ease;
  background: radial-gradient(ellipse at 50% 80%, rgba(196, 162, 101, 0.12) 0%, transparent 60%);
}

.ambient-glow.visible {
  opacity: 1;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  .js .lit-section {
    filter: none;
    opacity: 1;
    transition: none;
  }
  .js .lit-section::after {
    display: none;
  }
  .js .lit-section .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .scroll-line {
    animation: none;
  }
}

/* === Responsive === */
@media (max-width: 768px) {
  .nav {
    padding: 0 16px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .footer-links {
    justify-content: center;
  }

  .collection-counter {
    bottom: 16px;
    right: 16px;
    font-size: 12px;
  }

  .scroll-hint {
    bottom: 24px;
  }
}

@media (max-width: 480px) {
  .nav-cta span {
    display: none;
  }
}
