/* Chrome shared by every site: reset, default tokens, header, footer, 404.
   Sites restyle through their style (tokens + css); this file stays fixed.
   Ported from the old engine's Base.astro, keeping only what the fixed templates emit. */

:root {
  --color-primary: var(--primaryColor, #3b82f6);
  --color-secondary: var(--secondaryColor, #64748b);
  --font-family: var(--fontFamily, Inter);
  --border-radius: var(--borderRadius, 8px);

  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --text-primary: #1a1a1a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border-color: #e5e7eb;
  --border-color-light: rgba(148, 163, 184, 0.2);
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
}

html.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border-color: #334155;
  --code-bg: #0f172a;
}

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

body {
  font-family: var(--font-family), system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 2000;
  padding: 0.5rem 1rem; background: var(--bg-primary); color: var(--text-primary);
}
.skip-link:focus { left: 1rem; top: 1rem; }

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: var(--text-on-primary, #0b0b0b); /* white on a light primary (lime) fails contrast */
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }

/* Header */
.site-header {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1000;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.nav { display: flex; align-items: center; justify-content: space-between; }
.nav-right { display: flex; align-items: center; gap: 1rem; }
.logo {
  font-size: 1.5rem; font-weight: 700; color: var(--color-primary);
  display: flex; align-items: center; text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-image { height: 64px; width: auto; display: block; }
.brand-name { font-size: 1.25rem; font-weight: 600; line-height: 1.2; color: var(--text-primary); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: 0.75rem; padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 8px;
  background: transparent; color: var(--color-primary); cursor: pointer;
  transition: all 0.2s ease;
}
.theme-toggle:hover { background: rgba(59, 130, 246, 0.08); border-color: var(--color-primary); }
.theme-toggle .sun-icon { display: block; }
.theme-toggle .moon-icon { display: none; }
html.dark .theme-toggle .sun-icon { display: none; }
html.dark .theme-toggle .moon-icon { display: block; }

.header-search { position: relative; display: flex; align-items: center; }
.header-search .search-icon { position: absolute; left: 0.625rem; color: var(--text-tertiary); pointer-events: none; }
.header-search input {
  width: 180px;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.2s;
}
.header-search input::placeholder { color: var(--text-tertiary); }
.header-search input:focus { outline: none; border-color: var(--color-primary); background: var(--bg-primary); width: 220px; }

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.footer-bottom {
  padding-top: 1rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.copyright { color: var(--text-tertiary); font-size: 0.875rem; margin: 0; }
.cc-mark { display: inline-flex; align-items: center; margin-left: auto; opacity: 0.45; transition: opacity 0.15s ease; }
.cc-mark:hover, .cc-mark:focus-visible { opacity: 1; }
.cc-mark img { display: block; width: 24px; height: 24px; }

/* 404 */
.not-found { padding: 6rem 0; text-align: center; }
.not-found .container { max-width: 600px; margin: 0 auto; padding: 0 1.5rem; }
.not-found h1 { font-size: 8rem; line-height: 1; color: var(--color-primary); margin-bottom: 1rem; }
.not-found p { font-size: 1.5rem; margin-bottom: 2rem; color: var(--text-secondary, #666); }

/* Search page */
.cc-search { max-width: 1320px; margin: 0 auto; padding: 40px clamp(20px, 5vw, 64px) 0; }
.cc-search__form { display: flex; gap: 12px; margin: 0 0 24px; }
.cc-search__form input { flex: 1; padding: 12px 14px; font: inherit; border: 1px solid var(--border-color); background: var(--bg-secondary); color: var(--text-primary); }
.cc-search__form button { padding: 12px 18px; font: inherit; cursor: pointer; }
.cc-search__status { margin: 0 0 16px; font-size: 14px; color: var(--text-secondary); }

/* Menu, sign-in button and footer links (old engine Base.astro, unchanged). */
.nav-menu {
  display: flex;
  align-items: center;
}
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  transition: all 0.3s;
}
.menu-items {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
  align-items: center;
}
.menu-item a:not([class]) {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  padding: 0.5rem 0;
}
.menu-item a:not([class]):hover {
  color: var(--color-primary);
  text-decoration: underline;
}
.nav-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--nav-auth-btn-border, rgba(148, 163, 184, 0.5));
  background: var(--nav-auth-btn-bg, rgba(59, 130, 246, 0.08));
  color: var(--nav-auth-btn-color, var(--ss-primary, var(--color-primary, #3B82F6)));
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.nav-auth-btn:hover {
  background: var(--nav-auth-btn-bg-hover, rgba(59, 130, 246, 0.16));
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  text-decoration: none;
}
.btn-nav {
  background: var(--color-primary);
  color: white !important;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.2s;
}
.menu-item-button a:hover,
.btn-nav:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }
  .menu-items {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary, #ffffff);
    flex-direction: column;
    gap: 0;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color, #eee);
    display: none;
  }
  .nav-menu.active .menu-items {
    display: flex;
  }
  .menu-item {
    padding: 0 1.5rem;
  }
  .menu-item a {
    display: block;
    padding: 0.75rem 0;
  }
}
.footer-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 1.5rem; /* Reduced from 3rem */
  text-align: left;
}
.footer-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.footer-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-link-list li {
  margin-bottom: 0.5rem;
}
.footer-link-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}
.footer-link-list a:hover {
  color: var(--color-primary, #3b82f6);
}
@media (max-width: 768px) {
  .footer-links {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}
@media (max-width: 480px) {
  .footer-links {
    grid-template-columns: 1fr;
  }
}
