/* ============================================================================
   Cartas Maçônicas — Design System "Premium Gold" (site público, modo escuro).
   Par claro/escuro com o admin: mesmas fontes (EB Garamond + Lato) e mesmo
   dourado de marca. Tokens centralizados.
   ============================================================================ */

:root {
  /* superfícies (quase-preto premium, levemente quente) */
  --ink:        #0c0a09;
  --surface:    #1c1917;
  --surface-2:  #262220;
  --surface-3:  #2f2a27;
  --line:       #3a3531;
  --line-soft:  #2c2724;

  /* texto */
  --text:    #f5f1e8;
  --text-2:  #c4bcae;
  --text-3:  #8a8276;

  /* dourado de marca — tom luminoso (legível sobre o quase-preto) */
  --gold:       #c9a24a;
  --gold-2:     #e0bf6a;
  --gold-deep:  #a16207;
  --gold-soft:  rgba(201, 162, 74, .14);

  --danger:     #ef5350;
  --danger-bg:  #2a1715;

  /* tipografia */
  --font-head: "EB Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* raio / sombra / espaço */
  --radius:    18px;
  --radius-sm: 11px;
  /* sombra com tom quente (não preto puro) + leve halo dourado */
  --shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 1px 2px rgba(8,6,5,.5),
    0 28px 64px -18px rgba(8,6,5,.8),
    0 0 0 1px rgba(201,162,74,.07);
  --ring:      0 0 0 4px rgba(201,162,74,.22);
  --ease:      cubic-bezier(0.32, 0.72, 0, 1);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 560px at 50% -12%, #241e1a 0%, var(--ink) 58%) fixed;
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* grão de papel sutil — overlay fixo, sem capturar cliques */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }

/* ---- tipografia de marca -------------------------------------------------- */
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: .2px; }

.site-title {
  font-family: var(--font-head);
  color: var(--gold-2);
  font-weight: 600;
  letter-spacing: .5px;
}

/* emblema (esquadro e compasso) */
.emblem { color: var(--gold-2); }

/* assinatura: régua ornamental de papel timbrado (linha + nó central) */
.rule-ornament {
  height: 9px; width: 184px; margin: 16px auto 0;
  background:
    radial-gradient(circle at 50% 50%, var(--gold-2) 0 2.4px, transparent 3px),
    linear-gradient(90deg, transparent, var(--gold-deep) 26%, var(--gold-deep) 74%, transparent);
  background-size: 100% 100%, 100% 1.5px;
  background-position: center center;
  background-repeat: no-repeat;
}

/* ---- cabeçalho do site ---------------------------------------------------- */
.site-header { text-align: center; padding: 36px 16px 8px; }
.site-header .emblem { width: 180px; height: auto; }
.site-header h1 { margin: 10px 0 4px; font-size: 30px; color: var(--gold-2); }
.site-header p { margin: 0; color: var(--text-3); font-size: 14px; }

/* ---- barra superior (usuário / logout) ------------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; font-size: 14px; color: var(--text-2);
  background: rgba(28,25,23,.7);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .who { margin-right: auto; display: flex; align-items: center; gap: 10px; }
.topbar .badge {
  background: var(--gold-soft); border: 1px solid rgba(201,162,74,.4);
  color: var(--gold-2); border-radius: 999px; padding: 3px 11px;
  font-size: 11px; font-weight: 700; letter-spacing: .4px;
}
.topbar a { font-weight: 600; }
.topbar form { display: inline; margin: 0; }
.topbar .linklike {
  background: none; border: none; color: var(--gold); cursor: pointer;
  font: inherit; font-weight: 600; padding: 0;
}
.topbar .linklike:hover { color: var(--gold-2); }

/* ---- cartões (double-bezel: bandeja externa + núcleo interno) ------------- */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface)); /* bandeja */
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* núcleo interno desenhado atrás do conteúdo (sem precisar de wrapper no HTML) */
.card::before {
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  border-radius: calc(var(--radius) - 6px);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.card > * { position: relative; z-index: 1; }

/* ---- formulários ---------------------------------------------------------- */
label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text-2);
}
input, textarea, select {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  color: var(--text);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--gold); box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 160px; line-height: 1.6; }
select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c4bcae' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 38px;
}
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }

/* ---- botões --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 24px; border: none; border-radius: 999px;
  font-size: 15px; font-weight: 700; font-family: var(--font-body);
  cursor: pointer; letter-spacing: .2px;
  transition: filter .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1410;
  box-shadow: 0 6px 20px rgba(201,162,74,.26), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-gold:hover { filter: brightness(1.05); box-shadow: 0 10px 28px rgba(201,162,74,.34), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-ghost {
  background: var(--surface-3); color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--line); }
.btn-block { width: 100%; }

/* ---- mensagens / erros ---------------------------------------------------- */
.alert {
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px;
  border: 1px solid transparent;
}
.alert-error { background: var(--danger-bg); border-color: #5a2a26; color: #f3c9c5; }

/* ---- acessibilidade: foco visível e movimento reduzido -------------------- */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
