/**
 * Measuring worksheet.
 *
 * Sized for a phone held in one hand in a garage, not for a desk. Targets are
 * 48px minimum, the measurement input is oversized because it is the thing
 * being tapped most, and nothing relies on hover.
 *
 * Colours come from the theme tokens so this follows light and dark without
 * declaring a palette of its own.
 */

.ws {
  --ws-gap: clamp(18px, 3vw, 28px);
  max-width: 44rem;
  margin: 0 auto;
  color: var(--ink, #23282b);
}

.ws__fallback {
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--soft, #f4f3ef);
  padding: 20px;
}

/* ---- progress ---- */
.ws__bar {
  height: 3px;
  background: var(--line, #e4e5e1);
  margin-bottom: var(--ws-gap);
  overflow: hidden;
}
.ws__bar span {
  display: block;
  height: 100%;
  background: var(--teal, #159e9e);
  transition: width .3s cubic-bezier(.16, .84, .44, 1);
}

/* ---- type ---- */
.ws__h {
  font-family: var(--disp, inherit);
  font-weight: 400;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  line-height: 1.1;
  margin: 0 0 10px;
}
.ws__lede {
  color: var(--muted, #6b7073);
  margin: 0 0 var(--ws-gap);
  font-size: .98rem;
}
.ws__label {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 6px;
}
.ws__help {
  color: var(--muted, #6b7073);
  font-size: .9rem;
  margin: 0 0 12px;
  line-height: 1.45;
}

.ws__f { margin-bottom: var(--ws-gap); }
.ws__body { min-height: 16rem; }

/* ---- choices ---- */
.ws__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ws__opt {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--surface, #fff);
  color: var(--ink, #23282b);
  cursor: pointer;
  border-radius: 2px;
}
.ws__opt.is-on {
  border-color: var(--teal, #159e9e);
  box-shadow: inset 0 0 0 1px var(--teal, #159e9e);
  background: var(--teal-soft, rgba(21, 158, 158, .08));
}
.ws__opt:focus-visible,
.ws__btn:focus-visible,
.ws__num:focus-visible,
.ws__input:focus-visible,
.ws__text:focus-visible {
  outline: 2px solid var(--teal-ink, #0f7d7d);
  outline-offset: 2px;
}

/* ---- measurement ---- */
.ws__measure {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.ws__num {
  font: inherit;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
  width: 100%;
  max-width: 11rem;
  padding: 10px 12px;
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--surface, #fff);
  color: var(--ink, #23282b);
  border-radius: 2px;
}
.ws__unit {
  color: var(--muted, #6b7073);
  font-size: .95rem;
}
.ws__fracs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ws__frac {
  font: inherit;
  font-family: var(--mono, ui-monospace, monospace);
  min-height: 44px;
  min-width: 58px;
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--sunk, #ebece8);
  color: var(--ink, #23282b);
  cursor: pointer;
  border-radius: 2px;
}
.ws__frac--clear { color: var(--muted, #6b7073); }

/* ---- text ---- */
.ws__input,
.ws__text {
  font: inherit;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--surface, #fff);
  color: var(--ink, #23282b);
  border-radius: 2px;
}
.ws__text { resize: vertical; }

/* ---- rooms ---- */
.ws__rooms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.ws__room {
  font: inherit;
  text-align: left;
  padding: 18px;
  min-height: 92px;
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--surface, #fff);
  color: var(--ink, #23282b);
  cursor: pointer;
  border-radius: 2px;
  transition: border-color .2s, transform .2s;
}
.ws__room:hover { border-color: var(--teal, #159e9e); transform: translateY(-2px); }
.ws__room.is-on { border-color: var(--teal, #159e9e); box-shadow: inset 0 0 0 1px var(--teal, #159e9e); }
.ws__room b {
  display: block;
  font-family: var(--disp, inherit);
  font-weight: 400;
  font-size: 1.2rem;
  margin-bottom: 5px;
}
.ws__room span { color: var(--muted, #6b7073); font-size: .88rem; }

/* ---- photos ---- */
.ws__file {
  font: inherit;
  font-size: .92rem;
  width: 100%;
  padding: 16px;
  border: 1px dashed var(--line-2, #d7d9d6);
  background: var(--surface, #fff);
  color: var(--ink, #23282b);
  border-radius: 2px;
  cursor: pointer;
}
.ws__file:hover { border-color: var(--teal, #159e9e); }
.ws__thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.ws__thumb { position: relative; width: 104px; }
.ws__thumb img {
  display: block;
  width: 104px;
  height: 78px;
  object-fit: cover;
  border: 1px solid var(--line-2, #d7d9d6);
}
.ws__rm {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-2, #d7d9d6);
  background: var(--surface, #fff);
  color: var(--ink, #23282b);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

/* ---- review ---- */
.ws__review { border-top: 1px solid var(--line, #e4e5e1); }
.ws__rhead {
  font-family: var(--disp, inherit);
  font-size: 1.08rem;
  padding: 14px 0 6px;
  cursor: pointer;
}
.ws__rrow {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line, #e4e5e1);
  cursor: pointer;
  font-size: .95rem;
}
.ws__rrow:hover { background: var(--soft, #f4f3ef); }
.ws__rlabel { color: var(--muted, #6b7073); }
.ws__rval {
  font-family: var(--mono, ui-monospace, monospace);
  text-align: right;
  white-space: nowrap;
}
.ws__rval em { font-family: var(--body, inherit); color: var(--muted, #6b7073); }

/* ---- buttons ---- */
.ws__nav {
  display: flex;
  gap: 12px;
  margin-top: var(--ws-gap);
}
.ws__btn {
  font: inherit;
  font-weight: 700;
  min-height: 52px;
  padding: 14px 26px;
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: 2px;
}
.ws__btn--go {
  background: var(--ink, #23282b);
  color: var(--surface, #fff);
  flex: 1;
}
.ws__btn--go:disabled { opacity: .6; cursor: default; }
.ws__btn--ghost {
  background: transparent;
  border-color: var(--line-2, #d7d9d6);
  color: var(--ink, #23282b);
}
.ws__btn--quiet {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: transparent;
  color: var(--muted, #6b7073);
  font-weight: 400;
  font-size: .9rem;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ws__btn--quiet:hover { color: var(--teal-ink, #0f7d7d); }

/* ---- messages ---- */
.ws__flash {
  padding: 14px 16px;
  margin-bottom: var(--ws-gap);
  border-left: 3px solid var(--teal, #159e9e);
  background: var(--teal-soft, rgba(21, 158, 158, .08));
  font-size: .95rem;
}
.ws__flash.is-bad {
  border-left-color: #b32d2e;
  background: rgba(179, 45, 46, .08);
}
.ws__done { text-align: center; padding: 40px 0; }
.ws__resume { padding: 4px 0; }

@media (max-width: 480px) {
  .ws__nav { flex-direction: column-reverse; }
  .ws__btn--ghost { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ws__bar span, .ws__room { transition: none; }
}
