:root {
  color-scheme: light dark;
  --bg: #f7f8f9;
  --fg: #1f2328;
  --muted: #5b6470;
  --accent: #3b5a7a;
  --accent-fg: #ffffff;
  --card: #ffffff;
  --border: #dfe3e8;
  --alert-bg: #eaf1f8;
  --alert-border: #7ea3c4;
  --header-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131518;
    --fg: #e8eaed;
    --muted: #9aa3ad;
    --accent: #8db4d9;
    --accent-fg: #16232f;
    --card: #1d2124;
    --border: #30353b;
    --alert-bg: #1e2b38;
    --alert-border: #4a7297;
  }
}

:root[data-theme="light"] {
  --bg: #f7f8f9;
  --fg: #1f2328;
  --muted: #5b6470;
  --accent: #3b5a7a;
  --accent-fg: #ffffff;
  --card: #ffffff;
  --border: #dfe3e8;
  --alert-bg: #eaf1f8;
  --alert-border: #7ea3c4;
}
:root[data-theme="dark"] {
  --bg: #131518;
  --fg: #e8eaed;
  --muted: #9aa3ad;
  --accent: #8db4d9;
  --accent-fg: #16232f;
  --card: #1d2124;
  --border: #30353b;
  --alert-bg: #1e2b38;
  --alert-border: #4a7297;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

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

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 0.6rem;
  right: 0.75rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}
.theme-toggle .icon-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-light { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-dark { display: inline; }
}

/* ---------- Mobile top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--header-h);
  padding: 0 3.25rem 0 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar h1 {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Mobile slide-out nav ---------- */
.nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 20;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.nav-scrim.open {
  display: block;
  opacity: 1;
}

#site-toc {
  /* mobile: off-canvas drawer */
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 25;
  width: min(80vw, 300px);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1.25rem 2rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
#site-toc.open { transform: translateX(0); }

#site-toc h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
#site-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#site-toc li a {
  display: block;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--fg);
  font-size: 0.92rem;
}
#site-toc li.sub a {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}
#site-toc li a:hover {
  background: var(--alert-bg);
  color: var(--accent);
}
/* Active-section highlight: mobile drawer only (see desktop override below) */
#site-toc li a.active {
  background: var(--alert-bg);
  color: var(--accent);
}

/* ---------- Layout ---------- */
.layout {
  display: block;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

main {
  max-width: 680px;
  margin: 0 auto;
}

.intro {
  margin-bottom: 2rem;
}
.intro h1 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}
.intro p {
  color: var(--muted);
  margin: 0.3rem 0;
}

section {
  margin-bottom: 2rem;
  scroll-margin-top: calc(var(--header-h) + 12px);
}
section h2 {
  font-size: 1.15rem;
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
section h3 {
  font-size: 1rem;
  margin: 1.2rem 0 0.4rem;
  color: var(--accent);
}
section p {
  margin: 0.5rem 0;
}

.alert {
  background: var(--alert-bg);
  border: 1px solid var(--alert-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}
.alert h2 {
  border-bottom: none;
  margin-bottom: 0.4rem;
  padding-bottom: 0;
}
.alert p {
  font-weight: 600;
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
}

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

.wifi-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.5rem;
}
.wifi-detail div dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.wifi-detail div dd {
  margin: 0.15rem 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  word-break: break-all;
}

.steps {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}
.steps li { margin-bottom: 0.35rem; }

.signoff {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-style: italic;
}

footer.page-footer {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Desktop layout ---------- */
@media (min-width: 900px) {
  .topbar { display: none; }

  .layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 3rem;
    padding-top: 3rem;
  }

  #site-toc {
    position: sticky;
    top: 2rem;
    left: auto;
    bottom: auto;
    transform: none;
    width: auto;
    height: fit-content;
    max-height: calc(100vh - 4rem);
    border: none;
    background: transparent;
    padding: 0;
  }

  .nav-scrim { display: none !important; }

  /* No scroll-driven active highlight on the desktop sidebar TOC */
  #site-toc li a.active {
    background: none;
    color: var(--fg);
  }

  main { max-width: 680px; margin: 0; }
  footer.page-footer { margin: 0; }
}
