/* Page frame: fixed black sidebar on the left, light scrolling sheet on the right.
   Below 1000px the sidebar turns into a sticky top bar, a full-screen menu and a bottom CTA. */

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}

.logo svg {
  width: 32px;
  height: 32px;
  flex: none;
}

.toc {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.toc a::before {
  content: "";
  width: 14px;
  height: 1.5px;
  background: currentColor;
  transition: width 0.25s, background 0.25s;
}

.toc a:hover {
  color: var(--ink);
}

.toc a.on {
  color: var(--ink);
  font-weight: 700;
}

.toc a.on::before {
  width: 28px;
  background: var(--blue);
}

/* ---------- Sidebar ---------- */

.side {
  position: fixed;
  z-index: 40;
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  width: var(--side);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 26px;
  border-radius: 26px;
  background: var(--side-bg);
  color: var(--side-ink);
  overflow-y: auto;
}

.side .logo {
  gap: 13px;
  font-size: 31px;
  letter-spacing: -0.03em;
}

.side .logo svg {
  width: 62px;
  height: 62px;
}

.side .name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.side .about {
  font-size: 16px;
  line-height: 1.45;
  color: var(--side-muted);
}

.side .about b {
  color: #fff;
}

.side .toc a {
  color: var(--side-muted);
  font-size: 17px;
}

.side .toc a:hover,
.side .toc a.on {
  color: #fff;
}

.side-foot {
  display: grid;
  grid-template-columns: max-content;
  gap: 10px;
  justify-items: stretch;
  margin-top: auto;
}

.side-foot .btn {
  justify-content: center;
  padding: 16px 22px;
  font-size: 16px;
}

/* the same buttons in the desktop sidebar and in the mobile menu */
.side .btn-dark,
.menu .btn-dark {
  background: #fff;
  color: var(--ink);
}

.side .btn-dark:hover,
.menu .btn-dark:hover {
  background: var(--blue);
  color: #fff;
}

.side .btn-line,
.menu .btn-line {
  border-color: var(--side-muted);
  color: var(--side-ink);
}

.side .btn-line:hover,
.menu .btn-line:hover {
  background: var(--side-ink);
  border-color: var(--side-ink);
  color: var(--ink);
}

/* ---------- Sheet ---------- */

.sheet {
  margin: 12px max(12px, env(safe-area-inset-right, 0px)) 12px
    calc(var(--side) + 24px + env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

/* hide scrollbars, scrolling itself keeps working */
html,
.sheet,
.side {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
.sheet::-webkit-scrollbar,
.side::-webkit-scrollbar {
  display: none;
}

/* desktop: the sheet is its own scroll container, the page itself does not scroll */
@media (min-width: 1001px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .sheet {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: calc(var(--side) + 24px + env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
  }
}

.in {
  padding-left: clamp(20px, calc(5 * var(--vw)), 72px);
  padding-right: clamp(20px, calc(5 * var(--vw)), 72px);
}

/* every section is its own rounded "slide" on the frame background */
section,
footer {
  flex-shrink: 0; /* the sheet is a flex column: never squeeze a section below its content */
  border-radius: 26px;
  background: var(--sheet);
}

section {
  padding-block: clamp(72px, calc(10 * var(--vw)), 140px);
}

/* ---------- Footer ---------- */

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 28px;
  padding-block: 28px;
  color: var(--muted);
  font-size: 14px;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

footer a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Mobile: top bar, menu, bottom CTA ---------- */

.mbar,
.mcta,
.menu {
  display: none;
}

@media (max-width: 1000px) {
  .side {
    display: none;
  }

  .sheet {
    margin: 0;
    padding: 8px max(8px, env(safe-area-inset-right, 0px)) 8px max(8px, env(safe-area-inset-left, 0px));
    gap: 8px;
  }

  .mbar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
    /* dark like the desktop sidebar */
    background: rgba(10, 11, 13, 0.92);
    color: var(--side-ink);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .mbar .logo {
    font-size: 20px;
  }

  .mbar .logo svg {
    width: 38px;
    height: 38px;
  }

  .mbar button {
    margin-left: auto;
    padding: 10px 16px;
    border: 0;
    border-radius: 99px;
    background: #fff;
    color: var(--ink);
    font: 700 14px var(--body);
  }

  .mcta {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
    pointer-events: none; /* only the button itself takes taps, the strip around it does not cover the page */
  }

  .mcta .btn {
    pointer-events: auto;
    box-shadow: none;
  }

  .mcta .btn {
    flex: 1;
    justify-content: center;
  }

  .menu {
    position: fixed;
    inset: 0;
    z-index: 80;
    flex-direction: column;
    gap: 24px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) 24px
      max(24px, env(safe-area-inset-left, 0px));
    background: var(--side-bg);
    color: var(--side-ink);
  }

  .menu.open {
    display: flex;
  }

  .menu .toc a {
    padding: 8px 0;
    color: var(--side-muted);
    font-size: 22px;
  }

  .menu .toc a:hover,
  .menu .toc a.on {
    color: #fff;
  }

  /* buttons fill the menu width */
  .menu .side-foot {
    grid-template-columns: 1fr;
  }

  .menu .close {
    align-self: flex-end;
    padding: 10px 16px;
    border: 0;
    border-radius: 99px;
    background: var(--side-chip);
    color: var(--side-ink);
    font: 700 15px var(--body);
  }

  /* room for the fixed bottom CTA */
  footer {
    padding-bottom: 90px;
  }
}
