/* ============================================
   RULES PAGE STYLES
   Accordion layout with severity badges and TOC
   Colors are injected via banner.js from colors.json
============================================ */

:root {
  /* Fallback colors */
  --WHITE: #ffffff;
  --DARK: #000000;
  --TEXT: #cccccc;
  --TEXT_DIM: #999999;
  --RED_ACCENT: #D4949D;
  --RED: #C78B95;
  --BLUE: #8DBAC5;
  --BLUE_ACCENT: #6A9AA5;
  --CARD_BG: rgba(255,255,255,0.08);
  --CARD_SHADOW: #0004;
  --HIGHLIGHT: #8DBAC5;
  
  /* Rule-specific colors */
  --DANGER: #e85c5c;
  --DANGER_BG: rgba(232, 92, 92, 0.15);
  --WARNING: #e8a85c;
  --WARNING_BG: rgba(232, 168, 92, 0.15);
  --INFO_BG: rgba(141, 186, 197, 0.1);
  --TIP_BG: rgba(141, 186, 197, 0.08);
}

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

html {
  background: #000;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Exo 2', sans-serif;
  background: transparent;
  color: var(--TEXT);
  overflow-x: hidden;
  line-height: 1.6;
}

/* Starfield canvas */
#starfieldCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: transparent;
}

/* Fade animation */
.fade-slide-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-slide-in.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   MAIN CONTAINER
============================================ */

.rules-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ============================================
   HEADER SECTION
============================================ */

.rules-header {
  text-align: center;
  margin-bottom: 2rem;
}

.rules-header h1 {
  font-size: 2.4rem;
  font-weight: 700;
  margin: 0 0 1rem;
  background: linear-gradient(180deg, var(--BLUE) 30%, var(--BLUE_ACCENT) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rules-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--TEXT_DIM);
}

.meta-item svg {
  opacity: 0.7;
}

.meta-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-revised {
  background: rgba(141, 186, 197, 0.2);
  color: var(--BLUE);
  border: 1px solid var(--BLUE_ACCENT);
}

.rules-intro {
  font-size: 1rem;
  color: var(--TEXT);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ============================================
   BADGES
============================================ */

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.badge-ban {
  background: var(--DANGER_BG);
  color: var(--DANGER);
  border: 1px solid rgba(232, 92, 92, 0.3);
}

.badge-permaban {
  background: linear-gradient(135deg, rgba(232, 92, 92, 0.2), rgba(200, 60, 60, 0.3));
  color: #ff7070;
  border: 1px solid rgba(255, 100, 100, 0.4);
  animation: pulse-danger 2s ease-in-out infinite;
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.badge-warning {
  background: var(--WARNING_BG);
  color: var(--WARNING);
  border: 1px solid rgba(232, 168, 92, 0.3);
}

/* ============================================
   RULE ITEMS (ACCORDION)
============================================ */

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rule-item {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
  transition: background 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rule-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.1);
}

.rule-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--WHITE);
  font-family: 'Exo 2', sans-serif;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.rule-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.rule-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--BLUE_ACCENT);
  color: var(--DARK);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 6px;
  flex-shrink: 0;
}

.rule-title {
  flex: 1;
  font-weight: 600;
}

.rule-icon {
  font-size: 1.2rem;
  color: var(--BLUE);
  transition: transform 0.3s;
  margin-left: auto;
}

.rule-item.open .rule-icon {
  transform: rotate(45deg);
}

/* ============================================
   RULE CONTENT
============================================ */

.rule-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding: 0 1.25rem;
  background: rgba(0, 0, 0, 0.3);
}

.rule-content.open {
  max-height: 2000px;
  padding: 0 1.25rem 1.5rem;
}

.rule-content p {
  margin: 0 0 1rem;
  line-height: 1.7;
  color: var(--TEXT);
}

.rule-content h4 {
  color: var(--BLUE);
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(141, 186, 197, 0.2);
}

.rule-content h4:first-child {
  margin-top: 0.5rem;
}

.rule-content strong {
  color: var(--WHITE);
}

/* Rule lists */
.rule-list {
  margin: 0.5rem 0 1rem 1.5rem;
  padding: 0;
}

.rule-list li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.rule-list ul {
  margin: 0.5rem 0 0.5rem 1.5rem;
}

/* Danger list styling */
.danger-list li::marker {
  color: var(--DANGER);
}

/* Two-column list */
.two-column {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem 1.5rem;
}

@media (max-width: 500px) {
  .two-column {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   SPECIAL BOXES
============================================ */

.highlight-box {
  background: var(--INFO_BG);
  border-left: 3px solid var(--BLUE);
  padding: 1rem 1.25rem;
  border-radius: 0 6px 6px 0;
  margin: 1rem 0;
}

.info-box {
  background: var(--INFO_BG);
  border: 1px solid rgba(141, 186, 197, 0.2);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin: 1rem 0;
}

.info-box p {
  margin: 0 0 0.5rem;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.info-box ul {
  margin: 0.5rem 0 0.5rem 1.5rem;
  padding: 0;
}

.tip-box {
  background: var(--TIP_BG);
  border: 1px solid rgba(141, 186, 197, 0.15);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin: 1rem 0;
  color: var(--TEXT);
}

.warning-box {
  background: var(--DANGER_BG);
  border: 1px solid rgba(232, 92, 92, 0.25);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  margin: 1rem 0;
}

.warning-box p {
  margin: 0 0 0.5rem;
}

.warning-box p:last-child {
  margin-bottom: 0;
}

/* Text variants */
.warning-text {
  color: var(--WARNING);
  font-weight: 500;
}

.danger-text {
  color: var(--DANGER);
}

.info-text {
  color: var(--TEXT_DIM);
  font-size: 0.95rem;
}

.small-text {
  font-size: 0.9rem;
  color: var(--TEXT_DIM);
}

/* ============================================
   LINKS (Consistent styling)
============================================ */

.text-link,
.rules-intro a,
.rule-content a,
.rules-footer a {
  color: var(--BLUE);
  text-decoration: none;
  border-bottom: 1px solid rgba(141, 186, 197, 0.4);
  transition: color 0.2s, border-color 0.2s;
}

.text-link:hover,
.rules-intro a:hover,
.rule-content a:hover,
.rules-footer a:hover {
  color: var(--WHITE);
  border-bottom-color: var(--WHITE);
}

/* ============================================
   PUNISHMENTS TABLE (GUIDANCE)
============================================ */

.punishments-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.punishments-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--BLUE);
  margin: 0 0 0.75rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(141, 186, 197, 0.25);
}

.punishments-intro,
.punishments-disclaimer {
  font-size: 0.95rem;
  color: var(--TEXT);
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

.punishments-disclaimer {
  background: var(--WARNING_BG);
  border: 1px solid rgba(232, 168, 92, 0.25);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  color: var(--TEXT);
}

.punishments-table-wrap {
  overflow-x: auto;
  margin-top: 1.25rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
}

.punishments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.punishments-table th,
.punishments-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

.punishments-table th {
  background: rgba(141, 186, 197, 0.12);
  color: var(--BLUE);
  font-weight: 600;
  white-space: nowrap;
}

.punishments-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.punishments-table td:first-child {
  font-weight: 600;
  color: var(--WHITE);
  white-space: nowrap;
}

.punishments-table td:nth-child(2) {
  color: var(--TEXT);
}

.punishments-table td:nth-child(3) {
  color: var(--TEXT);
  min-width: 10rem;
}

.punishments-table td:nth-child(4) {
  color: var(--TEXT_DIM);
}

@media (max-width: 600px) {
  .punishments-table th,
  .punishments-table td {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* ============================================
   FOOTER
============================================ */

.rules-footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.rules-footer p {
  color: var(--TEXT_DIM);
  font-size: 0.95rem;
}

/* ============================================
   RESPONSIVE
============================================ */

@media (max-width: 768px) {
  .rules-container {
    padding: 1.5rem 1rem 3rem;
  }
  
  .rules-header h1 {
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .rules-header h1 {
    font-size: 1.75rem;
  }
  
  .rules-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .rule-header {
    padding: 0.875rem 1rem;
    gap: 0.5rem;
  }
  
  .rule-number {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }
  
  .rule-title {
    font-size: 0.95rem;
  }
  
  .badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
  }
  
  .rule-content {
    padding: 0 1rem;
  }
  
  .rule-content.open {
    padding: 0 1rem 1.25rem;
  }
  
  .toc-list a {
    font-size: 0.9rem;
  }
}

@media (max-width: 400px) {
  .rules-header h1 {
    font-size: 1.5rem;
  }
  
  .rule-header {
    flex-wrap: wrap;
  }
  
  .rule-header .badge {
    order: 4;
    margin-left: 36px;
    margin-top: -0.25rem;
  }
}

/* ============================================
   ACCESSIBILITY
============================================ */

@media (prefers-reduced-motion: reduce) {
  .fade-slide-in {
    transition: opacity 0.3s ease;
    transform: none;
  }
  
  .rule-content,
  .toc-list {
    transition: none;
  }
  
  .badge-permaban {
    animation: none;
  }
}

/* Focus styles */
.rule-header:focus-visible,
.toc-toggle:focus-visible,
.toc-list a:focus-visible {
  outline: 2px solid var(--BLUE);
  outline-offset: 2px;
}
