@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;1,500&display=swap");

:root {
  color-scheme: light;
  --ink: #242821;
  --muted: #77796f;
  --paper: #faf9f6;
  --surface: #fff;
  --line: #e7e4dc;
  --accent: #a34e38;
  --accent-soft: #f3e9e2;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-footer {
  padding: 2rem 1rem;
  color: var(--muted, #666);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer a {
  text-decoration: underline;
}

.recipe-index {
  width: min(100% - 36px, 1040px);
  margin: 0 auto;
  padding: 34px 0 64px;
}

.recipe-index h1 {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.04;
}

.search-box {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.search-box > span {
  font-size: 1.5rem;
  line-height: 1;
}

.search-box input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
}

.search-box:focus-within {
  border-color: #c49a89;
  box-shadow: 0 0 0 3px #a34e3814;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}

.tag-cloud-item,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: #66685e;
  font-size: calc(1rem * var(--tag-weight, 1));
  line-height: 1.2;
}

.tag-cloud-item {
  padding: 7px 11px;
  cursor: pointer;
}

.tag-cloud-item [data-tag-count] {
  margin-left: 4px;
  color: #a4a399;
  font-size: 0.75rem;
}

.tag-cloud-item:hover,
.tag-cloud-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.recipe-card {
  position: relative;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.recipe-card:hover {
  transform: translateY(-2px);
  border-color: #d8c9bb;
  box-shadow: 0 12px 32px #3a29100c;
}

.recipe-card > a {
  min-height: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
}

.recipe-card h2 {
  max-width: calc(100% - 28px);
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.card-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-arrow {
  position: absolute;
  top: 17px;
  right: 19px;
  color: #aaa99f;
  font-size: 1rem;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag {
  display: inline-block;
  padding: 5px 9px;
  font-size: 1rem;
}

.recipe-page {
  width: min(100% - 36px, 760px);
  margin: 0 auto;
  padding: 14px 0 60px;
}

.detail-nav {
  width: min(100% - 36px, 760px);
  margin: 0 auto;
  padding-top: 12px;
}

.detail-nav a {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.25rem;
}

.recipe h1 {
  margin: 14px 0 14px;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.04;
}

.recipe-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 28px;
}

.recipe-properties {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 0 0 0 5px;
  flex: 1 1 auto;
}

.recipe-meta-row .recipe-tags {
  justify-content: flex-end;
  margin: 0 0 0 auto;
}

.ingredients-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recipe-property {
  display: grid;
  gap: 1px;
}

.recipe-property dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.recipe-property dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ingredients {
  margin: 0 0 32px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.ingredients-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.servings {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 1.3rem;
}

.servings button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

.servings button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.servings > span {
  min-width: 32px;
  text-align: center;
}

#ingredient-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

#ingredient-list li {
  padding: 0 0 8px;
  border-bottom: 1px solid #f0eee9;
  font-size: 1rem;
}

.recipe-content {
  font-size: 1rem;
}

.recipe-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.recipe-content a:hover {
  text-decoration-thickness: 3px;
}

.recipe-content h1,
.recipe-content h2,
.recipe-content h3 {
  margin: 30px 0 10px;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.recipe-content p {
  margin: 0 0 16px;
}

.recipe-content li {
  margin: 5px 0;
}

.recipe-content [data-ingredient] {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: #713b2b;
  font-weight: 600;
}

.recipe-gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 30px 0;
}

.recipe-gallery figure {
  overflow: hidden;
  margin: 0;
  border-radius: 10px;
  background: #eeeae3;
}

.recipe-gallery img {
  width: 100%;
  max-height: 500px;
  display: block;
  object-fit: cover;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

[hidden] {
  display: none !important;
}

@media (min-width: 680px) {
  .recipe-index {
    padding-top: 52px;
  }

  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .recipe-page {
    padding-top: 30px;
  }

  .ingredients {
    padding: 22px 26px;
  }

  #ingredient-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
  }

  .recipe-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
