/* Slabacus — holding page
   Light, warm paper. A ruled sheet: one margin rule, one abacus rod. */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-subset.woff2") format("woff2");
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper:      #faf8f3;
  --ink:        #17150f;
  --ink-soft:   #57513e;
  --rule:       #cfc8b2;
  --bead-rest:  #9c937a;
  --wash:       #ebe5d3;

  --measure:    42rem;
  --margin-x:   clamp(1.5rem, 7vw, 6rem);
  /* Margin rule sits at a fixed fraction of the page margin, so the gap
     between rule and text scales with the sheet instead of drifting shut. */
  --rule-x:     calc(var(--margin-x) * 0.42);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(2rem, 7vw, 5rem) var(--margin-x) calc(clamp(2rem, 7vw, 5rem) * 1.7);

  display: grid;
  align-content: center;
  justify-items: start;

  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 100%;
  font-synthesis-weight: none;
}

/* The ledger margin rule. Only where there is margin to spare for it. */
@media (min-width: 52rem) {
  body::before {
    content: "";
    position: fixed;
    inset-block: 0;
    inset-inline-start: var(--rule-x);
    width: 1px;
    background: var(--rule);
  }
}

.sheet { width: 100%; }

.wordmark {
  margin: 0 0 0 -0.022em; /* optical: pull the S out to the true left edge */
  font-size: clamp(2.75rem, 9vw, 6rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.016em;
}

/* Abacus rod: counted beads pushed flush, the rest still resting.
   Spans the full sheet — it is the page's ruled line, not a divider
   sized to the paragraph beneath it. */
.rod {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 0.625rem;
  margin-top: clamp(1.5rem, 2.8vw, 2.1rem);
}

.rod::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 1px;
  background: var(--rule);
}

.beads {
  position: relative;
  display: flex;
  gap: 5px;
}

.bead {
  width: 12px;
  height: 9px;
  border-radius: 50%;
  background: var(--bead-rest);
}

.beads--counted .bead { background: var(--ink); }

.statement {
  margin: clamp(2.1rem, 5.5vh, 3.25rem) 0 0;
  max-width: var(--measure);
  font-size: clamp(1.0625rem, 1rem + 0.55vw, 1.3125rem);
  font-weight: 400;
  line-height: 1.58;
  text-wrap: pretty;
}

.status {
  margin: clamp(1.6rem, 4.5vh, 2.5rem) 0 0;
  font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* The one authored moment: four beads settle into the count, once, on load.
   Animates from an offset to the resting default, so nothing depends on it. */
@media (prefers-reduced-motion: no-preference) {
  .beads--counted .bead {
    animation: settle 640ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .beads--counted .bead:nth-child(1) { animation-delay: 180ms; }
  .beads--counted .bead:nth-child(2) { animation-delay: 240ms; }
  .beads--counted .bead:nth-child(3) { animation-delay: 300ms; }
  .beads--counted .bead:nth-child(4) { animation-delay: 360ms; }
}

@keyframes settle {
  from { translate: 1.4rem 0; }
}

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

::selection {
  background: var(--wash);
  color: var(--ink);
}
