/* ============================================================
   Sílica Shop — main.css
   Variáveis, reset, tipografia, utilitários globais
   ============================================================ */

/* ------------------------------------------------------------
   1. Custom Properties
   ------------------------------------------------------------ */
:root {
  /* Marca */
  --silica-red:        #7d0000;
  --silica-red-light:  #a00000;
  --silica-red-dark:   #5a0000;
  --silica-red-faint:  rgba(125, 0, 0, 0.08);
  --silica-red-glow:   rgba(125, 0, 0, 0.22);

  /* Fundos */
  --bg-base:           #0a0a0a;
  --bg-surface:        #111111;
  --bg-elevated:       #181818;
  --bg-overlay:        #1e1e1e;

  /* Texto */
  --text-primary:      #f2f2f2;
  --text-secondary:    #a8a8a8;
  --text-muted:        #5e5e5e;
  --text-inverse:      #0a0a0a;

  /* Bordas */
  --border-subtle:     rgba(255, 255, 255, 0.06);
  --border-default:    rgba(255, 255, 255, 0.10);
  --border-strong:     rgba(255, 255, 255, 0.18);

  /* Semânticas */
  --color-success:     #2e9e6b;
  --color-success-bg:  rgba(46, 158, 107, 0.10);
  --color-warning:     #c87d1a;
  --color-warning-bg:  rgba(200, 125, 26, 0.10);
  --color-danger:      #c0392b;
  --color-danger-bg:   rgba(192, 57, 43, 0.10);
  --color-info:        #2980b9;
  --color-info-bg:     rgba(41, 128, 185, 0.10);

  /* Raios */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   18px;
  --radius-pill: 999px;

  /* Sombras */
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.5);
  --shadow-md:   0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.7);
  --shadow-red:  0 0 24px rgba(125,0,0,0.35);

  /* Tipografia */
  --font-sans:  'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Sora', 'Inter', sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  /* Escala de tipo */
  --text-xs:   0.70rem;
  --text-sm:   0.813rem;
  --text-base: 0.9375rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  1.875rem;
  --text-3xl:  2.375rem;
  --text-4xl:  3rem;

  /* Espaçamento base */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Transições */
  --transition-fast:   120ms ease;
  --transition-base:   220ms ease;
  --transition-slow:   380ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --container-max:  1200px;
  --container-wide: 1440px;
  --navbar-height:  64px;
}


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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

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

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

p {
  color: var(--text-secondary);
  line-height: 1.7;
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
}

:focus-visible {
  outline: 2px solid var(--silica-red);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--silica-red);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--silica-red);
}


/* ------------------------------------------------------------
   3. Google Fonts import (Inter + Sora)
   ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Sora:wght@400;500;600;700;800&display=swap');


/* ------------------------------------------------------------
   4. Layout helpers
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

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

.section {
  padding-block: var(--space-20);
}

.section--sm {
  padding-block: var(--space-12);
}

.section--lg {
  padding-block: var(--space-24);
}

/* Grid utilitário */
.grid {
  display: grid;
  gap: var(--space-6);
}

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

.grid--auto {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Flex utilitário */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-2   { gap: var(--space-2); }
.flex-gap-3   { gap: var(--space-3); }
.flex-gap-4   { gap: var(--space-4); }
.flex-gap-6   { gap: var(--space-6); }

/* Empilhar verticalmente com gap */
.stack { display: flex; flex-direction: column; }
.stack--2  { gap: var(--space-2); }
.stack--3  { gap: var(--space-3); }
.stack--4  { gap: var(--space-4); }
.stack--6  { gap: var(--space-6); }
.stack--8  { gap: var(--space-8); }


/* ------------------------------------------------------------
   5. Tipografia utilitária
   ------------------------------------------------------------ */
.text-xs      { font-size: var(--text-xs); }
.text-sm      { font-size: var(--text-sm); }
.text-base    { font-size: var(--text-base); }
.text-md      { font-size: var(--text-md); }
.text-lg      { font-size: var(--text-lg); }
.text-xl      { font-size: var(--text-xl); }
.text-2xl     { font-size: var(--text-2xl); }
.text-3xl     { font-size: var(--text-3xl); }
.text-4xl     { font-size: var(--text-4xl); }

.weight-300   { font-weight: 300; }
.weight-400   { font-weight: 400; }
.weight-500   { font-weight: 500; }
.weight-600   { font-weight: 600; }
.weight-700   { font-weight: 700; }

.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-red       { color: var(--silica-red-light); }
.text-success   { color: var(--color-success); }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.leading-tight  { line-height: 1.15; }
.leading-snug   { line-height: 1.35; }
.leading-normal { line-height: 1.65; }
.leading-loose  { line-height: 1.85; }

.tracking-tight  { letter-spacing: -0.03em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide   { letter-spacing: 0.06em; }
.tracking-wider  { letter-spacing: 0.10em; }

.font-display { font-family: var(--font-display); }
.font-mono    { font-family: var(--font-mono); }

/* Títulos de secção */
.section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--silica-red-light);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: var(--text-md);
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.7;
}


/* ------------------------------------------------------------
   6. Divisores decorativos
   ------------------------------------------------------------ */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border-default) 30%,
    var(--border-default) 70%,
    transparent 100%
  );
}

.divider--accent {
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--silica-red) 30%,
    var(--silica-red) 70%,
    transparent 100%
  );
  opacity: 0.4;
}


/* ------------------------------------------------------------
   7. Superfícies / fundos decorativos
   ------------------------------------------------------------ */

/* Padrão de pontos subtil para fundos de secção */
.bg-dots {
  background-image: radial-gradient(
    circle,
    rgba(255,255,255,0.04) 1px,
    transparent 1px
  );
  background-size: 28px 28px;
}

/* Gradiente de entrada de página */
.bg-hero-gradient {
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(125,0,0,0.18) 0%, transparent 70%),
    var(--bg-base);
}

/* Superfície com borda sutil */
.surface {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.surface--elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Glassmorphism leve para elementos flutuantes */
.glass {
  background: rgba(24, 24, 24, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
}


/* ------------------------------------------------------------
   8. Visibilidade & acessibilidade
   ------------------------------------------------------------ */
.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;
}

.hidden  { display: none !important; }
.visible { visibility: visible; }

/* Animações de entrada */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

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

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

.animate-fade-in  { animation: fadeIn var(--transition-slow) both; }
.animate-scale-in { animation: scaleIn 280ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.animate-slide-up { animation: slideUp var(--transition-slow) both; }

/* Stagger de filhos */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 360ms; }
.stagger > *:nth-child(8) { animation-delay: 420ms; }

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


/* ------------------------------------------------------------
   9. Estados de carregamento (skeleton)
   ------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 0%,
    var(--bg-overlay) 50%,
    var(--bg-elevated) 100%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  border-radius: var(--radius-sm);
}

.skeleton-text--sm  { height: 12px; }
.skeleton-text--lg  { height: 20px; }
.skeleton-block     { height: 120px; }
.skeleton-card      { height: 280px; }


/* ------------------------------------------------------------
   10. Estado vazio
   ------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16);
  text-align: center;
  color: var(--text-muted);
}

.empty-state__icon {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.empty-state__title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state__desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
}


/* ------------------------------------------------------------
   11. Toast / Notificações
   ------------------------------------------------------------ */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  animation: slideInRight 300ms ease both;
  min-width: 240px;
  max-width: 380px;
}

.toast--success { border-left: 3px solid var(--color-success); }
.toast--error   { border-left: 3px solid var(--color-danger); }
.toast--info    { border-left: 3px solid var(--silica-red); }
.toast--warning { border-left: 3px solid var(--color-warning); }

.toast__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast.removing {
  animation: fadeIn 250ms ease reverse both;
}


/* ------------------------------------------------------------
   12. Overlays e modais (base)
   ------------------------------------------------------------ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeInFast 200ms ease both;
}

.overlay.hidden {
  display: none;
}

.sshop-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 260ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.sshop-modal--lg {
  max-width: 720px;
}

.sshop-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.sshop-modal__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.sshop-modal__body {
  padding: var(--space-6);
}

.sshop-modal__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}


/* ------------------------------------------------------------
   13. Responsive
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
  }

  .container {
    padding-inline: var(--space-4);
  }

  .section       { padding-block: var(--space-12); }
  .section--lg   { padding-block: var(--space-16); }

  .section-title { font-size: var(--text-2xl); }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .sshop-modal {
    max-width: 100%;
    margin: var(--space-4);
    border-radius: var(--radius-lg);
  }

  #toast-container {
    bottom: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  :root {
    --space-6: 20px;
    --space-8: 28px;
  }

  .section-title { font-size: var(--text-xl); }
}
