/**
 * Recipe Page UX Refinements
 * Layered on top of style.css
 */

/* ==========================================================================
   Ingredients List
   ========================================================================== */

li.p-ingredient {
  padding: 12px 0 !important;
  border-bottom-color: #f0f2f5 !important;
  font-size: 17px;
  line-height: 1.5;
  display: flex !important;
  align-items: baseline;
  gap: 8px;
}

li.p-ingredient img[src*="grip"] {
  opacity: 0.4;
  flex-shrink: 0;
}

article.h-recipe h2#ingredients {
  padding-bottom: 8px;
  border-bottom: 2px solid #2B354F;
  display: inline-block;
  margin-bottom: 24px !important;
}

@media (max-width: 575px) {
  li.p-ingredient {
    padding: 10px 0 !important;
    font-size: 15px;
  }
}

/* ==========================================================================
   Recipe Card
   ========================================================================== */

.recipe-card {
  background: #fff;
  border: 1px solid #e2e6ec;
  border-radius: 16px;
  padding: 0 32px 32px;
  margin-bottom: 32px;
  box-shadow: 0 4px 24px rgba(43, 53, 79, 0.08);
}

/* Block Mediavine ads inside the recipe card */
.recipe-card .mv-ad-box,
.recipe-card .adthrive-ad,
.recipe-card div[data-adthrive-ad],
.recipe-card div[id^="div-gpt"] {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* --- Header --- */
.recipe-card > .recipe-card-header {
  display: block !important;
  background: linear-gradient(135deg, #2B354F 0%, #3d4a6b 100%);
  color: #fff;
  margin: 0 -32px;
  padding: 20px 28px 18px;
  margin-bottom: 20px;
  border-radius: 16px 16px 0 0;
}

.recipe-card-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.recipe-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.7;
}

.recipe-card-header .recipe-card-title,
h2.recipe-card-title {
  color: #fff !important;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px !important;
  padding: 0 !important;
  border: none !important;
  border-bottom: none !important;
  line-height: 1.3;
  display: block !important;
}

/* --- Meta row (rating, times, servings) --- */
.recipe-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recipe-card-header .recipe-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.12) !important;
  white-space: nowrap;
}

.recipe-card-header .recipe-card-meta-total {
  font-weight: 700;
  background: rgba(255, 255, 255, 0.22) !important;
}

.recipe-card-meta-dim {
  opacity: 0.7;
  font-weight: 400;
}

.recipe-card-rating svg {
  flex-shrink: 0;
}

/* --- Actions (Print / Pin) --- */
.recipe-card-actions {
  display: flex;
  gap: 8px;
}

.recipe-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s;
}

.recipe-card-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  text-decoration: none;
}

.recipe-card-btn-pin {
  background: #E60023;
}

.recipe-card-btn-pin:hover {
  background: #ad081b;
  color: #fff;
}

/* --- Divider --- */
.recipe-card-divider {
  border-top: 1px solid #e8ecf0;
  margin: 4px 0 16px;
}

/* --- Spacing overrides inside the card --- */
.recipe-card .row.mb-3 {
  margin-bottom: 0.5rem !important;
}

.recipe-card h2#ingredients {
  margin-top: 0 !important;
}

/* ==========================================================================
   Directions / Steps Timeline
   ========================================================================== */

.steps-timeline {
  position: relative;
}

/* --- Step card: rail + content side by side --- */
.step-card {
  display: flex;
  gap: 20px;
  position: relative;
}

/* --- Rail: number circle + vertical line --- */
.step-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 44px;
  padding-top: 2px;
}

.step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2B354F;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.step-line {
  width: 2px;
  flex: 1;
  background: #e2e6ec;
  margin: 4px 0;
  min-height: 20px;
}

/* --- Step content (details/summary accordion) --- */
.step-content {
  flex: 1;
  min-width: 0;
  margin-bottom: 8px;
}

.step-summary {
  font-size: 18px;
  font-weight: 700;
  color: #2B354F;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 10px;
  background: #f7f8fa;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
  user-select: none;
}

.step-summary::-webkit-details-marker {
  display: none;
}

/* Chevron indicator */
.step-summary::after {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 2px solid #8892a6;
  border-bottom: 2px solid #8892a6;
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform 0.2s;
}

details[open] > .step-summary::after {
  transform: rotate(-135deg);
}

.step-summary:hover {
  background: #eef0f4;
}

details[open] > .step-summary {
  border-radius: 10px 10px 0 0;
  background: #f0f2f6;
}

/* --- Step body (expanded content) --- */
.step-body {
  background: #fff;
  border: 1px solid #e8ecf0;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 20px;
}

.step-text-media {
  display: flex;
  gap: 20px;
}

.step-text {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  line-height: 1.65;
  color: #3a3f4b;
}

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

/* --- Step image + tip --- */
.step-media {
  flex-shrink: 0;
  width: 220px;
}

.step-media figure {
  margin: 0;
}

.step-img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.step-tip {
  margin-top: 10px;
  padding: 12px 14px;
  background: #fef9f0;
  border-left: 3px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.45;
  color: #5a5040;
}

.step-tip-label {
  display: inline-block;
  font-weight: 700;
  color: #b45309;
  margin-right: 4px;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* --- Per-step ingredients --- */
.step-ingredients {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f0f2f5;
}

.step-ingredients-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8892a6;
  margin-bottom: 6px;
}

.step-ingredients ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.step-ingredients li {
  font-size: 14px;
  color: #3a3f4b;
  padding: 4px 12px;
  background: #f7f8fa;
  border-radius: 16px;
  border: 1px solid #e8ecf0;
}

/* --- Mobile steps --- */
@media (max-width: 575px) {
  .step-card {
    gap: 12px;
  }

  .step-rail {
    width: 36px;
  }

  .step-number {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .step-summary {
    font-size: 16px;
    padding: 8px 12px;
  }

  .step-body {
    padding: 14px;
  }

  .step-text-media {
    flex-direction: column;
  }

  .step-media {
    width: 100%;
  }

  .step-img {
    border-radius: 8px;
  }

  .step-ingredients ul {
    gap: 4px;
  }

  .step-ingredients li {
    font-size: 13px;
  }
}

/* --- Print steps --- */
@media print {
  .step-content[open],
  .step-content {
    /* Force all steps open for print */
  }

  .step-content {
    display: block !important;
  }

  details.step-content > .step-body {
    display: block !important;
  }

  .step-summary::after {
    display: none;
  }

  .step-body {
    border: none;
    padding: 8px 0;
  }

  .step-number {
    background: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .step-line {
    background: #ccc;
  }
}

/* --- Mobile --- */
@media (max-width: 575px) {
  .recipe-card {
    padding: 0 16px 24px;
    border-radius: 12px;
  }

  .recipe-card-header {
    margin: 0 -16px;
    padding: 16px 18px 14px;
    margin-bottom: 16px;
    border-radius: 12px 12px 0 0;
  }

  .recipe-card-title {
    font-size: 19px;
  }

  .recipe-card-label {
    font-size: 10px;
  }

  .recipe-card-btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  .recipe-card-meta-item {
    font-size: 12px;
    padding: 3px 10px;
  }
}

/* --- Print --- */
@media print {
  .recipe-card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    overflow: visible;
  }

  .recipe-card-divider {
    border-top-color: #ccc;
  }
}
