/* ============================================================
   Sour Life Bakery — Global Styles
   Aesthetic: Refined artisan — organic warmth, editorial elegance
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Lato:wght@300;400;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --green:         #8FAF7A;
  --green-dark:    #6D8F59;
  --green-light:   #B5CFA5;
  --green-pale:    #E8F2E3;
  --cream:         #FAF7F0;
  --cream-dark:    #F0EBE0;
  --cream-deeper:  #E6DDD0;
  --white:         #FFFFFF;
  --text-dark:     #2C2416;
  --text-mid:      #5C4F3A;
  --text-light:    #8C7F6A;
  --text-ghost:    #B5A898;
  --error:         #B85C4A;
  --success:       #5A9E6F;
  --overlay:       rgba(44, 36, 22, 0.55);

  --font-heading:  'Playfair Display', Georgia, serif;
  --font-body:     'Lato', 'Helvetica Neue', sans-serif;

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --radius-xl:     32px;

  --shadow-sm:     0 1px 4px rgba(44, 36, 22, 0.08);
  --shadow-card:   0 4px 16px rgba(44, 36, 22, 0.10);
  --shadow-lift:   0 10px 32px rgba(44, 36, 22, 0.16);
  --shadow-modal:  0 20px 60px rgba(44, 36, 22, 0.22);

  --transition:    all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background-color: var(--cream);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  /* Prevent off-canvas panels (cart / profile) from creating horizontal scroll */
  overflow-x: hidden;
  max-width: 100%;
  /* Subtle grain texture overlay */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-body);
}

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 60px);
  height: 184px;
  box-shadow: 0 2px 16px rgba(44, 36, 22, 0.12);
}

.nav-logo {
  height: 176px;
  width: auto;
  max-width: none;
  flex-shrink: 0;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  transition: var(--transition);
}

.nav-logo:hover {
  opacity: 1;
  transform: scale(1.02);
}

/* Fallback text shown only if logo image fails to load */
.nav-brand-text {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--cream);
  letter-spacing: 1px;
  display: none;
}

.nav-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

/* Nav page links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
  border-radius: var(--radius-sm);
  transition: color 0.18s, background 0.18s;
  text-decoration: none;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.nav-link.active {
  color: #fff;
  background: rgba(255,255,255,0.18);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-cart-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  color: var(--green-dark);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  padding: 14px 28px;
  border-radius: var(--radius-xl);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(44, 36, 22, 0.12);
  position: relative;
}

.nav-cart-btn:hover {
  background: var(--white);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.nav-cart-btn:active {
  transform: translateY(0);
}

.cart-icon {
  width: 24px;
  height: 24px;
  position: relative;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-dark);
  color: var(--cream);
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  padding: 0 5px;
  transition: var(--transition);
}

.cart-badge.empty {
  background: var(--text-ghost);
}

/* ── Hero Section ──────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 74vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(28px, 5vw, 56px) clamp(20px, 5vw, 80px) clamp(48px, 9vw, 100px);
  overflow: hidden;
  background: var(--cream);
}

/* Decorative background elements */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 30%, rgba(143, 175, 122, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 20% 70%, rgba(143, 175, 122, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(240, 235, 224, 0.5) 0%, transparent 50%);
  pointer-events: none;
}

/* Large decorative wheat motif */
.hero::after {
  content: '';
  position: absolute;
  bottom: -20px;
  right: -60px;
  width: 500px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(143, 175, 122, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-logo {
  width: clamp(260px, 38vw, 380px);
  height: auto;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.1s forwards;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.2s forwards;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-dark);
  margin-bottom: 24px;
  max-width: 800px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.4s forwards;
}

.hero-title em {
  font-style: italic;
  color: var(--green-dark);
}

.hero-cursive {
  font-family: 'Dancing Script', cursive;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.01em;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 300;
  color: var(--text-mid);
  max-width: 520px;
  line-height: 1.8;
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.6s forwards;
}

.hero-divider {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  margin: 0 auto 36px;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.5s forwards;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--green);
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 36px;
  border-radius: var(--radius-xl);
  border: 2px solid var(--green);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(109, 143, 89, 0.3);
  opacity: 0;
  animation: fadeUp 0.8s ease 0.8s forwards;
}

.hero-cta {
  text-decoration: none;
}

.hero-cta:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(109, 143, 89, 0.4);
}

.hero-cta:active {
  transform: translateY(-1px);
}

.hero-scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-ghost);
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  animation: float 2.5s ease-in-out infinite;
}

.hero-scroll-hint svg {
  animation: bounce 2s ease-in-out infinite;
}

/* ── Section Header ────────────────────────────────────────── */
.section-header {
  text-align: center;
  padding: clamp(60px, 8vw, 100px) clamp(20px, 5vw, 60px) clamp(40px, 6vw, 64px);
}

.section-eyebrow {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 16px;
  display: block;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.section-title em {
  font-style: italic;
  color: var(--green-dark);
}

.section-sub {
  font-size: 1rem;
  color: var(--text-light);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
  font-weight: 300;
}

.section-rule {
  width: 50px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  margin: 20px auto 0;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--text-dark);
  color: var(--text-ghost);
  text-align: center;
  padding: 48px clamp(20px, 5vw, 60px);
}

.footer-logo {
  height: 96px;
  width: auto;
  max-width: 80vw;
  filter: brightness(0) invert(1);
  opacity: 0.5;
  margin: 0 auto 20px;
}

.footer-text {
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  line-height: 1.8;
}

.footer-tagline {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1rem;
  color: var(--green-light);
  margin-bottom: 12px;
}

/* ── Toast Notifications ────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-dark);
  color: var(--cream);
  font-size: 0.9rem;
  font-weight: 400;
  padding: 14px 28px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-align: center;
}

#toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#toast.toast-success {
  background: var(--success);
}

#toast.toast-error {
  background: var(--error);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { opacity: 0.6; transform: translateX(-50%) translateY(0); }
  50%       { opacity: 1;   transform: translateX(-50%) translateY(-6px); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(4px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Utility ─────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .nav {
    height: 140px;
  }
  .nav-logo {
    height: 124px;
  }
  .nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.8rem;
  }
  .nav-cart-btn {
    font-size: 0.95rem;
    padding: 10px 20px;
  }
}

/* Two-row mobile nav: logo + actions on top, page links below */
@media (max-width: 768px) {
  .nav {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 16px;
    row-gap: 4px;
    column-gap: 8px;
  }
  .nav-logo-wrap { order: 1; }
  .nav-logo { height: 56px; max-width: 70vw; }
  .nav-brand-text { font-size: 1.1rem; }

  .nav-actions { order: 2; margin-left: auto; gap: 8px; }
  .nav-auth-btn,
  .nav-cart-btn,
  .nav-user-btn {
    font-size: 0.82rem;
    padding: 8px 14px;
  }
  .nav-cart-btn { gap: 6px; }
  .nav-cart-btn .cart-icon { width: 18px; height: 18px; }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding-top: 4px;
  }
  .nav-link {
    font-size: 0.9rem;
    padding: 0.45rem 0.5rem;
    letter-spacing: 0.03em;
  }
}

@media (max-width: 360px) {
  .nav-link { font-size: 0.82rem; padding: 0.4rem 0.35rem; }
  .nav-auth-btn,
  .nav-cart-btn { font-size: 0.78rem; padding: 7px 11px; }
}
