/* ==========================================================
   Recipe Finder – custom styles
   Tailwind handles most of the layout; this file adds the
   parts that are easier to write as plain CSS.
   ========================================================== */

html {
  scroll-behavior: smooth;
}

/* ---------- Hero banner ---------- */
.hero {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.15), transparent 40%),
    linear-gradient(135deg, #f97316 0%, #ea580c 55%, #c2410c 100%);
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-dark,
.btn-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.75rem;
  padding: 0.7rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-primary {
  background: #ea580c;
  color: #fff;
}
.btn-primary:hover {
  background: #c2410c;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(234, 88, 12, 0.3);
}

.btn-dark {
  background: #1c1917;
  color: #fff;
  padding-left: 1.75rem;
  padding-right: 1.75rem;
}
.btn-dark:hover {
  background: #44403c;
  transform: translateY(-1px);
}

.btn-light {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  width: 100%;
}
.btn-light:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-primary:active,
.btn-dark:active,
.btn-light:active {
  transform: scale(0.97);
}

/* Visible keyboard focus for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #fdba74;
  outline-offset: 2px;
}

/* ---------- Category chips ---------- */
.category-scroll {
  scrollbar-width: thin;
  scrollbar-color: #d6d3d1 transparent;
}
.category-scroll::-webkit-scrollbar {
  height: 6px;
}
.category-scroll::-webkit-scrollbar-thumb {
  background: #d6d3d1;
  border-radius: 999px;
}

.chip {
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid #e7e5e4;
  background: #fff;
  color: #44403c;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover {
  border-color: #f97316;
  color: #c2410c;
  transform: translateY(-1px);
}
.chip.active {
  background: #ea580c;
  border-color: #ea580c;
  color: #fff;
}

/* ---------- Recipe card ---------- */
.recipe-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid #e7e5e4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-align: left;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: fadeUp 0.45s ease both;
}
.recipe-card:hover,
.recipe-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.12);
}
.recipe-card .thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  background: #e7e5e4;
}
.recipe-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.recipe-card:hover img {
  transform: scale(1.08);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-category {
  background: #ffedd5;
  color: #c2410c;
}
.badge-area {
  background: #f5f5f4;
  color: #57534e;
}

/* ---------- Loading spinner ---------- */
.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #fed7aa;
  border-top-color: #ea580c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(28, 25, 23, 0.65);
  backdrop-filter: blur(4px);
  padding: 0;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 56rem;
  border-radius: 1.25rem 1.25rem 0 0;
  background: #fff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

/* The inner box scrolls, so the close button can stay fixed on top. */
.modal-scroll {
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1.5rem;
  }
  .modal-panel {
    border-radius: 1.25rem;
  }
  .modal-scroll {
    max-height: 90vh;
  }
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 5;
  display: flex;
  height: 2.5rem;
  width: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #292524;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.modal-close:hover {
  background: #fee2e2;
  transform: rotate(90deg);
}

.ingredient-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px dashed #e7e5e4;
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.instructions p {
  margin-bottom: 0.9rem;
  line-height: 1.75;
}

/* Prevent the page behind the modal from scrolling */
body.modal-open {
  overflow: hidden;
}

/* ---------- Animations ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
