/* ==================================================
   THEME VARIABLES
   ================================================== */
:root {
  --background: #f5f7fb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --highlight: #b84cff;
  --highlight-strong: #8b35f6;
  --highlight-soft: #f6e8ff;
  --accent: #21c7e8;
  --card: var(--surface);
  --card-shadow: rgba(15, 23, 42, 0.10);
  --link: #8b35f6;
  --cta-background: #fbf0ff;
  --footer-text: #64748b;
  --border: rgba(15, 23, 42, 0.10);
  --transition: 0.25s;
  --radius: 8px;
  --radius-lg: 14px;
  --header-bg: rgba(255, 255, 255, 0.82);
  --header-text: #172033;
  --hero-bg: linear-gradient(180deg, #ffffff, #fbf5ff);
}

[data-theme="dark"] {
  --background: #0f172a;
  --surface: #111827;
  --surface-elevated: #182235;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --highlight: #c75cff;
  --highlight-strong: #a855f7;
  --highlight-soft: rgba(199, 92, 255, 0.16);
  --accent: #38d6f4;
  --card: var(--surface-elevated);
  --card-shadow: rgba(0, 0, 0, 0.34);
  --link: #d8b4fe;
  --cta-background: #21112c;
  --footer-text: #9ca3af;
  --border: rgba(255,255,255,0.12);
  --header-bg: rgba(15, 23, 42, 0.82);
  --header-text: #f8fafc;
  --hero-bg: linear-gradient(180deg, #171126, rgba(17, 24, 39, 0.88));
}

/* ==================================================
   GLOBAL RESETS
   ================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(184, 76, 255, 0.10), transparent 32%),
    linear-gradient(315deg, rgba(33, 199, 232, 0.09), transparent 30%);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

a { color: inherit; text-decoration: none; }

/* Utility: Screen reader only */
.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;
}

/* ==================================================
   HEADER
   ================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.brand {
  color: var(--header-text);
  font-weight: 800;
  font-size: 1.4rem;
  cursor: pointer;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: inherit;
  text-decoration: none;
}

.nav > ul {
  display: flex;
  list-style: none;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  align-items: center;
  border-bottom: none;
  border: none;
  box-shadow: none;
}

.nav a,
.dropdown-toggle {
  color: var(--header-text);
  font-weight: 600;
  font-size: 0.96rem;
  opacity: 0.86;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}
.nav a:hover,
.dropdown-toggle:hover { opacity: 1; }

/* Theme toggle button */
.theme-toggle {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--header-text);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.theme-toggle:hover {
  background: var(--highlight-soft);
  transform: scale(1.04);
}
.theme-toggle .icon { line-height: 1; }

.header-logo {
  max-height: 36px;
  width: auto;
  filter: drop-shadow(0 8px 14px rgba(184, 76, 255, 0.22));
}

/* ==================================================
   HERO
   ================================================== */
.hero {
  background: var(--hero-bg);
  padding: clamp(2.5rem, 6vw, 5rem) 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

.hero-logo {
  max-width: 220px;
  width: 40vw;
  height: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 18px 28px rgba(184, 76, 255, 0.28));
}

.hero h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: 0;
}

.subtitle {
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  margin: 0;
  color: var(--muted);
}

/* ==================================================
   FEATURES
   ================================================== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 12px 28px var(--card-shadow);
}

.feature-card h3 {
  margin: 0 0 0.45rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
}

/* ==================================================
   CTA SECTION
   ================================================== */
.cta {
  background: var(--cta-background);
  padding: 3rem 1rem;
  text-align: center;
  margin-top: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.cta h2 { margin-top: 0; }

.cta-button {
  display: inline-block;
  margin-top: 0.75rem;
  background: var(--highlight);
  color: #fff;
  padding: 0.9rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
}
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--card-shadow);
}

.contact-section {
  max-width: 760px;
  margin: 1.25rem auto 0;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 45px var(--card-shadow);
}

.contact-section h2,
.benchmark-section h2 {
  margin-top: 0;
  text-align: center;
}

.contact-section p,
.benchmark-section p {
  color: var(--muted);
  text-align: center;
}

.contact-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.contact-form label {
  font-weight: 700;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.85rem 0.95rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border var(--transition), box-shadow var(--transition), background var(--transition);
}

.contact-form input {
  min-height: 3rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--highlight-strong);
  box-shadow: 0 0 0 3px var(--highlight-soft);
}

.contact-form button {
  width: 100%;
  border: none;
  cursor: pointer;
}

/* ==================================================
   FOOTER
   ================================================== */
.site-footer {
  background: transparent;
  text-align: center;
  padding: 1rem;
  color: var(--footer-text);
  font-size: 0.92rem;
}

/* ==================================================
   TABLES + WINNERS
   ================================================== */
.table-section {
  padding: clamp(1rem, 3vw, 2rem);
  background: var(--card);
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 45px var(--card-shadow);
}

.table-header {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* Segmented controls */
.segmented {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  overflow-x: auto;
}
[data-theme="dark"] .segmented {
  background: rgba(255,255,255,0.12);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  min-width: max-content;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  color: var(--muted);
  flex: 1;
  text-align: center;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.segmented input:checked + label {
  background: linear-gradient(135deg, var(--highlight), var(--highlight-strong));
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(184, 76, 255, 0.25);
}

/* Winner cards */
.winner-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 34px var(--card-shadow);
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.winner-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px var(--card-shadow);
}

#winner-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Runner-up rows */
.runner-up {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.runner-up-name {
  font-weight: 600;
  width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.runner-up-bar {
  flex: 1;
  height: 8px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
[data-theme="dark"] .runner-up-bar {
  background: rgba(255,255,255,0.12);
}

.runner-up-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--highlight), var(--accent));
  border-radius: 999px;
}

.runner-up-value {
  min-width: 104px;
  color: var(--muted);
  font-weight: 700;
  text-align: right;
}

.runner-up,
.top-tool {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.runner-up:hover,
.top-tool:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px var(--card-shadow);
}

/* ==================================================
   TOP TOOL EMPHASIS
   ================================================== */
.top-tool {
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--highlight) 0%, var(--highlight-strong) 62%, #6d28d9 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 6px 16px var(--card-shadow);
}

.top-tool .runner-up-name {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.top-tool .runner-up-bar {
  height: 18px;
  background: rgba(255,255,255,0.2);
}

.top-tool .runner-up-bar-fill {
  background: #fff;
}

.top-tool .runner-up-value {
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

/* ==================================================
   DROPDOWN MENU
   ================================================== */
.nav-item.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.7rem);
  left: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 210px;
  display: none;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0.35rem;
  z-index: 1000;
  box-shadow: 0 6px 20px var(--card-shadow);
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-menu li {
  list-style: none;
}

.dropdown-menu li a {
  display: block;
  padding: 0.72rem 1rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  transition: background var(--transition), color var(--transition);
}

.dropdown-menu li a:hover {
  background: var(--highlight-soft);
  color: var(--highlight-strong);
  border-radius: 6px;
}

#winner-cards {
  margin-bottom: -1.75rem; 
}

.tool-info {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.tool-info h3 {
  margin-top: 0;
}

.tool-field {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.tool-field:last-child {
  border-bottom: 0;
}

#winner-cards {
  padding-bottom: 1.5rem;
}

.plot-card object {
  border: 0;
  border-radius: var(--radius);
}

@media (max-width: 820px) {
  .site-header,
  .nav > ul {
    align-items: flex-start;
  }

  .site-header {
    flex-direction: column;
    gap: 0.85rem;
  }

  .nav > ul {
    flex-wrap: wrap;
    gap: 0.45rem 0.8rem;
  }

  .dropdown-menu {
    left: auto;
    right: 0;
  }

  .runner-up {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .runner-up-name {
    width: auto;
  }

  .runner-up-bar {
    grid-column: 1 / -1;
    order: 3;
  }
}
