/* style.css */

/* 색 */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --accent: #005bb5;
}

/* 리셋 */
* {
  box-sizing: border-box;
}

/* 기본 */
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.375rem;
  scroll-margin-top: 8rem;
}

a {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
  overflow-wrap: anywhere;
}

.site-footer {
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--accent);
  font-size: 0.875rem;
  flex-shrink: 0;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

button:hover {
  background: var(--line);
}

/* 머리글 · 내비 */
.site-header,
.site-footer {
  padding: 16px 24px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content:
    space-between;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
}

.site-name {
  color: var(--text);
  font-weight: bold;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

nav a {
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

nav a.current {
  color: var(--text);
  font-weight: bold;
}

/* 레시피 목록 */
.recipe-list {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(260px, 1fr)
  );
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style-type: none;
}

.recipe-card {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow:
    0 2px 8px rgb(0 0 0 / 0.1);
}

.recipe-card .badge {
  position: absolute;
  top: 24px;
  left: 24px;
}

.recipe-card img {
  display: block;
  margin-bottom: 12px;
}

.recipe-card-head {
  display: flex;
  justify-content:
    space-between;
  align-items: center;
  gap: 12px;
}

.recipe-card h2 {
  margin: 0;
}

.recipe-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

/* 레시피 본문 */
.ingredient-list li {
  border-bottom:
    1px solid var(--line);
}

.ingredient-list li:last-child {
  border-bottom: none;
}

table {
  border-collapse: collapse;
}

th,
td {
  padding: 6px 12px;
  border: 1px solid var(--line);
}

/* 후기 폼 */
label {
  font-weight: bold;
}

form div {
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.form-row > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0;
}

.form-row > div:first-child {
  flex: 1;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

select {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline:
    2px solid var(--accent);
  outline-offset: 2px;
}

button[type="submit"] {
  background: var(--accent);
  color: var(--surface);
}

button[type="submit"]:hover {
  background: var(--text);
}

/* 화면 폭 */
@media (min-width: 640px) {
  .site-header {
    flex-direction: row;
    align-items: center;
  }
}
