/* knotwick.com: the reading pages (support, privacy, not found) and the
 * design system's own page. Built from tokens.css and system.css. */

.bar {
  padding-block: calc(env(safe-area-inset-top, 0px) + var(--s4)) var(--s4);
  border-bottom: 1px solid var(--grid);
}
.bar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3) var(--s5);
}
.bar__logo img { width: 8.5rem; }
.bar__nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); font-size: var(--text-small); }
.bar__nav [aria-current="page"] { text-decoration-thickness: 2px; color: var(--brass-hi); }

.doc { padding-block: var(--s8) var(--s9); }
.doc__head { display: grid; gap: var(--s3); margin-bottom: var(--s6); }
.doc__head h1 { font-size: var(--text-h2); }

/* A long page of the grimoire. */
.doc__leaf {
  --skin: 1.4;
  --pad: clamp(1.25rem, 4vw, 2.75rem);
  max-width: 46rem;
  display: grid;
  gap: var(--s4);
}
.doc__leaf h2 { font-size: 1.6rem; margin-top: var(--s4); }
.doc__leaf h2:first-child { margin-top: 0; }
.doc__leaf ul { display: grid; gap: var(--s3); }
.doc__leaf li { position: relative; padding-left: 1.4em; }
.doc__leaf li::before {
  content: "";
  position: absolute;
  left: 0.2em;
  top: 0.6em;
  width: 0.45em;
  height: 0.45em;
  background: var(--oxblood);
  border-radius: 50% 45% 55% 40%;
}
.doc__leaf dl { display: grid; gap: var(--s4); margin: 0; }
.doc__leaf dt { font-weight: 700; }
.doc__leaf dd { margin: 0.15em 0 0; }

/* Something the owner still has to fill in before this goes live. */
.todo {
  padding: 0 0.3em;
  border: 1px dashed var(--oxblood);
  border-radius: var(--radius-small);
  color: var(--oxblood);
  font-style: italic;
}

.lost { display: grid; justify-items: center; gap: var(--s5); text-align: center; padding-block: var(--s9); }
.lost img { width: 9rem; animation: lost-sway var(--sway) var(--ease-drift) infinite alternate; }
@keyframes lost-sway {
  from { transform: rotate(-3deg) translateX(-0.6rem); }
  to { transform: rotate(3deg) translateX(0.6rem); }
}

.foot--plain {
  padding-block: var(--s6) calc(var(--s6) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--grid);
  font-size: var(--text-small);
}
.foot--plain .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3) var(--s5); }

/* ---------- The design system's page ---------- */

.ds { padding-block: var(--s7) var(--s9); display: grid; gap: var(--s8); }
.ds section { display: grid; gap: var(--s5); }
.ds section > h2 { font-size: var(--text-h3); padding-bottom: var(--s2); border-bottom: 1px solid var(--grid); }
.ds h3 { font-size: 1.35rem; }
.ds p { max-width: 44rem; }
.ds code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8em;
  color: var(--ghost);
}
.ds__intro { display: grid; gap: var(--s4); }
.ds__intro h1 { font-size: var(--text-h2); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: var(--s4); }
.swatch { display: grid; gap: var(--s2); font-size: var(--text-small); line-height: 1.3; }
.swatch__chip {
  height: 4.5rem;
  border-radius: var(--radius-small);
  border: 1px solid rgb(244 232 206 / 0.14);
}
.swatch code { display: block; }

.specimens { display: grid; gap: var(--s5); }
.specimen { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: var(--s4); align-items: baseline; }
.specimen > code { color: var(--text-dim); }

.scale { display: grid; gap: var(--s2); }
.scale__row { display: grid; grid-template-columns: 5rem 5rem minmax(0, 1fr); align-items: center; gap: var(--s3); font-size: var(--text-small); }
.scale__bar { height: 0.75rem; background: var(--brass); border-radius: 2px; }

.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s5);
  padding: var(--s5);
  border: 1px solid var(--grid);
  border-radius: var(--radius-small);
  background: var(--slate);
}
.demo--stack { display: grid; justify-items: start; }
.demo__cap { flex-basis: 100%; font-size: var(--text-small); color: var(--text-dim); }
.ds table { border-collapse: collapse; width: 100%; font-size: var(--text-small); }
.ds th, .ds td { text-align: left; padding: var(--s2) var(--s4) var(--s2) 0; border-bottom: 1px solid var(--grid); vertical-align: top; }
.ds th { font-weight: 700; color: var(--text-dim); }
.table-scroll { overflow-x: auto; }
.motion-knot { width: 4.5rem; animation: knot-idle var(--idle) var(--ease-drift) infinite alternate; }
@keyframes knot-idle { to { transform: scale(1.015, 0.985); } }
.motion-drift { width: 4.5rem; animation: lost-sway var(--sway) var(--ease-drift) infinite alternate; }
.motion-burst { position: relative; width: 5rem; height: 5rem; border: 1px dashed var(--grid); background: none; cursor: pointer; }
.motion-burst img { position: absolute; inset: 0; opacity: 0; }
.motion-burst.is-on img { animation: ds-burst var(--t-burst) ease-out; }
@keyframes ds-burst { from { transform: scale(0.55); opacity: 1; } to { transform: scale(1.1); opacity: 0; } }
.words { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--s5); }
.words .leaf { display: grid; gap: var(--s3); align-content: start; }

@media (max-width: 40rem) {
  .specimen { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
}
@media (prefers-reduced-motion: reduce) {
  .lost img, .motion-knot, .motion-drift { animation: none; }
}
