/* ============================================================
   TIM'S KITCHEN — warm editorial recipe collection
   Shares timtoggs.com's type + amber DNA on a cream cookbook base.
   ============================================================ */

/* ---- TOKENS ---- */
:root {
  --paper:     #f6f1e8;
  --paper-2:   #fffdf8;
  --paper-3:   #efe7d8;
  --ink:       #221e19;
  --ink-soft:  #4a4239;
  --muted:     #8a8175;
  --accent:    #bd7d39;
  --accent-deep: #a3661f;
  --accent-soft: rgba(189, 125, 57, 0.12);
  --line:      rgba(34, 30, 25, 0.10);
  --line-2:    rgba(34, 30, 25, 0.16);
  --dark:      #17140f;

  --serif: 'Playfair Display', Georgia, serif;
  --sans:  'DM Sans', system-ui, -apple-system, sans-serif;
  --mono:  'DM Mono', ui-monospace, monospace;

  --max:   1120px;
  --pad:   40px;
  --ease:  cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--paper-2); }

/* subtle paper texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

/* ============================================================
   NAV
   ============================================================ */
.k-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 241, 232, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.k-nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.k-brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.k-brand span { color: var(--accent); }
.k-back {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  transition: color 0.25s;
  white-space: nowrap;
}
.k-back:hover { color: var(--accent); }

/* ============================================================
   INDEX — MASTHEAD
   ============================================================ */
.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: 76px var(--pad) 48px;
  text-align: center;
}
.masthead .eyebrow {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
}
.masthead .eyebrow::before,
.masthead .eyebrow::after {
  content: ''; width: 34px; height: 1px; background: var(--accent); opacity: 0.5;
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 800;
  font-size: clamp(2.8rem, 6.5vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 22px;
}
.masthead h1 em { font-style: italic; color: var(--accent); }
.masthead p {
  max-width: 540px;
  margin: 0 auto;
  font-size: 1.08rem;
  color: var(--ink-soft);
}

/* ---- CONTROLS (search + filters) ---- */
.controls {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}
.search-wrap {
  position: relative;
  max-width: 460px;
  margin: 0 auto 26px;
}
.search-wrap svg {
  position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--muted); pointer-events: none;
}
#search {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.98rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 100px;
  padding: 14px 22px 14px 48px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.filter-group-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}
.chip {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 100px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper-2);
}
.results-meta {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin: 18px 0 4px;
}

/* ============================================================
   RECIPE GRID
   ============================================================ */
.grid-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--pad) 100px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.r-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s ease, border-color 0.3s;
}
.r-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px rgba(34, 30, 25, 0.14);
  border-color: var(--line-2);
}
.r-card-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-3);
  position: relative;
}
.r-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.r-card:hover .r-card-img img { transform: scale(1.06); }
.r-card-img .badge {
  position: absolute; top: 12px; left: 12px;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-2);
  background: rgba(23, 20, 15, 0.62);
  backdrop-filter: blur(6px);
  padding: 5px 11px;
  border-radius: 100px;
}
.r-card-body {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.r-card-title {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 600;
  line-height: 1.22;
  color: var(--ink);
  margin-bottom: 10px;
}
.r-card-dek {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 18px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.r-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-soft);
}
.r-card-meta .m { display: inline-flex; align-items: center; gap: 6px; }
.r-card-meta svg { width: 14px; height: 14px; color: var(--accent); }

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  font-size: 1rem;
}

/* ============================================================
   RECIPE DETAIL
   ============================================================ */
.detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px var(--pad) 90px;
}
.crumb {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 24px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 0.25s, gap 0.3s var(--ease);
}
.crumb:hover { color: var(--accent); gap: 12px; }

.d-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: var(--paper-3);
  box-shadow: 0 24px 50px rgba(34, 30, 25, 0.18);
  margin-bottom: 36px;
}
.d-hero img { width: 100%; height: 100%; object-fit: cover; }

.d-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.d-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 100px;
  padding: 5px 12px;
}
.d-title {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 14px;
}
.d-dek {
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 660px;
  margin-bottom: 30px;
}

/* META BAR */
.d-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 18px;
}
.d-meta .cell { background: var(--paper-2); padding: 18px 14px; text-align: center; }
.d-meta .label {
  font-family: var(--mono);
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.d-meta .val { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--ink); }

/* TOOLBAR */
.d-tools { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 44px; }
.tool-btn {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 100px;
  padding: 10px 20px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.25s var(--ease);
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
.tool-btn.on { background: var(--accent); border-color: var(--accent); color: var(--paper-2); }

/* BODY GRID */
.d-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 56px;
  align-items: start;
}
.d-col h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.d-col .h-rule {
  width: 44px; height: 2px; background: var(--accent); margin-bottom: 22px;
}
.d-col h3 {
  font-family: var(--mono);
  font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-deep);
  margin: 22px 0 12px;
}
.d-col h3:first-of-type { margin-top: 0; }

/* INGREDIENTS — checkable */
.ing-list { list-style: none; }
.ing-list li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
  font-size: 0.97rem;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.ing-list li:last-child { border-bottom: none; }
.ing-box {
  flex: 0 0 auto;
  width: 19px; height: 19px;
  margin-top: 3px;
  border: 1.5px solid var(--line-2);
  border-radius: 6px;
  display: grid; place-items: center;
  transition: all 0.2s var(--ease);
}
.ing-box svg { width: 12px; height: 12px; color: var(--paper-2); opacity: 0; transition: opacity 0.2s; }
.ing-list li.checked .ing-box { background: var(--accent); border-color: var(--accent); }
.ing-list li.checked .ing-box svg { opacity: 1; }
.ing-list li.checked { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }

.ingredients-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 26px 28px;
  position: sticky;
  top: 88px;
}

/* INSTRUCTIONS — numbered, checkable */
.step-list { list-style: none; counter-reset: step; }
.step-list li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.step-list li:last-child { border-bottom: none; }
.step-list li::before {
  counter-increment: step;
  content: counter(step);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1.5px solid var(--accent);
  color: var(--accent-deep);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  display: grid; place-items: center;
  transition: all 0.25s var(--ease);
}
.step-list li.done::before {
  background: var(--accent); color: var(--paper-2);
}
.step-list li .step-text { font-size: 1rem; color: var(--ink-soft); padding-top: 7px; line-height: 1.7; }
.step-list li.done .step-text { color: var(--muted); }

/* EXTRAS (notes / toppings) */
.extras { margin-top: 40px; }
.extra-block {
  background: var(--accent-soft);
  border: 1px solid rgba(189, 125, 57, 0.18);
  border-radius: 14px;
  padding: 22px 26px;
  margin-top: 18px;
}
.extra-block h3 { margin-top: 0; color: var(--accent-deep); }
.extra-block ul { list-style: none; }
.extra-block li {
  position: relative;
  padding: 5px 0 5px 20px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.extra-block li::before {
  content: '—'; position: absolute; left: 0; color: var(--accent);
}

/* ============================================================
   FOOTER
   ============================================================ */
.k-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-3);
}
.k-footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}
.k-footer a { color: var(--muted); transition: color 0.25s; }
.k-footer a:hover { color: var(--accent); }

/* ============================================================
   REVEAL
   ============================================================ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  :root { --pad: 24px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 20px; }
  .d-grid { grid-template-columns: 1fr; gap: 40px; }
  .ingredients-card { position: static; }
}
@media (max-width: 560px) {
  :root { --pad: 18px; }
  .grid { grid-template-columns: 1fr; }
  .d-meta { grid-template-columns: 1fr 1fr; }
  .k-footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .masthead { padding-top: 52px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .k-nav, .d-tools, .crumb, .k-footer, body::before { display: none !important; }
  body { background: #fff; color: #000; }
  .d-hero { box-shadow: none; max-height: 320px; }
  .d-grid { grid-template-columns: 1fr 1.2fr; gap: 28px; }
  .ingredients-card { position: static; border: 1px solid #ccc; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
