/* ===== CUSTOM PROPERTIES ===== */
:root {
  --bg: #0a0a0a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --red: #FF0000;
  --red-dim: #8B0000;
  --red-glow: rgba(255, 0, 0, 0.3);
  --red-subtle: rgba(255, 0, 0, 0.15);
  --crimson: #ED1305;
  --text: #f0f0f0;
  --text-dim: #a0a0a0;
  --text-muted: #666;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --max-w: 800px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
  overflow-x: hidden;
  position: relative;
}

/* ===== BACKGROUND PATTERN ===== */
.bg-pattern {
  position: fixed;
  inset: 0;
  background-image: url('/svg/pattern.svg');
  background-repeat: repeat;
  background-size: 60px 60px;
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.section-heading {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  text-transform: uppercase;
  color: var(--red);
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.section-heading::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: var(--red-dim);
  margin: 0.8rem auto 0;
}

/* ===== LAYOUT ===== */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 5rem 2rem;
  position: relative;
  z-index: 1;
}

/* ===== HERO ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.hero-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(80px);
  animation: glowPulse 4s ease-in-out infinite;
  pointer-events: none;
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4rem;
  position: relative;
  z-index: 1;
  max-width: 1000px;
  width: 100%;
}

.hero-text {
  flex: 1;
  text-align: left;
}

.hero-name {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: 0.08em;
}

.hero-title {
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  margin-top: 0.5rem;
}

.hero-line {
  width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  margin: 1.5rem 0;
}

.hero-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero-portrait {
  flex-shrink: 0;
}

/* ===== PORTRAIT ===== */
.portrait-wrapper {
  position: relative;
  display: inline-block;
}

.portrait {
  display: block;
  width: 320px;
  max-width: 80vw;
  border-radius: var(--radius);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  position: relative;
  z-index: 1;
}

.portrait:hover {
  transform: scale(1.03);
  box-shadow: 0 0 40px var(--red-glow);
}

.portrait-border {
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius) + 3px);
  border: 1px solid var(--red-subtle);
  pointer-events: none;
  transition: border-color 0.4s ease;
}

.portrait-wrapper:hover .portrait-border {
  border-color: var(--red);
}

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.stat-card {
  background: var(--bg-card);
  border-left: 3px solid var(--red-dim);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  backdrop-filter: blur(8px);
  transition: background 0.3s ease, transform 0.3s ease;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.stat-label {
  display: block;
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--text);
}

/* ===== BIOGRAPHY ===== */
.bio-block {
  margin-bottom: 2rem;
}

.bio-title {
  font-size: 1.3rem;
  color: var(--red);
  margin-bottom: 0.8rem;
}

.bio-text {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 2rem 0;
}

/* ===== ABILITIES ===== */
.abilities-subheading {
  font-size: 1.1rem;
  color: var(--red-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.2rem;
  font-family: 'Kdam Thmor Pro', sans-serif;
}

.abilities-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.ability-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  border: 1px solid var(--border);
  position: relative;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.ability-card:hover {
  transform: translateY(-2px);
  border-color: var(--red-dim);
}

.ability-name {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--text);
}

.ability-level {
  display: block;
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ===== LIKES & DISLIKES ===== */
.ld-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
}

.ld-heading {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.ld-likes-heading {
  color: var(--red-dim);
}

.ld-dislikes-heading {
  color: var(--red);
}

.ld-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ld-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  transition: background 0.3s ease;
  position: relative;
}

.ld-item:hover {
  background: var(--bg-card-hover);
}

.ld-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.6rem;
}

.like-bullet {
  background: var(--red-dim);
  box-shadow: 0 0 8px rgba(139, 0, 0, 0.5);
}

.dislike-bullet {
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

.ld-name {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.ld-desc {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ===== FOOTER ===== */
.site-footer {
  text-align: center;
  padding: 3rem 2rem 2rem;
  position: relative;
  z-index: 1;
}

.footer-line {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red-dim), transparent);
  margin: 0 auto 1.5rem;
}

.footer-text {
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ===== LOGIN MODAL ===== */
.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.login-modal.active {
  opacity: 1;
  pointer-events: all;
}

.login-box {
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 320px;
  max-width: 90vw;
  text-align: center;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.login-modal.active .login-box {
  transform: translateY(0);
}

.login-title {
  font-size: 1.4rem;
  color: var(--red);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.login-input {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.login-input:focus {
  border-color: var(--red-dim);
}

.login-btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.8rem;
  background: var(--red-dim);
  color: var(--text);
  border: none;
  border-radius: 8px;
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.login-btn:hover {
  background: var(--red);
  transform: scale(1.02);
}

.login-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.8rem;
  min-height: 1.2em;
}

.login-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

.login-close:hover {
  color: var(--text);
}

/* ===== LOCK BUTTON ===== */
.lock-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: rgba(20, 20, 20, 0.8);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: color 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(8px);
}

.lock-btn:hover {
  color: var(--red);
  border-color: var(--red-dim);
}

body.edit-mode .lock-btn {
  color: var(--red);
  border-color: var(--red);
}

/* ===== SAVE STATUS ===== */
.save-status {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.save-status.visible {
  opacity: 1;
}

.save-status.saving {
  color: var(--red);
}

.save-status.saved {
  color: #4a4;
}

.save-status.error {
  color: var(--red);
}

/* ===== EDIT MODE ===== */
.remove-btn,
.add-btn {
  display: none;
}

body.edit-mode .remove-btn {
  display: block;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

body.edit-mode .remove-btn:hover {
  color: var(--red);
}

body.edit-mode .add-btn {
  display: block;
  width: 100%;
  padding: 0.8rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: 'Kdam Thmor Pro', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s;
  margin-top: 0.5rem;
}

body.edit-mode .add-btn:hover {
  border-color: var(--red-dim);
  color: var(--red);
}

body.edit-mode [data-field] {
  outline: 1px dashed transparent;
  transition: outline-color 0.2s ease;
  cursor: text;
  border-radius: 4px;
}

body.edit-mode [data-field]:hover {
  outline-color: var(--red-subtle);
}

body.edit-mode [data-field]:focus {
  outline-color: var(--red);
  outline-style: solid;
}

body.edit-mode .portrait {
  cursor: pointer;
}

body.edit-mode .portrait:hover::after {
  content: 'Click to change';
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero-content {
    flex-direction: column;
    gap: 2rem;
  }

  .hero-text {
    text-align: center;
  }

  .hero-line {
    margin-left: auto;
    margin-right: auto;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .abilities-grid {
    grid-template-columns: 1fr;
  }

  .ld-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .section {
    padding: 3rem 1.5rem;
  }

  .hero-name {
    letter-spacing: 0.04em;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 2.5rem 1rem;
  }

  .portrait {
    width: 260px;
  }

  .stat-card {
    padding: 1rem 1.2rem;
  }
}
