/* keepclub-docs-v1: service-worker identity marker */
@font-face {
  font-family: "DM Mono";
  src: url("../fonts/dm-mono-400.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("../fonts/dm-mono-500.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #fffdf7;
  --paper-raised: #f5f1e7;
  --ink: #18201e;
  --muted: #5b6965;
  --line: #d8d2c4;
  --accent: #0e3f39;
  --accent-soft: #dceae5;
  --code: #f0ece2;
  --warning: #885b16;
  --max: 78rem;
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0, rgb(14 63 57 / 6%), transparent 28rem),
    var(--paper);
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}

a:hover {
  text-decoration-thickness: .14em;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid #5e9f91;
  outline-offset: 4px;
}

.skip {
  position: fixed;
  z-index: 20;
  top: .5rem;
  left: .5rem;
  padding: .7rem 1rem;
  color: var(--paper);
  background: var(--accent);
  transform: translateY(-150%);
}

.skip:focus {
  transform: none;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  width: min(var(--max), calc(100% - 2rem));
  min-height: 4.4rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.brand img {
  width: 2.25rem;
  height: 2.25rem;
}

.brand small {
  color: var(--muted);
  font-weight: 400;
}

.top-links {
  margin-left: auto;
  display: flex;
  gap: 1rem;
  font-size: .88rem;
}

.layout {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
}

.side {
  align-self: start;
  position: sticky;
  top: 5.5rem;
  max-height: calc(100vh - 6.5rem);
  padding: 2rem 0;
  overflow: auto;
  font-size: .82rem;
}

.side strong {
  display: block;
  margin: 1.2rem 0 .35rem;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.side a {
  display: block;
  padding: .25rem 0;
  color: var(--ink);
  text-decoration: none;
}

.side a:hover {
  color: var(--accent);
  text-decoration: underline;
}

main {
  min-width: 0;
  padding: clamp(3rem, 7vw, 6rem) 0 8rem;
}

.eyebrow {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.18;
  text-wrap: balance;
}

h1 {
  max-width: 17ch;
  margin: .7rem 0 1.2rem;
  font-size: clamp(2.35rem, 7vw, 5rem);
  letter-spacing: -.065em;
}

h2 {
  margin: 4.5rem 0 1rem;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  letter-spacing: -.035em;
}

h3 {
  margin: 2.6rem 0 .7rem;
  font-size: 1.15rem;
}

p,
li {
  max-width: 72ch;
}

.lede {
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.5vw, 1.28rem);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 1.8rem 0 0;
}

.button {
  display: inline-block;
  padding: .7rem 1rem;
  border: 1px solid var(--accent);
  border-radius: .35rem;
  background: var(--accent);
  color: #fffdf7;
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
}

.button.secondary {
  color: var(--accent);
  background: transparent;
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 3rem 0;
}

.principles article,
.callout {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: color-mix(in srgb, var(--paper-raised) 74%, transparent);
}

.principles h2 {
  margin: 0 0 .5rem;
  font-size: 1rem;
  letter-spacing: 0;
}

.principles p {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

.callout {
  margin: 1.4rem 0;
  border-left: .3rem solid var(--accent);
}

.callout.warning {
  border-left-color: var(--warning);
}

.callout > :first-child {
  margin-top: 0;
}

.callout > :last-child {
  margin-bottom: 0;
}

pre {
  max-width: 100%;
  margin: 1.2rem 0 1.8rem;
  padding: 1.2rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--code);
  font: .86rem/1.65 "DM Mono", ui-monospace, monospace;
  tab-size: 2;
}

code {
  padding: .08em .28em;
  border-radius: .2rem;
  background: var(--code);
  font-family: inherit;
  font-size: .92em;
}

pre code {
  padding: 0;
  background: transparent;
  font-size: inherit;
}

.table-wrap {
  max-width: 100%;
  margin: 1rem 0 2rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: .45rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}

th,
td {
  padding: .75rem .8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--paper-raised);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.yes,
.no {
  font-weight: 600;
}

.yes {
  color: var(--accent);
}

.no {
  color: var(--muted);
}

.steps {
  padding-left: 1.4rem;
  counter-reset: steps;
  list-style: none;
}

.steps > li {
  position: relative;
  margin: 1.4rem 0;
  padding-left: 2.2rem;
  counter-increment: steps;
}

.steps > li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  color: #fffdf7;
  background: var(--accent);
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.45rem;
  text-align: center;
}

.tree {
  white-space: pre;
}

.footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8rem;
}

.mobile-nav {
  display: none;
}

@media (max-width: 760px) {
  html {
    /* The sticky header can wrap at the narrowest supported width. Keep
       in-page headings clear when a learner follows a menu/deep link. */
    scroll-padding-top: 7.5rem;
  }

  .top-links a:not(:last-child) {
    display: none;
  }

  .layout {
    display: block;
  }

  .side {
    display: none;
  }

  main {
    padding-top: 2rem;
  }

  .mobile-nav {
    display: block;
    margin-bottom: 2rem;
    border: 1px solid var(--line);
    border-radius: .4rem;
    background: var(--paper-raised);
  }

  .mobile-nav summary {
    padding: .8rem 1rem;
    cursor: pointer;
    font-weight: 600;
  }

  .mobile-nav nav {
    display: grid;
    padding: 0 1rem 1rem;
    gap: .45rem;
    font-size: .86rem;
  }

  /* A display value on the child overrides the browser's built-in closed
     <details> hiding rule. Restate it so the menu is a real disclosure rather
     than links invisibly laid over the first page paragraphs. */
  .mobile-nav:not([open]) nav {
    display: none;
  }

  .principles {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1e25;
    --paper-raised: #262a31;
    --ink: #f4f1e8;
    --muted: #aebbb6;
    --line: #3d4545;
    --accent: #70c2af;
    --accent-soft: #183a34;
    --code: #252930;
    --warning: #efb85d;
  }

  .brand img {
    filter: brightness(0) saturate(100%) invert(75%) sepia(22%) saturate(720%)
      hue-rotate(116deg) brightness(93%);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
