:root {
  --amber: #f2b84b;
  --aquifer: #22344a;
  --moss-ink: #256b33;
  --amber-ink: #7d4e00;
  --shaft: 1.3rem;
}

[hidden] { display: none !important; }

.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* the top: the button on the left, the ground on the right */

.bench-ground { padding: 1.4rem 0 3.6rem; }
.bench.wrap { padding-left: var(--gutter); }
.crumb { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--dim); margin: 0 0 0.75rem; }
.crumb a { display: inline-block; color: var(--sand); padding: 0.75rem 0; }
.lead h1 { font-size: clamp(2.05rem, 4vw + 1.1rem, 3.2rem); margin: 0 0 1rem; max-width: 17ch; }
.lead .sub { color: var(--dim); max-width: 33rem; }
.lead .hand { max-width: 30rem; margin: 0; }
.needs { max-width: 33rem; padding-left: 0.9rem; border-left: 3px solid var(--amber); }
.start { margin: 1.6rem 0 1.3rem; }

.go {
  position: relative; overflow: hidden;
  display: block; width: 100%; max-width: 25rem; min-height: 4.2rem;
  padding: 1rem 1.4rem;
  font-family: var(--sans); font-weight: 600; font-size: 1.32rem; line-height: 1.2;
  color: var(--ink); background: var(--paper);
  border: 0; border-radius: 2px;
  box-shadow: 5px 5px 0 var(--clay);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s, box-shadow 0.12s;
}
.go:hover { transform: translate(-1px, -1px); box-shadow: 7px 7px 0 var(--clay); }
.go:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--clay); }
.go-fill {
  position: absolute; inset: 0;
  background: var(--paper);
  transform-origin: left center; transform: scaleX(var(--done, 1));
  transition: transform 0.3s linear;
}
.go-label { position: relative; font-variant-numeric: tabular-nums; }
.go[aria-disabled="true"] { background: #b3a78f; cursor: progress; transform: none; box-shadow: 3px 3px 0 var(--clay); }

/* the answer */

.result {
  max-width: 33rem; margin: 2rem 0 0; padding: 1.1rem 1.2rem 1rem; scroll-margin: 1rem;
  background: var(--paper); color: var(--ink);
  border-top: 7px solid var(--slate);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.4);
}
.result[data-kind="clean"] { border-top-color: var(--moss); }
.result[data-kind="some"] { border-top-color: var(--amber); }
.result-stamp {
  display: inline-block; margin: 0.25rem 0 0.9rem; padding: 0.28rem 0.6rem;
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); border: 2px solid currentColor; border-radius: 2px;
  transform: rotate(-1.5deg);
}
.result[data-kind="clean"] .result-stamp { color: var(--moss-ink); }
.result[data-kind="some"] .result-stamp { color: var(--amber-ink); }
.result h2 { font-size: clamp(1.4rem, 1.2vw + 1.15rem, 1.7rem); line-height: 1.2; margin: 0 0 0.8rem; max-width: none; overflow-wrap: anywhere; }
.result p { font-size: 1rem; line-height: 1.45; margin: 0 0 0.6rem; }
.result p:empty { display: none; }
.result .result-fine { color: var(--ink-soft); border-top: 1px dashed var(--ink-soft); padding-top: 0.6rem; margin-top: 0.8rem; }
.result-links { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; }
.result-links a { display: inline-block; font-weight: 600; padding: 0.6rem 0; }
.result :focus-visible { outline-color: var(--ink); }

/* the ground */

.sample { margin: 2.6rem 0 0; }
.sample h2 {
  font-family: var(--mono); font-weight: 400; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim); margin: 0 0 0.7rem; max-width: none;
}
.column { max-width: 33rem; box-shadow: 0 0 0 1px rgba(243, 234, 217, 0.18); }

.band {
  position: relative;
  padding: 1.15rem 0.85rem 0.55rem calc(var(--shaft) + 1.55rem);
  background-image:
    linear-gradient(rgba(243, 234, 217, 0.2), rgba(243, 234, 217, 0.2)),
    url("../grain.svg");
  background-size: 1px 100%, 360px 360px;
  background-position: calc(var(--shaft) + 1px) 0, 0 0;
  background-repeat: no-repeat, repeat;
}
.b-topsoil { background-color: var(--topsoil); }
.b-clay { background-color: var(--clay); }
.b-slate { background-color: var(--slate); }
.b-bedrock { background-color: var(--bedrock); }
.b-shale { background-color: var(--shale); }
.b-deep { background-color: var(--deep); }
.b-core { background-color: var(--core); }
.b-mantle { background-color: var(--mantle); }
.b-aquifer { background-color: var(--aquifer); }
.f-mantle { fill: var(--mantle); }

.band-edge { position: absolute; left: 0; top: -1px; width: 100%; height: 12px; pointer-events: none; }
.band-edge .seam { fill: none; stroke: var(--cream); stroke-opacity: 0.22; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.band:first-child .band-edge .seam { stroke: var(--moss); stroke-opacity: 0.8; stroke-linecap: round; }

.band::before {
  content: "";
  position: absolute; left: var(--shaft); top: 0; width: 3px;
  height: calc(var(--dug, 0) * 100%);
  background: var(--cream);
  transition: height 0.35s linear;
}
.band.is-drilling::after {
  content: "";
  position: absolute; left: calc(var(--shaft) - 5px); top: calc(var(--dug, 0) * 100% - 1px);
  border: 6.5px solid transparent; border-top: 10px solid var(--cream); border-bottom: 0;
  transition: top 0.35s linear;
}

.band-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 0.8rem; }
.band-head::before {
  content: "";
  position: absolute; left: calc(var(--shaft) - 6px); top: 1.4rem;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--sky); border: 2px solid rgba(243, 234, 217, 0.7);
}
.band.is-busy .band-head::before { border-color: var(--sand); animation: wait 1.1s ease-in-out infinite alternate; }
.band.is-ok .band-head::before { background: var(--moss); border-color: var(--sky); }
.band.is-miss .band-head::before { background: var(--amber); border-color: var(--sky); border-radius: 0; transform: rotate(45deg) scale(0.9); }
@keyframes wait { from { background: var(--sky); } to { background: var(--sand); } }

.band h3 { font-size: 1.12rem; line-height: 1.25; margin: 0; }
.band-state {
  margin: 0; padding: 0.22rem 0.55rem;
  font-family: var(--mono); font-size: 0.72rem; line-height: 1.4; letter-spacing: 0.06em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--dim); background: var(--sky);
}
.band.is-busy .band-state { color: var(--sand); }
.band.is-ok .band-state { color: var(--moss); }
.band.is-miss .band-state { color: var(--amber); }

.band summary {
  display: flex; align-items: center; gap: 0.45rem;
  min-height: 44px; width: fit-content;
  font-size: 0.9rem; color: var(--cream);
  cursor: pointer; list-style: none;
}
.band summary::-webkit-details-marker { display: none; }
.band summary::before {
  content: ""; width: 0.45rem; height: 0.45rem; margin-left: 0.1rem;
  border-right: 2px solid var(--sand); border-bottom: 2px solid var(--sand);
  transform: rotate(-45deg); transition: transform 0.15s;
}
.band details[open] summary::before { transform: rotate(45deg); }

.names { list-style: none; margin: 0 0 0.6rem; padding: 0.15rem 0.75rem; background: var(--sky); }
.names li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 0.9rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed rgba(243, 234, 217, 0.2);
}
.names li:last-child { border-bottom: 0; }
.nm { font-family: var(--mono); font-size: 0.86rem; overflow-wrap: anywhere; }
.st { font-family: var(--mono); font-size: 0.78rem; color: var(--dim); white-space: nowrap; margin-left: auto; }
.st::before {
  content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.45rem;
  border: 1.5px solid currentColor; border-radius: 50%;
}
.is-busy > .st { color: var(--sand); }
.is-ok > .st { color: var(--moss); }
.is-ok > .st::before { background: currentColor; }
.is-miss > .st { color: var(--amber); }
.is-miss > .st::before { border-radius: 0; transform: rotate(45deg) scale(0.9); }

/* below the ground */

#limits h3, #leaves h3 { margin-bottom: 0.5rem; }
#leaves .fine { margin-top: 1rem; }
#leaves .actions a:not(.primary) { display: inline-block; padding: 0.5rem 0; }
#leaves .primary { box-shadow: 4px 4px 0 var(--slate); }
#leaves .primary:hover { box-shadow: 6px 6px 0 var(--slate); }
footer .foot-big a { text-decoration-thickness: 0.06em; }

@media (min-width: 46rem) {
  .bench-ground { padding: 2rem 0 5rem; }
  .bench.wrap { padding-left: calc(var(--gutter) + 3.5rem); }
}

@media (min-width: 62rem) {
  .bench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(21rem, 27rem);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "lead sample" "result sample" ". sample";
    column-gap: 4rem;
  }
  .lead { grid-area: lead; }
  .result { grid-area: result; }
  .sample { grid-area: sample; margin-top: 3.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .go, .go-fill, .band::before, .band.is-drilling::after, .band summary::before { transition: none; }
  .go:hover, .go:active { transform: none; }
  .band.is-busy .band-head::before { animation: none; background: var(--sand); }
}
