/* 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); }
