:root {
  --bg: #060708; --ink: #f3f5f8; --ink-soft: #a7aeb7; --blue: #2b8af0; --blue-text: #6cb0ff;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  min-height: 100%; background-color: var(--bg);
  background-image: none;
  background-attachment: fixed; background-repeat: no-repeat;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { min-height: 100vh; font-family: var(--font); color: var(--ink); line-height: 1.6; }
a { color: var(--blue-text); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 60; padding: 10px 16px; border-radius: 999px; background: #121419; color: var(--ink); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

.lg-top {
  max-width: 1080px; margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.lg-brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 18px; }
.lg-brand img { width: 32px; height: 32px; object-fit: contain; }
.lg-brand i { font-style: normal; color: var(--blue); }
.lg-back {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14.5px;
  background: linear-gradient(rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.040));
  border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 3px 10px rgba(0, 0, 0, 0.05);
}
.lg-back svg { width: 16px; height: 16px; }

.lg-main { max-width: 1080px; margin: 0 auto; padding: clamp(36px, 6vw, 72px) max(20px, env(safe-area-inset-right, 0px)) 40px max(20px, env(safe-area-inset-left, 0px)); }
.lg-kicker { font-size: 15px; font-weight: 600; color: var(--blue-text); }
.lg-main h1 { margin-top: 8px; font-size: clamp(38px, 5.4vw, 64px); line-height: 1.02; letter-spacing: -0.035em; text-wrap: balance; }
.lg-lede { margin-top: 14px; font-size: clamp(17px, 0.5vw + 15px, 20px); color: var(--ink-soft); max-width: 52ch; }
.lg-date { margin-top: 10px; font-size: 14px; color: var(--ink-soft); }

.lg-layout { margin-top: clamp(28px, 4vw, 44px); display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.lg-toc { position: sticky; top: 24px; font-size: 14.5px; }
.lg-toc p { font-weight: 600; margin-bottom: 8px; }
.lg-toc ol { list-style: none; display: grid; gap: 2px; }
.lg-toc a { display: block; padding: 6px 10px; border-radius: 10px; color: var(--ink-soft); text-decoration: none; }
.lg-toc a:hover { background: rgba(255, 255, 255, 0.054); color: var(--ink); }

.lg-card {
  min-width: 0;
  border-radius: 28px; padding: clamp(22px, 3vw, 40px);
  background: linear-gradient(rgba(255, 255, 255, 0.070), rgba(255, 255, 255, 0.045));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 26px rgba(0, 0, 0, 0.05);
  max-width: 760px;
}
.lg-card section { scroll-margin-top: 24px; }
.lg-card section + section { margin-top: 30px; padding-top: 26px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.lg-card h2 { font-size: 21px; letter-spacing: -0.015em; line-height: 1.25; margin-bottom: 10px; }
.lg-card p { font-size: 16px; color: var(--ink-soft); max-width: 66ch; }
.lg-card p + p { margin-top: 10px; }
.lg-card p b { color: var(--ink); font-weight: 600; }
.lg-contact { margin-top: 32px !important; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
mark.todo { background: #fff3c4; color: #6b4e00; padding: 1px 6px; border-radius: 6px; font-weight: 600; }

.table-wrap { overflow-x: auto; margin: 4px 0 12px; border-radius: 16px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 11px 14px; vertical-align: top; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
th { font-size: 13px; font-weight: 600; color: var(--ink-soft); background: rgba(255, 255, 255, 0.054); }
tr:last-child td { border-bottom: 0; }
td { color: var(--ink-soft); }
code { font-size: 13px; background: rgba(255, 255, 255, 0.050); padding: 2px 6px; border-radius: 6px; color: var(--ink); }

.link-btn { font: inherit; color: var(--blue-text); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.lg-foot {
  max-width: 1080px; margin: 0 auto;
  padding: 24px max(20px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  display: grid; gap: 10px; font-size: 14px; color: var(--ink-soft);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.lg-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.lg-foot nav a { color: var(--ink); text-decoration: none; }
.lg-foot nav a[aria-current="page"] { color: var(--blue-text); font-weight: 600; }
.lg-foot .link-btn { color: var(--ink); text-decoration: none; font-size: 14px; }

@media (max-width: 820px) {
  .lg-layout { grid-template-columns: minmax(0, 1fr); }
  .lg-toc { position: static; }
  .lg-toc ol { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; margin: 0 -20px; padding: 0 20px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .lg-toc ol::-webkit-scrollbar { display: none; }
  .lg-toc li { flex-shrink: 0; }
  .lg-toc a { padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 13.5px; white-space: nowrap; }
  .lg-brand span { display: none; }
}

/* Page open: the heading and content fade up softly */
@keyframes pageRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .lg-main > * { animation: pageRise 520ms cubic-bezier(0.23, 1, 0.32, 1) both; }
  .lg-main > :nth-child(2) { animation-delay: 50ms; }
  .lg-main > :nth-child(3) { animation-delay: 100ms; }
  .lg-main > :nth-child(4) { animation-delay: 150ms; }
  .lg-main > :nth-child(n+5) { animation-delay: 220ms; }
}

/* Footer, shared with the rest of the site */
:root { --ease-out: cubic-bezier(0.23, 1, 0.32, 1); }
  /* ---------- Footer with the logo, pages, contact and legal links ---------- */
  .site-foot {
    max-width: 1180px; margin: clamp(48px, 7vw, 90px) auto 0;
    padding: clamp(32px, 4vw, 48px) max(20px, env(safe-area-inset-right, 0px)) calc(var(--dock-h) + var(--dock-gap) * 2 + 24px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
    display: grid; gap: clamp(28px, 4vw, 44px);
    font-size: 15px; color: var(--ink-soft);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  .sf-top { display: grid; grid-template-columns: auto 1fr auto; gap: 12px 28px; align-items: center; }
  .sf-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
  .sf-brand img { width: 40px; height: auto; }
  .sf-brand span { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
  .sf-brand i { font-style: normal; color: var(--blue); }
  .sf-say { font-size: 15px; }
  .sf-book { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px; font: 600 15px var(--font); color: #fff; text-decoration: none; background: linear-gradient(rgba(30, 125, 232, 0.97), rgba(9, 95, 196, 0.97)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); transition: transform 140ms var(--ease-out); }
  .sf-book svg { width: 16px; height: 16px; }
  .sf-book:active { transform: scale(0.97); }
  .sf-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
  .sf-cols h2 { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
  .sf-cols ul { list-style: none; display: grid; gap: 8px; }
  .site-foot .sf-cols a, .foot-btn { color: var(--ink-soft); text-decoration: none; font: 500 15px var(--font); background: none; border: 0; padding: 2px 0; cursor: pointer; text-align: left; word-break: break-word; }
  .sf-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 13.5px; }
  @media (hover: hover) and (pointer: fine) { .site-foot .sf-cols a:hover, .foot-btn:hover { color: var(--blue-text); } }
  @media (max-width: 760px) {
    .sf-top { grid-template-columns: 1fr; justify-items: start; }
    .sf-cols { grid-template-columns: 1fr 1fr; }
  }
.site-foot { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)) !important; }

  /* Black page: lift the dark panels off the background */
  body { color: var(--ink); }
  .pl-switch button[aria-pressed="true"] { background: #1670d9; color: #fff; }
  .pl-switch { background: rgba(22, 24, 29, 0.96) !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 6px 18px rgba(0, 0, 0, 0.4) !important; }
  .control, .nav, .not, .deck .face, .tape-case, .note-card.dark { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 20px 50px rgba(0, 0, 0, 0.5) !important; }
  .js-stamp { mix-blend-mode: normal; color: #6cb0ff; border-color: #6cb0ff; }
  .fcard { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 26px 60px rgba(0, 0, 0, 0.5); }
  .bign-step.lit .bign-num, .stick-side .big { color: #2b8af0; -webkit-text-stroke-color: #2b8af0; }
  ::selection { background: rgba(43, 138, 240, 0.4); }
