:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #15202c;
  --muted: #65717e;
  --line: #dce2e8;
  --nav: #111923;
  --nav-soft: #1d2a38;
  --gold: #d7ad55;
  --blue: #447bac;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: #000;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

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

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(16px, 3vw, 42px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  background: var(--nav);
  box-shadow: 0 5px 22px rgba(5, 12, 20, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 11px;
  color: #17130b;
  background: linear-gradient(145deg, #f0d183, #b9852f);
  font: 800 15px Georgia, serif;
  box-shadow: inset 0 1px rgba(255,255,255,.5);
}

.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .02em; }
.brand small { margin-top: 2px; color: #aeb9c4; font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 18px; }

.tutorial-link {
  color: #dbe5ef;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.tutorial-link:hover { color: #fff; text-decoration: underline; }

.language select {
  min-height: 38px;
  padding: 0 32px 0 11px;
  border: 1px solid #405062;
  border-radius: 8px;
  color: #fff;
  background: var(--nav-soft);
  font: inherit;
}

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 72px); }

.sidebar {
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  background: #f8fafb;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 12px;
  color: #778390;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.icon-button { display: none; border: 0; color: inherit; background: none; font-size: 28px; cursor: pointer; }
.guide-nav { display: grid; gap: 5px; }

.guide-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 9px 11px;
  border-radius: 9px;
  color: #3f4c58;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.guide-nav a::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 2px solid #9ca9b5;
  border-radius: 50%;
  content: "";
}

.guide-nav a:hover { color: #172533; background: #edf1f5; }
.guide-nav a.active { color: #fff; background: #315f88; box-shadow: 0 5px 14px rgba(49,95,136,.2); }
.guide-nav a.active::before { border-color: #f0cf84; background: var(--gold); }

.source-note {
  margin: 28px 10px 0;
  color: #7b8792;
  font-size: 11px;
  line-height: 1.55;
}

.content { min-width: 0; padding: clamp(20px, 3vw, 40px); }

.content-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  margin: 0 auto 18px;
  max-width: 1500px;
}

.content-heading h1 { margin: 2px 0 0; font: 700 clamp(25px, 3vw, 38px)/1.15 Georgia, serif; }
.eyebrow { margin: 0; color: #4f789e; font-size: 11px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.scroll-tip { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.menu-button { display: none; }

.guide-frame {
  display: block;
  width: 100%;
  min-height: 720px;
  max-width: 1500px;
  margin: 0 auto;
  border: 0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 12px 38px rgba(30, 43, 57, .09);
}

.loading { max-width: 1500px; margin: 0 auto 8px; color: var(--muted); font-size: 13px; }
.loading[hidden] { display: none; }
.backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(4, 10, 17, .56); }

@media (max-width: 840px) {
  .topbar { min-height: 64px; }
  .tutorial-link { display: none; }
  .layout { display: block; min-height: calc(100vh - 64px); }
  .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(310px, 88vw);
    padding-top: 22px;
    box-shadow: 12px 0 35px rgba(0,0,0,.2);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .icon-button { display: block; }
  .content { padding: 18px 12px 24px; }
  .content-heading { grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .content-heading h1 { font-size: 26px; }
  .scroll-tip { grid-column: 1 / -1; }
  .menu-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 11px;
    border: 1px solid #cbd4dc;
    border-radius: 9px;
    color: #30404f;
    background: #fff;
    font: 700 13px inherit;
  }
  .guide-frame { min-height: 680px; border-radius: 8px; }
}

@media (max-width: 440px) {
  .brand small { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .language select { width: 122px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
