/* styles.css — Sunrise Bakery, lesson 8: custom properties and dark mode */

/* 1. Every colour is defined once, as a custom property on :root. */
:root {
  --bg: #fffaf2;
  --surface: #ffffff;
  --text: #2b2118;
  --heading: #8a3b12;
  --accent: #f2a83c;
  --header-bg: #fff4e0;
  --border: #f1dfc4;
  --muted: #6b5a4a;
  --radius: 12px;
  color-scheme: light dark;
}

/* 2. When the visitor's device is set to dark mode, swap the values.
      Nothing else in the stylesheet has to change. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1410;
    --surface: #261c16;
    --text: #f3e9df;
    --heading: #f7b267;
    --accent: #f2a83c;
    --header-bg: #2c2019;
    --border: #3d2d22;
    --muted: #c4b3a3;
  }
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
}

h1,
h2,
h3 {
  line-height: 1.2;
  color: var(--heading);
}

a {
  color: var(--heading);
}

.page {
  display: grid;
  grid-template-areas:
    "header"
    "content"
    "sidebar"
    "footer";
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.site-header { grid-area: header; }
.content     { grid-area: content; }
.sidebar     { grid-area: sidebar; }
.site-footer { grid-area: footer; }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background-color: var(--header-bg);
  border-bottom: 3px solid var(--accent);
  border-radius: var(--radius);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--heading);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 8px;
}

.site-nav a {
  padding: 6px 12px;
  text-decoration: none;
  border-radius: 999px;
}

.site-nav a:hover {
  background-color: var(--accent);
  color: #2b2118;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* 3. A fallback value after the comma is used if the property isn't set. */
.card {
  padding: 20px 24px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
}

.sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.site-footer {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

@media (min-width: 900px) {
  .page {
    grid-template-columns: 1fr 300px;
    grid-template-areas:
      "header  header"
      "content sidebar"
      "footer  footer";
  }
}

/* Lesson 10: filter buttons and prices */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filters button {
  padding: 6px 14px;
  font: inherit;
  color: var(--heading);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.filters button[aria-pressed="true"] {
  background: var(--accent);
  color: #2b2118;
  border-color: var(--accent);
}

.price {
  font-weight: 700;
}
