/* 레시피 목록·상세 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.page-head h1 { margin: 0; }
.center { text-align: center; }

/* 검색 */
.search {
  display: flex; align-items: center; gap: 8px; margin-block-end: 12px;
  padding-inline: 14px; min-height: 44px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--line); color: var(--text-sub);
}
.search input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--text); min-width: 0; }
.search input:focus { outline: none; }

/* 보기 전환 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg a { display: grid; place-items: center; width: 40px; height: 36px; color: var(--text-sub); }
.seg a[aria-current] { background: var(--brand); color: var(--on-brand); }
.sort-row { font-size: 0.875rem; }
.sort-link { color: var(--text-sub); text-decoration: none; padding: 4px 6px; }
.sort-link[aria-current] { color: var(--brand-text); font-weight: 700; }

/* 목록 */
.recipe-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.recipe-card { display: block; color: inherit; text-decoration: none; }
.recipe-card .thumb {
  display: block; position: relative; overflow: hidden; border-radius: 14px;
  background: var(--brand-soft); aspect-ratio: 4 / 5;
}
.recipe-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-photo { position: absolute; inset: 0; display: grid; place-items: center; color: var(--brand-text); opacity: .6; }
.no-photo .icon { width: 32px; height: 32px; }
.recipe-card .meta { display: block; padding: 8px 2px 0; }
.recipe-card .name { display: block; font-weight: 700; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-line { display: flex; gap: 6px; align-items: center; font-size: 0.8125rem; color: var(--text-sub); flex-wrap: wrap; }
.stars { display: inline-flex; align-items: center; gap: 2px; color: var(--brand-text); }
.stars .icon { width: 14px; height: 14px; }

/* 사진 격자 3열: 사진 위에 제목 */
.view-grid3 { grid-template-columns: repeat(3, 1fr); gap: 4px; margin-inline: calc(var(--space) * -1 + 4px); }
.view-grid3 .thumb { border-radius: 6px; aspect-ratio: 1; }
.view-grid3 .recipe-card { position: relative; }
.view-grid3 .meta {
  position: absolute; inset-inline: 0; inset-block-end: 0; padding: 18px 8px 6px;
  border-radius: 0 0 6px 6px; background: linear-gradient(transparent, rgb(30 22 16 / 70%));
}
.view-grid3 .name { color: #fff; font-size: 0.8125rem; }
.view-grid3 .sub-line { display: none; }

/* 카드 2열 */
.view-grid2 { grid-template-columns: repeat(2, 1fr); }

/* 리스트 */
.view-list { gap: 8px; }
.view-list .recipe-card {
  display: flex; gap: 12px; align-items: center; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.view-list .thumb { width: 72px; flex: none; aspect-ratio: 1; border-radius: 10px; }
.view-list .meta { padding: 0; min-width: 0; }

@media (min-width: 720px) {
  .view-grid3 { grid-template-columns: repeat(5, 1fr); margin-inline: 0; }
  .view-grid2 { grid-template-columns: repeat(4, 1fr); }
}

/* 떠 있는 새 레시피 버튼 */
.fab {
  position: fixed; inset-inline-end: 20px; inset-block-end: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 9;
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 4px 12px rgb(74 63 56 / 25%);
}
.fab .icon { width: 28px; height: 28px; }

/* 상세: 사진 넘기기 → 위로 겹친 본문 시트 */
.hero { position: relative; margin: calc(var(--sp-4) * -1) calc(var(--space) * -1) 0; background: var(--brand-soft); aspect-ratio: 4 / 3; overflow: hidden; }
.hero.is-empty { aspect-ratio: 16 / 6; }
.hero-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; }
.hero-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 30%; background: linear-gradient(transparent, rgb(30 22 16 / 18%)); pointer-events: none; }
.hero-count {
  position: absolute; z-index: 1; inset-inline-end: 14px; inset-block-end: 36px; padding: 3px 10px; border-radius: var(--radius-pill);
  background: rgb(30 22 16 / 55%); color: #fff; font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.detail-sheet {
  position: relative; z-index: 2; margin: -22px calc(var(--space) * -1) 0; padding: var(--sp-1) var(--space) 0;
  border-radius: 22px 22px 0 0; background: var(--bg);
}
.detail-head { padding-block: var(--sp-5) var(--sp-1); }
.detail-head .sub-line { gap: 6px; }
.detail-head h1 { margin: 10px 0 6px; font-size: 1.625rem; line-height: 1.3; letter-spacing: -0.01em; word-break: keep-all; }
.detail-head .summary { margin: 0; color: var(--text-sub); font-size: 1rem; line-height: 1.6; word-break: keep-all; }
.badge-bake { background: var(--brand-soft); color: var(--brand-text); }
.badge-cook { background: var(--surface-2); color: var(--text-sub); }
.badge-muted { display: inline-flex; align-items: center; gap: 3px; background: var(--surface-2); color: var(--text-sub); }
.badge-muted .icon { width: 12px; height: 12px; }
.byline { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-block-start: var(--sp-4); }
.author-chip { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.author-chip .avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--brand-soft); color: var(--brand-text); font-weight: 800; font-size: 0.9375rem; }
.author-chip b { display: block; font-size: var(--fs-sm); line-height: 1.3; }
.author-chip time { display: block; color: var(--text-sub); font-size: var(--fs-xs); }
.rating-sum { display: inline-flex; align-items: center; gap: 4px; color: var(--text-sub); font-size: var(--fs-sm); font-weight: 600; }
.rating-sum .icon { width: 16px; height: 16px; color: var(--brand); }
.facts {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: var(--sp-4) 0 0; padding: 14px 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
}
.fact { display: grid; justify-items: center; align-content: start; gap: 2px; padding-inline: 6px; text-align: center; }
.fact + .fact { border-inline-start: 1px solid var(--line); }
.fact .icon { width: 20px; height: 20px; color: var(--brand-text); margin-block-end: 2px; }
.fact dt { order: 2; color: var(--text-sub); font-size: var(--fs-xs); }
.fact dd { order: 1; margin: 0; font-weight: 800; font-size: 0.9375rem; word-break: keep-all; }
.fact .oven-two span { display: block; line-height: 1.35; font-size: var(--fs-sm); }
.section { margin-block: 24px; }
.section > h2 { display: flex; align-items: center; gap: 8px; font-size: 1.125rem; margin: 0 0 12px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; font-size: 1.125rem; }
.section > h2::before, .section-head:not(.in-card) h2::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--brand); }
.section-head h2 { white-space: nowrap; }
.section-head h2 .count { color: var(--brand-text); font-variant-numeric: tabular-nums; }
.ingredients.card { padding: var(--sp-5) var(--sp-4) var(--sp-3); }
.check-hint { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); }
.ing-group + .ing-group { margin-block-start: 16px; }
.ing-group h3 { display: inline-block; margin: 0 0 4px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-sub); font-size: var(--fs-xs); font-weight: 700; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li + li { border-block-start: 1px dashed var(--line); }
.ing-list label { display: flex; align-items: center; gap: 10px; min-height: 46px; padding-block: 6px; cursor: pointer; }
.ing-check { position: absolute; opacity: 0; pointer-events: none; }
.ing-list .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line-strong); box-shadow: 0 0 0 3px var(--surface); }
.ing-list .name { flex: 1; min-width: 0; }
.ing-list .qty { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.ing-check:checked ~ .name, .ing-check:checked ~ .qty { color: var(--text-sub); text-decoration: line-through; text-decoration-color: var(--brand); text-decoration-thickness: 2px; }
.ing-check:checked ~ .dot { background: var(--ok) !important; }
.ing-check:focus-visible ~ .name { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.dot-orange { background: var(--brand) !important; }
.dot-blue { background: #7FA7D9 !important; }
.dot-green { background: #8DB892 !important; }
.dot-gray { background: #C7BBAE !important; }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.step-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-sm); }
.step-photo { display: block; aspect-ratio: 16 / 10; background: var(--surface-2); }
.step-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.step-body { padding: 14px 16px 16px; }
.step-no { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .02em; }
.step-list h3 { margin: 8px 0 0; font-size: 1rem; }
.step-list p { margin: 8px 0 0; white-space: pre-line; line-height: 1.7; word-break: keep-all; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 10px; }
.step-meta span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand-text); font-size: var(--fs-xs); font-weight: 700; }
.step-meta .icon { width: 14px; height: 14px; }
.memo { white-space: pre-line; }
.gallery-strip { display: flex; gap: 6px; overflow-x: auto; padding-block: 8px; }
.gallery-strip img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; }
.owner-actions { display: flex; gap: 8px; margin-block: 24px 8px; }
.owner-actions .btn { flex: 1; }
.btn-danger { color: var(--danger); }

@media (min-width: 720px) {
  .hero { margin: 0; border-radius: var(--radius-card); aspect-ratio: 16 / 9; max-height: 440px; width: 100%; }
  .hero-count { inset-block-end: 14px; }
  .detail-sheet { margin: 0; padding-inline: 0; border-radius: 0; background: none; }
}

/* 홈 */
.hello .sub { margin-block-end: 10px; font-size: 1.0625rem; color: var(--text); font-weight: 600; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 14px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); text-decoration: none; font-weight: 700;
}
.quick-btn .icon { color: var(--brand-text); width: 24px; height: 24px; }
.quick-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.quick-btn.primary .icon { color: var(--on-brand); }
.page-head h2 { margin: 0; font-size: 1.0625rem; }
.page-head a.muted { text-decoration: none; font-size: 0.875rem; }

/* 좋아요 · 저장 · 평점 */
.react-bar { display: flex; align-items: center; gap: var(--sp-2); margin-block: var(--sp-4) var(--sp-2); overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--space) * -1); padding-inline: var(--space); }
.react-bar::-webkit-scrollbar { display: none; }
.react-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font-weight: 700; font-size: var(--fs-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.react-btn[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.react-btn b { font-variant-numeric: tabular-nums; }
.rate-box { text-align: center; }
.rate-box h2 { justify-content: center; }
.rate-box h2::before { display: none; }
.rate-stars { display: inline-flex; gap: 6px; }
.rate-stars button { border: 0; background: none; padding: 2px; cursor: pointer; color: var(--line-strong); }
.rate-stars button .icon { width: 36px; height: 36px; }
.rate-stars button.on { color: var(--brand); }
.my-rating { margin: var(--sp-1) 0 0; min-height: 1.5em; font-size: var(--fs-sm); }

/* 내 레시피 / 둘러보기 */
.scope-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-block-end: var(--sp-3); border-radius: var(--radius); background: var(--surface-2); }
.scope-tabs a { display: grid; place-items: center; min-height: 40px; border-radius: 9px; color: var(--text-sub); font-weight: 700; text-decoration: none; }
.scope-tabs a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.recipe-card .likes { display: inline-flex; align-items: center; gap: 2px; }
.recipe-card .likes .icon { width: 13px; height: 13px; color: var(--brand); }

/* 댓글 */
.comments h2 .count { color: var(--brand-text); font-variant-numeric: tabular-nums; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2); align-items: end; margin-block-end: var(--sp-3); }
.comment-form textarea {
  width: 100%; resize: vertical; min-height: 48px; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
}
.comment-form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.comment-form > .btn { min-height: 48px; }
.comment-form.inline { grid-template-columns: 1fr; margin-block: var(--sp-2) 0; }
.comment-form.inline .row { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.comment-list, .comment-list .replies { list-style: none; margin: 0; padding: 0; }
.comment { padding-block: var(--sp-3); border-block-end: 1px solid var(--line); }
.comment-list > .comment:last-child { border-block-end: 0; }
.comment .head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-sm); }
.comment .head time { font-size: var(--fs-xs); }
.comment .body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.comment .deleted { margin: 0; font-size: var(--fs-sm); }
.comment .actions { display: flex; gap: var(--sp-3); margin-block-start: 4px; }
.comment .actions button { border: 0; background: none; padding: 0; color: var(--text-sub); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.comment .actions button:hover { color: var(--brand-text); }
.comment .replies { margin-block-start: var(--sp-2); padding-inline-start: var(--sp-4); border-inline-start: 2px solid var(--line); }
.comment.reply { padding-block: var(--sp-2); border-block-end: 0; }

/* 작성자 · 담은 원본 */
.author-line { margin: var(--sp-1) 0 0; font-size: var(--fs-sm); }
.copied-from { display: flex; align-items: center; gap: 6px; margin: var(--sp-2) 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-sub); }
.copied-from .icon { width: 16px; height: 16px; flex: none; color: var(--brand-text); }
.copied-from a { color: var(--brand-text); font-weight: 600; text-decoration: none; }

/* 요리: 태그 줄 · 인분 바꾸기 */
.tag-line { display: flex; flex-wrap: wrap; gap: 6px; margin-block: var(--sp-3) 0; }
.chip.small { min-height: 28px; padding: 0 10px; font-size: var(--fs-xs); color: var(--text-sub); }
.section-head.in-card { margin-block: 0 var(--sp-2); }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); }
.stepper .btn-icon { min-width: 36px; min-height: 36px; font-size: 1.125rem; font-weight: 700; }
.stepper output { min-width: 56px; text-align: center; font-weight: 700; font-size: var(--fs-sm); }
.scale-note { margin: 0 0 var(--sp-2); font-size: var(--fs-sm); color: var(--brand-text); }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-sub); text-decoration: underline; font: inherit; cursor: pointer; }

/* 베이킹 / 요리 */
.area-tabs { display: flex; gap: var(--sp-4); margin-block: calc(var(--sp-1) * -1) var(--sp-3); border-block-end: 1px solid var(--line); }
.area-tabs a { padding: 8px 2px 10px; color: var(--text-sub); font-weight: 700; text-decoration: none; border-block-end: 2px solid transparent; margin-block-end: -1px; }
.area-tabs a[aria-current] { color: var(--text); border-color: var(--brand); }
.cook-start { margin-block-start: var(--sp-4); }

/* 가져온 레시피 출처 */
.source-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: var(--sp-3) 0 0; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-sub); }
.source-line .icon { width: 16px; height: 16px; flex: none; color: var(--brand-text); }
.source-line b { color: var(--text); }
.source-line a { margin-inline-start: auto; color: var(--brand-text); font-weight: 700; text-decoration: none; }

/* 홈: AI 도우미 배너 */
.ai-banner { display: flex; align-items: center; gap: 12px; margin-block-start: 10px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--brand); background: linear-gradient(120deg, var(--brand-soft), var(--surface)); color: var(--text); text-decoration: none; }
.ai-banner .spark { font-size: 1.5rem; }
.ai-banner b { display: block; }
.ai-banner small { color: var(--text-sub); font-size: var(--fs-sm); }
.ai-banner .icon { margin-inline-start: auto; color: var(--brand-text); flex: none; }

/* 영상: 썸네일을 누르면 그 자리에서 재생 */
.play { position: absolute; inset: 0; margin: auto; width: 64px; height: 44px; border-radius: 12px; background: rgb(30 22 16 / 70%); pointer-events: none; }
.play::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff; transform: translateX(2px); }
.hero-video { position: relative; display: block; }
.video-lite, .video-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: var(--radius-card); overflow: hidden; background: #000; cursor: pointer; }
.video-lite img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-lite:hover .play, .video-lite:focus-visible .play { background: #E62117; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.tip-card h2::before { display: none; }
.video-badge { position: absolute; inset-inline-end: 8px; inset-block-end: 8px; width: 28px; height: 20px; border-radius: 6px; background: rgb(30 22 16 / 65%); }
.video-badge::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent #fff; transform: translateX(1px); }
.view-grid3 .video-badge { inset-inline-end: 4px; inset-block-start: 4px; transform: scale(.8); }
/* 유튜브 hqdefault(4:3)의 위아래 검은 띠를 잘라 16:9 로 */
.hero-video, .video-lite { aspect-ratio: 16 / 9; overflow: hidden; }
.hero-video img, .video-lite img { height: auto; object-fit: initial; margin-block-start: -9.375%; }
.hero:has(.hero-video) { aspect-ratio: 16 / 9; }

/* AI 대표 이미지 */
.ai-label { position: absolute; z-index: 1; inset-inline-start: 14px; inset-block-end: 36px; padding: 3px 10px; border-radius: var(--radius-pill); background: rgb(30 22 16 / 55%); color: #fff; font-size: var(--fs-xs); font-weight: 700; }
.ai-cover-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-block-start: var(--sp-4);
  border: 1px dashed var(--brand); border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-text);
  font: inherit; font-weight: 700; cursor: pointer;
}
.ai-cover-btn[disabled] { opacity: .8; cursor: progress; }
@media (min-width: 720px) { .ai-label { inset-block-end: 14px; } }
/* 홈 최근 레시피: 사진 높이를 조금 낮게 (4:5 → 1:1) */
.home-recent .thumb { aspect-ratio: 1; }
/* 이번 주 인기 (순위 카드 2열): 사진 높이를 조금 낮게 */
.view-grid2.ranked .thumb { aspect-ratio: 1; }
/* 첫 화면 최근 레시피 · 이번 주 인기: 사진을 가로·세로 2px 작게 */
.home-recent .thumb, .home-popular .view-grid2 .thumb { width: calc(100% - 2px); margin-inline: auto; }

/* 요리공책 느낌: 재료 카드에 공책 왼쪽 빨간 여백선 · 옅은 줄 */
.ingredients.card { position: relative; }
.ingredients.card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 37px; width: 1.5px; background: var(--tomato); opacity: .35; pointer-events: none; }
.ing-list li + li { border-block-start-color: var(--rule); border-block-start-style: solid; }
