/* =========================================================
   RECIPES — a cooking log
   Design: minimal editorial grid, monospace meta labels
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  --bg:        #f6f6f4;
  --bg-sunk:   #eeeeea;
  --ink:       #0a0a0a;
  --ink-soft:  #4a4a46;
  --muted:     #8f8f88;
  --line:      #deded8;
  --accent:    #b4472b;

  --font-sans: "Inter", "Helvetica Neue", Helvetica, Arial,
               "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --font-mono: "Courier Prime", "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --maxw: 1600px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       #0d0d0c;
    --bg-sunk:  #161614;
    --ink:      #f2f2ee;
    --ink-soft: #b9b9b1;
    --muted:    #77776f;
    --line:     #2a2a27;
    --accent:   #e0724f;
  }
}
:root[data-theme="dark"] {
  --bg:       #0d0d0c;
  --bg-sunk:  #161614;
  --ink:      #f2f2ee;
  --ink-soft: #b9b9b1;
  --muted:    #77776f;
  --line:     #2a2a27;
  --accent:   #e0724f;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- utilities ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 0.35em 0.9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease), background 0.3s var(--ease);
}
a.pill:hover, button.pill:hover { border-color: var(--ink); color: var(--ink); }
.pill[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: var(--bg);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 日本語の本文は文節で折り返す */
.detail__lede, .step p, .notes p {
  line-break: strict;
  word-break: auto-phrase;
}

/* link with sliding underline */
.link { position: relative; display: inline-block; }
.link::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.45s var(--ease);
}
.link:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .scroll-cue .bar::after { animation: none; }
}

/* =========================================================
   header
   ========================================================= */
.site-header {
  position: fixed; inset: 0 0 auto 0;
  z-index: 100;
  padding-block: 1.1rem;
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}
.site-header.is-stuck {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
}
.brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.brand span { color: var(--accent); }

.nav { display: flex; align-items: baseline; gap: 0.35rem; }
.nav a, .nav .sep {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav .sep { color: var(--muted); }
.nav a[aria-current="page"] { color: var(--accent); }

.theme-toggle {
  flex: none;
  width: 2rem; height: 2rem;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 999px;
  transition: border-color 0.3s var(--ease), transform 0.4s var(--ease);
}
.theme-toggle:hover { border-color: var(--ink); transform: rotate(45deg); }
.theme-toggle svg { width: 13px; height: 13px; }

/* =========================================================
   hero
   ========================================================= */
.hero-wrap { position: relative; }
.hero {
  min-height: 92svh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding-block: 9rem 6rem;
  gap: 1.75rem;
}
.hero__mark {
  font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 9rem);
  line-height: 0.95;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
}
.hero__lede {
  font-size: clamp(0.8125rem, 1.5vw, 1rem);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: var(--ink-soft);
}

.scroll-cue {
  position: absolute; left: 50%; bottom: 2rem;
  transform: translateX(-50%);
  display: grid; justify-items: center; gap: 0.6rem;
}
.scroll-cue .bar {
  width: 1px; height: 3rem; background: var(--line);
  position: relative; overflow: hidden;
}
.scroll-cue .bar::after {
  content: ""; position: absolute; inset: 0;
  background: var(--ink);
  animation: cue 2.4s var(--ease) infinite;
}
@keyframes cue {
  0%   { transform: translateY(-100%); }
  55%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* =========================================================
   sections
   ========================================================= */
.section { padding-block: clamp(3.5rem, 8vw, 7rem); }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  font-size: clamp(1.5rem, 3.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* controls: filters + view switch */
.controls {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.filters { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.viewswitch { display: flex; align-items: center; gap: 0.4rem; }
.viewswitch button, .viewswitch .sep {
  font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}
.viewswitch .sep { color: var(--line); }
.viewswitch button[aria-pressed="true"] { color: var(--ink); }

/* =========================================================
   year groups + cards
   ========================================================= */
.year-group { padding-top: clamp(2.25rem, 5vw, 4rem); }
.year-group__label {
  display: flex; align-items: center; gap: 1rem;
  margin-bottom: 1.75rem;
}
.year-group__label b {
  font-family: var(--font-mono);
  font-size: 0.75rem; letter-spacing: 0.18em; font-weight: 400;
}
.year-group__label i { flex: 1; height: 1px; background: var(--line); }

.cards { display: grid; gap: clamp(1.75rem, 3.5vw, 3.25rem) clamp(1rem, 2.5vw, 2rem); }
.view-img .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }

.card { display: block; }
.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-sunk);
  border-radius: 2px;
}
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.1s var(--ease);
}
.card:hover .card__media img { transform: scale(1.055); }
.card__index {
  position: absolute; top: 0.75rem; left: 0.75rem;
  padding: 0.25em 0.6em;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.1em;
}
.card__body { padding-top: 0.9rem; display: grid; gap: 0.35rem; }
.card__title {
  font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.45;
}
.card__meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.6875rem;
  letter-spacing: 0.1em; color: var(--muted);
}
.card__date { display: none; }

/* list (Txt) view */
.view-txt .cards { gap: 0; }
.view-txt .card {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding-block: 1.15rem;
  border-bottom: 1px solid var(--line);
  transition: padding-inline 0.45s var(--ease), background 0.45s var(--ease);
}
.view-txt .card:hover { padding-inline: 0.85rem; background: var(--bg-sunk); }
.view-txt .card__media { display: none; }
.view-txt .card__body { padding: 0; display: contents; }
.view-txt .card__title { order: 2; font-size: clamp(1rem, 2vw, 1.375rem); font-weight: 500; }
.view-txt .card__meta { order: 3; justify-content: flex-end; }
/* 日付は左の列に出るので、メタ内の日付は隠す */
.view-txt .card__meta span:first-child { display: none; }
.view-txt .card__date {
  order: 1; display: block;
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; color: var(--muted);
}

@media (max-width: 640px) {
  .view-txt .card { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .view-txt .card__meta { order: 4; grid-column: 2; justify-content: flex-start; }
}

.empty {
  padding-block: 5rem;
  text-align: center;
  font-family: var(--font-mono); font-size: 0.8125rem; color: var(--muted);
}

/* =========================================================
   footer
   ========================================================= */
.site-footer { padding-block: clamp(3rem, 6vw, 5rem) 2rem; }
.site-footer__top {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 2rem 3rem;
}
.site-footer__mark {
  font-weight: 700; font-size: clamp(2rem, 9vw, 6rem);
  letter-spacing: 0.06em; line-height: 1; text-transform: uppercase;
}
.footer-cols { display: flex; flex-wrap: wrap; gap: 2.5rem; }
.footer-col dt { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.footer-col dd { font-size: 0.875rem; }
.site-footer__bottom {
  margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
}

/* =========================================================
   recipe detail
   ========================================================= */
.detail { padding-top: 8rem; }
.detail__head { display: grid; gap: 1.25rem; padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.detail__back { justify-self: start; }
.detail__title {
  font-size: clamp(2rem, 6.5vw, 5rem);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.05;
  text-wrap: balance;
}
.detail__sub { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.1em; color: var(--muted); }
.detail__lede { max-width: 60ch; color: var(--ink-soft); line-height: 2; }
.detail__pills { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.detail__hero {
  aspect-ratio: 3 / 2;
  overflow: hidden; background: var(--bg-sunk); border-radius: 2px;
  margin-bottom: clamp(2.5rem, 6vw, 5rem);
}
.detail__hero img { width: 100%; height: 100%; object-fit: cover; }

.specs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0 2rem;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.spec { padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.spec dt { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.spec dd { margin-top: 0.35rem; font-size: 1.0625rem; font-weight: 500; }

.detail__cols { display: grid; gap: clamp(2.5rem, 6vw, 5rem); align-items: start; }
@media (min-width: 900px) { .detail__cols { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); } }

.block__title {
  font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 0.85rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--ink);
}
@media (min-width: 900px) { .ingredients { position: sticky; top: 6rem; } }

.ing-list li {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.ing-list .name { flex: 0 1 auto; }
.ing-list .dots { flex: 1 1 1.5rem; border-bottom: 1px dotted var(--line); transform: translateY(-0.3em); }
.ing-list .amount { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--ink-soft); white-space: nowrap; }

.steps { counter-reset: step; display: grid; gap: 2rem; }
.step {
  display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0 1.25rem;
  padding-bottom: 2rem; border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: 0; padding-bottom: 0; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.06em;
  color: var(--accent); padding-top: 0.28rem;
}
.step p { line-height: 1.95; }
/* 手順の写真。縦長でも高くなりすぎないよう幅で抑える */
.step figure { grid-column: 2; margin-top: 1.1rem; max-width: 32rem; }
.step figure img { width: 100%; border-radius: 2px; background: var(--bg-sunk); }

.notes {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--bg-sunk); border-radius: 2px;
}
.notes p { color: var(--ink-soft); line-height: 2; }

.detail__nav {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-block: clamp(3rem, 6vw, 5rem);
  border-top: 1px solid var(--line); margin-top: clamp(3rem, 6vw, 5rem);
}
.detail__nav a { display: grid; gap: 0.3rem; }
.detail__nav .next { text-align: right; }
.detail__nav strong { font-size: 1.0625rem; font-weight: 500; }
