/* Recepten - stylesheet
   Colors adapted from the original Word export with WCAG AA contrast
   fixes applied: link/visited-link colors darkened, hero gradient
   darkened so white title text stays readable at every point. */

:root {
  --font-main: "Century Gothic", Questrial, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --color-heading: #AB1E19;
  --color-heading-hover: #8a1813;
  --color-text: #333333;
  --color-link: #C8401D;
  --color-link-visited: #A6460E;
  --color-muted: #595959;
  --color-bg: #ffffff;
  --color-surface: #fff8f3;
  --color-border: #f0d9c9;
  --color-border-soft: #eee2d8;
  --max-width: 800px;
  --text-width: 68ch;
}

/* Dark mode: follows the OS/browser preference, no toggle needed.
   Hero banners keep their orange gradient with white text in both
   modes; only neutral page/card colors are swapped here. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-heading: #ff8a73;
    --color-heading-hover: #ffa28f;
    --color-text: #eae1db;
    --color-link: #ffab76;
    --color-link-visited: #e8a27a;
    --color-muted: #bfb3a9;
    --color-bg: #1b1310;
    --color-surface: #2a1f1a;
    --color-border: #4a3a30;
    --color-border-soft: #3a2d26;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Skip link: hidden until focused, helps keyboard/screen-reader users */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-surface);
  color: var(--color-heading);
  padding: 0.75rem 1rem;
  z-index: 10;
  border-radius: 0 0 6px 0;
}

.skip-link:focus {
  left: 0;
}

/* Hero banner (recreated with CSS instead of a baked-in cover image) */
.hero {
  background: linear-gradient(180deg, #dd6620 0%, #d35a12 30%, #c04c0a 60%, #a8400a 100%);
  padding: 4rem 1.5rem;
  text-align: center;
  scroll-margin-top: 1rem;
}

.hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: 3rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Table of contents */
.toc {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.toc h2 {
  color: var(--color-heading);
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.toc li ul {
  padding-left: 1.25rem;
}

.toc li {
  margin-bottom: 0.25rem;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

article,
.category {
  margin-bottom: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border-soft);
}

article:first-of-type,
.category:first-of-type {
  border-top: none;
  padding-top: 0;
}

h1, h2, h3, h4 {
  scroll-margin-top: 1rem;
}

.recipe-title {
  color: var(--color-heading);
  font-size: 2rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: normal;
}

.recipe-part {
  color: var(--color-heading);
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: normal;
}

.label-heading {
  color: var(--color-heading);
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
  font-weight: bold;
}

/* Category sections on the home page */
.category-title {
  color: var(--color-heading);
  font-size: 1.75rem;
  margin-top: 0;
  margin-bottom: 1rem;
  font-weight: normal;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
}

.recipe-card {
  margin: 0;
}

.recipe-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.recipe-card a:hover,
.recipe-card a:focus {
  border-color: var(--color-heading);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recipe-card-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--color-border);
}

.recipe-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.25rem 1.25rem;
  flex: 1;
}

.recipe-card-title {
  color: var(--color-heading);
  font-size: 1.15rem;
}

.recipe-card-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.recipe-card-time {
  margin-top: auto;
  padding-top: 0.4rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Home page search box, random-recipe button and tag filter chips */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.filters {
  max-width: var(--max-width);
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

#recipe-search {
  flex: 1 1 220px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
}

.button-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--color-heading);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--color-heading-hover);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  border-color: var(--color-heading);
}

.filter-chip[aria-pressed="true"] {
  background: var(--color-heading);
  border-color: var(--color-heading);
  color: #ffffff;
}

.filter-chip-reset {
  background: transparent;
  border-style: dashed;
}

#no-results-message {
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  color: var(--color-muted);
}

/* Recipe page header: breadcrumb back-link and meal-type badge */
.hero-recipe {
  text-align: left;
  padding: 2rem 1.5rem;
}

.hero-recipe .breadcrumb {
  margin: 0 0 1rem;
  max-width: none;
}

.hero-recipe .breadcrumb a {
  color: #ffffff;
  font-size: 0.9rem;
  opacity: 0.9;
}

.hero-recipe h1 {
  text-transform: none;
  font-size: 2.25rem;
  text-align: left;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.category-badge,
.tag-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

.category-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-transform: uppercase;
}

.tag-badge {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
}

.recipe-meta {
  margin: 0.6rem 0 0;
  color: #ffffff;
  opacity: 0.9;
  font-size: 0.95rem;
  max-width: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

/* Shared pill-button look for the keep-awake and print actions */
.hero-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.hero-button:hover,
.hero-button:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

/* Keep-awake toggle: hidden by default, revealed by wake-lock.js only
   when the Screen Wake Lock API is actually supported. */
.wake-lock-toggle[aria-pressed="true"] {
  background: #ffffff;
  color: var(--color-heading);
  font-weight: bold;
}

.wake-lock-toggle[hidden] {
  display: none;
}

/* Servings/yield scaler shown above the ingredient lists */
.servings-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  max-width: none;
}

.servings-control label {
  font-weight: bold;
  color: var(--color-heading);
}

.servings-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.servings-stepper button {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--color-heading);
  background: var(--color-surface);
  color: var(--color-heading);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.servings-stepper button:hover,
.servings-stepper button:focus-visible {
  background: var(--color-heading);
  color: #ffffff;
}

.servings-stepper input {
  width: 3.5rem;
  text-align: center;
  padding: 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

.servings-hint {
  margin: 0;
  flex-basis: 100%;
  font-size: 0.85rem;
  color: var(--color-muted);
}

ul, ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
  max-width: var(--text-width);
}

li {
  margin-bottom: 0.25rem;
}

p {
  margin: 0 0 1rem;
  max-width: var(--text-width);
}

a {
  color: var(--color-link);
  text-decoration: underline;
}

a:visited {
  color: var(--color-link-visited);
}

.back-to-top {
  margin-top: 1.5rem;
  max-width: none;
}

.back-to-top a {
  font-size: 0.9rem;
}

.recipe-photo {
  margin: 0 0 1.5rem;
}

.recipe-photo img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 1rem 0;
  max-width: none;
}

.gallery figure {
  margin: 0;
  width: 220px;
  max-width: 100%;
}

.gallery img {
  display: block;
  max-width: 100%;
  height: auto;
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.gallery figcaption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: center;
}

.tip {
  font-style: italic;
  color: var(--color-muted);
}

@media (max-width: 600px) {
  .hero {
    padding: 2.5rem 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .gallery figure {
    width: 100%;
  }
}

/* Print: strip chrome/colors, keep ingredients and steps ink-friendly */
@media print {
  .skip-link,
  .hero,
  .toc,
  .back-to-top,
  .servings-control,
  .filters,
  #no-results-message {
    display: none;
  }

  body {
    color: #000;
  }

  .recipe-title,
  .recipe-part,
  .category-title,
  .label-heading {
    color: #000;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  article,
  .category {
    border-top: none;
    page-break-inside: avoid;
  }

  .gallery img,
  .recipe-photo img {
    box-shadow: none;
  }
}
