/* site.css — estilos compartilhados por index, contos, avancos, sobre e conto.
   Cada pagina carrega este arquivo e depois seu <style> proprio, que sobrescreve
   o que precisar. O admin.html nao usa este arquivo: tem CSS proprio e isolado. */

/* ====================================================================
   CATEGORY COLOUR VARIABLES
   ==================================================================== */
:root {
  --c-NM-bg: #122012; --c-NM-bd: #3a7a3a;
  --c-NG-bg: #121027; --c-NG-bd: #4830a0;
  --c-AM-bg: #241212; --c-AM-bd: #8a3030;
  --c-AE-bg: #221a0c; --c-AE-bd: #8a5818;
  --c-TM-bg: #101724; --c-TM-bd: #2a5090;
  --c-PT-bg: #0c1d22; --c-PT-bd: #1a6888;
  --c-MM-bg: #0d1a18; --c-MM-bd: #246858;
  --c-LA-bg: #200c20; --c-LA-bd: #7a2a7a;
  --c-AC-bg: #0f1020; --c-AC-bd: #2830a0;
}

.c-NM  { background: var(--c-NM-bg); border-color: var(--c-NM-bd); }
.c-NG  { background: var(--c-NG-bg); border-color: var(--c-NG-bd); }
.c-AM  { background: var(--c-AM-bg); border-color: var(--c-AM-bd); }
.c-AE  { background: var(--c-AE-bg); border-color: var(--c-AE-bd); }
.c-TM  { background: var(--c-TM-bg); border-color: var(--c-TM-bd); }
.c-PT  { background: var(--c-PT-bg); border-color: var(--c-PT-bd); }
.c-MM  { background: var(--c-MM-bg); border-color: var(--c-MM-bd); }
.c-LA  { background: var(--c-LA-bg); border-color: var(--c-LA-bd); }
.c-AC  { background: var(--c-AC-bg); border-color: var(--c-AC-bd); }

/* ====================================================================
   BASE
   ==================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
html, body { margin: 0; padding: 0; }

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

body {
  background: #171616;
  color: #e8e6e1;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 300;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 2.25rem; line-height: 1.15; }
h2 { font-size: 1.5rem; line-height: 1.3; }
@media (min-width: 720px) { h1 { font-size: 3rem; } }
#header-title { font-size: 2rem; }
@media (min-width: 720px) {
  #header-title { font-size: 2.2rem; }
  /* O titulo do header e menor que um h1 comum: fica em 2 linhas no topo e
     encolhe para 1 linha quando a barra gruda. */
  .page-header h1,
  .page-header .site-title { font-size: 2.4rem; max-width: 50%; }
}

p { margin: 0 0 1.2em; color: #d4d2cd; }

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #3a3a37;
  padding-bottom: 1px;
  transition: border-color 120ms, color 120ms;
}
a:hover { border-bottom-color: #e8e6e1; color: #c9a84c; }

/* ====================================================================
   HEADER
   ==================================================================== */
/* Nas subpaginas o titulo do site nao e o h1 — o h1 e o titulo da propria
   pagina, dentro do .text-section. Mesmo desenho, semantica correta. */
.site-title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.15;
  color: #e8e6e1;
}
@media (min-width: 720px) { .site-title { font-size: 3rem; } }

/* O header tem tres niveis: .page-header segura a altura em fluxo (espacador),
   .page-header-bar e a barra em si — no desktop ela vira fixed e encolhe no
   scroll — e .page-header-inner e o conteudo centralizado. Sem JS, ou no
   mobile, os tres se comportam como um bloco normal no topo da pagina. */
.page-header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 40px;
}
@media (min-width: 720px) { .page-header-inner { padding: 80px 40px 40px; } }

.back {
  display: inline-block;
  margin-bottom: 32px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #7a7a76;
  border: none;
}
.back::before { content: "← "; }
.back:hover { color: #c9a84c; border: none; }

/* O respiro embaixo do header e padding do .page-header-inner, nao margin
   daqui: margin colapsaria para fora do header e, quando a barra vira fixed,
   a altura medida ficaria menor que a desenhada — a barra cobriria o topo do
   conteudo. */
.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 8px 0 0;
}

.site-tagline {
  font-style: italic;
  color: #7a7a76;
  font-size: 1rem;
  margin: 0;
}

/* --- Barra fixa que encolhe no scroll (desktop) --------------------------- */
/* O JS mede a altura natural do header, guarda em --header-h e so entao poe
   .hdr-ready no <html>. Assim a barra pode virar fixed sem que o conteudo
   suba: .page-header continua ocupando a altura original em fluxo. */
@media (min-width: 720px) {
  html.hdr-ready .page-header { height: var(--header-h); }

  html.hdr-ready .page-header-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50; /* abaixo do backdrop (90) do painel de elemento do index */
    background: #171616;
    border-bottom: 1px solid transparent;
    transition: border-color 340ms ease, box-shadow 340ms ease;
  }

  html.hdr-ready .page-header-inner,
  html.hdr-ready .page-header h1,
  html.hdr-ready .page-header .site-title,
  html.hdr-ready .page-header .header-row,
  html.hdr-ready .page-header .site-tagline {
    transition: padding   340ms cubic-bezier(0.22, 0.61, 0.36, 1),
                font-size 340ms cubic-bezier(0.22, 0.61, 0.36, 1),
                margin    340ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  /* Compacto: mesmo container de 860px — so o vertical colapsa. O titulo
     encolhe o bastante para caber em uma linha so. */
  html.hdr-ready .page-header.is-stuck .page-header-bar {
    border-bottom-color: #1f1f1d;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
  html.hdr-ready .page-header.is-stuck .page-header-inner { padding: 14px 40px; }
  html.hdr-ready .page-header.is-stuck h1,
  html.hdr-ready .page-header.is-stuck .site-title {
    font-size: 1.35rem;
    max-width: none;
    white-space: nowrap;
  }
  html.hdr-ready .page-header.is-stuck .header-row { margin: 2px 0 0; }
  html.hdr-ready .page-header.is-stuck .site-tagline { font-size: 0.85rem; }

  /* Enquanto o JS remede (resize, fontes carregando), nada anima. */
  html.hdr-measuring .page-header,
  html.hdr-measuring .page-header * { transition: none !important; }
}

/* ====================================================================
   NAV
   ==================================================================== */
.site-nav { display: flex; align-items: baseline; }

.site-nav a {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a7a76;
  border: none;
  padding: 4px 0;
  transition: color 120ms;
}
.site-nav a + a { position: relative; margin-left: 1.7em; }
.site-nav a + a::before {
  content: '·';
  position: absolute;
  left: -1.05em;
  color: #3a3a37;
  pointer-events: none;
}
.site-nav a:hover { color: #e8e6e1; border: none; }
.site-nav a.is-active { color: #c9a84c; }

/* ====================================================================
   TEXT SECTIONS
   ==================================================================== */
.text-section h1 { font-size: 1.5rem; line-height: 1.3; }

.text-section {
  max-width: 660px;
  margin: 0 auto;
  padding: 52px 24px 96px;
}

.section-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: #7a7a76;
  margin-bottom: 12px;
}

.section-sub {
  font-style: italic; color: #7a7a76;
  font-size: 1rem; margin: 8px 0 40px;
}

/* Avanços posts */
.posts-list { display: flex; flex-direction: column; }

.post-card {
  padding: 28px 0;
  border-bottom: 1px solid #1f1f1d;
}
.post-card:first-child { border-top: 1px solid #1f1f1d; }

.post-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: #5a5a56;
  margin-bottom: 6px;
}
.post-title {
  font-size: 1.3rem; font-weight: 400;
  color: #e8e6e1; margin: 0 0 10px;
}
.post-body { color: #a8a6a1; font-size: 0.95rem; line-height: 1.75; margin: 0; }
.post-body + .post-body { margin-top: 0.8em; }

.empty-state {
  color: #4a4a46; font-style: italic; font-size: 0.95rem;
}

/* Contos */
.contos-list { list-style: none; padding: 0; margin: 0; }
.conto-card { padding: 28px 0; border-bottom: 1px solid #1f1f1d; position: relative; display: flex; gap: 20px; align-items: flex-start; }
.conto-card:first-child { border-top: 1px solid #1f1f1d; }
.conto-read::before { content: ''; position: absolute; inset: 0; }

.conto-stamp {
  flex-shrink: 0; width: 52px; height: 52px;
  border-radius: 3px; border-width: 1px; border-style: solid;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; padding: 4px;
}
.conto-stamp-num { font-family: "JetBrains Mono", monospace; font-size: 0.52rem; color: #7a7a76; line-height: 1; position: absolute; top: 3px; left: 3px; }
.conto-stamp-sym { font-family: "Newsreader", serif; font-size: 1.55rem; font-weight: 400; color: #e8e6e1; line-height: 1; }
.conto-body { flex: 1; min-width: 0; padding-top: 2px; }
.conto-title {
  font-size: 1.2rem; font-weight: 400;
  font-style: italic; color: #e8e6e1; margin: 0 0 8px;
}
.conto-desc { color: #a8a6a1; font-size: 0.95rem; line-height: 1.65; margin: 0 0 12px; }

.conto-read {
  display: inline-block;
  font-family: "JetBrains Mono", monospace; font-size: 0.68rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #c9a84c; border-bottom: 1px solid #4a3a18; padding-bottom: 1px;
}
.conto-read:hover { color: #dab85c; border-bottom-color: #dab85c; }

.conto-card-status {
  display: inline-block;
  font-family: "JetBrains Mono", monospace; font-size: 0.6rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #4a8a5a; margin-left: 8px; opacity: 0;
  transition: opacity 160ms;
}
.conto-card.is-read .conto-card-status { opacity: 1; }
.conto-card.is-read .conto-stamp { opacity: 0.55; }

/* Sobre */
.about-body { color: #a8a6a1; font-size: 1rem; line-height: 1.8; }

/* ====================================================================
   FOOTER
   ==================================================================== */
.site-footer {
  border-top: 1px solid #1f1f1d;
  padding: 24px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem; letter-spacing: 0.04em;
  color: #4a4a46;
  display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.site-footer a { color: #4a4a46; border: none; }
.site-footer a:hover { color: #c9a84c; }
  
