/* Reset + base typography + layout primitives + site chrome (header/drawer). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html {
  /* Keep anchored / scrolled-to content clear of the sticky header. */
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-bg);
  /* Sticky footer: column layout lets <main> grow and push the footer down. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--c-brand);
}

:focus-visible {
  outline: 3px solid var(--c-brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -60px;
  z-index: 100;
  background: var(--c-surface);
  color: var(--c-text);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  transition: top 0.15s;
}
.skip-link:focus {
  top: var(--sp-3);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--c-top);
  color: var(--c-text-inv);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: var(--shadow-2);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: var(--header-h);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--c-text-inv);
  text-decoration: none;
  white-space: nowrap;
}
.brand .logo {
  font-size: 1.4rem;
}
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}
@media (max-width: 420px) {
  .brand {
    font-size: 1rem;
    gap: var(--sp-1);
  }
  .brand-logo {
    height: 32px;
  }
}

.main-nav {
  margin-left: auto;
}
.main-nav ul {
  list-style: none;
  display: flex;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
}
.main-nav a {
  color: var(--c-text-inv);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.18);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--c-text-inv);
  font-size: 1.6rem;
  cursor: pointer;
  padding: var(--sp-2);
  line-height: 1;
}

/* ---------- Mobile drawer ---------- */
@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }
  .main-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--c-surface);
    box-shadow: var(--shadow-2);
    transform: translateY(-100%);
    /* visibility guarantees the closed drawer can't peek above the header,
       regardless of how short it is (transform alone leaves a sliver). */
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0.22s ease;
    margin: 0;
  }
  .main-nav.open {
    transform: translateY(0);
    visibility: visible;
  }
  .main-nav ul {
    flex-direction: column;
    gap: 0;
    padding: var(--sp-2);
  }
  .main-nav a {
    color: var(--c-text);
    display: block;
    padding: var(--sp-3);
  }
  .main-nav a:hover,
  .main-nav a[aria-current="page"] {
    background: var(--c-surface-2);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  padding: var(--sp-6) 0;
  background: var(--c-bottom);
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--fs-sm);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  justify-content: space-between;
}
.site-footer a {
  color: #fff;
}

/* ---------- Utility ---------- */
.section-title {
  font-size: var(--fs-lg);
  margin: 0 0 var(--sp-4);
}
.muted {
  color: var(--c-text-muted);
}
