/* Shared styling for every recipe page. Changing it changes all recipes. */
@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Kalam:wght@400;700&display=swap");

:root{
  --font:Nunito,system-ui,-apple-system,"Segoe UI",sans-serif;
  --font-head:Kalam,"Comic Sans MS",cursive;
  --fs:15px;
  --paper:#fdfcf3; --sheet:#fffef8; --ink:#1f2a44; --muted:#6a7593;
  --rule:#3a5a9a;   /* outer frame */
  --line:#a9bbdf;   /* lines between cells */
  --hold:#8fa3cc;   /* pass-through arrows */
  --prep:#2f6fd6; --heat:#d65a2f; --combine:#8a4fd6; --finish:#2f9a5a;
  --tint:9%;
  --ingw:190px;     /* ingredient column */
  --colmin:150px;   /* narrowest a step column may get */
  --pad:12px;
}

/* ───── page ───── */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;font:var(--fs)/1.4 var(--font);color:var(--ink);
  background:linear-gradient(rgba(58,90,154,.12) 1px,transparent 1px) 0 0/100% 28px,var(--paper);
  padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 48px max(16px,env(safe-area-inset-left));
  max-width:1320px;margin-inline:auto;
}

/* ───── one-line header ───── */
body > header{
  display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 24px;
  border:1.5px solid var(--rule);background:var(--sheet);padding:10px 14px;margin-bottom:12px;
}
body > header > *{margin:0;font-size:1em;font-weight:400}
body > header h1{font:700 1.2em/1.2 var(--font-head)}
body > header em{font-style:normal;color:var(--muted);margin-right:4px}

/* ───── the chart ───── */
.toolchart{
  container-type:inline-size;
  overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;
  border:1.5px solid var(--rule);background:var(--sheet);
  /* how many step columns → deepest nesting of .step (up to 12) */
  --cols:1;
}
.toolchart:has(.step .step){--cols:2}
.toolchart:has(.step .step .step){--cols:3}
.toolchart:has(.step .step .step .step){--cols:4}
.toolchart:has(.step .step .step .step .step){--cols:5}
.toolchart:has(.step .step .step .step .step .step){--cols:6}
.toolchart:has(.step .step .step .step .step .step .step){--cols:7}
.toolchart:has(.step .step .step .step .step .step .step .step){--cols:8}
.toolchart:has(.step .step .step .step .step .step .step .step .step){--cols:9}
.toolchart:has(.step .step .step .step .step .step .step .step .step .step){--cols:10}
.toolchart:has(.step .step .step .step .step .step .step .step .step .step .step){--cols:11}
.toolchart:has(.step .step .step .step .step .step .step .step .step .step .step .step){--cols:12}
.toolchart > .step{
  /* step columns share whatever width is left after the ingredient column */
  --colw:max(var(--colmin),calc((100cqw - var(--ingw) - 1px) / var(--cols)));
  width:max-content;min-width:100%;
}

/* A step = [its inputs stacked] [its own cell] [pass-through filler]  */
.step{display:flex;align-items:stretch;--c:var(--prep)}
.step.heat{--c:var(--heat)}
.step.combine{--c:var(--combine)}
.step.finish{--c:var(--finish)}

.in{display:flex;flex-direction:column;flex:none}
.in > *{flex:1 1 auto}
.in > * + *{border-top:1px solid var(--line)}

.do{
  flex:none;width:var(--colw);
  border-left:1px solid var(--line);margin-left:-1px;
  padding:12px var(--pad);
  display:flex;flex-direction:column;justify-content:center;gap:3px;
  background:color-mix(in srgb,var(--c) var(--tint),var(--sheet));
}
.do h3{margin:0;font:700 1.35em/1.05 var(--font-head)}
.do p{margin:0;font-size:.93em;line-height:1.4;color:color-mix(in srgb,var(--ink) 85%,var(--sheet))}
.do p b,.do p strong{color:var(--ink)}
.do time{font-size:.82em;font-weight:700;color:var(--muted)}

/* Ingredient = [qty / name / note] [pass-through filler] */
.ing{
  display:grid;grid-template-columns:var(--ingw) 1fr;align-content:center;
  background:var(--sheet);
}
.ing > *{grid-column:1;padding:0 var(--pad);line-height:1.25}
.ing > :first-child{padding-top:9px}
.ing > :last-child{padding-bottom:9px}
.ing b{font-weight:700;color:var(--muted);font-size:.9em}
.ing span{font-weight:700}
.ing small{font-size:.8em;color:var(--muted)}

/* pass-through filler: dashed arrow with optional label (data-wait) */
.step::after,.ing::after{
  content:attr(data-wait);
  flex:1 0 0;min-width:0;
  border-left:1px solid var(--line);margin-left:-1px;
  display:flex;align-items:center;justify-content:center;
  padding:0 0 1.9em;overflow:hidden;
  font:400 14px/1 var(--font-head);color:var(--muted);text-align:center;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='10'%3E%3Cpath d='M0 0L9 5L0 10z' fill='%238fa3cc'/%3E%3C/svg%3E") right 50%/9px 10px no-repeat,
    linear-gradient(90deg,var(--hold) 50%,transparent 0) 0 50%/9px 1.5px repeat-x;
}
.toolchart > .step::after{display:none}
.toolchart > .step > .do{flex-grow:1}
.ing::after{content:"";grid-column:2;grid-row:1 / span 3;padding:0}

/* ───── responsive ───── */
@media (max-width:1024px){ :root{--ingw:150px;--colmin:122px;--pad:10px;--fs:14px} }
@media (max-width:640px){
  :root{--ingw:118px;--colmin:156px;--pad:9px}
  body{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}
  body > header{padding:8px 10px}
  body > header{gap:2px 16px}
  body > header h1{flex-basis:100%}
}
@media (max-height:500px) and (orientation:landscape){ :root{--ingw:150px;--colmin:120px;--pad:8px} body{padding-top:8px} }
@media print{
  @page{size:landscape;margin:10mm}
  body{background:#fff;padding:0}
  .toolchart{overflow:visible}
}
