/* ==========================================================================
   Sarvam Chess Academy — Design System
   Concept: royal court meets bright modern sport. Deep royal-indigo (the
   King's authority), vivid gold (the crown / trophy), bright emerald
   (a lively board felt), and ruby (checks/alerts) — a premium, high-
   contrast palette rather than the muted vintage-paper look, with mono
   type reserved for notation-like data (FIDE IDs, time controls, rounds).
   ========================================================================== */

:root {
  /* Color */
  --board-ebony: #150e4d;      /* royal indigo — primary dark surface */
  --ivory: #faf8f3;            /* bright pearl white */
  --ivory-dim: #f1ecdf;
  --felt-green: #00a96e;       /* vivid emerald */
  --felt-green-dark: #00875a;
  --brass: #ffc93c;            /* bright gold */
  --brass-light: #ffd24c;
  --burgundy: #e63950;         /* bright ruby */
  --ink: #1c1640;
  --ink-soft: #4d4870;
  --line: #e3ddf0;

  /* Type */
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;

  /* Scale */
  --radius: 3px;
  --shadow-card: 0 1px 2px rgba(21, 14, 77, 0.06), 0 8px 24px -12px rgba(21, 14, 77, 0.18);
}

* { box-sizing: border-box; }

[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--ivory);
  color: var(--ink);
  margin: 0;
  line-height: 1.55;
}

h1, h2, h3, h4, .display-font {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--board-ebony);
  letter-spacing: -0.01em;
}

.mono, .fide-id, .time-control, .round-label, .reg-number {
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

a { color: var(--felt-green); text-decoration: none; }
a:hover { color: var(--felt-green-dark); text-decoration: underline; }

/* Focus visibility (accessibility floor) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------------- */
/* Navbar                                                                   */
/* ---------------------------------------------------------------------- */
.rca-navbar {
  background: var(--board-ebony);
  border-bottom: 3px solid var(--brass);
}
/* Explicit background on the collapsible mobile menu itself - without
   this, some mobile browsers render the expanded menu outside the
   navbar's dark background (falling onto the page's light background
   instead), making the light-colored nav links nearly invisible. */
.rca-navbar .navbar-collapse {
  background: var(--board-ebony);
}
@media (max-width: 991.98px) {
  .rca-navbar .navbar-collapse.show {
    padding: 1rem 0 1.25rem;
    margin: 0 -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .rca-navbar .navbar-nav .nav-item {
    margin-bottom: 0.25rem;
  }
}
/* Bootstrap's default hamburger icon uses dark lines unless the navbar
   is explicitly marked with the .navbar-dark class - since our navbar
   doesn't use that class (custom rca-navbar styling instead), the icon
   defaulted to dark-on-dark and was nearly invisible. Override its
   background-image directly with light/ivory-colored lines instead. */
.rca-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(250, 248, 243, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.rca-navbar .navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(250, 248, 243, 0.25);
}
.rca-navbar .brand {
  font-family: var(--font-display);
  color: var(--ivory);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.rca-navbar .brand-mark {
  width: 30px; height: 30px;
  display: inline-block;
  background-image:
    linear-gradient(45deg, var(--brass) 25%, transparent 25%),
    linear-gradient(-45deg, var(--brass) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--brass) 75%),
    linear-gradient(-45deg, transparent 75%, var(--brass) 75%);
  background-size: 15px 15px;
  background-position: 0 0, 0 7.5px, 7.5px -7.5px, -7.5px 0;
  border-radius: 2px;
  opacity: 0.9;
}
.rca-navbar .nav-link {
  color: rgba(250, 248, 243, 0.78) !important;
  font-size: 0.92rem;
  font-weight: 500;
}
.rca-navbar .nav-link:hover, .rca-navbar .nav-link.active {
  color: var(--ivory) !important;
}
.btn-brass {
  background: var(--brass);
  border: 1px solid var(--brass);
  color: var(--board-ebony);
  font-weight: 600;
  border-radius: var(--radius);
  padding: 0.5rem 1.15rem;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-brass:hover { background: var(--brass-light); color: var(--board-ebony); }
.btn-outline-ivory {
  background: transparent;
  border: 1px solid rgba(250, 248, 243, 0.4);
  color: var(--ivory);
  border-radius: var(--radius);
  padding: 0.5rem 1.15rem;
}
.btn-outline-ivory:hover { border-color: var(--ivory); color: var(--ivory); }
.btn-felt {
  background: var(--felt-green);
  border: 1px solid var(--felt-green);
  color: var(--ivory);
  font-weight: 600;
  border-radius: var(--radius);
  padding: 0.6rem 1.4rem;
}
.btn-felt:hover { background: var(--felt-green-dark); color: var(--ivory); }

/* ---------------------------------------------------------------------- */
/* Hero                                                                     */
/* ---------------------------------------------------------------------- */
.hero {
  position: relative;
  background: var(--board-ebony);
  color: var(--ivory);
  padding: 5.5rem 0 4.5rem;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, rgba(250,248,243,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(250,248,243,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(250,248,243,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(250,248,243,0.035) 75%);
  background-size: 64px 64px;
  background-position: 0 0, 0 32px, 32px -32px, -32px 0;
  pointer-events: none;
}
.hero .eyebrow {
  font-family: var(--font-mono);
  color: var(--brass-light);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero h1 {
  color: var(--ivory);
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  max-width: 18ch;
  margin: 0.5rem 0 1.1rem;
}
.hero p.lead {
  color: rgba(250, 248, 243, 0.75);
  max-width: 52ch;
  font-size: 1.08rem;
}
.hero .countdown {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  color: var(--brass-light);
  font-weight: 600;
  line-height: 1;
}
.hero .countdown-label {
  font-size: 0.78rem;
  color: rgba(250, 248, 243, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------------------------------------------------------------------- */
/* Tournament card — "scoresheet corner" signature                          */
/* ---------------------------------------------------------------------- */
.scoresheet-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.scoresheet-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 6px rgba(21,14,77,0.08), 0 16px 32px -14px rgba(21,14,77,0.28);
}
.scoresheet-card::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent var(--brass) transparent transparent;
}
.scoresheet-card .card-media {
  height: 150px;
  background: var(--felt-green);
  background-size: cover;
  background-position: center;
}
.scoresheet-card .card-body { padding: 1.25rem 1.35rem 1.4rem; flex: 1; display: flex; flex-direction: column; }
.scoresheet-card h3 {
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}
.scoresheet-card .meta-row {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.82rem; color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.scoresheet-card .card-footer-row {
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; align-items: center;
}

/* Status pills */
.status-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}
.status-upcoming { background: rgba(0,169,110,0.12); color: var(--felt-green-dark); }
.status-running { background: rgba(255,201,60,0.18); color: #8a6a00; }
.status-completed { background: rgba(77,72,112,0.12); color: var(--ink-soft); }
.status-cancelled { background: rgba(230,57,80,0.12); color: var(--burgundy); }

.badge-format {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------- */
/* Sections / generic                                                       */
/* ---------------------------------------------------------------------- */
.section { padding: 4rem 0; }
.section-title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 2rem; flex-wrap: wrap; gap: 0.75rem;
}
.section-eyebrow {
  font-family: var(--font-mono);
  color: var(--felt-green);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.divider-dashed { border: none; border-top: 1px dashed var(--line); margin: 2.5rem 0; }

.rca-tabs .nav-link {
  color: var(--ink-soft);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.6rem 0.2rem;
  margin-right: 1.75rem;
}
.rca-tabs .nav-link.active {
  color: var(--board-ebony);
  background: transparent;
  border-bottom-color: var(--brass);
}

/* Forms */
.rca-form-card {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}
.form-label { font-weight: 600; font-size: 0.88rem; color: var(--ink); }
.form-control, .form-select {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0.55rem 0.75rem;
  background: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--felt-green);
  box-shadow: 0 0 0 3px rgba(0,169,110,0.12);
}
.step-indicator {
  display: flex; gap: 0.5rem; margin-bottom: 2rem; font-family: var(--font-mono); font-size: 0.78rem;
}
.step-indicator .step {
  flex: 1; text-align: center; padding: 0.5rem 0.25rem;
  border-bottom: 3px solid var(--line); color: var(--ink-soft);
}
.step-indicator .step.active { border-color: var(--brass); color: var(--board-ebony); font-weight: 600; }
.step-indicator .step.done { border-color: var(--felt-green); color: var(--felt-green); }

.age-preview {
  font-family: var(--font-mono);
  background: var(--ivory-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: inline-block;
}

/* Dashboard table */
.rca-table { width: 100%; border-collapse: collapse; background: #fffdf8; }
.rca-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 2px solid var(--board-ebony);
}
.rca-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.rca-table tr:hover td { background: rgba(0,169,110,0.04); }

/* Footer */
.rca-footer {
  background: var(--board-ebony);
  color: rgba(250,248,243,0.65);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.rca-footer h5 { color: var(--ivory); font-family: var(--font-display); font-size: 1rem; }
.rca-footer a { color: rgba(250,248,243,0.65); }
.rca-footer a:hover { color: var(--brass-light); }
.rca-footer .fine-print {
  border-top: 1px solid rgba(250,248,243,0.12);
  margin-top: 2rem; padding-top: 1.25rem;
  font-size: 0.8rem;
  color: rgba(250,248,243,0.45);
}

/* Alerts */
.alert-rca {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
}
.alert-rca-success { background: rgba(0,169,110,0.08); border-color: var(--felt-green); color: var(--felt-green-dark); }
.alert-rca-danger { background: rgba(230,57,80,0.08); border-color: var(--burgundy); color: var(--burgundy); }
.alert-rca-info { background: rgba(255,201,60,0.08); border-color: var(--brass); color: #8a6a00; }
