/* グレイのレシピ — Minimal Monochrome Culinary Line Art */
:root {
  --bg: #FFFFFF;
  --ink: #171717;
  --muted: #737373;
  --line: #E5E5E5;
  --line-dark: #171717;
  --serif-jp: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif TC", serif;
  --serif-tc: "Noto Serif TC", "Songti TC", "Hiragino Mincho ProN", "PMingLiU", serif;
  --latin: "Cormorant Garamond", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Noto Sans CJK TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  --gutter: 16px;
  --maxw: 640px;
  --tap: 44px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
svg { stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 6px 12px; }
.skip:focus { left: 8px; z-index: 10; }

/* ornament: thin line — lozenge — thin line */
.ornament { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.ornament span { flex: 1; height: 1px; background: var(--line); }
.ornament i { width: 6px; height: 6px; border: 1px solid var(--ink); transform: rotate(45deg); }

/* ===== 首頁 ===== */
.masthead { padding-top: calc(28px + env(safe-area-inset-top)); text-align: center; }
.site-title {
  font-family: var(--serif-jp);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: .06em;
  margin: 10px 0 2px;
  line-height: 1.3;
}
.site-sub {
  font-family: var(--latin);
  font-size: 13px;
  letter-spacing: .32em;
  color: var(--muted);
  margin: 0 0 10px;
  text-transform: uppercase;
}

.search { position: relative; display: flex; align-items: center; margin: 20px 0 6px; border-bottom: 1px solid var(--ink); }
.search-icon { width: 18px; height: 18px; flex: none; color: var(--muted); }
.search input {
  flex: 1; min-width: 0; height: var(--tap); border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 17px; padding: 0 10px; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); }
.search .clear { width: var(--tap); height: var(--tap); font-size: 22px; color: var(--muted); line-height: 1; }

.tabs { margin: 6px calc(-1 * var(--gutter)) 8px; }
.tabs-scroll {
  display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 0 var(--gutter); scrollbar-width: none; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--line);
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab {
  flex: none; height: var(--tap); padding: 0 12px; white-space: nowrap;
  font-size: 15px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.is-active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

.cat { margin-top: 22px; }
.cat-title {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--serif-tc); font-weight: 500; font-size: 15px; letter-spacing: .12em;
  color: var(--muted); margin: 0 0 2px;
}
.cat-title small { font-family: var(--latin); font-size: 14px; letter-spacing: 0; font-weight: 400; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dish a {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.dish:last-child a { border-bottom: 0; }
.dish-name { font-family: var(--serif-tc); font-weight: 500; font-size: 19px; line-height: 1.4; }
.dish-sub { color: var(--muted); font-size: 14px; }
.chev { width: 16px; height: 16px; margin-left: auto; flex: none; color: var(--muted); }
.dish a:active { background: #FAFAFA; }
.dish.is-hidden, .cat.is-hidden { display: none; }
.is-searching .cat-title { display: none; }
.is-searching .cat { margin-top: 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.foot { text-align: center; color: var(--muted); font-family: var(--latin); font-size: 14px; letter-spacing: .12em; padding: 30px 0 calc(30px + env(safe-area-inset-bottom)); }
.foot .ornament { margin-bottom: 18px; }

/* ===== 食譜頁 ===== */
.topbar { position: sticky; top: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); z-index: 5; padding-top: env(safe-area-inset-top); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: var(--tap); }
.back, .share { display: inline-flex; align-items: center; gap: 4px; height: var(--tap); font-size: 15px; color: var(--ink); }
.back svg, .share svg { width: 18px; height: 18px; }
.share { padding-left: 10px; }

.recipe { padding-top: 26px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.r-title { font-family: var(--serif-tc); font-weight: 600; font-size: 28px; line-height: 1.35; margin: 0; text-align: center; letter-spacing: .02em; }
.r-sub { font-family: var(--latin); font-size: 16px; color: var(--muted); text-align: center; margin: 6px 0 0; letter-spacing: .05em; }
.recipe > .ornament { margin: 18px 0; }

.r-fig { margin: 4px auto 22px; max-width: 420px; }
.r-fig img { width: 100%; border: 1px solid var(--line); background: #fff; }

.r-meta { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; padding: 0; margin: 0 0 8px; font-size: 15px; }
.r-meta span { color: var(--muted); margin-right: 6px; font-size: 13px; letter-spacing: .1em; }

.sec { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.sec-intro { border-top: 0; padding-top: 6px; margin-top: 10px; color: #333; }
.sec-intro p { margin: 0 0 10px; }
.sec-title { font-family: var(--serif-tc); font-weight: 600; font-size: 17px; letter-spacing: .14em; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.ing-group + .ing-group { margin-top: 14px; }
.ing-name { font-size: 13px; letter-spacing: .14em; color: var(--muted); font-weight: 500; margin: 0 0 4px; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 16.5px; }
.ing-list li:last-child { border-bottom: 0; }
.ing-note { color: var(--muted); font-size: 15px; }
.ing-note p { margin: 6px 0 0; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { position: relative; padding: 10px 0 10px 40px; line-height: 1.85; font-size: 17px; counter-increment: step; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  font-family: var(--latin); font-size: 24px; font-weight: 500; line-height: 1.3; color: var(--ink);
}
.steps li + li { border-top: 1px solid var(--line); }

.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 10px; }
.prose a, .r-foot a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted); }
.prose a { word-break: break-all; }

.wake { display: block; width: 100%; min-height: var(--tap); margin-top: 16px; border: 1px solid var(--line); font-size: 14px; color: var(--muted); letter-spacing: .06em; }
.wake[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }

.r-foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 36px; }
.r-foot .ornament { margin-bottom: 18px; }
.r-foot p { margin: 4px 0; }

/* ===== 404 ===== */
.notfound { text-align: center; padding-top: 80px; }
.nf-code { font-family: var(--latin); font-size: 64px; margin: 10px 0 0; letter-spacing: .1em; line-height: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 26px; border: 1px solid var(--ink); margin-top: 20px; letter-spacing: .1em; }

/* 平板與桌機：只放寬留白，不改流程 */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .site-title { font-size: 36px; }
  .r-title { font-size: 32px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tab, .wake { transition: color .15s, border-color .15s; }
}
