/* Narto · home page components, all below the first screen: the estimate sheet (the drawn phone and the steps track
   live in components.css, as the subpages use them too). Loaded without blocking the first paint (see index.html). */

/* ==================== estimate ==================== */
/* Deal section: an estimate sheet from their own trade, with the work already done.
   Existing tokens only. Green: --accent for the tick strokes, --accent-tint for the vial liquid.
   The bubble outline is ink at 35% (as .level__bubble in site.css). */

.estimate { overflow-x: clip; } /* the sheet starts slightly tilted; never a sideways scroll */
.estimate-grid { display: grid; gap: var(--space-xl); align-items: start; }
.estimate-intro .section__lead { margin-bottom: 0; }
.estimate-stage { padding-top: 2rem; } /* room for the level resting on the sheet */

/* The sheet */
.estimate-sheet {
  position: relative;
  max-width: 42rem;
  color: var(--ink);
  padding: var(--space-l);
  border-radius: var(--radius);
  background: var(--white);
}
.estimate-title {
  margin-bottom: var(--space-xs);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 1.8rem + 1.4vw, 3rem);
  font-weight: 800;
  line-height: .95;
}
.estimate-for { margin-bottom: var(--space-l); color: var(--graphite); font-size: var(--small-size); }
.estimate-for b { color: var(--ink); font-weight: 600; }

/* Line items: a tick column, the item, the value on the right */
.estimate-lines { margin: 0; }
.estimate-line {
  position: relative;
  display: grid;
  grid-template-columns: minmax(min-content, 1fr) auto; /* the label keeps its width; a long value wraps instead */
  align-items: baseline;
  gap: var(--space-m);
  padding: var(--space-s) 0 var(--space-s) 2.5rem;
  border-top: 1px solid var(--rule);
}
.estimate-line dt { font-weight: 600; line-height: 1.35; }
.estimate-line dd {
  max-width: 9em;
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.estimate-note { display: block; color: var(--graphite); font-size: var(--small-size); font-weight: 400; }

/* Hand-drawn tick, drawn in left to right by two opposing wrappers */
.estimate-tick {
  position: absolute;
  top: calc(var(--space-s) - .1rem);
  left: 0;
  width: 1.75rem;
  height: 1.5rem;
  overflow: hidden;
}
.estimate-draw, .estimate-tick svg { display: block; width: 100%; height: 100%; }
.estimate-tick path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.estimate-line:nth-child(2n) .estimate-tick svg { transform: rotate(-7deg) scale(.92); }
.estimate-line:nth-child(3n) .estimate-tick svg { transform: rotate(5deg) scale(1.04); }

/* Total: a heavier rule, then the sum */
.estimate-total { align-items: end; padding-top: var(--space-m); padding-bottom: 0; border-top: 0; }
.estimate-rule {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--ink);
  transform-origin: 0 50%;
}
.estimate-total dt, .estimate-total dd {
  font-family: var(--font-display);
  font-size: var(--h3-size);
  font-weight: 700;
  line-height: 1;
}
.estimate-sum { display: block; }

/* The level resting on the sheet's top edge: an ink body with the vial window */
.estimate-level {
  position: absolute;
  right: var(--space-l);
  bottom: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(10rem, 42%, 14rem);
  height: 2rem;
  border-radius: var(--radius);
  background: var(--ink);
}
.estimate-vial {
  position: relative;
  width: 6.5rem;
  height: 1.375rem;
  border-radius: 1rem;
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
.estimate-vial::before,
.estimate-vial::after { /* the two centre marks */
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: calc(50% - 1.125rem);
  width: 1.5px;
  background: var(--ink);
}
.estimate-vial::after { left: calc(50% + 1.125rem - 1.5px); }
.estimate-bubble {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.75rem;
  height: .75rem;
  margin: -.375rem 0 0 -.875rem;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 1px rgba(23, 24, 27, .35);
}

.night .estimate-level { background: var(--rule); } /* on the ink section the level is light, like aluminium */

@media (max-width: 640px) {
  .estimate-sheet { padding: var(--space-l) var(--space-m) var(--space-m); }
  .estimate-level { right: var(--space-m); }
  .estimate-line { gap: var(--space-s); padding-left: 2.25rem; }
  /* A long value sits under its label; on narrow phones there is no room beside it. */
  .estimate-line--stack { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .estimate-line--stack dd { max-width: none; text-align: left; }
  /* The total gets its own line for the label, the value under it on the right. */
  .estimate-total { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); }
  .estimate-total dd { justify-self: end; max-width: none; }
}
@media (min-width: 900px) {
  .estimate-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0 var(--space-xl); }
  .estimate-intro { position: sticky; top: var(--space-xl); } /* stays beside the taller sheet */
}
