/* The whole recipe on one page, as two screens (templates/recipe_v2_make.html). The overview is laid out in
   static/css/overview_layouts.css. Cooking (html.cooking): only the steps, without the site's top bar and footer
   and without bars of its own; small floating controls in the corners. The bowls open over the whole screen. */

/* Cooking: nothing but the steps */
html.cooking body > header, html.cooking body > footer { display: none !important; }
html.cooking .rv2.make { padding-top: 0; }
.rv2 .cookmode { margin-top: 0; padding: 52px 0 84px; /* clear of the floating controls at the top and the bottom */ }
.cookmode[hidden] { display: none; }
.cookmode .slist { max-width: 780px; margin-inline: auto; }
html.cooking body .trialbar { bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }  /* no bar under it while cooking */

/* The floating controls: small, round and half see-through, over the steps */
.fab, .fab-tools .vmenu-btn, .fab-tools .bowls-open, .fab-tools .details-btn { display: inline-grid; place-items: center; height: 40px; min-width: 40px; border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--color-line) 70%, transparent); color: var(--color-ink); cursor: pointer;
  background: color-mix(in srgb, var(--color-paper) 82%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgb(0 0 0 / .08); padding: 0; font: 600 13px/1 var(--font-sans); }
.fab:hover, .fab-tools .vmenu-btn:hover, .fab-tools .bowls-open:hover, .fab-tools .details-btn:hover { background: var(--color-paper); }
.fab-tools .details-btn[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-ink); }
.fab-back { position: fixed; z-index: 130; top: calc(10px + env(safe-area-inset-top, 0px)); left: max(10px, env(safe-area-inset-left, 0px)); }
.fab-tools { position: fixed; z-index: 130; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 8px; }
.fab-tools .bowls-open { display: inline-flex; gap: 5px; padding: 0 12px; color: var(--color-prep-ink); border-color: color-mix(in srgb, var(--color-prep) 45%, transparent); }
.fab-tools .bowls-open .bl { display: none; }
.fab-tools .bowls-open [data-bowl-count] { font: 500 12px var(--font-mono); }
.fab .icon, .fab-tools .icon { width: 18px; height: 18px; }

/* The view menu opens upwards, aligned to the right */
.vmenu { position: relative; }
.vmenu-list { position: absolute; right: 0; bottom: calc(100% + 8px); min-width: 180px; display: grid; padding: 6px; background: var(--color-paper);
  border: 1px solid var(--color-line); border-radius: var(--radius); box-shadow: 0 10px 30px rgb(0 0 0 / .15); }
.vmenu-list[hidden] { display: none; }
.vmenu-list button { text-align: left; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font: 500 15px var(--font-sans); color: var(--color-ink); cursor: pointer; }
.vmenu-list button:hover { background: var(--color-soft); }
.vmenu-list button[aria-checked="true"] { font-weight: 700; background: var(--color-soft); }
.fab:focus-visible, .details-btn:focus-visible, .vmenu-btn:focus-visible, .vmenu-list button:focus-visible, .bowls-open:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* The running timers: small pills at the top right, only while something is running */
.fab-runs { position: fixed; z-index: 130; top: calc(10px + env(safe-area-inset-top, 0px)); right: max(10px, env(safe-area-inset-right, 0px));
  max-width: calc(100vw - 80px); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.fab-runs[hidden] { display: none; }
.fab-runs .tm { padding: 0 0 0 10px; box-shadow: 0 2px 10px rgb(0 0 0 / .1); }
.fab-runs .tm button { border: 0; background: none; color: inherit; font: inherit; min-height: 34px; padding: 0 4px; cursor: pointer; }
.fab-runs .tm b { font-variant-numeric: tabular-nums; }
.fab-runs .tm-x { padding: 0 10px 0 6px !important; opacity: .7; }

/* The list */
.slist { list-style: none; margin: var(--space-3) 0 0; padding: 0; }
.seg-h { margin: var(--space-4) 0 var(--space-2); font: 600 12px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.seg-h::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--seg); }
.seg-h.prep { --seg: var(--color-prep); color: var(--color-prep-ink); }
.seg-h.cook { --seg: var(--color-cook); color: var(--color-cook-ink); }
.seg-h:first-child { margin-top: 0; }
.heat-line { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-6) 0 var(--space-2); color: var(--color-cook-ink); font-size: 14px; font-weight: 600; }
.heat-line::before, .heat-line::after { content: ""; flex: 1; border-top: 2px dashed var(--color-cook); }

.st { --ph: var(--color-prep); --ph-soft: var(--color-prep-soft); display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--space-3);
  padding: var(--space-3) var(--space-2); border-radius: var(--radius); cursor: pointer; transition: background .15s; }
.st.cook { --ph: var(--color-cook); --ph-soft: var(--color-cook-soft); }
.st.serve { --ph: var(--color-serve); --ph-soft: var(--color-soft); }
.st + .st { border-top: 1px solid var(--color-line); }
.st-tick { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ph); background: var(--color-paper); color: var(--color-ink);
  display: grid; place-items: center; font: 600 14px var(--font-mono); cursor: pointer; padding: 0; margin-top: 2px; }
.st-body h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.st-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.st-meta { font: 400 12px var(--font-mono); color: var(--color-muted); }
.st-tag { font-size: 12px; font-weight: 600; color: var(--color-prep-ink); background: var(--color-prep-soft); border-radius: var(--radius-pill); padding: 1px 8px; }
.st-timer-mini { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 10px; margin-left: auto; border: 1px solid var(--ph);
  border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-ink); font: 600 12px/1 var(--font-sans); cursor: pointer; font-variant-numeric: tabular-nums; }
.st-timer-mini.running { background: var(--ph-soft); }
.st-timer-mini .icon { width: 14px; height: 14px; }
.st-part { font: 500 12px var(--font-mono); color: var(--color-muted); text-transform: uppercase; letter-spacing: .06em; }
.st-body p { margin: 6px 0 0; }
.st-body .txt { font-size: 16px; line-height: 1.55; }
.st-eq { font-size: 13px; color: var(--color-muted); }
.st-donewhen { font-size: 14px; }
.st-donewhen b { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; margin-right: 4px; color: var(--color-muted); }
.st-timer { margin-top: var(--space-2); display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--ph);
  border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-ink); font: 600 14px/1 var(--font-sans); cursor: pointer; }
.st-timer.running { background: var(--ph-soft); font-variant-numeric: tabular-nums; }
.st.setup .st-body h3 { font-weight: 600; color: var(--color-muted); }
/* The next step and the ones done */
.st.is-next { background: var(--ph-soft); }
.st.is-next .st-tick { background: var(--ph); color: var(--color-paper); }
.st.is-done .st-body { opacity: .45; }
.st.is-done .st-body h3 { text-decoration: line-through; text-decoration-thickness: 1px; }
.st.is-done .st-tick { background: var(--ph); border-color: var(--ph); color: var(--color-paper); }
/* Focus: the step you are on shows everything, the others one line that opens on a tap. "Show all details" opens all */
.slist.focus .st:not(.is-next):not(.is-open) .st-more { display: none; }
.slist.focus .st:not(.is-next):not(.is-open) { padding-block: 10px; }
.slist.focus .st:not(.is-next):hover { background: var(--color-soft); }
.slist.focus .st.is-next { cursor: default; }
.slist.all .st { cursor: default; }
.slist.all .st-timer-mini, .st.is-next .st-timer-mini, .st.is-open .st-timer-mini { display: none; }
.st-reset { margin: var(--space-4) 0 0; text-align: right; }
.st-reset button { border: 0; background: none; color: var(--color-muted); font-size: 13px; text-decoration: underline; cursor: pointer; }

/* The views the menu shows instead of the list; the next step is marked, and a tap on a step opens its card */
.vpanel { margin-top: var(--space-3); }
.vpanel:not([data-panel="steps"]) :is(.tl-row, .fx-seg) { cursor: pointer; }
.step-sheet { border: 0; border-radius: 18px; padding: 14px 10px 10px; width: min(600px, calc(100vw - 20px)); max-height: 85vh; overflow: auto;
  background: var(--color-paper); color: var(--color-ink); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
.step-sheet::backdrop { background: rgb(0 0 0 / .35); }
.step-sheet .sheet-x { position: absolute; top: 4px; right: 4px; }
.step-sheet .slist { margin: 0; }
.step-sheet .st { padding-right: 40px; }
.vpanel .g2-node.cur { background: color-mix(in srgb, var(--color-serve) 8%, transparent); border-radius: 16px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-serve) 8%, transparent); }
.vpanel .fx-seg.cur .mn-v { text-decoration: underline; text-decoration-color: var(--color-serve); text-decoration-thickness: 3px; text-underline-offset: 4px; }

/* The bowls over the whole screen. static/js/steps.js scales the board down until it fits without scrolling */
.sheet { border: 0; margin: 0; padding: var(--space-3) var(--space-4) var(--space-4); background: var(--color-paper); color: var(--color-ink);
  width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; display: none; overflow: hidden; overscroll-behavior: contain; }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .2s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet::backdrop { background: var(--color-paper); }
.sheet-h { display: flex; align-items: center; gap: var(--space-3); flex: none; }
.sheet-h h2 { margin: 0; font-size: 20px; }
.sheet-h .hint { margin: 0; }
.sheet-x { margin-left: auto; width: var(--tap); height: var(--tap); border: 0; background: none; display: grid; place-items: center; color: var(--color-muted); cursor: pointer; }
.sheet .meter { flex: none; margin: var(--space-2) 0 var(--space-3); }
.sheet-fit { flex: 1; min-height: 0; overflow: hidden; }
.sheet-fit.scrolls { overflow: auto; }  /* too much to fit at a size you can still read: it scrolls instead */
/* The bowls in rows, each as wide as its tiles need (--n: how many side by side, from the template), stretched to fill
   the row and to the height of the tallest in it; take out and what you probably have the same way */
.sheet-bowls .board { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: stretch; }
.sheet-bowls .board > * { flex: 1 1 max(260px, calc(var(--n, 3) * 92px + 40px)); min-width: 0; max-width: 100%; }
.sheet-bowls .sec-head { margin-bottom: var(--space-2); }
/* Less around the board in the sheet, so the bowls get the height */
.sheet-bowls .ready section, .sheet-bowls section { margin-top: var(--space-3); }
.sheet-bowls section:first-child { margin-top: 0; }
.sheet-bowls .later { margin-top: var(--space-3); }
.sheet-bowls .equipment { margin-top: var(--space-4); padding-top: var(--space-3); }
.sheet-bowls .eqtiles .sym { --s: 40px !important; }
.sheet-bowls .eq.has-img { width: 80px; }
/* A ready bowl is only its title line, until it is opened: what is left gets the room */
.sheet-bowls .board > .bowl.is-ready:not([open]) { flex-basis: 260px; }
.sheet-bowls .bowl.is-ready:not([open]) .tiles { display: none; }
.sheet-bowls .bowl-h b { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }  /* a long name wraps, the step button stays */
/* The step a bowl goes into: a button in its phase colour, shows the step in the view you are in */
.sheet-bowls .bowl-go { flex: none; min-height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-pill); font: 600 12px/1 var(--font-sans);
  background: var(--color-prep-soft); color: var(--color-prep-ink); }
.sheet-bowls .bowl-go.ph-cook { background: var(--color-cook-soft); color: var(--color-cook-ink); }
.sheet-bowls .bowl-go.ph-serve { background: var(--color-serve-soft); color: var(--color-serve-ink); }
.sheet-bowls .bowl-go:hover { filter: brightness(.96); }
.bowl-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-3); margin: 0; font-size: 13px; color: var(--color-muted); }
.bowl-key .k { padding-left: 8px; border-left: 4px solid var(--color-prep); color: var(--color-ink); }
.bowl-key .k.ph-cook { border-left-color: var(--color-cook); }
.bowl-key .k.ph-serve { border-left-color: var(--color-serve); }
/* Bowls for a wait that has started: forward and marked */
.sheet-bowls .later-now { display: none; }
.sheet-bowls .later.is-now { border: 2px solid var(--color-prep); background: color-mix(in srgb, var(--color-prep) 6%, var(--color-paper)); }
.sheet-bowls .later.is-now .later-now { display: block; color: var(--color-prep-ink); font-weight: 600; }
/* Once a wait has started the cooking is under way: the plan's note and the equipment make room for the bowls left */
.sheet-bowls .later.is-now summary small:not(.later-now) { display: none; }
.sheet-bowls .fit-in:has(.later.is-now) .equipment { display: none; }
.fab-tools .bowls-open.later-due { position: relative; }
.fab-tools .bowls-open.later-due::after { content: ""; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-accent); border: 2px solid var(--color-paper); }
/* On a phone the title and the count share the line */
@media (max-width: 600px) { .sheet-h { flex-wrap: wrap; } .sheet-h h2 { font-size: 18px; } .sheet-h .hint { order: 3; flex-basis: 100%; } }
/* The button that ends prep, in the title line; on a phone at the bottom, over the board, which leaves room for it */
.sheet-h .sheet-go { margin-left: auto; white-space: nowrap; }
.sheet-h .sheet-go + .sheet-x { margin-left: 0; }
@media (max-width: 600px) {
  .sheet-h .sheet-go { position: fixed; z-index: 2; right: var(--space-4); bottom: calc(var(--space-4) + env(safe-area-inset-bottom)); box-shadow: 0 4px 16px rgb(0 0 0 / .18); }
  .sheet-bowls:has(.sheet-go) .sheet-fit { padding-bottom: 72px; }
}
@media (min-width: 1000px) { .sheet { padding: var(--space-4) var(--space-8); } }
