/* =====================================================
   Professionals Playground — Main Stylesheet
   ===================================================== */

:root {
  --bg-dark: #0d0f14;
  --bg-card: #161a22;
  --bg-nav: #0a0c10ee;
  --accent: #e8a020;
  --accent-dim: #b87c12;
  --text-primary: #e8eaf0;
  --text-secondary: #9aa0b0;
  --border: #2a2f3d;
  --danger: #e05050;

  /* Accessibility overrides (toggled via JS) */
  --font-size-base: 16px;
  --line-height-base: 1.7;
}

/* ---- Accessibility: High-Contrast Mode ---- */
body.hc-mode {
  --bg-dark: #000000;
  --bg-card: #111111;
  --bg-nav: #000000ee;
  --accent: #ffd700;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --border: #ffffff44;
}

/* ---- Accessibility: Reduce Motion ---- */
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
body.reduce-motion { scroll-behavior: auto !important; }

/* ---- Accessibility: Dyslexia-Friendly Font ---- */
body.dyslexia-font,
body.dyslexia-font * {
  font-family: 'Trebuchet MS', 'Verdana', 'Arial', sans-serif !important;
  letter-spacing: 0.06em;
  word-spacing: 0.12em;
  line-height: 1.9 !important;
}

/* ---- Accessibility: Enhanced Focus Outlines ---- */
body.enhanced-focus *:focus,
body.enhanced-focus *:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 6px rgba(232,160,32,0.28) !important;
}

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

html {
  scroll-behavior: smooth;
  font-size: var(--font-size-base);
}

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: var(--line-height-base);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; outline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--accent); }

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

/* ---- Navigation ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg-nav);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}
.nav-logo:hover { text-decoration: none; opacity: 0.85; }

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
  text-decoration: none;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

@media (max-width: 680px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem 1rem;
  }

  .nav-links.open { display: flex; }
  .nav-links a {
    width: 100%;
    padding: 1rem 0.5rem;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border);
    min-height: 48px;
    display: flex;
    align-items: center;
  }
  .nav-links li:last-child a { border-bottom: none; }
}

/* ---- Accessibility Widget ---- */
#a11y-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  transition: background 0.2s;
}
#a11y-btn:hover { background: var(--border); }

#a11y-panel {
  display: none;
  position: fixed;
  bottom: 4.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  z-index: 500;
  min-width: 260px;
  max-width: 92vw;
  box-shadow: 0 8px 32px #0008;
}
#a11y-panel.open { display: block; }

#a11y-panel h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.9rem;
}

.a11y-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.a11y-option:last-child { margin-bottom: 0; }

/* Slider option */
.a11y-slider-wrap {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.a11y-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}
.a11y-range-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 2.8rem;
  text-align: right;
}
input[type='range'].a11y-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
  margin: 0.2rem 0;
}

/* Reset button */
.a11y-reset {
  width: 100%;
  margin-top: 0.85rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: border-color 0.2s, color 0.2s;
}
.a11y-reset:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s;
}

.toggle-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}

.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before {
  transform: translateX(20px);
  background: #fff;
}
.toggle-switch input:focus-visible + .toggle-track { outline: 2px solid var(--accent); }

/* Floating a11y toggle button */
#a11y-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 499;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px #0006;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#a11y-float:hover { background: var(--accent-dim); }

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 4rem;
  background: radial-gradient(ellipse at 50% 0%, #1e2a1a 0%, var(--bg-dark) 70%);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.btn-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--accent); color: #000; }
/* Keep btn-primary text black in every link state (visited, hover, active) */
.btn-primary:visited,
.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus { color: #000; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-donate {
  background: #ff5e5b;
  color: #fff;
  border: none;
  padding: 0.45rem 1rem;
  font-size: 0.87rem;
}
.btn-donate:visited,
.btn-donate:hover,
.btn-donate:active,
.btn-donate:focus { color: #fff; }

/* Nav action items (Web App + Donate) — pill buttons inside nav-links */
.nav-links .nav-action {
  margin-left: 0.35rem;
}
.nav-links .nav-action a {
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.83rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.nav-links .nav-webapp a {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
}
.nav-links .nav-webapp a:hover {
  background: rgba(232,160,32,0.12);
  color: var(--accent);
}
.nav-links .nav-kofi a {
  background: #ff5e5b;
  color: #fff;
  border: 1px solid transparent;
}
.nav-links .nav-kofi a:hover,
.nav-links .nav-kofi a:visited,
.nav-links .nav-kofi a:active,
.nav-links .nav-kofi a:focus { color: #fff; }
.nav-links .nav-kofi a:hover { background: #e04c4a; }

@media (max-width: 680px) {
  .nav-links .nav-action { margin-left: 0; width: 100%; }
  .nav-links .nav-action a {
    border-radius: 6px;
    width: 100%;
    font-size: 1.05rem;
    padding: 1rem 0.5rem;
    justify-content: flex-start;
    background: transparent !important;
    border: none !important;
  }
  .nav-links .nav-webapp a { color: var(--accent) !important; }
  .nav-links .nav-kofi a { color: #ff5e5b !important; }
}

/* ---- Global inline code ---- */
code {
  background: #1e2535;
  color: var(--accent);
  padding: 0.1em 0.45em;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'Courier New', Consolas, monospace;
}

/* ---- Feature section intro text ---- */
.feature-intro {
  font-size: 0.93rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  max-width: 740px;
  line-height: 1.7;
}

/* ---- Section Container ---- */
.section {
  padding: 4rem 1.5rem;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.section-sub {
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 680px;
}

/* ---- Cards Grid ---- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--accent); }

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card p, .card ul {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.card ul { padding-left: 1.1rem; }
.card li { margin-bottom: 0.25rem; }

/* ---- Feature Category ---- */
.feature-section {
  margin-bottom: 3rem;
}

.feature-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.feature-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.4rem 1.5rem;
}

.feature-list li {
  font-size: 0.92rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  padding-left: 1.1rem;
  position: relative;
}
.feature-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* ---- Rules Page ---- */
.rules-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.rules-meta a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}
.rules-meta a:hover { border-color: var(--accent); }

#rules-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
}

/* markdown rendered output */
#rules-content h1 { font-size: 1.5rem; color: var(--accent); margin-bottom: 1.25rem; }
#rules-content h2 { font-size: 1.1rem; color: var(--text-primary); margin-top: 2rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
#rules-content h3 { font-size: 1rem; color: var(--accent); margin-top: 1.25rem; margin-bottom: 0.4rem; }
#rules-content p { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
#rules-content ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
#rules-content li { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
#rules-content strong { color: var(--text-primary); }
#rules-content code { background: #1e2535; padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.88rem; color: var(--accent); }
#rules-content em { color: var(--text-secondary); }

.rules-loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ---- Privacy / About prose ---- */
.prose {
  max-width: 780px;
}
.prose h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}
.prose h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.prose p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.85rem;
}
.prose ul {
  padding-left: 1.25rem;
  margin-bottom: 0.85rem;
}
.prose li {
  font-size: 0.93rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.prose strong { color: var(--text-primary); }
.prose a { color: var(--accent); }
.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---- About page ---- */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 2rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.55rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-dark);
}
.timeline-year {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.timeline-item h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.timeline-item p { font-size: 0.9rem; color: var(--text-secondary); }

/* ---- Banner / callout ---- */
.callout {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-size: 0.93rem;
  color: var(--text-secondary);
}

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
footer a { color: var(--text-secondary); }
footer a:hover { color: var(--accent); }
