/* Tally's lobes' layer, the site: the page's room, the head, the opening, the slate of what is to come, the screens drawn
   small, the foot. Every rule names a class. The colours are the theme's tokens, the person's text size scales the
   type. */

/* The page's room: every part asks this container how wide it is, never the window. */
.tally-site {
  container: tally-site / inline-size;
  margin: 0;
  min-height: 100vh;
  background: var(--tally-surface);
  color: var(--tally-body);
  font-family: var(--tally-font);
  font-size: calc(var(--tally-size-base) * var(--access-text-size, 1));
  line-height: calc(1.6 * var(--access-leading, 1));
  -webkit-font-smoothing: antialiased;
  color-scheme: var(--tally-scheme);
}
/* The one tint a page wears: the accent, its text, its wash and its glow, read from the theme's tokens. */
.tally-tint-mint {
  --tally-accent: var(--tally-mint);
  --tally-accent-text: var(--tally-mint-text);
  --tally-wash: var(--tally-mint-wash);
  --tally-glow: var(--tally-mint-glow);
}
.tally-wrap {
  box-sizing: border-box;
  max-width: var(--tally-wide);
  margin-inline: auto;
  padding-inline: var(--tally-gutter);
}

/* The mark and the count: strokes, the fifth across the four before it, in the accent. */
.tally-mark,
.tally-count {
  display: block;
  fill: none;
  stroke-linecap: round;
}
.tally-mark {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
}
.tally-mark-bar,
.tally-bar {
  stroke: var(--tally-text);
  stroke-width: var(--tally-stroke);
}
.tally-mark-cross,
.tally-cross {
  stroke: var(--tally-accent);
  stroke-width: var(--tally-stroke);
}
.tally-count {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* The head: the mark, the name, the theme. */
.tally-head {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--tally-line);
  background: color-mix(in srgb, var(--tally-surface) 86%, transparent);
  backdrop-filter: blur(14px);
}
.tally-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.5rem;
}
.tally-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--tally-text);
  text-decoration: none;
}
.tally-brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tally-switchers {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* A fold of choices: an outlined press and a panel of rows, with no script. */
.tally-fold {
  position: relative;
}
.tally-fold-press {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--tally-line-strong);
  border-radius: 999px;
  background: var(--tally-raised);
  color: var(--tally-text);
  font: inherit;
  font-size: var(--tally-size-small);
  cursor: pointer;
  list-style: none;
}
.tally-fold-press::-webkit-details-marker {
  display: none;
}
.tally-fold-press:focus-visible,
.tally-fold-link:focus-visible {
  outline: 2px solid var(--tally-accent);
  outline-offset: 2px;
}
.tally-icon {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.tally-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--tally-muted);
}
.tally-fold[open] .tally-chevron {
  transform: rotate(180deg);
}
.tally-theme-day {
  display: var(--tally-show-day);
}
.tally-theme-night {
  display: var(--tally-show-night);
}
.tally-fold-panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.4rem);
  z-index: 6;
  display: flex;
  flex-direction: column;
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--tally-line-strong);
  border-radius: var(--tally-radius-card);
  background: var(--tally-raised);
  box-shadow: var(--tally-shadow);
}
.tally-fold-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.5rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: var(--tally-radius);
  background: none;
  color: var(--tally-body);
  font: inherit;
  font-size: var(--tally-size-small);
  text-align: start;
  cursor: pointer;
}
.tally-fold-link[aria-current='true'] {
  background: var(--tally-wash);
  color: var(--tally-accent-text);
}
.tally-choice-mark {
  color: var(--tally-muted);
}
.tally-fold-link[aria-current='true'] .tally-choice-mark {
  color: var(--tally-accent-text);
}

.tally-choice-press {
  min-width: 2.5rem;
  justify-content: center;
}
.tally-choice-panel {
  gap: 0.15rem;
}

/* The words every part shares. */
.tally-eyebrow {
  margin: 0 0 1rem;
  color: var(--tally-accent-text);
  font-family: var(--tally-font-mono);
  font-size: var(--tally-size-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tally-title {
  margin: 0;
  color: var(--tally-text);
  font-size: var(--tally-size-title);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}
.tally-heading {
  margin: 0;
  color: var(--tally-text);
  font-size: var(--tally-size-heading);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}
.tally-lead {
  margin: 1.25rem 0 0;
  max-width: var(--tally-measure);
  font-size: var(--tally-size-lead);
  line-height: 1.5;
}
.tally-text {
  margin: 0;
  max-width: var(--tally-measure);
}
.tally-note {
  margin: 1.5rem 0 0;
  max-width: var(--tally-measure);
  color: var(--tally-muted);
  font-size: var(--tally-size-small);
}

/* The opening: its statement, then its figure, side by side where there is room. */
.tally-hero {
  padding-block: clamp(3rem, 12cqi, 7rem) clamp(2.5rem, 8cqi, 5rem);
}
.tally-hero-row {
  display: grid;
  gap: 3rem;
  align-items: center;
}
.tally-hero-words {
  min-width: 0;
}
.tally-figure {
  max-width: 28rem;
  padding: 1.5rem;
  border: 1px solid var(--tally-line);
  border-radius: var(--tally-radius-card);
  background: var(--tally-raised);
  box-shadow: var(--tally-shadow);
}
@container tally-site (min-width: 52rem) {
  .tally-hero-row {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 4rem;
  }
}
.tally-count .tally-bar,
.tally-count .tally-cross {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: tally-draw var(--tally-draw-duration) cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.tally-count :nth-child(2) {
  animation-delay: 0.1s;
}
.tally-count :nth-child(3) {
  animation-delay: 0.2s;
}
.tally-count :nth-child(4) {
  animation-delay: 0.3s;
}
.tally-count :nth-child(5) {
  animation-delay: 0.45s;
}
.tally-count :nth-child(6) {
  animation-delay: 0.55s;
}
.tally-count :nth-child(7) {
  animation-delay: 0.65s;
}
.tally-count :nth-child(8) {
  animation-delay: 0.75s;
}
.tally-count :nth-child(9) {
  animation-delay: 0.9s;
}
.tally-count :nth-child(n + 10) {
  animation-delay: 1s;
}
@keyframes tally-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* What is to come: a card for each thing, headed by its count. */
.tally-slate,
.tally-phones,
.tally-words {
  padding-block: clamp(2.5rem, 8cqi, 5rem);
}
.tally-slate-head {
  margin-bottom: 2.5rem;
}
.tally-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tally-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  border: 1px solid var(--tally-line);
  border-radius: var(--tally-radius-card);
  background: var(--tally-raised);
}
.tally-item .tally-count {
  width: auto;
  height: 1.5rem;
  align-self: flex-start;
  animation: none;
}
.tally-item .tally-bar,
.tally-item .tally-cross {
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  animation: none;
}
.tally-item-title {
  margin: 0.5rem 0 0;
  color: var(--tally-text);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.tally-item-text {
  margin: 0;
  color: var(--tally-body);
  font-size: var(--tally-size-base);
}

/* The screens, drawn small: a phone's one thing at a time, with its caption under it. */
.tally-phones {
  background: var(--tally-sunken);
  border-block: 1px solid var(--tally-line);
}
.tally-phone-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 2rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tally-phone {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.tally-phone-screen {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 19rem;
  min-height: 25rem;
  padding: 1.75rem 1.1rem 1.25rem;
  border: 1px solid var(--tally-line-strong);
  border-radius: 2rem;
  background: var(--tally-surface);
  box-shadow: var(--tally-shadow);
  font-size: var(--tally-size-small);
  line-height: 1.4;
}
.tally-phone-cap {
  max-width: 19rem;
  color: var(--tally-body);
  font-size: var(--tally-size-small);
  text-align: center;
}
.tally-ph-label {
  margin: 0;
  color: var(--tally-muted);
  font-family: var(--tally-font-mono);
  font-size: var(--tally-size-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tally-ph-big {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.tally-ph-num {
  color: var(--tally-accent-text);
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}
.tally-ph-line {
  color: var(--tally-body);
}
.tally-ph-rows {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tally-ph-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--tally-line);
  border-radius: var(--tally-radius);
  background: var(--tally-raised);
  color: var(--tally-text);
}
.tally-ph-row-now {
  border-color: transparent;
  background: var(--tally-wash);
}
.tally-ph-row-you {
  border-color: var(--tally-accent);
}
.tally-ph-row-free {
  border-style: dashed;
  border-color: var(--tally-line-strong);
  background: none;
  color: var(--tally-muted);
}
.tally-ph-time {
  color: var(--tally-muted);
  font-family: var(--tally-font-mono);
  font-size: var(--tally-size-tiny);
}
.tally-ph-hint {
  margin-inline-start: auto;
  color: var(--tally-muted);
  font-size: var(--tally-size-tiny);
}
.tally-ph-note {
  margin: auto 0 0;
  color: var(--tally-muted);
  font-size: var(--tally-size-tiny);
}
.tally-ph-ask {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--tally-line-strong);
  border-radius: var(--tally-radius-card);
  background: var(--tally-raised);
}
.tally-ph-ask .tally-ph-text {
  margin: 0;
  color: var(--tally-text);
}
.tally-ph-asks {
  display: flex;
  gap: 0.5rem;
}
.tally-ph-btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid var(--tally-line-strong);
  border-radius: 999px;
  color: var(--tally-text);
  font-size: var(--tally-size-small);
  font-weight: 600;
}
.tally-ph-btn-accent {
  border-color: var(--tally-accent);
  background: var(--tally-accent);
  color: var(--tally-on-accent);
}

/* The closing words and the foot. */
.tally-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.tally-foot {
  border-top: 1px solid var(--tally-line);
  padding-block: 2rem;
}
.tally-foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.tally-foot-held {
  margin: 0;
  color: var(--tally-muted);
  font-family: var(--tally-font-mono);
  font-size: var(--tally-size-tiny);
  letter-spacing: 0.04em;
}
.tally-place-page {
  min-height: 1px;
}

@media (prefers-reduced-motion: reduce) {
  .tally-count .tally-bar,
  .tally-count .tally-cross {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }
}
