/* ==========================================================================
   The Storybook Bakery shared stylesheet
   Palette: slate blue / linen / bamboo / charcoal (see website-design.md §3)
   ========================================================================== */

:root {
  --slate: #5B7FA6;
  --slate-deep: #3F5A79;
  --linen: #F5EFE6;
  --linen-dark: #EBE2D3;
  --bamboo: #C4A46B;
  --bamboo-deep: #A8874D;
  --charcoal: #2C2C2C;
  --white: #FFFFFF;

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Lato", "Segoe UI", sans-serif;

  --radius-img: 8px;
  --radius-btn: 6px;
}

/* ---------- Reset & base ---------- */

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--charcoal);
  background-color: var(--white);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5em;
  color: var(--charcoal);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p {
  margin: 0 0 1em;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--bamboo);
  outline-offset: 2px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Buttons ---------- */

.btn,
.btn-outline,
.btn-light-outline {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn {
  background-color: var(--slate);
  color: var(--white);
  border: 2px solid var(--slate);
}

.btn:hover,
.btn:focus-visible {
  background-color: var(--bamboo-deep);
  border-color: var(--bamboo-deep);
}

.btn-outline {
  background-color: transparent;
  color: var(--slate);
  border: 2px solid var(--slate);
}

.btn-outline:hover,
.btn-outline:focus-visible {
  color: var(--bamboo-deep);
  border-color: var(--bamboo-deep);
}

/* For use on slate-blue backgrounds */
.btn-light-outline {
  background-color: transparent;
  color: var(--white);
  border: 2px solid var(--white);
}

.btn-light-outline:hover,
.btn-light-outline:focus-visible {
  color: var(--linen);
  border-color: var(--bamboo);
  background-color: rgba(255, 255, 255, 0.08);
}

/* ---------- Header & navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--slate);
  box-shadow: 0 2px 6px rgba(44, 44, 44, 0.2);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

/* The logo is black line art; seat it on a linen disc so it reads on slate */
.nav-logo img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--linen);
  padding: 3px;
}

.nav-logo span {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 0.6rem 0.8rem;
  color: var(--white);
  text-decoration: none;
  font-weight: 400;
  border-bottom: 3px solid transparent;
  transition: border-color 0.2s ease;
}

.nav-links a:hover {
  border-bottom-color: var(--linen);
}

.nav-links a.active {
  border-bottom-color: var(--bamboo);
  font-weight: 700;
}

/* ---------- Chapter headings (storybook motif) ---------- */

.chapter-heading {
  text-align: center;
  margin: 0 0 2rem;
}

.chapter-heading::before {
  content: "\2726"; /* ✦ */
  display: block;
  color: var(--bamboo);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.chapter-heading::after {
  content: "";
  display: block;
  width: 70px;
  height: 1px;
  background-color: var(--bamboo);
  margin: 0.75rem auto 0;
}

/* ---------- Sections ---------- */

.section {
  padding: 3.5rem 0;
}

.section-linen {
  background-color: var(--linen);
}

.section-slate {
  background-color: var(--slate);
  color: var(--white);
}

.section-slate h2 {
  color: var(--white);
}

.section-slate .chapter-heading::before {
  color: var(--linen);
}

.section-slate .chapter-heading::after {
  background-color: var(--linen);
}

.section-intro {
  max-width: 640px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

/* ---------- Hero ---------- */

.hero {
  background-color: var(--linen);
  /* Faint woven-linen texture in pure CSS */
  background-image:
    repeating-linear-gradient(0deg, rgba(196, 164, 107, 0.05) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(196, 164, 107, 0.05) 0 1px, transparent 1px 5px);
  text-align: center;
  padding: 4rem 1.5rem 4.5rem;
}

.hero img {
  max-width: 220px;
  margin: 0 auto 1.5rem;
}

.hero .tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  max-width: 520px;
  margin: 0 auto 2rem;
  color: var(--charcoal);
}

/* ---------- Storybook initial: enlarged first letter, inline with its word ---------- */

.drop-cap::first-letter {
  font-family: var(--font-display);
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1;
  color: var(--slate);
}

/* ---------- Card grids ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.card {
  background-color: var(--linen);
  border: 1px solid var(--bamboo);
  border-radius: var(--radius-img);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.card h3 {
  margin-bottom: 0.4rem;
}

.card p {
  flex-grow: 1;
  margin-bottom: 0.75rem;
}

.card .card-link {
  font-weight: 700;
  text-decoration: none;
  color: var(--slate);
}

.card .card-link:hover {
  color: var(--bamboo-deep);
}

/* ---------- Notice banner ---------- */

.banner {
  background-color: var(--linen);
  border-left: 4px solid var(--bamboo);
  border-radius: var(--radius-btn);
  padding: 1rem 1.25rem;
  margin-bottom: 2.5rem;
}

.banner p {
  margin: 0;
}

/* ---------- Menu page ---------- */

.menu-category {
  margin-bottom: 3rem;
}

.menu-category:last-of-type {
  margin-bottom: 0;
}

.menu-items {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 720px;
  margin-inline: auto;
}

.menu-items li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--linen-dark);
}

.menu-items li:last-child {
  border-bottom: none;
}

.menu-items .item-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  display: block;
}

.menu-items .item-desc {
  margin: 0.15rem 0 0;
  color: #555555;
}

.page-cta {
  text-align: center;
  margin-top: 3rem;
}

/* ---------- Product cards (dry mixes) ---------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.product-card {
  background-color: var(--white);
  border: 1px solid var(--bamboo);
  border-radius: var(--radius-img);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card .card-body {
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card p {
  flex-grow: 1;
}

/* ---------- Placeholder image tiles (pure CSS, no external images) ---------- */

.placeholder-img {
  background-color: var(--linen);
  border-radius: var(--radius-img);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--bamboo-deep);
  font-family: var(--font-display);
  font-style: italic;
  text-align: center;
  padding: 1rem;
  min-height: 180px;
}

.placeholder-img::before {
  content: "\2726";
  font-size: 1.6rem;
  font-style: normal;
  color: var(--bamboo);
}

.product-card .placeholder-img {
  border-radius: 0;
  border-bottom: 1px solid var(--linen-dark);
}

/* ---------- Wholesale ---------- */

.reasons-list {
  list-style: none;
  margin: 2rem auto;
  padding: 0;
  max-width: 640px;
}

.reasons-list li {
  padding: 0.6rem 0 0.6rem 2rem;
  position: relative;
}

.reasons-list li::before {
  content: "\2726";
  position: absolute;
  left: 0.25rem;
  color: var(--bamboo);
}

/* ---------- Gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.gallery-tile {
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-img);
}

.gallery-tile .placeholder-img,
.gallery-tile img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-img);
}

.gallery-tile img {
  object-fit: cover;
}

.gallery-note {
  text-align: center;
  margin-top: 2rem;
  font-style: italic;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(44, 44, 44, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-img);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--white);
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

/* ---------- About ---------- */

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 2.5rem;
  align-items: start;
}

.about-layout .placeholder-img {
  min-height: 320px;
}

.story-lead {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--slate);
  margin-bottom: 1.25rem;
}

.story-signature {
  font-family: var(--font-display);
  font-style: italic;
  margin-top: 1.5rem;
}

/* ---------- Contact form ---------- */

.contact-layout {
  max-width: 640px;
  margin: 0 auto;
}

.contact-form {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.form-field label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.form-field .optional {
  font-weight: 400;
  color: #666666;
  font-size: 0.9rem;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--charcoal);
  background-color: var(--white);
  border: 1px solid var(--bamboo);
  border-radius: var(--radius-btn);
  padding: 0.7rem 0.85rem;
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}

.form-field input.invalid,
.form-field select.invalid,
.form-field textarea.invalid {
  border-color: #A94436;
  border-width: 2px;
}

.field-error {
  display: none;
  color: #A94436;
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

.field-error.visible {
  display: block;
}

.form-message {
  border-radius: var(--radius-btn);
  padding: 1rem 1.25rem;
  display: none;
}

.form-message.visible {
  display: block;
}

.form-message.success {
  background-color: var(--linen);
  border: 1px solid var(--bamboo);
}

.form-message.error {
  background-color: #FAEDEA;
  border: 1px solid #C4826B;
}

.form-message p {
  margin: 0;
}

.contact-direct {
  background-color: var(--linen);
  border-radius: var(--radius-img);
  padding: 1.5rem;
  text-align: center;
}

.contact-direct p {
  margin: 0.35rem 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background-color: var(--slate-deep);
  color: var(--linen);
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.site-footer a {
  color: var(--linen);
}

.site-footer a:hover {
  color: var(--bamboo);
}

.footer-contact p {
  margin: 0.25rem 0;
}

.footer-license {
  font-size: 0.85rem;
  opacity: 0.75;
}

.footer-social {
  margin: 1.25rem 0;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-social a {
  text-decoration: none;
}

.footer-social .coming-soon {
  opacity: 0.6;
  cursor: default;
}

.footer-tagline {
  font-family: var(--font-display);
  font-style: italic;
  margin-bottom: 1rem;
}

.footer-copyright {
  font-size: 0.85rem;
  opacity: 0.75;
  margin: 0;
}

/* ---------- Responsive: tablet and below ---------- */

@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.5rem; }

  .hero .tagline {
    font-size: 1.25rem;
  }

  .nav-toggle {
    display: block;
  }

  .nav-logo span {
    font-size: 1rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background-color: var(--slate);
    box-shadow: 0 6px 12px rgba(44, 44, 44, 0.25);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.9rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .nav-links a.active {
    border-bottom-color: var(--bamboo);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .card-grid,
  .product-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 2.5rem 0;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .nav-toggle,
  .btn,
  .btn-outline,
  .btn-light-outline {
    display: none !important;
  }

  body {
    background: var(--white);
  }
}
