/* The shared fiche: carnet.cooking/r/<id>. Two columns on a wide screen,
   the app's three tabs on a phone, cook mode full screen on both. */
:root {
  --support: #c0703f;
  --ink-muted: #9c7350;
  --shadow: 0 18px 50px rgba(58, 39, 25, 0.12);
}
.recipe-status {
  padding-block: 90px;
  min-height: 400px;
}
.recipe-status h1 {
  font-size: 46px;
  margin: 20px 0;
}
.recipe-status button {
  margin-top: 25px;
}
.fiche {
  padding-block: 18px 90px;
}

/* Hero: the cover (or the original video, in the same frame) beside the
   title and the source. */
.fiche-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 56px;
  align-items: start;
}
.fiche-hero.is-text {
  grid-template-columns: minmax(0, 760px);
}
.fiche-media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}
.fiche-media.is-empty {
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at 30% 30%, rgba(237, 207, 181, 0.7), transparent 60%),
    var(--card);
}
.fiche-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 18px;
  border: 0;
  background: linear-gradient(to top, rgba(30, 20, 12, 0.42), transparent 45%);
  color: var(--ink);
}
.cover-play-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s;
}
.cover-play-pill .glyph {
  color: var(--accent);
}
.cover-play:hover .cover-play-pill {
  transform: scale(1.03);
}
.fiche-media.is-playing {
  background: #000;
  max-height: min(82vh, 860px);
}
.fiche-media.is-playing.is-vertical {
  aspect-ratio: 9 / 16;
  margin-inline: auto;
  width: min(100%, calc(min(82vh, 860px) * 9 / 16));
}
.fiche-media.is-playing.is-horizontal {
  aspect-ratio: 16 / 9;
}
.fiche-media.is-light {
  background: #fff;
}
.fiche-media iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.fiche-heading {
  padding-top: 12px;
}
.fiche-heading h1 {
  font-size: clamp(42px, 4.6vw, 64px);
  margin: 0 0 18px;
  letter-spacing: -1.2px;
}
.recipe-description {
  font-size: 18px;
  max-width: 560px;
}

/* The source, right under the title: the creator and the way back. */
.source-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.source-text {
  min-width: 0;
}
.source-by {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}
.source-author {
  font-weight: 700;
  color: var(--accent);
}
.source-author:hover,
.source-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.source-detail {
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 1px;
}
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--body);
  font-size: inherit;
  font-weight: 600;
}
.source-mark {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--highlight);
  color: var(--support);
  font-weight: 700;
  font-size: 16px;
}
.source-mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 26px 0 0;
}
.recipe-meta dt {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--support);
}
.recipe-meta dd {
  margin: 3px 0 0;
  font:
    600 26px Cormorant,
    serif;
}
.fiche-cook {
  margin-top: 28px;
  min-width: 200px;
}

/* Body: the ingredients stay in view beside the steps. */
.fiche-body {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: 64px;
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 16px;
}
.fiche-ingredients {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-heading h2 {
  font-size: 38px;
}
.panel-empty {
  color: var(--ink-muted);
}
.ingredient-list,
.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list-section {
  font:
    600 23px Cormorant,
    serif;
  color: var(--ink);
  padding-top: 22px;
  margin-bottom: 6px;
}
.ingredient {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.45;
}
.ingredient-list li + li .ingredient {
  border-top: 1px solid var(--line);
}
.ingredient input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ingredient-mark {
  display: grid;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--accent);
}
.ingredient-mark .glyph {
  grid-area: 1 / 1;
}
.ingredient-mark .glyph + .glyph,
.ingredient input:checked + .ingredient-mark .glyph:first-child {
  display: none;
}
.ingredient input:checked + .ingredient-mark {
  color: var(--line);
}
.ingredient input:checked + .ingredient-mark .glyph + .glyph {
  display: block;
  color: #b9b2a3;
}
.ingredient input:focus-visible + .ingredient-mark {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 50%;
}
.ingredient-text {
  color: var(--body);
}
/* As on the app's fiche: the number is what the eye hunts for mid-cooking,
   so it takes the accent, a step bolder than the name it leads. */
.ingredient-text strong {
  color: var(--accent);
  font-weight: 600;
}
.ingredient input:checked ~ .ingredient-text,
.ingredient input:checked ~ .ingredient-text strong {
  color: #b9b2a3;
  text-decoration: line-through;
}
.step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 6px 14px;
  padding: 22px 0;
}
.step + .step {
  border-top: 1px solid var(--line);
}
.step-number {
  font:
    500 30px / 1 Cormorant,
    serif;
  color: var(--accent);
}
.step-lead {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.5;
  white-space: pre-line;
}
.substeps {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--body);
}
.substeps li {
  padding-left: 4px;
}
.substeps li + li {
  margin-top: 9px;
}
.substeps li::marker {
  color: var(--support);
}
.duration {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}
.step-media {
  grid-column: 2;
  margin: 16px 0 0;
}
.step-media-frame {
  position: relative;
  display: block;
  width: min(100%, 420px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  -webkit-touch-callout: none;
  user-select: none;
}
.step-media-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.step-clip {
  opacity: 0;
  transition: opacity 0.25s;
}
.step-clip.is-visible {
  opacity: 1;
}
.step-media-badge {
  position: absolute;
  z-index: 1;
  left: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(251, 250, 247, 0.88);
  color: var(--ink);
}
.step-media-badge .glyph {
  color: var(--accent);
}

/* Phone tabs: hidden on a wide screen, where both panels show. */
.fiche-tabs {
  display: none;
}

.photo-viewer {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(20, 14, 9, 0.92);
}
.photo-viewer[open] {
  display: grid;
  place-items: center;
}
.photo-viewer img {
  max-width: 94vw;
  max-height: 88dvh;
  border-radius: 10px;
}
.photo-viewer-close {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* Cook mode. */
.is-cooking body {
  overflow: hidden;
}
.cook {
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.cook[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.cook::backdrop {
  background: var(--paper);
}
.cook-header,
.cook-body,
.cook-footer {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-inline: 28px;
}
.cook-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px 18px;
  padding-block: 18px 10px;
}
.cook-close,
.photo-viewer-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.photo-viewer-close {
  padding: 10px;
}
.cook-progress-label {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--support);
}
.cook-progress {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.cook-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s;
}
.cook-body {
  overflow-y: auto;
  padding-block: 28px;
  touch-action: pan-y;
}
.cook-page {
  display: grid;
  gap: 22px;
  animation: cook-page 0.22s ease-out;
}
@keyframes cook-page {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.cook-phase {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--ink-muted);
}
.cook-gesture {
  font-size: clamp(27px, 4.2vw, 38px);
  line-height: 1.35;
  color: var(--ink);
  white-space: pre-line;
}
.cook-timer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.cook-timer-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 22px 10px 16px;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  font-size: 20px;
}
.cook-timer-start.is-running {
  background: var(--highlight);
  border-color: var(--highlight);
  color: var(--ink);
}
.cook-timer-start.is-done {
  background: var(--accent);
  color: var(--paper);
}
.cook-page .step-media {
  margin: 0;
}
.cook-page .step-media-frame {
  width: min(100%, 520px);
}
.cook-needs ul {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.cook-needs li {
  padding: 8px 0;
  font-size: 19px;
  border-bottom: 1px solid var(--line);
}
.cook-needs strong {
  color: var(--accent);
  font-weight: 600;
}
.cook-footer {
  padding-block: 10px max(18px, env(safe-area-inset-bottom));
}
.cook-timers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cook-timers:empty {
  display: none;
}
.cook-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  font-size: 14px;
}
.cook-timer-label {
  color: var(--body);
}
.cook-timer strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cook-timer.is-done {
  background: var(--accent);
  border-color: var(--accent);
  animation: cook-ring 1s ease-in-out infinite;
}
.cook-timer.is-done,
.cook-timer.is-done * {
  color: var(--paper);
}
@keyframes cook-ring {
  50% {
    transform: scale(1.04);
  }
}
.cook-nav {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 12px;
}
.cook-nav .button {
  min-height: 60px;
  font-size: 18px;
}
.cook-nav .button:disabled {
  opacity: 0.35;
  cursor: default;
}
.cook-finish h2 {
  font-size: clamp(48px, 7vw, 72px);
}
.cook-finish .source-line {
  margin: 0;
}
.cook-keep {
  padding: 28px;
  border-radius: 16px;
  background: var(--highlight);
}
.cook-keep h3 {
  font-size: 34px;
}
.cook-keep p {
  margin: 8px 0 20px;
  max-width: 520px;
}

@media (max-width: 980px) {
  .fiche-hero {
    gap: 36px;
  }
  .fiche-body {
    gap: 40px;
  }
}

/* Phone: the app's fiche. Full-bleed cover, then the tabs. */
@media (max-width: 700px) {
  .fiche {
    padding-block: 0 40px;
  }
  .fiche-hero {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .fiche-media {
    margin-inline: -32px;
    border-radius: 0;
    aspect-ratio: 4 / 3;
    box-shadow: none;
  }
  .fiche-media.is-playing.is-vertical {
    width: auto;
    max-height: 78vh;
    margin-inline: -32px;
    aspect-ratio: auto;
    height: 78vh;
  }
  .fiche-heading {
    padding-top: 0;
  }
  .fiche-heading h1 {
    font-size: 40px;
    letter-spacing: -0.8px;
    margin: 0 0 14px;
  }
  .recipe-description {
    font-size: 16px;
  }
  .recipe-meta {
    gap: 22px;
    margin-top: 20px;
  }
  .recipe-meta dd {
    font-size: 23px;
  }
  /* The tab bar carries "Cuisiner" on a phone. */
  .fiche-cook {
    display: none;
  }
  .fiche-body {
    display: block;
    margin-top: 34px;
    padding-top: 24px;
    scroll-margin-top: 0;
  }
  .fiche-ingredients {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .fiche[data-tab="ingredients"] .fiche-steps,
  .fiche[data-tab="recette"] .fiche-ingredients {
    display: none;
  }
  .panel-heading h2 {
    font-size: 34px;
  }
  .step {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 6px 10px;
  }
  .step-number {
    font-size: 26px;
  }
  .step-lead {
    font-size: 17px;
  }
  .step-media {
    grid-column: 1 / -1;
  }
  .step-media-frame {
    width: 100%;
  }
  /* Sticky within the fiche, not fixed to the viewport: the bar follows
     the recipe and docks at its end, so the download panel and the footer
     below scroll free of it. */
  .fiche-tabs {
    display: block;
    position: sticky;
    z-index: 5;
    bottom: max(12px, env(safe-area-inset-bottom));
    margin-top: 32px;
    pointer-events: none;
  }
  .fiche-tab-row {
    display: flex;
    gap: 4px;
    max-width: 420px;
    margin-inline: auto;
    padding: 5px;
    border: 1px solid rgba(227, 224, 214, 0.9);
    border-radius: 999px;
    background: rgba(251, 250, 247, 0.82);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: 0 10px 30px rgba(58, 39, 25, 0.16);
    pointer-events: auto;
  }
  .fiche-tab {
    flex: 1;
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--body);
    font-size: 15px;
    font-weight: 600;
  }
  .fiche-tab[aria-current="true"] {
    background: rgba(184, 72, 43, 0.12);
    color: var(--accent);
  }
  .fiche-tab-cook {
    background: var(--accent);
    color: var(--paper);
  }
  .cook-header,
  .cook-body,
  .cook-footer {
    padding-inline: 18px;
  }
  .cook-progress-label {
    font-size: 11px;
  }
  .cook-nav .button {
    min-height: 56px;
  }
  .recipe-status {
    padding-block: 55px;
  }
  .recipe-status h1 {
    font-size: 38px;
  }
}
@media (max-width: 600px) {
  .fiche-media,
  .fiche-media.is-playing.is-vertical {
    margin-inline: -24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cook-page,
  .cook-timer.is-done {
    animation: none;
  }
}
