/* 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;
}

/* Images never overflow their container, and keep their proportions. */
img {
  max-width: 100%;
  height: auto;
}

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;
}

/* ---------- Final project additions ---------- */
.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: 8px;
}

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

.hero {
  padding: 24px 0 8px;
}

.button {
  display: inline-block;
  padding: 10px 18px;
  font-weight: 700;
  color: #2b2118;
  text-decoration: none;
  background: var(--accent);
  border-radius: 999px;
}

.status {
  display: inline-block;
  padding: 4px 12px;
  font-weight: 600;
  border-radius: 999px;
}

.status.is-open {
  background: #e3f4d7;
  color: #2f5d0d;
}

.status.is-closed {
  background: #fbe3d8;
  color: #8a2a0c;
}

.faq-question {
  display: block;
  width: 100%;
  padding: 12px 0;
  font: inherit;
  font-weight: 600;
  text-align: left;
  color: var(--heading);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

/* ---------- The order form (order.html) ---------- */
.form {
  display: grid;
  gap: 16px;
  max-width: 520px;
}

.form label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.form input:not([type="radio"], [type="checkbox"]),
.form select,
.form textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
}

.form fieldset label,
.form > label {
  display: inline-block;
  margin-right: 12px;
  font-weight: 400;
}

.form button {
  justify-self: start;
  padding: 10px 20px;
  font: inherit;
  font-weight: 700;
  color: #2b2118;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- Lesson 14: no layout shift while the menu loads ---------- */
/* Each placeholder is as tall as a real card, so the page below it
   doesn't move when the real cards replace them. */
.card.skeleton {
  min-height: 185px;
  background: linear-gradient(90deg, var(--surface), var(--border), var(--surface));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card.skeleton {
    animation: none;
  }
}
