/* Setup steps as disclosures, the mobile next-action dock and live step states. */
/* Setup disclosures and the persistent next action share one flow on every screen. */
.workspace {
  display: block;
  max-width: 900px;
  margin-inline: auto;
}
.workspace.has-plan {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  max-width: none;
}
.setup-step {
  padding: 0;
  overflow: clip;
}
.setup-step > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  padding: 20px 24px;
  min-height: 80px;
}
.setup-step > summary::-webkit-details-marker {
  display: none;
}
.setup-step > summary:after {
  content: '＋';
  font-size: var(--text-xl);
  color: var(--action);
  flex-shrink: 0;
}
.setup-step[open] > summary:after {
  content: '−';
}
.setup-step > summary h2,
.library-step > summary h2 {
  font-size: var(--text-lg);
  flex-shrink: 0;
}
.setup-step .selected-label {
  max-width: 55%;
  text-align: right;
  line-height: 1.6;
  font-size: var(--text-sm);
}
.setup-step[open] > summary {
  border-bottom: 1px solid var(--line);
}
.step-content {
  padding: 22px 24px;
}
.step-content > .text-button {
  display: block;
  margin: 0 0 16px auto;
}
.step-content > #batch-badge {
  margin-bottom: 14px;
}
.tracker {
  margin-top: 24px;
}
.plan {
  min-width: 0;
}
.timeline li.current {
  background: var(--step-chip);
  border: 1px solid var(--step-chip-line);
  border-radius: var(--radius-inner);
  margin-left: -12px;
  /* 41 px keeps the step name in line with the names of the other steps. */
  padding: 14px 12px 14px 41px;
}
.timeline li.complete .phase-name {
  color: var(--positive);
}
.timeline li.upcoming .phase-name {
  color: var(--muted);
}
.phase-actual {
  font-size: var(--text-sm);
  line-height: 1.8;
  margin-top: 6px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.timeline li.current .phase-actual {
  font-weight: 600;
}
.timeline li.current:before {
  background: var(--action);
  /* Back on the rail and level with the step name, despite the card's margin and padding. */
  left: 12px;
  top: 18px;
}
body.has-bake {
  padding-bottom: 105px;
}
.mobile-dock {
  position: fixed;
  z-index: 10;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(24px, calc((100vw - 1240px) / 2)) max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 -3px 16px var(--shadow-faint);
}
.mobile-dock > span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-base);
}
.mobile-dock small {
  font-size: var(--text-sm);
  color: var(--muted);
}
.mobile-dock .button {
  max-width: 50%;
  line-height: 1.5;
  text-align: left;
}
.mobile-dock .button {
  white-space: normal;
}
input,
select,
button,
summary,
[tabindex] {
  scroll-margin-bottom: 125px;
}
@media (max-width: 900px) {
  .workspace.has-plan {
    display: block;
    max-width: 900px;
  }
  .plan {
    position: static;
  }
  .setup-step > summary {
    padding: 18px;
  }
  .setup-step .selected-label {
    font-size: var(--text-sm);
  }
  .step-content {
    padding: 20px 18px;
  }
  .setup-step > summary h2,
  .library-step > summary h2 {
    font-size: var(--text-base);
  }
}
@media (max-width: 520px) {
  .setup-step > summary {
    flex-wrap: wrap;
    gap: 6px 12px;
  }
  .setup-step .selected-label {
    max-width: calc(100% - 35px);
    width: 100%;
    order: 3;
    text-align: left;
    margin-left: 0;
  }
  .setup-step > summary:after {
    order: 2;
  }
  .mobile-dock {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    gap: 12px;
  }
  .mobile-dock > span {
    font-size: var(--text-sm);
    max-width: 44%;
  }
  .mobile-dock small {
    font-size: var(--text-label);
  }
  .mobile-dock .button {
    font-size: var(--text-sm);
    max-width: 55%;
    padding: 10px 12px;
  }
  .recipe-grid {
    gap: 8px;
  }
  .recipe-card-meta {
    line-height: 1.5;
  }
  .timeline li.current {
    margin-right: 0;
  }
}
@media print {
  body.has-bake {
    padding: 0;
  }
  .mobile-dock {
    display: none !important;
  }
  .workspace.has-plan {
    display: block;
  }
}
.timeline li.upcoming:before {
  background: var(--sand);
  border: 1px solid var(--line-strong);
}
.timeline li.complete:before {
  background: var(--action);
}
.timeline progress {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 12px;
  accent-color: var(--action);
}
/* Steps 01 and 02 use the same card as steps 03 to 05 and line up with them. */
.library-section,
.welcome {
  max-width: 900px;
  margin-inline: auto;
}
.library-step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: clip;
}
.library-step > summary {
  padding: 20px 24px;
  min-height: 80px;
}
.library-step[open] > summary {
  border-bottom: 1px solid var(--line);
}
.library-content {
  padding: 22px 24px;
}
@media screen and (min-width: 901px) {
  /* With a plan, steps 01–05 share the left column and the plan starts level with step 01:
     the workspace steps aside (display: contents) so its form and plan join main's grid.
     The plan spans an elastic row, so its height never opens a gap between steps 02 and 03. */
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) main {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: repeat(5, auto) 1fr auto;
    column-gap: var(--workspace-gap);
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) main > * {
    grid-column: 1 / -1;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) .workspace {
    display: contents;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) .page-heading {
    grid-row: 1;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) .save-strip {
    grid-row: 2;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) .storage-conflict {
    grid-row: 3;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) .library-section {
    grid-row: 4;
    grid-column: 1;
    max-width: none;
    margin-inline: 0;
    margin-bottom: 0;
  }
  /* Six water cards do not fit the setup column; three per row keep "65%" inside its card. */
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) .water-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) #calculator {
    grid-row: 5;
    grid-column: 1;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) #baking-plan {
    grid-row: 4 / 7;
    grid-column: 2;
    align-self: start;
  }
  body:has(.workspace.has-plan:not([hidden])):not(.is-baking:not(.show-setup)) #bake-tracker {
    grid-row: 7;
  }
}
@media (max-width: 900px) {
  .library-step > summary {
    padding: 18px;
  }
  .library-content {
    padding: 20px 18px;
  }
}
