:root {
  color-scheme: light dark;

  --bg: #f3f6fb;
  --surface: #ffffff;
  --text: #14213a;
  --muted: #55637d;
  --border: #dde4ef;
  --accent: #1463d6;
  --accent-soft: #e5efff;

  --sidebar-bg: #0b1b33;
  --sidebar-text: #c9d6ee;
  --sidebar-muted: #8296b8;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: #1463d6;

  --sidebar-width: 288px;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1320;
    --surface: #161f31;
    --text: #e8eefa;
    --muted: #9dabc6;
    --border: #263350;
    --accent: #6ea8ff;
    --accent-soft: #1c2d4d;
    --sidebar-bg: #080e1a;
  }
}

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

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#main:focus {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 50;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Sidebar */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  padding: 22px 16px;
  overflow-y: auto;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.sidebar :focus-visible {
  outline-color: #8fbcff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 0 6px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-heading {
  margin: 24px 0 8px;
  padding: 0 12px;
  color: var(--sidebar-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-list li + li {
  margin-top: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: inherit;
  font-size: 0.94rem;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link[aria-current="page"] {
  background: var(--sidebar-active);
  color: #fff;
}

.external-icon {
  width: 15px;
  height: 15px;
  margin-left: auto;
  opacity: 0.55;
}

/* Page */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  padding: 40px clamp(20px, 4vw, 48px);
}

.hero {
  margin-bottom: 36px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(125deg, #0f4fb3, #1463d6 50%, #1b98c9);
  color: #fff;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.2;
}

.hero p {
  max-width: 46ch;
  margin: 0;
  font-size: 1.05rem;
}

main h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(10, 40, 90, 0.14);
  transform: translateY(-2px);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.card-icon svg {
  width: 26px;
  height: 26px;
}

.card-title {
  font-size: 1.08rem;
  font-weight: 650;
}

.card-description {
  flex: 1;
  margin: 6px 0 18px;
  color: var(--muted);
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
}

.card-action svg {
  width: 16px;
  height: 16px;
}

/* Download page */

.download {
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.download h2 {
  margin-bottom: 6px;
}

.download p {
  margin: 0 0 20px;
  color: var(--muted);
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  background: #1463d6;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 0.15s;
}

.download-button:hover {
  background: #0f4fb3;
}

.footer {
  padding: 20px clamp(20px, 4vw, 48px);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer p {
  margin: 0;
}

/* Mobile */

.topbar,
.backdrop {
  display: none;
}

@media (max-width: 800px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--sidebar-bg);
    color: #fff;
    font-weight: 700;
  }

  .menu-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    cursor: pointer;
  }

  .menu-button svg {
    width: 26px;
    height: 26px;
  }

  .sidebar {
    width: min(var(--sidebar-width), 84vw);
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.22s ease, visibility 0s 0.22s;
  }

  .nav-open .sidebar {
    visibility: visible;
    transform: none;
    transition: transform 0.22s ease;
  }

  .nav-open {
    overflow: hidden;
  }

  .nav-open .backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(4, 10, 22, 0.55);
  }

  .page {
    margin-left: 0;
  }

  main {
    padding-top: 22px;
  }
}

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

  .card:hover {
    transform: none;
  }
}
