/* =========================================================
   Spaghetti + Meatballs — Global Stylesheet
   ========================================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
  --color-white: #fefcf9;
  --color-bg: #f5f0e8;
  --color-bg-warm: #ece6db;
  --color-bg-dark: #2c2420;
  --color-black: #2c2420;
  --color-text: #2c2420;
  --color-text-secondary: #6b5c52;
  --color-text-muted: #9e8d7f;
  --color-border: #ddd4c6;
  --color-border-light: #e8e0d2;
  --color-accent: #b8452e;
  --color-accent-dark: #943824;
  --color-accent-light: #f5ddd6;
  --color-success: #2d6a4f;
  --color-success-light: #d8f3dc;
  --color-warning: #d4940e;
  --color-warning-light: #fdf3d7;
  --color-error: #b5342a;
  --color-error-light: #fde8e8;

  --font-heading: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;

  --header-height: 64px;
  --max-width: 1200px;
  --max-width-narrow: 720px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(44,36,32,0.012) 3px, rgba(44,36,32,0.012) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(44,36,32,0.012) 3px, rgba(44,36,32,0.012) 4px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-dark);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  background: var(--color-white);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

input::placeholder {
  color: var(--color-text-muted);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-style: italic;
  line-height: 1.2;
  color: var(--color-black);
}

h1 { font-size: 2.75rem; }
h2 { font-size: 2.125rem; }
h3 { font-size: 1.625rem; }
h4 { font-size: 1.25rem; font-style: normal; font-weight: 600; }

p {
  margin-bottom: 1rem;
}

ul, ol {
  list-style: none;
}

/* ---------- Skip to Content ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--color-black);
  color: var(--color-white);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 10000;
  font-size: 0.875rem;
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--color-white);
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

main {
  flex: 1;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-light);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__logo {
  height: 52px;
  width: auto;
  mix-blend-mode: multiply;
}

.site-header__logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-header__nav a {
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.01em;
  transition: color var(--transition-fast);
}

.site-header__nav a:hover {
  color: var(--color-accent);
}

/* ---------- Cart Icon ---------- */
.cart-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--color-text);
}

.cart-link svg {
  width: 24px;
  height: 24px;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-accent);
  color: var(--color-white);
  font-size: 0.6875rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  transform: scale(0);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.cart-badge--visible {
  opacity: 1;
  transform: scale(1);
}

.cart-badge--pulse {
  animation: cartPulse 0.35s ease;
}

@keyframes cartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ---------- Footer ---------- */
.site-footer {
  background-color: var(--color-bg-warm);
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(44,36,32,0.012) 10px, rgba(44,36,32,0.012) 11px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(44,36,32,0.012) 10px, rgba(44,36,32,0.012) 11px);
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  margin-top: 0;
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3.5rem 0 2rem;
  gap: 2rem;
}

.site-footer__logo {
  height: 150px;
  mix-blend-mode: multiply;
}

.site-footer__details {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: 100%;
  text-align: center;
}

.site-footer__info p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.site-footer__info a {
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.site-footer__info a:hover {
  color: var(--color-accent);
}

.site-footer__links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}

.site-footer__links p {
  margin-bottom: 0;
}

.site-footer__links a {
  color: var(--color-text-secondary);
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.0625rem;
  transition: color var(--transition-fast);
}

.site-footer__links a:hover {
  color: var(--color-accent);
}

.site-footer__bottom {
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
}

.site-footer__bottom p {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .site-footer__details {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  border-radius: var(--radius-pill);
  padding: 0.75rem 2rem;
  transition: all var(--transition-fast);
  min-height: 48px;
  text-align: center;
  cursor: pointer;
  border: none;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-white);
}

.btn--primary:hover {
  background: var(--color-accent-dark);
  color: var(--color-white);
}

.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn--secondary:hover {
  border-color: var(--color-text);
}

.btn--dark {
  background: var(--color-black);
  color: var(--color-white);
}

.btn--dark:hover {
  background: #333;
  color: var(--color-white);
}

.btn--ghost {
  background: transparent;
  color: var(--color-accent);
  padding: 0.5rem 1rem;
}

.btn--ghost:hover {
  background: var(--color-accent-light);
}

.btn--sm {
  font-size: 0.8125rem;
  padding: 0.5rem 1.25rem;
  min-height: 36px;
}

.btn--lg {
  font-size: 1.0625rem;
  padding: 1rem 2.5rem;
  min-height: 56px;
}

.btn--full {
  width: 100%;
}

.btn--danger {
  background: var(--color-error);
  color: var(--color-white);
}

.btn--danger:hover {
  background: #a5312a;
  color: var(--color-white);
}

.btn--success {
  background: var(--color-success);
  color: var(--color-white);
}

.btn--success:hover {
  background: #245a3f;
  color: var(--color-white);
}

/* ---------- Form Fields ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: 0.375rem;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--color-error);
  margin-top: 0.25rem;
}

.form-input--error {
  border-color: var(--color-error);
}

.form-input--error:focus {
  box-shadow: 0 0 0 3px var(--color-error-light);
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, #f5f1ec 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

/* ---------- Toast Notifications ---------- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: rgba(44, 36, 32, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-white);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(1rem);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
  max-width: 360px;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

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

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

.toast--warning {
  background: var(--color-warning);
  color: var(--color-black);
}

/* ---------- Modal / Dialog ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay--open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: rgba(254, 252, 249, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(221, 212, 198, 0.4);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  padding: 1.5rem;
}

.modal-overlay--open .modal {
  transform: translateY(0);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
}

.modal__close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-text-secondary);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.modal__close:hover {
  background: var(--color-border-light);
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--radius-lg);
    transform: translateY(2rem) scale(0.98);
  }

  .modal-overlay--open .modal {
    transform: translateY(0) scale(1);
  }
}

/* ---------- Loading Overlay ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 9000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.loading-overlay--visible {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay__text {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge--placed {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.badge--progress {
  background: #dbeafe;
  color: #1e40af;
}

.badge--ready {
  background: var(--color-success-light);
  color: var(--color-success);
}

.badge--completed {
  background: #f3f4f6;
  color: #6b7280;
}

.badge--cancelled {
  background: var(--color-error-light);
  color: var(--color-error);
}

.badge--pending {
  background: var(--color-warning-light);
  color: #92400e;
}

/* ---------- Animations ---------- */
.fade-in-up {
  opacity: 0;
  animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reveal on scroll — JS adds .revealed which triggers keyframe */
.reveal {
  opacity: 0;
  transform: translateY(40px);
}

.reveal.revealed {
  animation: revealUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes revealUp {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.stagger-1 { animation-delay: 0.12s; }
.stagger-2 { animation-delay: 0.24s; }
.stagger-3 { animation-delay: 0.36s; }
.stagger-4 { animation-delay: 0.48s; }

/* ---------- Textures & Italian Ornaments ---------- */

/* Warm section texture — linen crosshatch */
.textured-warm {
  position: relative;
  background-color: var(--color-bg-warm);
}

.textured-warm::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(44,36,32,0.015) 8px, rgba(44,36,32,0.015) 9px),
    repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(44,36,32,0.015) 8px, rgba(44,36,32,0.015) 9px);
}

/* Italian ornamental divider — elegant thin line with center diamond */
.divider-italian {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2.5rem 0;
}

.divider-italian::before,
.divider-italian::after {
  content: '';
  height: 1px;
  width: 80px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

.divider-italian__diamond {
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* Thinner variant */
.divider-thin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 1.5rem 0;
}

.divider-thin::before,
.divider-thin::after {
  content: '';
  height: 1px;
  width: 48px;
  background: var(--color-border);
}

.divider-thin__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
}

/* Double-line Italian rule */
.rule-italian {
  border: none;
  height: 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding-top: 3px;
  margin: 2rem auto;
  max-width: 200px;
  opacity: 0.6;
}

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-accent { color: var(--color-accent); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-heading { font-family: var(--font-heading); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Reduced motion — kept minimal so animations still work */

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.625rem; }
  h3 { font-size: 1.375rem; }

  .container {
    padding: 0 1rem;
  }

  .site-header__logo {
    height: 42px;
  }

  .site-header__nav {
    gap: 0.75rem;
  }

  .site-header__nav a {
    font-size: 0.95rem;
  }

  .site-footer__logo {
    height: 110px;
  }

  .btn--lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    min-height: 52px;
  }
}
