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

:root {
  --ink: #243447;
  --muted: #5b6b7c;
  --white: #ffffff;
  --blue: #1e5ab4;
  --blue-deep: #163f7a;
  --soft: #eef3f9;
  --panel: #ffffff;
  --panel-hover: #f4f8fd;
  --line: rgba(36, 52, 71, 0.12);
  --bar: rgba(255, 255, 255, 0.88);
  --ok: #0f7a5a;
  --danger: #b33b3b;
  --amber: #c47a12;
  --font: "Alan Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1180px;
  --ease: 0.2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.45;
  background:
    radial-gradient(1000px 480px at 8% -12%, rgba(30, 90, 180, 0.12), transparent 58%),
    radial-gradient(900px 420px at 96% 108%, rgba(242, 163, 58, 0.08), transparent 55%),
    linear-gradient(180deg, #f7f9fc 0%, #e8eef6 48%, #f3f6fb 100%);
  background-attachment: fixed;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--blue-deep);
}

button,
input {
  font: inherit;
}

.visually-hidden,
.skip-link {
  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:focus {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  padding: 0.65rem 0.9rem;
  background: var(--blue-deep);
  color: var(--white);
  border-radius: 0.5rem;
}

.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

/* Header — matches landing top bar feel */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-inner {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--blue);
  color: var(--white);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 1.02rem;
  font-weight: 750;
}

.brand-text span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem 1rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.92rem;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--blue-deep);
  border-bottom-color: var(--blue);
}

.nav-external {
  padding: 0.35rem 0.7rem !important;
  border: 1px solid var(--line) !important;
  border-radius: 0.45rem;
  border-bottom-color: var(--line) !important;
  color: var(--ink) !important;
}

.nav-external:hover {
  background: var(--soft);
  border-color: rgba(30, 90, 180, 0.28) !important;
}

.nav-toggle {
  display: none;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--white);
  place-items: center;
  gap: 4px;
  flex-direction: column;
}

.nav-toggle span {
  width: 1rem;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

/* Page shell */
.page {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 1.75rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 42rem;
  margin: 0 auto;
  width: 100%;
  text-align: center;
  animation: rise 0.45s ease both;
}

.eyebrow {
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.intro h1,
.page-banner h1,
.section-head h2 {
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.intro h1 {
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  margin-bottom: 0.35rem;
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
}

.search-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.55rem 0.55rem 0.9rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 10px 28px -22px rgba(30, 50, 90, 0.45);
  text-align: left;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.search-panel:focus-within {
  border-color: rgba(30, 90, 180, 0.45);
  box-shadow: 0 0 0 3px rgba(30, 90, 180, 0.12), 0 10px 28px -22px rgba(30, 50, 90, 0.45);
}

.search-panel .icon {
  color: var(--muted);
}

.search-panel input {
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
  padding: 0.45rem 0;
  font-size: 1.05rem;
  color: var(--ink);
}

.search-panel input::placeholder {
  color: #8a97a6;
}

.search-panel button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 0.45rem;
  padding: 0.7rem 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--ease), color var(--ease);
}

.search-panel button,
.btn-primary {
  background: var(--blue);
  color: var(--white);
}

.search-panel button:hover,
.btn-primary:hover {
  background: var(--blue-deep);
  color: var(--white);
}

.btn-secondary {
  background: var(--soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: #e4ebf5;
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-text {
  margin-top: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.86rem;
  cursor: pointer;
  padding: 0;
}

.btn-text:hover {
  color: var(--danger);
}

/* Sections */
.section {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.section.narrow {
  max-width: 40rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
}

.section-head h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
}

.section-note {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

/* Topic grid — same idea as landing system cards */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.85rem;
}

.topic-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.95rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 28px -24px rgba(30, 50, 90, 0.45);
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}

.topic-card:hover {
  background: var(--panel-hover);
  border-color: rgba(30, 90, 180, 0.28);
  transform: translateY(-1px);
  color: inherit;
}

.topic-icon,
.banner-icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.6rem;
  display: grid;
  place-items: center;
  background: rgba(30, 90, 180, 0.1);
  color: var(--blue);
  flex-shrink: 0;
}

.topic-icon .icon,
.banner-icon .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.topic-text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.topic-name {
  font-weight: 750;
  font-size: 1rem;
}

.topic-desc {
  color: var(--muted);
  font-size: 0.88rem;
}

.topic-count {
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

/* Guide rows */
.guide-list,
.tutorial-grid {
  display: grid;
  gap: 0.65rem;
}

.guide-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 10px 28px -24px rgba(30, 50, 90, 0.4);
  transition: background var(--ease), border-color var(--ease);
}

.guide-row:hover {
  background: var(--panel-hover);
  border-color: rgba(30, 90, 180, 0.28);
  color: inherit;
}

.guide-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.guide-main strong {
  font-size: 1.02rem;
}

.guide-main span {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-side {
  display: grid;
  gap: 0.15rem;
  justify-items: end;
  text-align: right;
}

.guide-cat {
  color: var(--blue-deep);
  font-size: 0.8rem;
  font-weight: 750;
}

.meta-inline {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.guide-go {
  color: var(--blue);
}

.pill {
  display: inline-block;
  margin-bottom: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(30, 90, 180, 0.1);
  color: var(--blue-deep);
  font-size: 0.76rem;
  font-weight: 750;
}

/* Banners */
.page-banner {
  animation: rise 0.4s ease both;
}

.page-banner h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  margin-bottom: 0.3rem;
}

.page-banner > p,
.banner-row p {
  color: var(--muted);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--blue);
}

.banner-row {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.banner-count {
  margin-top: 0.4rem;
  font-weight: 750;
  color: var(--ink) !important;
}

.search-panel-page {
  margin-top: 1rem;
  max-width: 40rem;
  text-align: left;
}

.empty-state {
  padding: 1.1rem 1.15rem;
  border-radius: 0.7rem;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

/* Tutorial interactive */
.tutorial-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  align-items: start;
}

.tutorial-sidebar {
  position: sticky;
  top: 4.4rem;
  display: grid;
  gap: 0.75rem;
}

.progress-card,
.step-panel,
.completion-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: 0 10px 28px -24px rgba(30, 50, 90, 0.45);
}

.progress-card {
  padding: 0.95rem 1rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.progress-label span {
  color: var(--muted);
  font-weight: 650;
}

.progress-track {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.35s ease;
}

.step-nav {
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.step-nav-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
  text-align: left;
  padding: 0.65rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.45);
  color: inherit;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}

.step-nav-btn:hover {
  background: var(--white);
  border-color: var(--line);
}

.step-nav-btn.is-current {
  background: var(--white);
  border-color: rgba(30, 90, 180, 0.3);
}

.step-nav-btn.is-done .step-num {
  background: var(--ok);
  color: var(--white);
  border-color: var(--ok);
}

.step-num {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.step-nav-btn span:last-child {
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.3;
  padding-top: 0.1rem;
}

.tutorial-main {
  min-width: 0;
}

.step-panel,
.completion-card {
  padding: 1.2rem 1.25rem 1.1rem;
  animation: rise 0.3s ease both;
}

.step-kicker {
  color: var(--blue);
  font-weight: 750;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-header h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
}

.step-body > p {
  font-size: 1.02rem;
  margin-bottom: 0.9rem;
}

.tip-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem;
  margin-bottom: 1rem;
  border-radius: 0.65rem;
  background: rgba(196, 122, 18, 0.1);
  border: 1px solid rgba(196, 122, 18, 0.22);
}

.tip-box .icon {
  color: var(--amber);
  margin-top: 0.1rem;
}

.tip-box p {
  color: var(--muted);
  margin-top: 0.1rem;
  font-size: 0.92rem;
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.completion-card {
  text-align: center;
  padding: 2rem 1.25rem;
}

.completion-badge {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.8rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(15, 122, 90, 0.12);
  color: var(--ok);
}

.completion-badge .icon {
  width: 1.45rem;
  height: 1.45rem;
}

.completion-card h2 {
  margin-bottom: 0.35rem;
}

.completion-card p {
  color: var(--muted);
  max-width: 30rem;
  margin: 0 auto 1.1rem;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.keyboard-hint {
  margin-top: 0.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.footer-inner {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 1.15rem 0 1.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .tutorial-layout {
    grid-template-columns: 1fr;
  }

  .tutorial-sidebar {
    position: static;
  }

  .guide-side {
    display: none;
  }

  .guide-row {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem 1rem 1rem;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--line);
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.7rem 0.15rem;
    border-bottom: 1px solid var(--line);
  }

  .nav-external {
    margin-top: 0.45rem;
    text-align: center;
  }

  .search-panel {
    grid-template-columns: auto 1fr;
  }

  .search-panel button {
    grid-column: 1 / -1;
  }

  .step-actions {
    flex-direction: column-reverse;
  }

  .step-actions .btn {
    width: 100%;
  }

  .keyboard-hint {
    display: none;
  }
}
