* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff8ed;
  color: #25313f;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  line-height: 1;
}

h2 {
  margin-bottom: 1.25rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.15;
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  line-height: 1.25;
}

p {
  color: #5f6c7b;
}

a {
  color: #7c4a03;
  font-weight: 700;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 20;
  background: #25313f;
  color: #ffffff;
  padding: 0.75rem 1rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  border-bottom: 1px solid #f0d7b8;
  background: #ffffff;
}

.nav,
.hero,
.layout {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.nav {
  padding-top: 1rem;
}

.nav a {
  text-decoration: none;
}

.hero {
  padding: 3rem 0;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: #b45309;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero p {
  max-width: 720px;
  font-size: 1.1rem;
}

.layout {
  display: grid;
  gap: 1rem;
  padding: 2rem 0 4rem;
}

.card {
  border: 1px solid #f0d7b8;
  border-radius: 1rem;
  background: #ffffff;
  padding: 1.25rem;
  box-shadow: 0 16px 36px rgba(124, 74, 3, 0.08);
}

.stack {
  display: grid;
  gap: 0.5rem;
}

label {
  font-weight: 700;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

input {
  min-height: 3rem;
  flex: 1 1 240px;
  border: 1px solid #d7c0a4;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

button {
  min-height: 3rem;
  border: 0;
  border-radius: 0.75rem;
  background: #b45309;
  color: #ffffff;
  font-weight: 800;
  padding: 0.75rem 1rem;
}

button:hover {
  background: #92400e;
}

.button-secondary {
  border: 1px solid #d7c0a4;
  background: #ffffff;
  color: #7c4a03;
}

button.button-secondary:hover,
button.button-secondary:focus-visible {
  border-color: #92400e;
  background: #92400e;
  color: #ffffff;
}

.icon-button {
  min-height: auto;
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
}

.helper-text {
  margin-bottom: 0;
  color: #697586;
}

.search-card {
  display: grid;
  gap: 1.25rem;
}

.search-box,
.button-group {
  display: grid;
  gap: 0.75rem;
}

.button-group {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.button-group h3 {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.status-region {
  min-height: 2.75rem;
}

.status-message {
  margin: 0;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  font-weight: 800;
}

.loading {
  background: #dbeafe;
  color: #1d4ed8;
}

.error {
  background: #fee2e2;
  color: #991b1b;
}

.hidden {
  display: none;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.recipe-grid,
.favorites-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.recipe-card,
.favorite-card {
  overflow: hidden;
  border: 1px solid #f0d7b8;
  border-radius: 1rem;
  background: #fffaf2;
}

.recipe-card img,
.favorite-card img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: #f8ead7;
}

.recipe-card-body,
.favorite-card-body {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.recipe-card h3,
.favorite-card h3 {
  margin-bottom: 0;
}

.meta-list,
.ingredient-list,
.nutrition-grid {
  display: grid;
  gap: 0.5rem;
  padding-left: 0;
  list-style: none;
}

.meta-list li,
.nutrition-grid li {
  border-radius: 0.75rem;
  background: #fff3df;
  padding: 0.75rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(37, 49, 63, 0.72);
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 1rem;
  background: #ffffff;
}

.modal-header {
  position: sticky;
  top: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f0d7b8;
  background: #ffffff;
  padding: 1rem;
}

.modal-header h2 {
  margin-bottom: 0;
}

.modal-body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.modal-body img {
  width: 100%;
  max-height: 320px;
  border-radius: 1rem;
  object-fit: cover;
}

.detail-section {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  }

  .api-card,
  .search-card,
  .status-region,
  .results-card {
    grid-column: 1;
  }

  .favorites-card {
    grid-column: 2;
    grid-row: 1 / span 4;
  }
}
