/* nanochat-ai.com - Refined dark theme */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Colors - warm dark with teal/coral accents */
  --bg-base: #0c0d10;
  --bg-elevated: #14161c;
  --bg-card: #1a1d26;
  --bg-hover: #22262f;
  --border: #2a2f3a;
  --border-light: #363d4a;
  --text: #f1f3f5;
  --text-muted: #8b92a0;
  --text-subtle: #5c6470;
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-secondary: #f97316;
  --accent-muted: rgba(20, 184, 166, 0.15);
  --gradient-start: #14b8a6;
  --gradient-end: #06b6d4;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.4);
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --transition: 0.2s ease;
  --nav-height: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.site-header {
  background: rgba(12, 13, 16, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  gap: 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  transition: color var(--transition);
}

.logo-link:hover {
  color: var(--accent);
}

.logo-link img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

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

.nav-links > li {
  position: relative;
}

.nav-links a,
.nav-trigger {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav-links a:hover,
.nav-trigger:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  margin: 0.25rem 0 0;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
  z-index: 50;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu li {
  margin: 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.nav-dropdown-menu a:hover {
  background: var(--bg-hover);
}

/* Hamburger - hidden on desktop */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition);
}

.nav-toggle:hover {
  background: var(--bg-hover);
}

.hamburger-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 7px 0 currentColor, 0 -7px 0 currentColor;
}

/* Mobile nav */
@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.2s, visibility 0.2s;
  }

  .site-header.nav-open .main-nav {
    max-height: 80vh;
    overflow-y: auto;
    opacity: 1;
    visibility: visible;
  }

  .site-header .container {
    position: relative;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0;
  }

  .nav-links > li {
    border-bottom: 1px solid var(--border);
  }

  .nav-links > li:last-child {
    border-bottom: none;
  }

  .nav-links a,
  .nav-trigger {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
  }

  .nav-dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0 0 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-dropdown.open .nav-dropdown-menu {
    max-height: 500px;
    padding: 0 0 0.5rem 1rem;
  }

  .nav-dropdown-menu a {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}

@media (min-width: 901px) {
  .main-nav {
    position: static;
    max-height: none;
    opacity: 1;
    visibility: visible;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .hero {
    padding: 3rem 0 4rem;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .hero-subheading {
    font-size: 1.1rem;
  }
  .hero p {
    font-size: 1rem;
  }
  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-buttons .btn {
    justify-content: center;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }

  main h1 {
    font-size: 1.5rem;
  }

  main h2 {
    font-size: 1.25rem;
  }

  .try-nanochat-cta {
    padding: 1.5rem;
  }

  pre {
    font-size: 0.8rem;
    padding: 1rem;
  }

  table, th, td {
    font-size: 0.9rem;
    padding: 0.6rem;
  }

  .site-footer .container {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .footer-links {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .footer-links li {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    width: 100%;
  }

  .footer-links li:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }
}

/* Hero */
.hero {
  padding: 4rem 0 5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 100%;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, var(--accent-muted) 0%, transparent 60%);
  pointer-events: none;
}

.hero .container {
  position: relative;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subheading {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
  line-height: 1.3;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #0c0d10;
  box-shadow: 0 2px 12px rgba(20, 184, 166, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(20, 184, 166, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--accent);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 2.5rem 0;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.75rem;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  margin-top: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap var(--transition);
}

.card a:hover {
  gap: 0.5rem;
}

/* Stats section */
.stats-section {
  margin: 2.5rem 0;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Section intro */
.section-intro {
  margin-bottom: 1.5rem;
}

/* Try nanochat CTA */
.try-nanochat-cta {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(6, 182, 212, 0.06) 100%);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: var(--radius);
  padding: 2rem;
  margin: 2.5rem 0;
}

.try-nanochat-cta h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.try-nanochat-cta p {
  margin-bottom: 1rem;
}

.try-nanochat-cta .btn {
  margin-top: 0.5rem;
}

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

.record-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.record-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.record-card--gold {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.12) 0%, rgba(6, 182, 212, 0.08) 100%);
  border-color: rgba(20, 184, 166, 0.4);
}

.record-card--gold:hover {
  border-color: var(--accent);
}

.record-card--outline {
  background: var(--bg-card);
}

.record-card--outline:hover {
  border-color: var(--accent);
}

.record-rank {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.record-time {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.record-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.record-meta {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
  margin-top: auto;
}

.record-cta {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 0.5rem;
}

.record-card:hover .record-cta {
  text-decoration: underline;
}

/* Main content */
main {
  padding: 2rem 0 5rem;
}

main .page-header {
  margin-bottom: 2.5rem;
}

main .lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

main h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

main h2 {
  font-size: 1.45rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text);
}

main h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
}

main p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

main ul, main ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}

main li {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

main li::marker {
  color: var(--accent);
}

main a {
  color: var(--accent);
  text-decoration: none;
}

main a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Code blocks */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  color: var(--accent);
  border-radius: 6px;
  padding: 0.2em 0.5em;
  border: 1px solid var(--border);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
}

pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
}

/* Footer */
.site-footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2.5rem 0;
  margin-top: 5rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.9rem;
  color: var(--text-subtle);
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

/* Explore section (homepage) */
.explore-section {
  margin: 3rem 0 0;
}

.explore-section h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.explore-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  transition: all var(--transition);
}

.explore-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.explore-icon {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.explore-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.explore-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .explore-grid {
    grid-template-columns: 1fr;
  }
}

/* Related pages */
.related-pages {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin: 2.5rem 0;
}

.related-pages h3 {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.related-pages ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-pages li {
  margin-bottom: 0.5rem;
}

.related-pages a {
  color: var(--text-muted);
}

.related-pages a:hover {
  color: var(--accent);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 400px;
  border-collapse: collapse;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-elevated);
  font-weight: 600;
  color: var(--text);
}

td {
  color: var(--text-muted);
}

tr:last-child td {
  border-bottom: none;
}

/* Stats / highlights */
.stat-box {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.stat-box strong {
  color: var(--accent);
}

/* Sections */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 3rem 0;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Visually hidden for screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--bg-base);
  font-weight: 600;
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 1rem;
}
