/* ============================================================
   Loon — Site Stylesheet
   ============================================================ */

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

:root {
  /* Background & surfaces */
  --bg: #141218;
  --surface: #1E1C22;
  --border: #2E2B34;
  --red-tint: #1C1018;

  /* Text */
  --text: #E8E4DF;
  --text-muted: #9590A0;

  /* Accent */
  --accent: #C42B2B;
  --accent-hover: #D94040;

  /* Semantic aliases — dark theme mapping
     Old gray scale was light-theme (50=white, 900=black).
     For dark theme: low numbers = dark surfaces, high numbers = light text.
     Teal aliases used as text must be visible on dark backgrounds. */
  --teal-900: #141218;   /* bg: header, hero gradient start */
  --teal-800: #1E1C22;   /* bg: surface */
  --teal-700: #2E2B34;   /* border */
  --teal-600: #C42B2B;   /* accent */
  --teal-500: #C42B2B;   /* accent */
  --teal-400: #D94040;   /* accent hover */
  --teal-300: #D94040;   /* accent hover */
  --teal-100: #1C1018;   /* bg: dark red tint */
  --gray-50: #1E1C22;    /* bg: section alt */
  --gray-100: #1E1C22;   /* bg: surface */
  --gray-200: #2E2B34;   /* border */
  --gray-300: #E8E4DF;   /* text: primary on dark */
  --gray-400: #9590A0;   /* text: muted */
  --gray-500: #9590A0;   /* text: muted */
  --gray-600: #E8E4DF;   /* text: primary */
  --gray-700: #2E2B34;   /* border */
  --gray-800: #E8E4DF;   /* text: primary */
  --gray-900: #141218;   /* bg: darkest background */
  --red-500: #C42B2B;
  --red-100: #1C1018;
  --green-500: #38a169;
  --green-100: #0a1f0e;
  --code-bg: #1E1C22;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  background: var(--teal-900);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo a {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-img {
  height: 50px;
  width: auto;
  vertical-align: middle;
}

.logo-img + .logo-name {
  /* Hide text when logo image is present */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.logo-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-tagline {
  font-size: 0.8rem;
  color: var(--teal-300);
  font-weight: 400;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.main-nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  text-decoration: none;
  transition: color 0.15s;
}

.main-nav a:hover {
  color: #fff;
  text-decoration: none;
}

.main-nav .nav-coming-soon {
  color: var(--gray-400);
  cursor: default;
}

.badge {
  font-size: 0.65rem;
  background: var(--teal-700);
  color: var(--teal-300);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  vertical-align: middle;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-github {
  border: 1px solid var(--teal-600);
  padding: 0.3rem 0.75rem !important;
  border-radius: 4px;
}

.nav-github:hover {
  background: var(--teal-700);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(170deg, var(--bg) 0%, var(--surface) 100%);
  color: #fff;
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  left: -5%;
  top: -10%;
  width: 500px;
  height: 500px;
  background: url('/media/looncircle.png') no-repeat center / contain;
  opacity: 0.25;
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  max-width: 800px;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--teal-300);
  margin-top: 1.25rem;
  max-width: 720px;
  line-height: 1.6;
}

/* Code comparison panels */
.code-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
}

.code-panel {
  border-radius: 8px;
  overflow: hidden;
}

.code-panel-header {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.code-panel-bad .code-panel-header {
  background: var(--red-500);
  color: #fff;
}

.code-panel-good .code-panel-header {
  background: var(--green-500);
  color: #fff;
}

.code-panel {
  display: flex;
  flex-direction: column;
}

.code-panel pre {
  background: var(--code-bg);
  padding: 1.25rem;
  margin: 0;
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
}

.code-panel code {
  color: var(--gray-300);
}

.code-comment { color: var(--gray-500); }
.code-hl-bad { color: var(--red-500); font-weight: 700; }
.code-hl-good { color: var(--green-500); font-weight: 700; text-decoration: wavy underline; }
.code-error { color: var(--red-500); font-style: italic; }

/* CTA Buttons */
.hero-ctas {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--teal-500);
  color: #fff;
}

.btn-primary:hover {
  background: var(--teal-400);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--teal-300);
  border: 1px solid var(--teal-600);
}

.btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================================
   LANGUAGE SECTION
   ============================================================ */
.language-section {
  padding: 5rem 0;
}

.language-section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--text);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 4rem;
}

.stat-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 2rem;
}

.feature-card h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.feature-card p {
  font-size: 0.95rem;
  color: var(--gray-600);
  line-height: 1.65;
}

.feature-card code {
  background: var(--teal-100);
  color: var(--text);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}

.feature-code {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--gray-300);
  overflow-x: auto;
}

.feature-code code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* Timeline */
.timeline-section {
  margin-top: 4rem;
}

.timeline-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.timeline-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  color: var(--gray-500);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timeline-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
}

.timeline-current {
  background: var(--teal-100);
}

.timeline-current td {
  font-weight: 600;
  color: var(--text);
}

/* ============================================================
   MISSION SECTION
   ============================================================ */
.mission-section {
  padding: 5rem 0;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}

.mission-section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}

.mission-lead {
  font-size: 1.1rem;
  color: var(--gray-600);
  margin-top: 0.75rem;
  max-width: 720px;
  line-height: 1.65;
}

.mission-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2.5rem;
}

.mission-col {
  padding: 2rem;
  border-radius: 8px;
}

.mission-col h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.mission-col ul {
  list-style: none;
  padding: 0;
}

.mission-col li {
  padding: 0.4rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.95rem;
}

.mission-col li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}

.mission-col-allowed {
  background: var(--green-100);
  border: 1px solid #b2dfca;
}

.mission-col-allowed h3 { color: var(--green-500); }
.mission-col-allowed li::before { content: "+"; color: var(--green-500); }

.mission-col-prohibited {
  background: var(--red-100);
  border: 1px solid var(--accent);
}

.mission-col-prohibited h3 { color: var(--red-500); }
.mission-col-prohibited li::before { content: "\00d7"; color: var(--red-500); }

.mission-footer {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--gray-600);
  max-width: 720px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg);
  color: var(--text-muted);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-stewardship {
  font-weight: 600;
  color: var(--gray-300);
  font-size: 0.9rem;
}

.footer-tagline {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.footer-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.footer-nav a {
  color: var(--gray-400);
  font-size: 0.85rem;
}

.footer-nav a:hover {
  color: #fff;
}

/* ============================================================
   CONTENT PAGES (docs, license, why)
   ============================================================ */
.page-hero {
  background: linear-gradient(170deg, var(--bg) 0%, var(--surface) 100%);
  color: #fff;
  padding: 3.5rem 0 2.5rem;
}

.page-hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-hero .page-subtitle {
  font-size: 1.1rem;
  color: var(--teal-300);
  margin-top: 0.5rem;
  max-width: 640px;
}

.page-content {
  padding: 3rem 0 5rem;
}

.page-content .container {
  max-width: 860px;
}

/* Docs hub cards */
.docs-grid {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

.doc-card {
  display: block;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1.5rem 2rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
}

.doc-card:hover {
  border-color: var(--teal-400);
  box-shadow: 0 2px 8px rgba(42, 157, 168, 0.1);
  text-decoration: none;
}

.doc-card h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.doc-card p {
  font-size: 0.93rem;
  color: var(--gray-500);
  margin: 0;
}

.docs-note {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--teal-100);
  border-left: 4px solid var(--teal-500);
  border-radius: 0 6px 6px 0;
  font-size: 0.9rem;
  color: var(--text);
}

/* License page */
.license-section {
  margin-bottom: 2.5rem;
}

.license-section h2 {
  font-size: 1.35rem;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--gray-200);
}

.license-section p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.license-section ul {
  padding-left: 1.5rem;
}

.license-section li {
  padding: 0.35rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.license-prohibited-list {
  list-style: none;
  padding-left: 0 !important;
}

.license-prohibited-list li {
  color: var(--text-muted);
  padding-left: 1.5rem;
  position: relative;
}

.license-prohibited-list li::before {
  content: "\00d7";
  position: absolute;
  left: 0;
  color: var(--red-500);
  font-weight: 700;
}

.license-prohibited-list li strong {
  color: var(--red-500);
}

.license-callout {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1.5rem 2rem;
  margin-top: 2.5rem;
  font-size: 0.95rem;
  color: var(--gray-600);
}

.license-callout p {
  line-height: 1.65;
}

.license-callout a {
  font-weight: 600;
}

/* Why/essay page */
.essay h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.essay h3 {
  font-size: 1.2rem;
  color: var(--text);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.essay p {
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.essay .essay-lede {
  font-size: 1.2rem;
  color: var(--gray-800);
  line-height: 1.7;
  margin-bottom: 2rem;
  font-weight: 500;
}

.essay pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--gray-300);
  overflow-x: auto;
}

.essay code {
  background: var(--teal-100);
  color: var(--text);
  padding: 0.12rem 0.3rem;
  border-radius: 3px;
  font-size: 0.88em;
}

.essay pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.essay ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.essay li {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  padding: 0.2rem 0;
}

.essay-cta {
  margin-top: 3rem;
  padding: 2rem;
  background: var(--teal-100);
  border-radius: 8px;
  text-align: center;
}

.essay-cta p {
  color: var(--text);
  font-weight: 500;
  margin-bottom: 1rem;
}

.essay-cta .btn {
  margin: 0 0.5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    height: auto;
    padding: 1rem 2rem;
    gap: 0.75rem;
  }

  .main-nav ul {
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .code-compare {
    grid-template-columns: 1fr;
  }

  .mission-columns {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .page-hero h1 {
    font-size: 1.6rem;
  }
}
