:root {
  --paper: #faf6ef;
  --card: #ffffff;
  --ink: #2f2a24;
  --ink-soft: #6b6257;
  --accent: #a4501f;
  --accent-soft: #f3e2d4;
  --line: #e5dccd;
  --shadow: 0 1px 3px rgba(47, 42, 36, 0.08), 0 4px 16px rgba(47, 42, 36, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header.site {
  text-align: center;
  margin-bottom: 2rem;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  line-height: 1.2;
}

header.site h1 {
  font-size: 2.4rem;
  margin: 0 0 0.35rem;
}

header.site .sub {
  color: var(--ink-soft);
  margin: 0;
  font-style: italic;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- landing page --- */

.controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: 1.05rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.86rem;
  cursor: pointer;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.count { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 0.5rem; }

table.recipes {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.recipes th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0.7rem 1rem;
  border-bottom: 2px solid var(--line);
  cursor: pointer;
  user-select: none;
}
table.recipes th .arrow { font-size: 0.7rem; }

table.recipes td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
}
table.recipes tr:last-child td { border-bottom: none; }
table.recipes tbody tr { cursor: pointer; }
table.recipes tbody tr:hover { background: var(--accent-soft); }

td.title-cell { font-family: Georgia, serif; font-size: 1.05rem; }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.12rem 0.65rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.empty { text-align: center; color: var(--ink-soft); padding: 2.5rem 1rem; }

/* --- detail page --- */

.back { display: inline-block; margin-bottom: 1rem; font-size: 0.92rem; }

article.recipe {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 2rem 2.25rem;
}

article.recipe h1 { font-size: 2rem; margin: 0.2rem 0 0.4rem; }

.recipe-body { margin-top: 1.25rem; }
.recipe-body h3 {
  font-size: 1.05rem;
  color: var(--accent);
  margin: 1.3rem 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: -apple-system, sans-serif;
  font-weight: 700;
}
ul.ingredients {
  margin: 0.4rem 0;
  padding-left: 1.3rem;
}
ul.ingredients li { margin: 0.18rem 0; }
p.step { margin: 0.7rem 0; }
p.step::before {
  content: "◆";
  color: var(--accent);
  font-size: 0.7rem;
  margin-right: 0.55rem;
  vertical-align: 2px;
}

details.original { margin-top: 1.75rem; color: var(--ink-soft); }
details.original summary { cursor: pointer; font-size: 0.9rem; }
details.original pre {
  white-space: pre-wrap;
  font: 0.85rem/1.5 ui-monospace, Menlo, monospace;
  background: var(--paper);
  border-radius: 8px;
  padding: 1rem;
}

/* --- photos --- */

section.photos { margin-top: 2rem; }
section.photos h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.photo-card {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.photo-card a { display: block; }
.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.photo-card .caption {
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.no-photos { color: var(--ink-soft); font-style: italic; margin-bottom: 1rem; }

form.upload {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
form.upload label { font-weight: 600; font-size: 0.95rem; }
form.upload input[type="text"] {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
}
form.upload input[type="file"] { font-size: 0.9rem; }

.btn {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.4rem;
  font-size: 0.98rem;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }

.status { font-size: 0.9rem; min-height: 1.2em; }
.status.err { color: #b3261e; }
.status.ok { color: #2e6b34; }

@media (max-width: 560px) {
  article.recipe { padding: 1.25rem 1rem; }
  .wrap { padding: 1.25rem 0.75rem 3rem; }
}
