/* =========================================================================
   Recipe Site — shared stylesheet
   Every public page links this one file. Tokens below mirror DESIGN.md;
   change a token here and the whole site follows.
   ========================================================================= */

:root {
  /* Colour */
  --color-bg:        #faf7f2;   /* warm paper */
  --color-surface:   #ffffff;   /* cards, panels */
  --color-ink:       #2b2622;   /* body text */
  --color-ink-soft:  #6b625a;   /* meta, captions */
  --color-line:      #e7e0d6;   /* hairlines, borders */
  --color-accent:    #b5532c;   /* terracotta: links, buttons */
  --color-accent-ink:#ffffff;
  --color-tint:      #f1e9de;   /* placeholders, subtle fills */

  /* Type */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: clamp(2rem, 5vw, 2.75rem);

  /* Space (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* Shape & depth */
  --radius: 10px;
  --shadow: 0 1px 2px rgba(43, 38, 34, 0.06), 0 4px 14px rgba(43, 38, 34, 0.06);
  --shadow-hover: 0 2px 4px rgba(43, 38, 34, 0.08), 0 10px 24px rgba(43, 38, 34, 0.10);

  /* Layout */
  --page-width: 1080px;
  --read-width: 720px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-4);
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); }

a { color: var(--color-accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

img { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.site-header {
  border-bottom: 1px solid var(--color-line);
  background: var(--color-surface);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 64px;
}

.site-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
}

.site-footer {
  margin-top: var(--space-12);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-line);
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  text-align: center;
}

main.container { padding-top: var(--space-8); padding-bottom: var(--space-8); }

/* ---------- Home page ---------- */
.intro {
  max-width: var(--read-width);
  margin-bottom: var(--space-8);
}
.intro p { color: var(--color-ink-soft); font-size: var(--text-lg); }

.search {
  width: 100%;
  max-width: 360px;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  color: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  margin-bottom: var(--space-6);
}
.search:focus-visible { outline-offset: 0; }

.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-6);
}

.card {
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover, .card:focus-within {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.card-link:focus-visible { outline-offset: -3px; border-radius: var(--radius); }

.card-body { padding: var(--space-4) var(--space-4) var(--space-6); }
.card-title { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.card-summary { color: var(--color-ink-soft); font-size: var(--text-sm); margin: 0; }

.empty-state { color: var(--color-ink-soft); }

/* ---------- Image + placeholder (shared by cards and recipe pages) ---------- */
.media {
  aspect-ratio: 4 / 3;
  width: 100%;
  background: var(--color-tint);
  overflow: hidden;
}
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-image: repeating-linear-gradient(
    45deg, transparent 0 12px, rgba(43, 38, 34, 0.03) 12px 24px
  );
}

/* ---------- Home button ---------- */
.home-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.home-btn:hover { filter: brightness(0.92); text-decoration: none; }

/* ---------- Recipe page ---------- */
.recipe { max-width: var(--read-width); margin: 0 auto; }

.recipe-header { margin-bottom: var(--space-6); }
.recipe-summary { font-size: var(--text-lg); color: var(--color-ink-soft); }

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
  font-size: var(--text-sm);
}
.recipe-meta div { display: flex; gap: var(--space-2); }
.recipe-meta dt { color: var(--color-ink-soft); }
.recipe-meta dd { margin: 0; font-weight: 600; }

.recipe-figure {
  margin: 0 0 var(--space-8);
  border-radius: var(--radius);
  overflow: hidden;
}
.recipe-figure figcaption {
  padding-top: var(--space-2);
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
}

.recipe-section { margin-bottom: var(--space-8); }

.ingredients {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: var(--space-6);
}
.ingredients h3 {
  font-size: var(--text-base);
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-soft);
  margin: var(--space-4) 0 var(--space-2);
}
.ingredients ul { margin: 0; padding-left: var(--space-6); }
.ingredients li { margin-bottom: var(--space-1); }

.method ol, .method ul { padding-left: var(--space-6); }
.method li { margin-bottom: var(--space-3); padding-left: var(--space-1); }
.method blockquote, .notes blockquote {
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-left: 3px solid var(--color-accent);
  background: var(--color-tint);
}

.notes {
  padding: var(--space-4) var(--space-6);
  background: var(--color-tint);
  border-radius: var(--radius);
}

.notes > :last-child, .method > :last-child { margin-bottom: 0; }

.recipe-footer {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-line);
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .container { padding: 0 var(--space-4); }
  .ingredients, .notes { padding: var(--space-4); }
}

/* ---------- Print: recipes should print cleanly ---------- */
@media print {
  .site-header, .site-footer, .recipe-footer, .home-btn, .search { display: none !important; }
  body { background: #fff; }
  .media--placeholder { display: none; }
  .ingredients, .notes { border: 0; background: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover, .card:focus-within { transform: none; }
}
