/* BackStage — base.css : reset e componentes compartilhados público/admin */

/* ============================================================
   Base / reset
   ============================================================ */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--c-text);
  background: var(--c-bg);
  font-family: var(--ff-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--c-accent);
  color: var(--c-bg);
}

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

a:hover {
  color: var(--brand-1);
}

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

h1, h2, h3, h4 {
  font-family: var(--ff-display);
  letter-spacing: -0.03em; /* densidade editorial */
  margin: 0;
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* — Focus ring (acessibilidade) — */
:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 3px;
  border-radius: 4px;
}

button:focus-visible,
.button:focus-visible,
a.button:focus-visible {
  outline-offset: 4px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

/* — Skip link — */
.skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  z-index: var(--z-modal);
  padding: 8px 14px;
  background: var(--c-surface);
  color: var(--c-text);
  border-radius: var(--r-sm);
  font-weight: 700;
  transition: top var(--m-fast);
}

.skip-link:focus {
  top: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--ff-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-logo {
  display: block;
  width: auto;
  height: 34px;
}

.brand-logo-dark {
  display: none;
}

.admin-brand-label {
  padding: 3px 10px;
  background: var(--brand-tint);
  color: var(--brand-1);
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}


.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  color: var(--c-text);
  cursor: pointer;
  position: relative;
  z-index: calc(var(--z-nav) + 1);
}

.nav-toggle .material-symbols-outlined {
  font-size: 1.5rem;
}

.nav-toggle::after {
  /* Fallback visual caso Material Symbols ainda não tenha carregado */
  content: "";
  position: absolute;
  inset: 12px;
  background:
    linear-gradient(currentColor, currentColor) 0 25% / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) 0 75% / 100% 2px no-repeat;
  opacity: 0;
}

.nav-toggle:not(:has(.material-symbols-outlined))::after { opacity: 1; }
@supports not selector(:has(*)) {
  .nav-toggle .material-symbols-outlined:empty + ::after { opacity: 1; }
}

/* — Theme toggle (segmented) — */
.theme-toggle,
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-full);
}

.theme-toggle button,
.lang-toggle button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--r-full);
  color: var(--c-text-muted);
  cursor: pointer;
  transition: background var(--m-fast), color var(--m-fast);
}

.theme-toggle button .material-symbols-outlined { font-size: 1.05rem; }

.theme-toggle button:hover,
.lang-toggle button:hover {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

.theme-toggle button[aria-pressed="true"],
.lang-toggle button[aria-pressed="true"] {
  background: var(--c-accent-grad);
  color: var(--c-bg);
  box-shadow: var(--sh-1);
}

.theme-toggle button[aria-pressed="true"] .material-symbols-outlined {
  color: var(--c-bg);
}

.lang-toggle button {
  width: 36px;
  overflow: hidden;
}

.lang-toggle button svg {
  display: block;
  width: 22px;
  height: auto;
  border-radius: 3px;
  opacity: 0.55;
  transition: opacity var(--m-fast), transform var(--m-fast);
}

.lang-toggle button:hover svg,
.lang-toggle button[aria-pressed="true"] svg {
  opacity: 1;
}

.lang-toggle button[aria-pressed="true"] svg {
  transform: scale(1.05);
  box-shadow: 0 0 0 1px rgba(255,255,255,.4);
}

/* ============================================================
   Buttons
   ============================================================ */

.button,
button.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 46px;
  padding: 0 var(--s-6);
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bg);
  border-radius: var(--r-sm);
  font-family: var(--ff-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform var(--m-base), box-shadow var(--m-base), background var(--m-fast), border-color var(--m-fast);
}

.button:hover {
  transform: translateY(-1px);
  background: var(--btn-bg-hover);
  border-color: var(--btn-bg-hover);
  color: var(--btn-fg);
  box-shadow: var(--sh-3);
}

.button:not(.secondary) {
  position: relative;
  overflow: hidden;
}

.button:not(.secondary)::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  pointer-events: none;
}

.button:not(.secondary):hover::after {
  animation: button-shimmer 1s ease-in-out;
}

@keyframes button-shimmer {
  0% {
    left: -150%;
  }
  100% {
    left: 150%;
  }
}

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

.button.secondary {
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-1);
}

.button.secondary:hover {
  border-color: var(--c-text-soft);
  background: var(--c-bg-soft);
  box-shadow: var(--sh-2);
  color: var(--c-text);
}

.button.small {
  min-height: 38px;
  padding: 0 var(--s-4);
  font-size: 0.9rem;
}

.button .material-symbols-outlined {
  font-size: 1.15rem;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--brand-1);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--m-fast);
}

.link-button:hover {
  color: var(--c-text);
}

.link-button.danger {
  color: var(--c-error);
}

/* ============================================================
   Sections / containers
   ============================================================ */

.section,
.admin-page {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s-20) var(--s-6);
}

/* Faixa "muted" sem bordas duras: a superfície nasce e morre em fade,
   misturando a seção com o fundo da página. */
.section.muted {
  --muted-fade: 96px;
  max-width: none;
  padding-top: calc(var(--s-20) + var(--s-8));
  padding-bottom: calc(var(--s-20) + var(--s-8));
  padding-left: max(var(--s-6), calc((100vw - var(--container)) / 2));
  padding-right: max(var(--s-6), calc((100vw - var(--container)) / 2));
  background: linear-gradient(
    180deg,
    transparent 0,
    var(--c-surface) var(--muted-fade),
    var(--c-surface) calc(100% - var(--muted-fade)),
    transparent 100%
  );
}

.section.muted > * { max-width: var(--container); margin-left: auto; margin-right: auto; }

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

.page-top {
  padding-top: calc(var(--nav-h) + var(--s-12));
}


.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-1) 12%, transparent);
  color: var(--brand-1);
  font-size: 0.78rem;
  font-weight: 600;
}

.chip-muted {
  background: color-mix(in srgb, var(--c-text-muted) 12%, transparent);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}


/* ============================================================
   Cards / grids
   ============================================================ */

.grid {
  display: grid;
  gap: var(--s-5);
}

/* ============================================================
   Forms
   ============================================================ */

.form {
  display: grid;
  gap: var(--s-4);
}

label {
  display: grid;
  gap: var(--s-2);
  color: var(--c-text-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font: inherit;
  transition: border-color var(--m-fast), box-shadow var(--m-fast);
}

textarea {
  resize: vertical;
}

.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
}

.check input {
  width: auto;
  margin: 0;
}

.error {
  color: var(--c-error);
  font-weight: 700;
}

.error-list {
  margin: var(--s-4) 0;
  padding-left: var(--s-5);
  color: var(--c-error);
}

/* — Banners — */
.banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin-bottom: var(--s-5);
  font-weight: 600;
}

.banner.success {
  background: rgba(5, 150, 105, .1);
  color: var(--c-success);
  border: 1px solid rgba(5, 150, 105, .25);
}

.banner.info {
  background: var(--brand-tint);
  color: var(--brand-1);
  border: 1px solid var(--brand-ring);
}

/* ============================================================
   Modal de confirmação
   ============================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--c-overlay);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  opacity: 0;
  transition: opacity var(--m-base);
}

.modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--s-8);
  max-width: 460px;
  width: 100%;
  box-shadow: var(--sh-4);
  border: 1px solid var(--c-border);
  transform: scale(0.95);
  transition: transform var(--m-base);
}

.modal-backdrop.open .modal {
  transform: scale(1);
}

.modal h2 {
  font-size: 1.3rem;
  margin-bottom: var(--s-3);
}

.modal p {
  color: var(--c-text-muted);
  margin-bottom: var(--s-6);
}

.modal-actions {
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
}

/* ============================================================
   Theme — light/dark visibility helpers
   ============================================================ */

[data-theme="dark"] .brand-logo-light,
[data-theme="dark"] .light-only { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }

@media (prefers-color-scheme: dark) {
  [data-theme="system"] .brand-logo-light,
  [data-theme="system"] .light-only { display: none; }
  [data-theme="system"] .brand-logo-dark { display: block; }
}

/* ============================================================
   Spinner / loading
   ============================================================ */

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

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

button.button[data-loading="true"] {
  pointer-events: none;
  opacity: .85;
}

button.button[data-loading="true"] .button-content { display: none; }
button.button[data-loading="true"] .button-loading { display: inline-flex !important; gap: 8px; align-items: center; }
.button-loading { display: none; }

/* ============================================================
   Skeleton loaders
   ============================================================ */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c-text) 6%, transparent), transparent);
  animation: shimmer 1.6s linear infinite;
}

.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-line.lg { height: 18px; }
.skeleton-line.sm { height: 8px; width: 60%; }

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   Error pages (404 / 500)
   ============================================================ */

.error-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--nav-h));
  padding: var(--s-12) var(--s-6);
  text-align: center;
}

.error-page-inner { max-width: 520px; }

.error-code {
  font-family: var(--ff-display);
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 800;
  line-height: 1;
  margin-bottom: var(--s-4);
  background: var(--brand-grad-text);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.error-page h1 {
  font-size: 1.6rem;
  margin-bottom: var(--s-3);
}

.error-page p {
  color: var(--c-text-muted);
  margin-bottom: var(--s-6);
  font-size: 1.05rem;
}

.error-waveform {
  width: 200px;
  height: 40px;
  margin: 0 auto var(--s-6);
  background: var(--brand-grad);
  -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40'%3E%3Cg fill='black'%3E%3Crect x='2' y='18' width='3' height='4' rx='1.5'/%3E%3Crect x='10' y='14' width='3' height='12' rx='1.5'/%3E%3Crect x='18' y='8' width='3' height='24' rx='1.5'/%3E%3Crect x='26' y='2' width='3' height='36' rx='1.5'/%3E%3Crect x='34' y='10' width='3' height='20' rx='1.5'/%3E%3Crect x='42' y='16' width='3' height='8' rx='1.5'/%3E%3Crect x='50' y='6' width='3' height='28' rx='1.5'/%3E%3Crect x='58' y='12' width='3' height='16' rx='1.5'/%3E%3Crect x='66' y='4' width='3' height='32' rx='1.5'/%3E%3Crect x='74' y='14' width='3' height='12' rx='1.5'/%3E%3Crect x='82' y='8' width='3' height='24' rx='1.5'/%3E%3Crect x='90' y='2' width='3' height='36' rx='1.5'/%3E%3Crect x='98' y='10' width='3' height='20' rx='1.5'/%3E%3Crect x='106' y='16' width='3' height='8' rx='1.5'/%3E%3Crect x='114' y='6' width='3' height='28' rx='1.5'/%3E%3Crect x='122' y='12' width='3' height='16' rx='1.5'/%3E%3Crect x='130' y='4' width='3' height='32' rx='1.5'/%3E%3Crect x='138' y='14' width='3' height='12' rx='1.5'/%3E%3Crect x='146' y='8' width='3' height='24' rx='1.5'/%3E%3Crect x='154' y='2' width='3' height='36' rx='1.5'/%3E%3Crect x='162' y='10' width='3' height='20' rx='1.5'/%3E%3Crect x='170' y='16' width='3' height='8' rx='1.5'/%3E%3Crect x='178' y='6' width='3' height='28' rx='1.5'/%3E%3Crect x='186' y='12' width='3' height='16' rx='1.5'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40'%3E%3Cg fill='black'%3E%3Crect x='2' y='18' width='3' height='4' rx='1.5'/%3E%3Crect x='10' y='14' width='3' height='12' rx='1.5'/%3E%3Crect x='18' y='8' width='3' height='24' rx='1.5'/%3E%3Crect x='26' y='2' width='3' height='36' rx='1.5'/%3E%3Crect x='34' y='10' width='3' height='20' rx='1.5'/%3E%3Crect x='42' y='16' width='3' height='8' rx='1.5'/%3E%3Crect x='50' y='6' width='3' height='28' rx='1.5'/%3E%3Crect x='58' y='12' width='3' height='16' rx='1.5'/%3E%3Crect x='66' y='4' width='3' height='32' rx='1.5'/%3E%3Crect x='74' y='14' width='3' height='12' rx='1.5'/%3E%3Crect x='82' y='8' width='3' height='24' rx='1.5'/%3E%3Crect x='90' y='2' width='3' height='36' rx='1.5'/%3E%3Crect x='98' y='10' width='3' height='20' rx='1.5'/%3E%3Crect x='106' y='16' width='3' height='8' rx='1.5'/%3E%3Crect x='114' y='6' width='3' height='28' rx='1.5'/%3E%3Crect x='122' y='12' width='3' height='16' rx='1.5'/%3E%3Crect x='130' y='4' width='3' height='32' rx='1.5'/%3E%3Crect x='138' y='14' width='3' height='12' rx='1.5'/%3E%3Crect x='146' y='8' width='3' height='24' rx='1.5'/%3E%3Crect x='154' y='2' width='3' height='36' rx='1.5'/%3E%3Crect x='162' y='10' width='3' height='20' rx='1.5'/%3E%3Crect x='170' y='16' width='3' height='8' rx='1.5'/%3E%3Crect x='178' y='6' width='3' height='28' rx='1.5'/%3E%3Crect x='186' y='12' width='3' height='16' rx='1.5'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
}

/* — Rich content (renderiza HTML do Trix) — */

.rich-content > * + * { margin-top: var(--s-3); }
.rich-content h1, .rich-content h2, .rich-content h3 {
  font-family: var(--ff-display);
  margin-top: var(--s-5);
  margin-bottom: var(--s-2);
}
.rich-content h1 { font-size: 1.6rem; }
.rich-content h2 { font-size: 1.35rem; }
.rich-content h3 { font-size: 1.15rem; }
.rich-content ul, .rich-content ol {
  padding-left: var(--s-6);
}
.rich-content li + li { margin-top: 4px; }
.rich-content blockquote {
  border-left: 3px solid var(--brand-1);
  padding: var(--s-2) var(--s-4);
  background: var(--brand-tint);
  border-radius: var(--r-sm);
  font-style: italic;
}
.rich-content a { color: var(--brand-1); text-decoration: underline; }
.rich-content pre, .rich-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--c-surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}
.rich-content pre {
  padding: var(--s-3) var(--s-4);
  overflow-x: auto;
}
.rich-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  margin: var(--s-5) auto;
}
.rich-content figure {
  margin: var(--s-5) 0;
}
.rich-content figure img {
  margin: 0 auto;
}
.rich-content figcaption {
  margin-top: var(--s-2);
  text-align: center;
  font-size: 0.88rem;
  color: var(--c-text-muted);
  font-style: italic;
}

/* Trix renderiza attachments como <figure class="attachment attachment--preview"> */
.rich-content .attachment {
  display: block;
  margin: var(--s-5) 0;
}
.rich-content .attachment img { margin: 0 auto; }


/* ============================================================
   Breadcrumb
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
  font-size: 0.92rem;
  color: var(--c-text-muted);
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--c-text-soft);
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: background var(--m-fast), color var(--m-fast);
}

.breadcrumb a:hover {
  background: var(--brand-tint);
  color: var(--brand-1);
}

.breadcrumb .material-symbols-outlined {
  font-size: 1.05rem;
}

.breadcrumb .sep {
  opacity: 0.5;
}

/* ============================================================
   Reveal on scroll
   ============================================================ */

[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 900ms cubic-bezier(.22, 1, .36, 1), transform 900ms cubic-bezier(.22, 1, .36, 1);
}

[data-reveal][data-reveal-from="left"] { transform: translateX(-72px); }
[data-reveal][data-reveal-from="right"] { transform: translateX(72px); }
[data-reveal][data-reveal-from="up"] { transform: translateY(56px); }
[data-reveal][data-reveal-from="down"] { transform: translateY(-56px); }

[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* Stagger automático para listas (tbody, .grid, .cards-stack) */
.table-wrap tbody [data-reveal],
.cards [data-reveal],
.cards-stack [data-reveal],
.bento-grid [data-reveal],
.grid [data-reveal] {
  transition-delay: calc(var(--reveal-index, 0) * 110ms);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Custom Scrollbar Styles (Aesthetics)
   ============================================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--c-bg-soft);
}

::-webkit-scrollbar-thumb {
  background: var(--brand-3);
  border: 2px solid var(--c-bg-soft);
  border-radius: var(--r-full);
  transition: background var(--m-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--c-accent);
}

/* Firefox Support */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--brand-3) var(--c-bg-soft);
}

