:root {
  /* backgrounds */
  --bg-body: #f0ede3;
  --bg-page: #fff;
  --bg-nav: #fafafa;
  --bg-footer: #222;
  --bg-card: #fafafa;
  --bg-card-alt: #f5f5f5;
  --bg-alert: #fef0ee;
  --bg-hover: #fef0ee;
  --bg-pre: #f5f5f5;

  /* text */
  --text-primary: #333;
  --text-secondary: #555;
  --text-muted: #888;
  --text-muted2: #777;
  --text-footer: #aaa;
  --text-on-accent: #fdfdfd;
  --text-on-dark: #fdfdfd;

  /* accents */
  --accent: #ce4e50;
  --accent-hover: #b03e40;
  --accent-yellow: #fdb604;
  --accent-yellow-hover: #e0a000;

  /* borders */
  --border-page: #ccc;
  --border-light: #e0e0e0;
  --border-mid: #ddd;
  --border-nav: #ddd;
  --border-news: #eee;
}

[data-theme="dark"] {
  --bg-body: #111;
  --bg-page: #1a1a1a;
  --bg-nav: #222;
  --bg-footer: #0d0d0d;
  --bg-card: #222;
  --bg-card-alt: #2a2a2a;
  --bg-alert: #2a1a1a;
  --bg-hover: #2a1a1a;
  --bg-pre: #222;

  --text-primary: #ccc;
  --text-secondary: #999;
  --text-muted: #666;
  --text-muted2: #777;
  --text-footer: #666;
  --text-on-accent: #fff;
  --text-on-dark: #ccc;

  --accent: #e06c6e;
  --accent-hover: #ce4e50;
  --accent-yellow: #fdb604;
  --accent-yellow-hover: #e0a000;

  --border-page: #333;
  --border-light: #333;
  --border-mid: #444;
  --border-nav: #333;
  --border-news: #2a2a2a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Verdana, "Bitstream Vera Sans", Geneva, Arial, sans-serif;
  font-size: 110%;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

#skiplink {
  position: absolute;
  left: -9999px;
}

#skiplink:focus {
  position: static;
}

#page {
  max-width: 1270px;
  margin: 0 auto;
  border: 1px solid var(--border-page);
  border-top: none;
  background: var(--bg-page);
}

/* ---- HEADER ---- */

#header {
  background: var(--accent);
  padding: 14px 24px;
  border-bottom: 4px solid #222;
  display: flex;
  align-items: center;
  gap: 16px;
}

#header a {
  color: var(--text-on-accent);
}

#logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

#logo img {
  height: 86px;
  width: auto;
}

#logo .sitename {
  font-size: 31px;
  font-weight: 900;
  color: var(--text-on-accent);
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 #000;
}

#toplinks {
  margin-left: auto;
  font-size: 12px;
}

#toplinks a {
  color: var(--text-on-accent);
  margin-left: 14px;
}

#toplinks a:hover {
  text-decoration: underline;
}

.theme-toggle {
  cursor: pointer;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--text-on-accent);
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-family: inherit;
  margin-left: 14px;
}

.theme-toggle:hover {
  background: rgba(0,0,0,0.35);
}

/* ---- LAYOUT: NAV + CONTENT ---- */

#content {
  display: flex;
  min-height: 500px;
}

/* ---- NAVIGATION SIDEBAR ---- */

#nav {
  width: 200px;
  flex-shrink: 0;
  padding: 16px 0 16px 14px;
  border-right: 1px solid var(--border-nav);
  background: var(--bg-nav);
}

#nav ul {
  list-style: none;
}

#nav > ul > li {
  margin-bottom: 3px;
}

#nav > ul > li > .nav-heading {
  display: block;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 3px;
}

#nav > ul > li > span.nav-heading {
  cursor: default;
  user-select: none;
}

#nav > ul > li > a.nav-heading:hover {
  background: var(--bg-hover);
  color: var(--accent);
  text-decoration: none;
}

#nav ul ul {
  padding: 2px 0 5px 20px;
}

#nav ul ul li {
  margin-bottom: 1px;
}

#nav ul ul a {
  display: block;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 3px;
}

#nav ul ul a:hover {
  background: var(--bg-hover);
  color: var(--accent);
  text-decoration: none;
}

/* ---- MAIN CONTENT ---- */

#mainContent {
  flex: 1;
  padding: 20px 28px 24px;
  min-width: 0;
}

h1 {
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 12px;
}

h2 {
  font-size: 22px;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 5px;
  margin: 22px 0 12px;
  clear: both;
}

h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 5px;
}

p {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
}

.alert {
  background: var(--bg-alert);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

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

.more {
  font-weight: 700;
  font-size: 12px;
}

ul, ol {
  margin: 0 0 12px 22px;
  font-size: 13px;
}

li {
  margin-bottom: 4px;
}

dl {
  margin-bottom: 12px;
  font-size: 13px;
}

dt {
  margin-bottom: 2px;
  margin-top: 10px;
}

dd {
  margin-left: 18px;
  color: var(--text-secondary);
}

code {
  background: var(--bg-card-alt);
  color: var(--text-primary);
  padding: 1px 4px;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  font-size: 12px;
}

pre {
  background: var(--bg-pre);
  border: 1px solid var(--border-mid);
  padding: 12px;
  font-size: 12px;
  margin-bottom: 12px;
  overflow-x: auto;
  color: var(--text-primary);
}

/* ---- DOWNLOAD TABLE ---- */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 12px;
}

th {
  background: #222;
  color: var(--text-on-dark);
  padding: 7px 12px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

tr:hover td {
  background: var(--bg-hover);
}

table a {
  color: var(--accent);
}

table a:hover {
  text-decoration: underline;
}

.download-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ---- HERO SECTION ---- */

.hero {
  margin-bottom: 8px;
}

.hero h1 {
  font-size: 30px;
  margin-bottom: 8px;
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---- FEATURES ---- */

.features-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.feature-item {
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-yellow);
  padding: 12px 14px;
  background: var(--bg-card);
}

.feature-item h3 {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 3px;
}

.feature-item p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ---- DONATE ---- */

.donate-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}

.btn-donate {
  display: inline-block;
  padding: 9px 24px;
  background: var(--accent);
  color: var(--text-on-accent) !important;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
}

.btn-donate:hover {
  background: var(--accent-hover);
}

.btn-donate.yellow {
  background: var(--accent-yellow);
  color: #222 !important;
}

.btn-donate.yellow:hover {
  background: var(--accent-yellow-hover);
}

/* ---- NEWS / EVENTS ---- */

.news-list {
  list-style: none;
  margin: 0;
}

.news-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border-news);
  font-size: 12px;
}

.news-list li:last-child {
  border-bottom: none;
}

.news-date {
  color: var(--text-muted);
  font-size: 11px;
}

.news-list a {
  font-weight: 600;
}

.events-list {
  list-style: none;
  margin: 0;
}

.events-list li {
  padding: 6px 0;
  font-size: 12px;
}

.events-date {
  color: var(--text-muted);
  font-size: 11px;
}

.rss-link {
  font-size: 11px;
  color: var(--accent-yellow);
  font-weight: 700;
}

.feed-block {
  margin: 14px 0;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-yellow);
  font-size: 12px;
}

.feed-block a {
  font-weight: 700;
}

.feed-subtitle {
  color: var(--text-muted);
  font-size: 11px;
}

/* ---- COMMIT LIST ---- */

.commit-list {
  list-style: none;
  margin: 0;
}

.commit-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-news);
  font-size: 12px;
}

.commit-list li:last-child {
  border-bottom: none;
}

.commit-list code {
  font-size: 11px;
}

.loading {
  color: var(--text-muted);
  font-style: italic;
}

/* ---- BLOG POSTS ---- */

.blog-post {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.blog-post:last-child {
  border-bottom: none;
}

/* ---- GALLERY ---- */

.gallery {
  display: grid;
  gap: 24px;
  margin-bottom: 16px;
}

.gallery-item {
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  padding: 12px;
}

.gallery-item img {
  max-width: 100%;
  height: auto;
  display: block;
}

.gallery-caption {
  padding: 10px 0 4px;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ---- SPONSORS ---- */

.sponsors {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin: 16px 0;
  padding: 16px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.sponsor-box {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-muted2);
  font-style: italic;
}

/* ---- FOOTER ---- */

#footer {
  background: var(--bg-footer);
  color: var(--text-footer);
  padding: 16px 24px;
  font-size: 11px;
  text-align: center;
  border-top: 4px solid var(--accent);
}

#footer a {
  color: var(--accent-yellow);
}

#footer a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-bottom: 8px;
}

.footer-links a {
  margin: 0 10px;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 820px) {
  #content {
    flex-direction: column;
  }

  #nav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-nav);
    padding: 10px 14px;
  }

  #nav > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  #nav > ul > li {
    margin-bottom: 0;
  }

  #nav > ul > li > .nav-heading {
    font-size: 11px;
    padding: 4px 8px;
  }

  #nav ul ul {
    display: none;
  }

  #logo .sitename {
    font-size: 22px;
    letter-spacing: 2px;
  }

  #logo img {
    height: 56px;
  }

  #toplinks {
    display: none;
  }

  .features-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  #header {
    padding: 10px 14px;
  }

  #mainContent {
    padding: 14px 16px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 18px;
  }

  #page {
    border-left: none;
    border-right: none;
  }
}
