/* Recipe page. Builds on styles.css */

.r-hero {
  position: relative; overflow: hidden;
  background: var(--green); color: var(--cream);
  padding: calc(env(safe-area-inset-top, 0px) + 120px) clamp(16px, 4vw, 48px) clamp(48px, 7vw, 90px);
  display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(28px, 5vw, 70px); align-items: center;
}
.r-hero > *:not(.deco) { max-width: 640px; position: relative; z-index: 1; }
.r-soon { display: inline-block; padding: 11px 18px; border-radius: 999px; border: 1.5px dashed rgba(253,244,207,.45); font-weight: 700; font-size: .9rem; opacity: .85; }
.r-photo { opacity: 0; scale: .94; transition: opacity 1s var(--ease-out) .25s, scale 1.2s var(--ease-out) .25s; }
.loaded .r-photo { opacity: 1; scale: 1; }
.r-hero-copy { justify-self: end; width: 100%; container-type: inline-size; }
.r-hero h1 { margin: 0 0 18px; line-height: .95; }
.r-hero h1 .serif { display: block; font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 500; }
/* Sized to the column so long words like SHORTBREAD never run into the photo */
.r-hero h1 .bold { display: block; font-weight: 400; font-size: min(7.4rem, 12.5cqi); letter-spacing: -0.055em; }
.r-credit { margin: 0 0 28px; opacity: .8; }
.r-credit a { border-bottom: 1px solid currentColor; }
.r-facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 12px 32px; margin: 0 0 28px; }
.r-facts dt { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .6; }
.r-facts dd { margin: 4px 0 0; font-family: var(--serif); font-size: 1.15rem; }
.r-watch { display: flex; gap: 10px; flex-wrap: wrap; }
.r-watch a {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px;
  border: 1.5px solid rgba(253,244,207,.45); font-weight: 700; font-size: .9rem;
  transition: background .25s, color .25s;
}
.r-watch a:hover { background: var(--cream); color: var(--green); }
.r-watch svg { font-size: 1.1rem; }
.r-photo { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 50% 50% 22px 22px / 34% 34% 22px 22px; border: 4px solid var(--cream); rotate: 2deg; box-shadow: 0 30px 60px rgba(0,0,0,.35); }

.r-body {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(48px, 7vw, 90px) clamp(16px, 4vw, 48px) 0;
  display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: clamp(28px, 5vw, 72px); align-items: start;
}
.r-ingredients {
  background: var(--cream); border-radius: 26px; padding: 28px;
  position: sticky; top: 90px;
}
.r-col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.r-col-head h2 { margin: 0; font-size: 2.2rem; color: var(--green); }
.r-hint { margin: 4px 0 8px; font-size: .85rem; color: var(--muted); }
.r-reset { font-size: .85rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid currentColor; }
.r-reset:hover { color: var(--green); }
.r-progress { font-size: .85rem; font-weight: 700; color: var(--green-3); }
.r-ingredients h3 { font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green-3); margin: 24px 0 8px; }
.r-ingredients h3 em { font-style: normal; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); margin-left: 6px; }
.r-aside { font-size: .88rem; color: var(--muted); line-height: 1.5; margin: 8px 0 0; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  position: relative; padding: 9px 0 9px 32px; cursor: pointer; line-height: 1.4;
  border-bottom: 1px solid rgba(3,58,44,.1); transition: color .2s;
}
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 10px; width: 18px; height: 18px;
  border: 2px solid var(--green); border-radius: 6px; transition: background .2s;
}
.checklist li::after {
  content: ""; position: absolute; left: 6px; top: 13px; width: 5px; height: 9px;
  border: solid var(--cream); border-width: 0 2.5px 2.5px 0; rotate: 45deg; opacity: 0; transition: opacity .2s;
}
.checklist li.done { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(3,58,44,.4); }
.checklist li.done::before { background: var(--green); }
.checklist li.done::after { opacity: 1; }

.r-method .r-col-head { margin-bottom: 20px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step; position: relative; cursor: pointer;
  padding: 20px 20px 20px 74px; margin-bottom: 10px; border-radius: 18px;
  background: #fff; border: 1.5px solid var(--line); line-height: 1.65; font-size: 1.02rem;
  transition: background .25s, border-color .25s, opacity .25s;
}
.steps li:hover { border-color: var(--green-3); }
.steps li::before {
  content: counter(step); position: absolute; left: 20px; top: 18px;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--bold); font-size: 1rem; background: var(--green); color: var(--cream);
  transition: background .25s;
}
.steps li b { color: var(--green); }
.steps li.done { opacity: .5; background: transparent; }
.steps li.done::before { content: ""; background: var(--green-3); }
.steps li.done::after {
  content: ""; position: absolute; left: 34px; top: 27px; width: 7px; height: 13px;
  border: solid var(--cream); border-width: 0 2.5px 2.5px 0; rotate: 45deg;
}

.r-notes { margin-top: 44px; padding-top: 28px; border-top: 1.5px solid var(--line); }
.r-notes h2 { margin: 0 0 12px; font-size: 2.2rem; color: var(--green); }
.r-notes ul { margin: 0; padding-left: 20px; }
.r-notes li { margin-bottom: 10px; line-height: 1.6; }
.r-notes li::marker { color: var(--pink); }


@media (max-width: 860px) {
  .r-hero { grid-template-columns: 1fr; }
  .r-hero-copy { justify-self: start; }
  .r-photo { aspect-ratio: 16 / 11; rotate: 0deg; border-radius: 50% 50% 18px 18px / 46% 46% 18px 18px; }
  .r-facts { grid-template-columns: repeat(2, auto); }
  .r-body { grid-template-columns: 1fr; }
  .r-ingredients { position: static; }
}
@media (max-width: 520px) {
  .steps li { padding: 16px 16px 16px 60px; font-size: .97rem; }
  .steps li::before { left: 14px; top: 15px; width: 32px; height: 32px; }
  .steps li.done::after { left: 26px; top: 23px; }
}
.r-notes a { color: var(--green); font-weight: 600; border-bottom: 1px solid currentColor; }

/* ---------- Kitchen toolbar (top of the recipe) ---------- */
.r-tools {
  grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px;
  padding: 14px 18px; border: 1.5px solid var(--line); border-radius: 18px; background: #fff;
}
.r-switch, .r-tool-btn { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--green); font-size: .95rem; }
.r-switch-track { width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .25s; flex-shrink: 0; }
.r-switch-track span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .3s var(--ease-out); }
.r-switch[aria-checked="true"] .r-switch-track { background: var(--green); }
.r-switch[aria-checked="true"] .r-switch-track span { transform: translateX(18px); }
.r-tool-btn { padding: 8px 14px; border-radius: 999px; background: var(--cream); transition: background .2s; }
.r-tool-btn:hover { background: var(--cream-2); }
.r-tool-btn svg { font-size: 1.15rem; }
.r-tools-hint { color: var(--muted); font-size: .85rem; margin-left: auto; }

/* Times inside steps become little timer buttons */
.step-time {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; margin: 0 1px;
  border-radius: 999px; background: var(--cream); color: var(--green); font-weight: 700; font-size: .92em;
  border: 1.5px solid transparent; transition: border-color .2s, background .2s; vertical-align: baseline;
}
.step-time svg { font-size: .95em; }
.step-time:hover { border-color: var(--green); }
.steps li.done .step-time { background: transparent; }

/* ---------- Floating timer ---------- */
.kt { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); z-index: 60; font-family: var(--sans); }
.kt-fab {
  margin-left: auto; display: flex; align-items: center; gap: 8px; height: 56px; min-width: 56px; padding: 0 17px;
  border-radius: 999px; background: var(--green); color: var(--cream); box-shadow: 0 14px 30px rgba(3,58,44,.3);
  font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; transition: transform .3s var(--ease);
}
.kt-fab svg { font-size: 1.35rem; }
.kt-fab:hover { transform: translateY(-2px); }
.kt-fab-time:empty { display: none; }
.kt.running .kt-fab { background: var(--pink); color: #fff; }

.kt-panel {
  position: absolute; right: 0; bottom: 70px; width: min(360px, calc(100vw - 32px));
  max-height: min(78vh, 640px); overflow: auto; overscroll-behavior: contain;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 24px; padding: 20px;
  box-shadow: 0 30px 70px rgba(3,58,44,.28); animation: kt-in .35s var(--ease-out);
}
@keyframes kt-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.kt-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.kt-head h3 { margin: 0; font-size: 1.7rem; color: var(--green); }
.kt-x { width: 34px; height: 34px; border-radius: 50%; position: relative; background: var(--cream); }
.kt-x::before, .kt-x::after { content: ""; position: absolute; left: 10px; right: 10px; top: 16px; height: 2px; background: var(--green); border-radius: 2px; rotate: 45deg; }
.kt-x::after { rotate: -45deg; }

.kt-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.kt-list li {
  position: relative; overflow: hidden; border-radius: 16px; padding: 12px 14px; background: var(--green); color: var(--cream);
}
.kt-list li::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); background: rgba(253,244,207,.12); transition: width .25s linear; }
.kt-list li > * { position: relative; }
.kt-list li.done { background: var(--pink); color: #fff; }
.kt-item-text { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.kt-item-label { font-weight: 600; font-size: .9rem; opacity: .9; }
.kt-item-time { font-family: var(--bold); font-size: 1.6rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kt-item-actions { display: flex; gap: 14px; margin-top: 6px; }
.kt-item-actions button { font-size: .8rem; font-weight: 700; opacity: .8; border-bottom: 1px solid currentColor; }
.kt-item-actions button:hover { opacity: 1; }

/* Big clock-style time you can type into */
.kt-dial { display: flex; justify-content: center; align-items: center; gap: 2px; padding: 6px 0 14px; }
.kt-dial input {
  border: 0; background: none; outline: none; padding: 0 2px; text-align: center;
  font-family: var(--bold); font-size: 4rem; line-height: 1; color: var(--green); letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; border-bottom: 2.5px solid transparent; border-radius: 0; transition: border-color .2s;
}
#ktMin { width: 3.1ch; text-align: right; }
#ktSec { width: 2.2ch; text-align: left; }
.kt-dial input:focus { border-bottom-color: var(--pink); }
.kt-colon { font-family: var(--bold); font-size: 3.4rem; line-height: 1; color: var(--green); opacity: .35; padding-bottom: .1em; }

.kt-row { display: flex; gap: 8px; }
.kt-select {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: 999px; background: #fff; transition: border-color .2s;
}
.kt-select:focus-within, .kt-select:hover { border-color: var(--green); }
.kt-select span { position: absolute; left: 16px; font-size: .75rem; font-weight: 600; color: var(--muted); pointer-events: none; }
.kt-select select {
  width: 100%; appearance: none; -webkit-appearance: none; border: 0; background: none; outline: none; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .92rem; color: var(--green); padding: 13px 34px 13px 64px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23033a2c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; background-size: 11px;
}
.kt-start {
  padding: 0 24px; border-radius: 999px; background: var(--green); color: var(--cream); font-weight: 700; font-size: .95rem;
  transition: transform .25s var(--ease), background .2s;
}
.kt-start:hover { background: var(--green-3); }
.kt-start:active { transform: scale(.97); }

/* Time's up */
.kt-alarm {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 90px); translate: -50% 0; z-index: 70;
  width: min(420px, calc(100vw - 32px)); display: flex; align-items: center; gap: 14px;
  background: var(--pink); color: #fff; border-radius: 22px; padding: 14px 14px 14px 16px;
  box-shadow: 0 24px 60px rgba(255,59,92,.4); animation: kt-in .4s var(--ease-out);
}
.kt-alarm > div { flex: 1; min-width: 0; }
.kt-alarm p { margin: 0; }
.kt-alarm-title { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.kt-alarm-sub { font-size: .85rem; opacity: .9; }
.kt-ring { font-size: 1.8rem; display: grid; animation: kt-shake .5s ease-in-out infinite; }
@keyframes kt-shake { 0%,100% { rotate: 0deg; } 25% { rotate: -14deg; } 75% { rotate: 14deg; } }
.kt-stop { background: #fff; color: var(--pink); padding: 12px 22px; }

.kt-toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 90px); translate: -50% 20px; z-index: 65;
  background: var(--ink); color: var(--cream); padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .3s, translate .4s var(--ease-out); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.kt-toast.show { opacity: 1; translate: -50% 0; }

@media (max-width: 860px) {
  .r-tools-hint { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 520px) {
  /* Bottom sheet on phones */
  .kt.open .kt-panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-height: 85vh; border-radius: 26px 26px 0 0; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); }
  .kt.open .kt-fab { visibility: hidden; }
}
.kt [hidden], .kt-alarm[hidden], .kt-list[hidden] { display: none !important; }
.kt-desc {
  width: 100%; margin-bottom: 8px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff;
  font: inherit; font-size: .92rem; font-weight: 600; color: var(--green); outline: none; transition: border-color .2s;
}
.kt-desc::placeholder { color: var(--muted); font-weight: 500; }
.kt-desc:focus { border-color: var(--green); }
.kt-start:disabled { opacity: .4; cursor: default; transform: none; }
.kt-list li.paused .kt-item-time { opacity: .6; }
