:root {
  --bg: #f4ede2;
  --surface: #fffaf3;
  --ink: #2c2622;
  --ink-soft: #6f655c;
  --line: #e4d8c8;
  --terracotta: #a8451f;
  --terracotta-soft: #f6e7df;
  --amber: #b9701a;
  --heart: #c6446e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(70, 50, 30, 0.06), 0 8px 24px rgba(70, 50, 30, 0.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* ---------- Header ---------- */
.site-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  font-size: 34px;
  line-height: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
}
.brand-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  margin: 0;
  letter-spacing: 0.2px;
}
.brand-sub { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 300px;
  max-width: 460px;
}
.add-link {
  white-space: nowrap;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--terracotta);
  border-radius: 999px;
  padding: 11px 16px;
  box-shadow: var(--shadow);
}
.add-link:hover { background: #8f3a1a; }

.search {
  position: relative;
  display: block;
  min-width: 220px;
  flex: 1 1 220px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  opacity: 0.7;
}
.search input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.search input:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-soft);
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 14px;
  background: var(--terracotta-soft);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--terracotta);
  margin-right: 2px;
}
.chip {
  font: inherit;
  font-size: 13px;
  border: 1px solid transparent;
  background: var(--surface);
  color: #6b2f18;
  border-color: #e8c9b8;
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chip:hover { border-color: var(--terracotta); }
.chip[aria-pressed="true"] {
  background: var(--terracotta);
  color: #fff;
  border-color: var(--terracotta);
}

/* ---------- Gallery grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(70,50,30,0.12); }
.card:focus-visible { outline: 3px solid var(--terracotta-soft); outline-offset: 2px; }

.card-photo {
  position: relative;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
}
.card-body { padding: 14px 16px 16px; }
.card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 10px;
  line-height: 1.25;
}
.card-meta {
  display: flex;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 11px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--terracotta-soft);
  color: #7a3418;
}

.heart {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  color: #cbb9a7;
}
.heart[aria-pressed="true"] { color: var(--heart); }
.source-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--ink-soft);
}

.empty { text-align: center; color: var(--ink-soft); padding: 48px 0; line-height: 1.8; }
.empty a { color: var(--terracotta); font-weight: 600; }

/* ---------- Detail view ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 18px;
}
.back:hover { color: var(--terracotta); }

.hero {
  height: 168px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 76px;
  position: relative;
  margin-bottom: 22px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 32px;
  margin: 0;
  line-height: 1.15;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

.watch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-size: 14px;
  color: var(--ink);
  border: 1px solid var(--terracotta);
  border-radius: 10px;
  padding: 9px 15px;
  white-space: nowrap;
  background: var(--surface);
}
.watch:hover { background: var(--terracotta); color: #fff; }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 30px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-label { font-size: 11px; color: var(--ink-soft); }
.stat-value { font-size: 15px; font-weight: 600; }
.stepper { display: flex; gap: 6px; }
.stepper button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
.stepper button:hover { border-color: var(--terracotta); color: var(--terracotta); }

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: 34px;
  align-items: start;
}
.col-head {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  margin: 0 0 14px;
}
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink-soft);
}
.ing-amt {
  min-width: 68px;
  font-weight: 600;
  color: var(--ink);
}
.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.step-list li { display: flex; gap: 13px; font-size: 15px; color: var(--ink-soft); line-height: 1.6; }
.step-num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--terracotta-soft);
  color: var(--terracotta);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
}
.step-list li > span:last-child { padding-top: 2px; }

.note {
  margin-top: 30px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  gap: 9px;
  align-items: center;
}

@media (max-width: 620px) {
  .columns { grid-template-columns: 1fr; gap: 26px; }
  .detail-title { font-size: 27px; }
}
