@import url("https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap");

* {
  box-sizing: border-box;
  font-family: "Montserrat", sans-serif;
}

body {
  margin: 0;
  padding-bottom: 4rem;
  line-height: 1.5;
  font-size: 1rem;
  color: #333;
  background: #fff;
  font-family: "Montserrat", sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.hero-title,
.phase-heading,
.step-heading {
  font-family: "Playfair Display", serif;
}

a {
  color: #b8345e;
}

.hero {
  width: 100%;
  min-height: 28rem;
  padding: 10rem 1.5rem;
  background-image:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 1)),
    url("../../images/final-macarons-scattered.jpg");
  background-size: cover;
  background-position: center;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-img-wrap {
  display: none;
}

.hero-title {
  margin: 0 0 0.5rem;
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: #333;
  margin-bottom: 3rem;
}

.jump-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: #b8345e;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.jump-btn:hover {
  background: #8f2950;
  color: #fff;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  justify-content: center;
  margin-top: 0.25rem;
}

.hero-buttons .jump-btn {
  margin: 0;
}

.recipe-end-message {
  margin: 6rem 0 0.75rem;
  font-family: "Playfair Display", serif;
  font-size: 1.75rem;
  font-weight: 600;
  color: #333;
  text-align: center;
}

.recipe-end-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

/* ---------- Top content: description ---------- */
.top-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

@media (max-width: 600px) {
  .top-content {
    padding: 1.5rem 1.5rem 1.5rem;
  }
}

.hero-description {
  margin: 0;
  font-size: 1rem;
  color: #555;
  line-height: 1.6;
}

.recipe-meta-bar-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.recipe-meta-bar {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.5rem;
  background: #f8ebed;
}

.recipe-meta-bar .meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: #444;
}

.recipe-meta-bar .meta-item strong {
  color: #333;
}

.fa-solid {
  margin-left: 0.5rem;
}

.pre-instructions {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-lines {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: #444;
  font-size: 0.95rem;
}

.info-lines p {
  margin: 0;
}

.pink-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.pink-row > .info-box {
  flex: 1 1 320px;
}

.equipment-controls {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.equipment-control {
  flex: 1 1 240px;
}

.info-box-equipment.hidden-by-accordion {
  display: none !important;
}

.info-box {
  padding: 1.25rem;
  background: #f8ebed;
}

.info-box h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-box p,
.info-box ul {
  margin: 0;
  font-size: 0.95rem;
  color: #444;
}

.info-box ul {
  padding-left: 1.25rem;
  list-style: disc;
}

.info-box ul.checklist {
  padding-left: 0;
  list-style: none;
}

.info-box li {
  margin-bottom: 0.25rem;
}

.main-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: block;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-row label {
  cursor: pointer;
  font-size: 0.95rem;
  user-select: none;
}

.serving-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.serving-control label {
  font-size: 0.9rem;
}

.units-toggle,
.scale-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.units-toggle button,
.scale-toggle button {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  background: #fff;
  color: #555;
}

.units-toggle button.active,
.scale-toggle button.active {
  background: #b8345e;
  color: #fff;
  border-color: #b8345e;
}

.units-toggle button:not(.active):hover,
.scale-toggle button:not(.active):hover {
  background: #fff9fa;
}

.serving-reset-wrap {
  margin-top: 0.35rem;
  margin-left: 0;
  display: none;
}

.serving-reset-wrap.visible {
  display: block;
}

.serving-reset {
  color: #999;
  font-size: 0.85rem;
}

.serving-reset:hover {
  color: #666;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.checklist .ingredient-qty {
  font-weight: 700;
}

.checklist li.ingredient-section-head {
  margin-left: 0;
  margin-bottom: 0.35rem;
}

.equipment-control .equipment-control-indent {
  margin-left: 1.25rem;
}

.units-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.units-label {
  font-size: 0.9rem;
  color: #555;
}

input[type="checkbox"] {
  margin-top: 0.2rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #b8345e;
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  position: relative;
}

input[type="checkbox"]:checked {
  background: #b8345e;
  border-color: #b8345e;
}
input[type="checkbox"]:checked::after {
  content: "✓";
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.checklist li.checked {
  color: #777;
  text-decoration: line-through;
}

.checklist .sublist {
  list-style: none;
  padding-left: 0;
  margin: 0.35rem 0 0 1.25rem;
  font-size: 0.85rem;
}

.checklist .sublist li {
  margin-bottom: 0.25rem;
}

/* ---------- Instructions column ---------- */
.instructions-col {
  min-width: 0;
}

.instructions-col .phase-heading {
  margin: 4rem 0 1rem;
  font-size: 1.1rem;
  color: #b8345e;
}

.instructions-col .phase-heading:first-child {
  margin-top: 0;
}

.step-panel {
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.step-panel:nth-of-type(odd) {
  background: #fff;
}

.step-panel:nth-of-type(even) {
  background: #f8ebed;
}

.step-panel .step-heading {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.step-panel .step-text {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: #444;
}

.step-panel .step-text p {
  margin: 0 0 0.5rem;
}

.step-panel .step-text p:last-child {
  margin-bottom: 0;
}

.step-panel .step-text .ingredient {
  text-decoration: underline;
  cursor: help;
  position: relative;
}

.step-panel .step-text .ingredient::after {
  content: attr(data-qty);
  position: absolute;
  left: 50%;
  bottom: calc(100%);
  transform: translateX(-50%);
  white-space: nowrap;
  border: 1px solid #b8345e;
  background: #fff;
  color: #333;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease;
}

.step-panel .step-text .ingredient:hover::after {
  opacity: 1;
  visibility: visible;
}

.step-panel .step-text .ingredient.ingredient-no-tooltip::after {
  display: none;
}

.step-panel .step-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.step-panel .step-figures figure {
  margin: 0;
  flex: 0 0 auto;
  max-width: 250px;
}

.step-panel .step-figures img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  aspect-ratio: 1.25;
}

.step-panel .step-figures figcaption {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  color: #666;
  line-height: 1.3;
}

.instruction-intro {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #555;
}

@media (max-width: 768px) {
  .hero {
    padding: 1.5rem 1rem;
    min-height: 22rem;
    display: flex;
  }

  .hero-inner {
    margin-top: auto;
  }

  .recipe-meta-bar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem 1.5rem;
  }

  .recipe-meta-bar .meta-item {
    padding: 0.5rem;
  }

  .main-body {
    padding-bottom: 2rem;
  }

  .pre-instructions {
    padding: 1rem 1.5rem 0.5rem;
  }

  /* Mobile ordering: allergy/storage -> controls -> ingredients -> equipment */
  .info-lines {
    order: 1;
  }

  .pink-row {
    order: 2;
    flex-direction: column;
  }

  .pink-row > .info-box {
    flex: 1 1 100%;
    width: 100%;
  }

  .step-panel {
    margin-bottom: 0.75rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    box-shadow: none;
  }

  .step-panel .step-figures {
    gap: 0.75rem;
  }

  .step-panel .step-figures figure {
    flex: 0 0 calc(50% - 0.5rem);
    max-width: none;
  }

  /* Phase progress bar: two-line layout on mobile */
  .phase-step-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.25;
  }

  .phase-step-num {
    display: block;
    font-size: 0.8rem;
  }

  .phase-step-num::after {
    content: none;
  }

  .phase-step-name {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.9;
  }

  .phase-stepper {
    justify-content: space-between;
    padding: 0 0.5rem;
  }

  .phase-step {
    gap: 0;
  }
}

@media (min-width: 769px) {
  /* reserved */
}

.phase-progress-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0 auto 1rem;
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;
  padding: 0.75rem 0;
  background: #f8ebed;
}

.phase-progress-bar.stuck {
  background: transparent;
}

.phase-progress-bar.stuck::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  z-index: -1;
}

.phase-stepper {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 0;
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

.phase-step {
  display: flex;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.phase-step-label {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
  text-align: center;
  white-space: nowrap;
}

.phase-step-num::after {
  content: ". ";
}

.phase-step:hover .phase-step-label {
  background: rgba(235, 235, 235, 0.95);
}

.phase-step.active:hover .phase-step-label {
  background: #8f2950;
}

.phase-step.active .phase-step-label {
  color: #fff;
  background: #b8345e;
}
