/* ==========================================================================
   Layout — Header, Footer, Container, Grid
   ========================================================================== */

/* ---------- Container ---------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

@media (max-width: 640px) {
  .container { padding: 0 var(--space-md); }
}

/* ---------- Header ---------- */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

[data-theme="dark"] .header {
  background: rgba(15, 23, 42, 0.82);
}

.header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--space-xl);
}

/* Brand lockup: a logo-only link followed by the non-linked "LCP / Registry"
   text. Spacing between them mirrors the LCP docs navbar (~12px). */
.header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header__logo {
  display: flex;
  align-items: center;
}
.header__logo img {
  width: 32px;
  height: 32px;
  transition: transform 0.15s ease;
}
/* Logo grows slightly on hover, mirroring the LCP docs navbar. */
.header__logo:hover img {
  transform: scale(1.08);
}

.header__brand-text {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
}
.header__logo-label {
  color: var(--color-primary);
}
.header__logo-sep {
  color: var(--color-border);
  font-weight: 300;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-left: auto;
}

.nav__link {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.nav__link:hover {
  color: var(--color-text);
  background: var(--color-bg-muted);
}
.nav__link--active {
  color: var(--color-primary);
}
.nav__link--active:hover {
  color: var(--color-primary-dark);
  background: var(--color-primary-bg);
}
/* Cross-link to the LCP docs site: orange + bold, mirroring the docs
   navbar's link back to the registry. */
.nav__link--brand {
  color: var(--color-primary);
  font-weight: 700;
}
.nav__link--brand:hover {
  color: var(--color-primary-dark);
  background: var(--color-primary-bg);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.theme-toggle:hover { background: var(--color-bg-muted); color: var(--color-text); }
.theme-toggle svg { width: 18px; height: 18px; }

.theme-toggle__sun  { display: block; }
.theme-toggle__moon { display: none; }
[data-theme="dark"] .theme-toggle__sun  { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: block; }

/* GitHub repo widget — mirrors Material's md-source: repo name plus
   star/fork/tag facts pulled from the GitHub API. Points at the LCP repo. */
.header__repo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.25rem 0.5rem;
  color: var(--color-text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}
.header__repo:hover { background: var(--color-bg-muted); color: var(--color-text); }
.header__repo-icon { width: 22px; height: 22px; flex-shrink: 0; }

.header__repo-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.header__repo-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.header__repo-facts {
  display: flex;
  gap: 0.6rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}
.header__repo-fact {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
}
.header__repo-fact svg { width: 11px; height: 11px; flex-shrink: 0; }

/* On narrow screens collapse to just the GitHub glyph. */
@media (max-width: 640px) {
  .header__repo-info { display: none; }
}

/* Mobile menu */
.header__menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
}
.header__menu-btn svg { width: 20px; height: 20px; }

@media (max-width: 640px) {
  .header__menu-btn { display: flex; }
  .header__nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-md);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
  }
  .header__nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav__link { width: 100%; padding: 0.65rem 0.75rem; }
}

/* ---------- Footer ---------- */

/* Footer mirrors the navbar: page background with a delicate top hairline
   that separates it from the content (instead of the old dark bar). Follows
   the active theme via semantic tokens, just like the header. */
.footer {
  background: var(--color-bg);
  color: var(--color-text);
  border-top: 1px solid var(--color-border-light);
  margin-top: auto;
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  font-size: 0.8125rem;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
}
.footer__brand img { width: 24px; height: 24px; }

.footer__text {
  color: var(--color-text-muted);
}

.footer__links {
  display: flex;
  gap: var(--space-lg);
}
.footer__link {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  transition: color var(--transition-fast);
}
.footer__link:hover {
  color: var(--color-text);
}

@media (max-width: 640px) {
  .footer__inner {
    flex-direction: column;
    text-align: center;
  }
}
