/* ========================================
   Grazi Mimos - Styles
   Modern CSS with Cascade Layers
   ======================================== */

/* --- Custom Properties (Design Tokens) --- */
:root {
  /* Colors */
  --color-bg: #fdf8f9;
  --color-surface: #ffffff;
  --color-primary: #d46a8c;        /* Rosa principal */
  --color-primary-dark: #b84f72;
  --color-secondary: #9b7bb8;      /* Lavanda */
  --color-accent: #e8b4bc;
  --color-text: #3d2c3a;
  --color-text-muted: #6b5a66;
  --color-border: #f0e4e8;
  --color-gold: #c9a86c;

  /* Typography */
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;

  /* Radii & Shadows */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(61, 44, 58, 0.06);
  --shadow-md: 0 8px 24px rgba(61, 44, 58, 0.08);
  --shadow-lg: 0 16px 40px rgba(61, 44, 58, 0.12);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;
}

/* --- Cascade Layers (ordem de prioridade) --- */
@layer reset, base, layout, components, utilities;

/* ========== RESET ========== */
@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

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

  body {
    min-height: 100vh;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
  }

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

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

  ul,
  ol {
    list-style: none;
  }

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

/* ========== BASE ========== */
@layer base {
  body {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background-color: var(--color-bg);
  }

  h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-text);
  }

  h1 {
    font-size: clamp(2.25rem, 5vw, 3.5rem);
  }

  h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  }

  h3 {
    font-size: 1.15rem;
  }

  p {
    color: var(--color-text-muted);
  }

  :focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
  }

  .skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-md);
    background: var(--color-primary);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    z-index: 100;
    transition: top var(--duration) var(--ease);
  }

  .skip-link:focus {
    top: var(--space-md);
  }
}

/* ========== LAYOUT ========== */
@layer layout {
  .container {
    width: min(100% - 2rem, 1100px);
    margin-inline: auto;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(253, 248, 249, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: var(--space-md);
    gap: var(--space-lg);
  }

  .logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text);
  }

  .logo-icon {
    font-size: 1.5rem;
  }

  .main-nav ul {
    display: flex;
    gap: var(--space-xl);
  }

  .main-nav a {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    transition: color var(--duration) var(--ease);
  }

  .main-nav a:hover,
  .main-nav a:focus-visible {
    color: var(--color-primary);
  }

  .menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: var(--space-sm);
  }

  .menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform var(--duration) var(--ease);
  }

  /* Hero */
  .hero {
    position: relative;
    padding-block: var(--space-3xl);
    overflow: hidden;
    background: linear-gradient(135deg, #fdf8f9 0%, #f8eef2 50%, #f3e8f0 100%);
  }

  .hero-content {
    position: relative;
    z-index: 2;
    max-width: 600px;
  }

  .hero-eyebrow {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: var(--space-md);
  }

  .hero h1 {
    margin-bottom: var(--space-lg);
  }

  .hero-text {
    font-size: 1.125rem;
    margin-bottom: var(--space-xl);
    max-width: 34ch;
  }

  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .hero-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
  }

  /* About */
  .about {
    padding-block: var(--space-3xl);
  }

  .about-grid {
    display: grid;
    gap: var(--space-2xl);
    align-items: center;
  }

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

  .about-text h2 {
    margin-bottom: var(--space-lg);
  }

  .about-text p {
    margin-bottom: var(--space-md);
  }

  .about-highlights {
    margin-top: var(--space-xl);
    display: grid;
    gap: var(--space-sm);
  }

  .about-highlights li {
    position: relative;
    padding-left: 1.5rem;
    color: var(--color-text);
    font-weight: 500;
  }

  .about-highlights li::before {
    content: "✦";
    position: absolute;
    left: 0;
    font-size: 0.9rem;
    color: var(--color-primary);
  }

  .about-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
  }

  .about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 6 / 7;
  }

  /* Gallery */
  .gallery {
    padding-block: var(--space-3xl);
    background: var(--color-surface);
  }

  .section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
  }

  .section-header h2 {
    margin-bottom: var(--space-sm);
  }

  .gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-xl);
  }

  .gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  }

  .gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
  }

  .gallery-item figure {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
  }

  .gallery-item figcaption {
    padding: var(--space-md) var(--space-lg);
  }

  .gallery-item h3 {
    margin-bottom: var(--space-xs);
  }

  .gallery-item p {
    font-size: 0.9rem;
  }

  /* Contact */
  .contact {
    padding-block: var(--space-3xl);
    background: linear-gradient(160deg, #f8eef2, #f3e8f0);
  }

  .contact-inner {
    text-align: center;
    max-width: 560px;
  }

  .contact h2 {
    margin-bottom: var(--space-md);
  }

  .contact p {
    margin-bottom: var(--space-xl);
  }

  .contact-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
  }

  /* Footer */
  .site-footer {
    padding-block: var(--space-xl);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
  }

  .footer-inner {
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-muted);
  }

  .footer-note {
    margin-top: var(--space-xs);
  }
}

/* ========== COMPONENTS ========== */
@layer components {
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-full);
    transition: background-color var(--duration) var(--ease),
                color var(--duration) var(--ease),
                transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
  }

  .btn:active {
    transform: scale(0.98);
  }

  .btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(212, 106, 140, 0.35);
  }

  .btn-primary:hover,
  .btn-primary:focus-visible {
    background: var(--color-primary-dark);
  }

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

  .btn-secondary:hover,
  .btn-secondary:focus-visible {
    background: var(--color-primary);
    color: white;
  }

  /* Decorative sparkles */
  .sparkle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-primary);
    border-radius: 50%;
    opacity: 0.25;
    box-shadow: 0 0 12px var(--color-accent);
  }

  .sparkle-1 {
    top: 18%;
    right: 15%;
    width: 10px;
    height: 10px;
  }

  .sparkle-2 {
    bottom: 25%;
    right: 28%;
    width: 14px;
    height: 14px;
    background: var(--color-secondary);
  }

  .sparkle-3 {
    top: 45%;
    right: 8%;
    width: 8px;
    height: 8px;
  }

  /* Preço dos produtos */
  .price {
    display: inline-block;
    margin-top: var(--space-sm);
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-primary);
  }
}

/* ========== UTILITIES ========== */
@layer utilities {
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

/* ========== Responsive ========== */
@media (max-width: 767px) {
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-md);
    box-shadow: var(--shadow-md);
  }

  .main-nav.is-open {
    display: block;
  }

  .main-nav ul {
    flex-direction: column;
    gap: var(--space-md);
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    padding-block: var(--space-2xl);
  }

  .hero-decoration {
    opacity: 0.5;
  }
}

/* Preferências de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========== CARRINHO (estilo Mercado Livre) ========== */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--color-text);
  border-radius: var(--radius-full);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.cart-btn:hover {
  background: var(--color-border);
  color: var(--color-primary);
}

.cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  color: white;
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

/* Overlay */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s var(--ease);
}

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

/* Painel lateral */
.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 420px);
  height: 100%;
  background: var(--color-surface);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.35s var(--ease);
}

.cart-panel.is-open {
  transform: translateX(0);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.cart-header h2 {
  font-size: 1.25rem;
  font-family: var(--font-body);
  font-weight: 600;
}

.cart-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: background var(--duration) var(--ease);
}

.cart-close:hover {
  background: var(--color-border);
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-xl);
}

.cart-empty-hint {
  font-size: 0.9rem;
  margin-top: var(--space-sm);
}

/* Item do carrinho */
.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  margin-bottom: var(--space-md);
}

.cart-item-img {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #eee;
}

.cart-item-info h3 {
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 600;
  margin-bottom: 2px;
}

.cart-item-price {
  font-size: 0.9rem;
  color: var(--color-primary);
  font-weight: 600;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-sm);
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
  transition: background var(--duration) var(--ease);
}

.qty-btn:hover {
  background: var(--color-border);
}

.qty-value {
  width: 32px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
}

.cart-item-remove {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-decoration: underline;
  transition: color var(--duration) var(--ease);
}

.cart-item-remove:hover {
  color: #c0392b;
}

/* Footer do carrinho */
.cart-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.cart-summary {
  margin-bottom: var(--space-lg);
}

.cart-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.cart-total {
  font-size: 1.15rem;
  color: var(--color-text);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

.btn-checkout {
  width: 100%;
  margin-bottom: var(--space-sm);
  padding: 0.9rem;
}

.btn-continue {
  width: 100%;
}

/* Botão adicionar ao carrinho nos produtos */
.btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: var(--space-md);
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}

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

.btn-add:active {
  transform: scale(0.97);
}

.btn-add.added {
  background: #27ae60;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: #2c3e50;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
}

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

/* Ajuste produto card */
.gallery-item figcaption {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.gallery-item .price {
  margin-top: auto;
  padding-top: var(--space-sm);
}

/* ========== Categorias (catálogo) ========== */
.categories {
  padding-block: var(--space-3xl);
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-xl);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  color: inherit;
}

.category-card-emoji {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.category-card h3 {
  margin-bottom: var(--space-xs);
  font-size: 1.25rem;
}

.category-card p {
  font-size: 0.9rem;
}

.breadcrumb {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.breadcrumb a {
  color: var(--color-primary);
  font-weight: 500;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-2xl);
}

.category-tab {
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.category-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.category-tab.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.category-page .section-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
}

/* Paginação pedidos */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.pagination button {
  min-width: 36px;
  height: 36px;
  padding: 0 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid #f0e4e8;
  background: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  color: #3d2c3a;
  cursor: pointer;
}

.pagination button:hover:not(:disabled) {
  border-color: #d46a8c;
  color: #d46a8c;
}

.pagination button.is-active {
  background: #d46a8c;
  border-color: #d46a8c;
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info {
  width: 100%;
  text-align: center;
  font-size: 0.85rem;
  color: #6b5a66;
  margin-bottom: 0.35rem;
}
