/* Monocerus — My personal site theme
 
/* 1. Tokens
   ========================================================================== */

:root {
  /* Fundo principal (sépia, igual ao extra.css original) */
  --color-bg: #f4ecd8;
  --color-bg-raised: #f8f1e3;
  --color-bg-dim: #e8dcc2;
  --color-text-header: #ffffff;

  /* Texto sobre fundo claro */
  --color-text: #2a2a2a;
  --color-heading: #1c1c1e;
  --color-muted: #6b6255;

  /* Links — cor fria pra contraste com o sépia quente */
  --color-accent: #3e5c76;
  --color-accent-light: #6c8ca3;
  --color-accent-hover: #2a4a63;

  --color-border: #c2b8a3;

  /* Selo/carimbo (ex: "feito sem IA") */
  --color-seal-bg: #e8dcc2;
  --color-seal-border: #1f2937;
  --color-seal-text: #2a2a2a;
  --color-seal-accent: #0f766e;

  --max-width: 1200px;
  --font-body: Roboto, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Largura fixa da coluna lateral (TOC/nav) em telas largas — usada em
     §6 e desligada em §14 (abaixo de --breakpoint-tablet ela empilha em
     vez de ficar ao lado do conteúdo). */
  --sidebar-width: 230px;

  /* Únicos breakpoints do arquivo — todo `@media` referencia um destes
     dois, em vez de valores soltos espalhados pelo arquivo. */
  --breakpoint-tablet: 48rem;
  /* 768px — mesmo valor já usado pelas colunas ODT */
  --breakpoint-phone: 30rem;
  /* 480px */
}


/* 2. Font face
   ========================================================================== */

@font-face {
  font-display: swap;
  /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: url('/fonts/roboto-v51-latin_latin-ext_math-regular.29a04bbc7e.woff2') format("woff2");
}


/* 3. Reset & base elements
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  text-align: justify;
  /* volta a left-align abaixo de --breakpoint-tablet — ver §14 */
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-body);
  color: var(--color-heading);
  line-height: 1.25;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-light);
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration-color: var(--color-accent-hover);
}

.site-menu a,
.sidebar-toc a,
.sidebar-nav a,
.breadcrumbs a,
.post-list a,
.term-list a,
.post-nav a,
.social-link,
.tag,
.category {
  text-decoration: none;
}

.site-menu a:hover,
.sidebar-toc a:hover,
.sidebar-nav a:hover {
  text-decoration: none;
}


/* 4. Layout shell
   ========================================================================== */

.site-header {
  background: var(--color-heading);
  color: var(--color-text-header);
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.site-content {
  flex: 1;
  min-width: 0;
  /* deixa o conteúdo (tabelas largas, blocos <pre>) encolher
                   dentro do flex item em vez de estourar a largura */
}

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-shrink: 0;
}

.site-footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  /* empurra o footer pro fim quando o conteúdo da
                        página é mais baixo que a tela (ver body flex) */
}

.footer-elements {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}


/* 5. Header components
   ========================================================================== */

.title-box {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.title-box:hover {
  color: var(--color-text-header);
}

.site-title {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-left: 1rem;
}

.custom-header-monocerus {
  font-size: 3rem;
  line-height: 1.2;
  padding-bottom: 0.5rem;
  padding-top: 0.5rem;
}

.site-title,
.site-title:visited,
.site-title:hover,
.site-title:active,
.site-title:focus {
  color: inherit;
  text-decoration: none;
}

.site-title-block {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.site-tagline {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-light);
}

.site-wordmark {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--color-bg-raised);
  line-height: 1.15;
}

.site-menu ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin: 0;
  padding: 0;
}

.site-menu li+li {
  margin-left: 1.1rem;
}

.site-menu a {
  color: var(--color-text-header);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.site-menu a:hover {
  color: var(--color-accent-light);
}

.menu-toggle {
  display: none;
}

/* 6. Sidebar — TOC & navigation
   ========================================================================== */

.sidebar-toc,
.sidebar-nav {
  width: var(--sidebar-width);
  flex-shrink: 0;
  font-size: 0.85rem;
}

.sidebar-toc {
  position: sticky;
  top: 1rem;
}

.sidebar-toc h2,
.sidebar-nav h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 0.4rem;
}

.sidebar-toc ul,
.sidebar-nav ul {
  list-style: none;
  padding-left: 0.9rem;
  margin: 0;
}

.sidebar-toc>ul,
.sidebar-nav>ul {
  padding-left: 0;
}

.sidebar-toc a,
.sidebar-nav a,
.sidebar-nav .nav-section {
  display: block;
  padding: 0.2rem 0;
  color: var(--color-text);
}

.sidebar-nav .nav-section {
  color: var(--color-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.sidebar-toc a:hover,
.sidebar-nav a:hover {
  color: var(--color-accent);
}

.sidebar-nav li.active>a {
  color: var(--color-accent);
  font-weight: 700;
}

.sidebar-nav details {
  margin: 0;
}

.sidebar-nav summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.2rem 0;
  list-style: none;
}

.sidebar-nav summary::-webkit-details-marker {
  display: none;
}

.sidebar-nav summary::before {
  content: "\25b8";
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.7em;
  color: var(--color-muted);
  transition: transform 0.15s ease;
}

.sidebar-nav details[open]>summary::before {
  transform: rotate(90deg);
}

.sidebar-nav summary a {
  display: inline;
  padding: 0;
}

.sidebar-nav .nav-section-title {
  color: var(--color-text);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}


/* 7. Breadcrumbs
   ========================================================================== */

.breadcrumbs {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.breadcrumbs a {
  color: var(--color-muted);
}

.breadcrumbs__sep {
  margin: 0 0.4rem;
}

.breadcrumbs__current {
  color: var(--color-text);
  font-weight: 600;
}


/* 8. Content typography
   ========================================================================== */

.document__title {
  font-size: 1.9rem;
  font-weight: 800;
  border-bottom: 3px solid var(--color-border);
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
}

.document__meta {
  color: var(--color-muted);
  font-size: 0.85rem;
}

table {
  border-collapse: collapse;
  width: auto;
  table-layout: auto;
  margin: 1.25rem 0;
}

th {
  background: var(--color-bg-dim);
  text-align: left;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

th,
td {
  border: 1px solid var(--color-border);
  padding: 0.4rem 0.7rem;
}

dl {
  margin: 1.25rem 0;
}

dt {
  font-weight: 800;
  color: var(--color-heading);
}

dd {
  margin: 0 0 0.9rem;
  color: var(--color-text);
}

blockquote {
  background: var(--color-bg-raised);
  border-left: 3px solid var(--color-accent);
  margin: 1.25rem 0;
  padding: 0.75rem 1.1rem;
  color: var(--color-text);
}

pre,
code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: var(--color-bg-raised);
  border: 1px solid var(--color-border);
  border-radius: 3px;
}

code {
  padding: 0.1rem 0.35rem;
  font-size: 0.85em;
}

pre {
  padding: 1rem;
  overflow-x: auto;
}

pre code {
  border: none;
  padding: 0;
  background: none;
}

.asteria-embed {
  display: block;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
}


/* 9. Post listings, taxonomy & pagination
   ========================================================================== */

.tag,
.category {
  display: inline-block;
  background: var(--color-bg-dim);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.4rem;
}

.tag:hover,
.category:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list a {
  font-weight: 700;
}

.post-list time,
.post-list span {
  color: var(--color-muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

li time+span::before {
  content: "•";
  margin-right: 0.5rem;
}

.post-list__excerpt {
  margin: 0.3rem 0 0;
  color: var(--color-muted);
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  font-size: 0.85rem;
}

.term-list {
  list-style: none;
  padding: 0;
}

.term-count {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  font-weight: 600;
}


/* 10. Footer & social links
   ========================================================================== */

.social-links {
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.social-link img {
  width: 22px;
  height: 22px;
  display: block;
  opacity: 0.75;
  transition: color 0.15s ease;
}

.social-link:hover img {
  opacity: 1;
}


/* 11. Seal badge
   ========================================================================== */

.seal-badge {
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 50%;
  border: 2px solid var(--color-seal-border);
  box-shadow: 0 0 0 3px var(--color-seal-bg), 0 0 0 4px var(--color-seal-border);
  background: var(--color-seal-bg);
  color: var(--color-seal-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 auto 1.25rem;
  padding: 0.4rem;
}


/* 12. ODT content utilities (columns, images)
   ========================================================================== */

.odt-columns {
  column-gap: 1.5rem;
}

/* Contagem de colunas só entra a partir de --breakpoint-tablet (ver §14
   / regra abaixo) — SEM media query aqui embaixo, de propósito: uma
   regra .odt-columns-2{column-count:2} incondicional (como estava antes)
   forçava 2 colunas mesmo em tela de celular estreita, o que
   provavelmente era a causa principal do layout quebrado no celular. */
@media (min-width: 48rem) {
  .odt-columns-2 {
    column-count: 2;
    column-gap: 2rem;
  }

  .odt-columns-3 {
    column-count: 3;
    column-gap: 2rem;
  }
}

.odt-columns h3 {
  break-after: avoid-column;
  break-inside: avoid;
}

.odt-columns ul,
.odt-columns ol {
  break-inside: avoid;
}

.odt-columns>* {
  margin-block: 0 1rem;
}

.odt-columns> :has(+ :is(h1, h2, h3, h4, h5, h6)) {
  margin-block-end: 2rem;
}

.odt-keep-with-next {
  break-after: avoid;
}

.odt-columns>p {
  orphans: 2;
  widows: 2;
}

.odt-image {
  max-width: 100%;
}

figure.odt-image img {
  max-width: 100%;
  height: auto;
}

img.odt-image {
  height: auto;
}

.odt-image-small {
  max-width: min(100%, 12rem);
}

.odt-image-medium {
  max-width: min(100%, 24rem);
}

.odt-image-large {
  max-width: 100%;
}

.odt-image-align-center {
  display: block;
  margin-inline: auto;
}

.odt-image-align-right {
  display: block;
  margin-inline-start: auto;
}


/* 13. Print
   ========================================================================== */

@media print {

  .site-header,
  .sidebar-column,
  .site-footer,
  .breadcrumbs,
  .post-nav {
    display: none;
  }

  .site-layout {
    display: block;
    max-width: 100%;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}


/* 14. Responsive breakpoints
   ========================================================================== */

/* Tablet and narrower: the fixed --sidebar-width beside the content
   (see §4/§6, .site-layout + .sidebar-toc/.sidebar-nav) is what was
   squeezing .site-content into an unreadably narrow column on phones —
   it's not optional-width, it's a fixed 230px taken out of the screen
   no matter how narrow the screen is. Below this breakpoint the sidebar
   stacks above the content instead of sitting beside it. */
@media (max-width: 47.99rem) {
  .site-layout {
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }

  .sidebar-column {
    width: 100%;
  }

  .sidebar-toc,
  .sidebar-nav {
    width: 100%;
    position: static;
    /* a versão "sticky" (ver §6) só faz sentido ao
                          lado do conteúdo; empilhada, ela grudaria no
                          topo da tela por cima do conteúdo ao rolar */
  }

  .footer-elements {
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
    padding: 1.5rem 1rem;
  }

  body {
    text-align: left;
    /* texto justificado numa coluna estreita cria
                          buracos de espaço em branco entre palavras —
                          ilegível em telas de celular */
  }

  /* Tabelas largas (muitas colunas) não têm como encolher pra caber
     numa tela de celular sem virar ilegível — em vez disso, a própria
     tabela vira uma caixa com rolagem horizontal própria. */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Phones: o cabeçalho (título do site / easter-egg "Sob um Céu
   Estranho") está dimensionado pra uma tela larga de desktop — reduz
   pra não dominar/estourar uma tela de 320–375px de largura. */
@media (max-width: 30rem) {
  .site-header__inner {
    padding: 1.1rem 1rem;
  }

  .site-title {
    font-size: 1.6rem;
    margin-left: 0;
  }

  .custom-header-monocerus {
    font-size: 1.9rem;
  }

  .document__title {
    font-size: 1.5rem;
  }

  .site-menu ul {
    gap: 0.6rem;
  }

  .menu-toggle {
    display: block;
    position: relative;
    z-index: 1001;
    background: none;
    border: 0;
    font-size: 1.8rem;
    cursor: pointer;
  }

  .site-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 80%;
    height: 100vh;

    background: #fff;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);

    transform: translateX(100%);
    transition: transform 0.3s ease;

    z-index: 1000;
    padding: 80px 25px 25px;
  }

  .site-menu.is-open {
    transform: translateX(0);
  }

  .site-menu ul {
    display: flex;
    flex-direction: column;
    gap: 0;
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .site-menu li {
    border-bottom: 1px solid #eee;
  }

  .site-menu a {
    display: block;
    padding: 15px 5px;
  }

  /* Fundo escurecido */
  .menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 999;
  }

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