/* Site header */
.site-header {
  padding: var(--space-6) 0 var(--space-4);
}

.site-header__title {
  font-size: calc(var(--font-size-display) * 1.5);
  margin-bottom: 0;
}

/* Recipe list */
.recipe-grid {
  list-style: none;
  margin: 0 0 20vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.recipe-row {
  position: relative;
  display: block;
}

.recipe-row__name {
  display: block;
  padding-left: 100px;
  font-size: calc(var(--font-size-display) * 1.5);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  transition: color 0.15s ease;
}

/* Mobile: thumbnails are always visible, tilted per-recipe. Hovering one
   row fades every other row's name and washes out its thumbnail with an
   opaque white overlay — not transparency, so overlapping thumbnails
   never blend into each other. */
.recipe-row__thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 90px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-image-bg);
  border: 3px solid var(--color-bg);
  opacity: 1;
  transform: translateY(-50%) rotate(var(--rotate, 0deg));
  transition: opacity 0.15s ease;
  z-index: 0;
}

.recipe-row:hover .recipe-row__thumb {
  z-index: 1;
}

.recipe-row__thumb img {
  display: block;
  width: 100%;
  height: auto;
}

.recipe-row__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-bg);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.recipe-grid:hover .recipe-row:not(:hover) .recipe-row__name {
  color: var(--color-text-faint);
}

.recipe-grid:hover .recipe-row:not(:hover) .recipe-row__thumb::after {
  opacity: 0.75;
}

/* Desktop: text-only list by default, at 2x the font size; hovering a row
   reveals just that row's tilted photo right after the text. The thumb
   stays position:absolute (out of flow) here too — same as mobile — so
   its height never affects row spacing; it's free to overlap the
   recipe names above/below when revealed instead of pushing them apart. */
@media (min-width: 768px) {
  .site-header {
    padding-bottom: var(--space-2);
  }

  .site-header__title {
    font-size: calc(var(--font-size-display) * 2);
  }

  .recipe-grid {
    gap: var(--space-2);
  }

  .recipe-row {
    display: inline-block;
  }

  .recipe-row__name {
    padding-left: 0;
    font-size: calc(var(--font-size-display) * 2);
  }

  .recipe-row__break {
    display: none;
  }

  .recipe-row__thumb {
    top: 50%;
    right: auto;
    left: 100%;
    margin-left: var(--space-4);
    width: 180px;
    border: none;
    transform: translateY(-50%) rotate(var(--rotate, 0deg));
    opacity: 0;
  }

  .recipe-row:hover .recipe-row__thumb {
    opacity: 1;
  }
}

.tag {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-size: var(--font-size-small);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* Recipe page */
.recipe-header {
  padding: var(--space-7) 0;
}

.recipe-body {
  padding-bottom: var(--space-7);
}

.recipe-back {
  display: inline-block;
  margin-bottom: var(--space-5);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}

.recipe-header-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.recipe-photo {
  width: 110px;
  height: auto;
  background: var(--color-image-bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transform: rotate(var(--rotate, 0deg));
}

.recipe-title {
  min-width: 0;
  margin-bottom: 0;
  font-size: calc(var(--font-size-display) * 1.5);
}

@media (min-width: 768px) {
  .recipe-title {
    font-size: calc(var(--font-size-display) * 2);
  }

  .recipe-photo {
    width: 180px;
  }
}

.recipe-meta {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--font-size-small);
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* Mobile: tags on their own line, then prep/cook/servings below.
   Desktop: tags and meta share a single line. */
.recipe-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
  .recipe-info {
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
  }
}

/* Mobile: Ingredients then Instructions stacked, normal page flow/scroll. */
.recipe-split {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.recipe-pane {
  flex: 1;
  min-width: 0;
}

.recipe-pane__title {
  font-size: var(--font-size-heading);
  margin-bottom: var(--space-4);
}

.recipe-pane ul {
  list-style: none;
  padding-left: 0;
}

.recipe-pane li + li {
  margin-top: var(--space-2);
}

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
}

.ingredient-item__checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.2em;
  accent-color: var(--color-text);
  cursor: pointer;
}

.ingredient-item__checkbox:checked + .ingredient-item__text {
  font-style: italic;
  text-decoration: line-through;
}

.ingredient-section {
  font-size: var(--font-size-body);
  margin: var(--space-4) 0 var(--space-2);
}

.ingredient-section:first-child {
  margin-top: 0;
}

/* Desktop: two columns side by side, Instructions gets more room
   (1/3 Ingredients, 2/3 Instructions) since it's denser prose. */
@media (min-width: 768px) {
  .recipe-split {
    flex-direction: row;
    gap: var(--space-6);
  }

  .recipe-pane:first-child {
    flex: 1;
  }

  .recipe-pane:last-child {
    flex: 2;
  }
}

.recipe-notes {
  margin-top: var(--space-6);
}

.recipe-notes__title {
  font-size: var(--font-size-heading);
  margin-bottom: var(--space-4);
}

/* Recipe modal: full screen on mobile with a close X. On desktop, a
   centered 80%-width panel sized to its content with a mid-grey backdrop,
   closable by clicking outside. .modal__scroll doubles as the backdrop
   (its own background, not a separate element) since it's the thing that
   visually spans the full viewport — a separate backdrop layer would sit
   underneath it and never receive the click. It also owns the scrollbar
   instead of .modal__panel, so overflow scrolls the whole viewport edge
   rather than clipping inside the rounded panel. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.modal__scroll {
  position: relative;
  height: 100%;
  overflow-y: auto;
  background: transparent;
}

.modal__panel {
  position: relative;
  min-height: 100%;
  background: var(--color-surface);
  padding: var(--space-4);
}

/* Mobile: push the recipe content down before the photo starts. Lives on
   the content wrapper (not .modal__panel) so it doesn't shift the
   position:absolute close button. */
#modal-content {
  padding-top: 5vh;
}

.modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-full);
  background: var(--color-image-bg);
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 768px) {
  .modal__scroll {
    background: var(--color-backdrop);
  }

  .modal__panel {
    width: 80%;
    min-height: 0;
    margin: 10vh auto;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
  }

  .modal__close {
    top: var(--space-6);
    right: var(--space-6);
  }

  #modal-content {
    padding-top: 0;
  }
}
