/* ============================================================
   shared.css — PalworldBase Design System Foundation
   Dark theme, CSS custom properties, reset, typography, layout
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  /* Background & Surface */
  --color-bg: #0a0e14;
  --color-bg-elevated: #11161e;
  --color-bg-glass: rgba(255, 255, 255, 0.03);
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-surface-hover: rgba(255, 255, 255, 0.06);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(255, 255, 255, 0.14);

  /* Accent */
  --color-accent: #00d4ff;
  --color-accent-glow: rgba(0, 212, 255, 0.3);
  --color-accent-dim: rgba(0, 212, 255, 0.12);

  /* Text */
  --color-text: rgba(255, 255, 255, 0.85);
  --color-text-secondary: rgba(255, 255, 255, 0.55);
  --color-text-muted: rgba(255, 255, 255, 0.35);
  --color-text-inverse: #0a0e14;

  /* Status */
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-danger: #f87171;
  --color-info: #60a5fa;

  /* 9 Element Colors (high saturation, solid — for borders, badges, highlights) */
  --color-element-fire: #ff6b4a;
  --color-element-water: #4da6ff;
  --color-element-grass: #5cd859;
  --color-element-ground: #d4a040;
  --color-element-electric: #ffd940;
  --color-element-ice: #64d8e8;
  --color-element-dragon: #b080e0;
  --color-element-dark: #c860a0;
  --color-element-neutral: #9098a8;

  /* 12 Work Type Colors (subdued, for small badges — distinct but not competing with elements) */
  --color-work-kindling: #f07848;
  --color-work-watering: #58a0e8;
  --color-work-planting: #68c058;
  --color-work-generating: #f0c840;
  --color-work-handiwork: #e89840;
  --color-work-gathering: #80b040;
  --color-work-lumbering: #b89050;
  --color-work-mining: #9098a8;
  --color-work-medicine: #e870a0;
  --color-work-cooling: #58c0c8;
  --color-work-transporting: #60a0d0;
  --color-work-farming: #88b850;

  /* Rarity Colors */
  --color-rarity-legendary: #facc15;
  --color-rarity-epic: #c084fc;
  --color-rarity-rare: #60a5fa;
  --color-rarity-uncommon: #34d399;
  --color-rarity-common: #9ca3af;

  /* Tier Badge Colors */
  --color-tier-s: #facc15;
  --color-tier-a: #c084fc;
  --color-tier-b: #60a5fa;

  /* Typography */
  --font-display: 'Orbitron', system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing Scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 800px;
  --content-padding: var(--space-4);
  --header-height: 56px;
  --header-height-mobile: 48px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows & Glow */
  --glow-accent: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-accent-strong: 0 0 40px rgba(0, 212, 255, 0.5);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Ad Placeholder (fixed height to prevent CLS) */
  --ad-height: 90px;
}

/* ---- Light Theme Override (future-proof) ---- */
:root[data-theme="light"] {
  --color-bg: #f8f9fa;
  --color-bg-elevated: #ffffff;
  --color-bg-glass: rgba(0, 0, 0, 0.02);
  --color-surface: rgba(0, 0, 0, 0.03);
  --color-surface-hover: rgba(0, 0, 0, 0.05);
  --color-border: rgba(0, 0, 0, 0.1);
  --color-border-hover: rgba(0, 0, 0, 0.18);
  --color-text: rgba(0, 0, 0, 0.87);
  --color-text-secondary: rgba(0, 0, 0, 0.6);
  --color-text-muted: rgba(0, 0, 0, 0.38);
  --color-text-inverse: #ffffff;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Subtle accent glow — depth without DOM overhead */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(0, 212, 255, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

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

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

a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

ul, ol {
  list-style: none;
}

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

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

table {
  border-collapse: collapse;
  width: 100%;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  letter-spacing: 0.01em;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-family: var(--font-body);
  font-weight: 600;
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-secondary);
}

small {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

strong {
  font-weight: 600;
  color: var(--color-text);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ---- Layout Utilities ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

.container-narrow {
  max-width: var(--container-narrow);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Flex & Grid helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing */
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }

/* Section spacing */
.section {
  padding: var(--space-12) 0;
}

.section-alt {
  background: var(--color-bg-elevated);
  border-top: 1px solid rgba(0, 212, 255, 0.05);
  border-bottom: 1px solid rgba(0, 212, 255, 0.05);
}

/* Section intro (centered header with label) */
.section-intro {
  text-align: center;
  margin-bottom: var(--space-8);
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.section-desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  margin-bottom: 0;
}

/* Section variants for differentiated spacing */
.section-showcase {
  padding: var(--space-12) 0;
}

.section-guides {
  padding: var(--space-12) 0;
}

.section-about {
  padding: var(--space-8) 0 var(--space-12);
}

/* Visual separator (three centered accent dots) */
.section-separator {
  text-align: center;
  color: var(--color-accent);
  font-size: 0.875rem;
  letter-spacing: 0.3em;
  opacity: 0.35;
  margin-bottom: var(--space-6);
  user-select: none;
}

/* ---- Scrollbar (dark theme) ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ---- Focus styles ---- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---- Selection ---- */
::selection {
  background: var(--color-accent-dim);
  color: var(--color-text);
}

/* ---- Print ---- */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .no-print {
    display: none !important;
  }
}
