/*
Theme Name: Skail
Theme URI: https://skail.dev
Author: Brunn
Description: Tema editorial de coluna única com sumário lateral fixo ("Nesta página") gerado a partir dos H2 do artigo. Tipografia system-ui, paleta teal/terra, blocos de diagrama prontos e suporte a tema escuro.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: skail
Tags: blog, one-column, editorial, custom-menu, featured-images, translation-ready
*/

/* =========================================================
   1. Tokens
   ========================================================= */

/*
 * Três estados de tema:
 *   sem data-theme          → segue o sistema (prefers-color-scheme)
 *   data-theme="light"      → claro forçado pelo usuário
 *   data-theme="dark"       → escuro forçado pelo usuário
 * O atributo é escrito no <html> por um script inline no <head> (functions.php),
 * antes da primeira pintura, para não piscar o tema errado.
 */

:root {
  color-scheme: light;

  --bg: #fff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #ece7df;
  --teal: #0e7c6b;
  --terra: #c2603f;
  --code-bg: #f6f3ee;
  --body-fg: #2a2a2a;
  --quote-bg: #faf7f2;
  --quote-fg: #3a3a3a;
  /*
   * Botões: fundo e texto separados do --terra dos links. No claro o terra
   * puro com texto branco dá 4.17:1, abaixo do mínimo de 4.5:1 — daí o tom
   * levemente mais escuro. No escuro o terra clareia e o texto é que escurece.
   */
  --terra-btn: #b75a3a;
  --on-terra: #fff;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Deslocamento do topo usado pelo sumário fixo e pelo scroll das âncoras.
     Aumente se você adicionar um cabeçalho sticky. */
  --header-h: 0px;
  --toc-top: 96px;
}

/* Escuro por preferência do sistema, exceto se o usuário forçou o claro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #121212;
    --fg: #f2f2f2;
    --muted: #a3a3a3;
    --line: #2a2a2a;
    --teal: #2bb8a0;
    --terra: #e08a6c;
    --code-bg: #1e1e1e;
    --body-fg: #e4e4e4;
    --quote-bg: #1a1a1a;
    --quote-fg: #dcdcdc;
    --terra-btn: #e08a6c;
    --on-terra: #21140f;
  }
}

/* Escuro escolhido no botão, independente do sistema. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #121212;
  --fg: #f2f2f2;
  --muted: #a3a3a3;
  --line: #2a2a2a;
  --teal: #2bb8a0;
  --terra: #e08a6c;
  --code-bg: #1e1e1e;
  --body-fg: #e4e4e4;
  --quote-bg: #1a1a1a;
  --quote-fg: #dcdcdc;
  --terra-btn: #e08a6c;
  --on-terra: #21140f;
}

/* =========================================================
   2. Reset / base
   ========================================================= */

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

* { margin: 0; padding: 0; }

html,
body { max-width: 100vw; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--terra);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
  border-radius: 3px;
}

img,
svg,
video,
iframe { max-width: 100%; }

.skail-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .6rem 1rem;
  font-size: .9rem;
  font-weight: 700;
}

.skail-skip-link:focus {
  left: 24px;
  top: 16px;
  text-decoration: none;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   3. Cabeçalho e rodapé do site
   ========================================================= */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1rem 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-branding {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.custom-logo-link {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.custom-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: var(--logo-h, 40px);
  max-width: 220px;
  border: 0;
  border-radius: 0;
}

/*
 * Troca de logo por tema. Segue o mesmo contrato de três estados do resto
 * do CSS, senão o botão de tema mudaria a página e deixaria o logo para trás.
 */
.skail-logo-dark { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .skail-logo-light { display: none; }
  :root:not([data-theme="light"]) .skail-logo-dark { display: block; }
}

:root[data-theme="dark"] .skail-logo-light { display: none; }
:root[data-theme="dark"] .skail-logo-dark { display: block; }

.site-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.2;
}

.site-title a { color: var(--fg); }
.site-title a:hover { color: var(--terra); text-decoration: none; }

.site-description {
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.4;
}

.site-nav { margin-left: auto; }

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

.site-nav a {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav .current-menu-item > a {
  color: var(--fg);
  text-decoration: none;
}

/* Submenus: dropdown no desktop, lista indentada no mobile */
.site-nav li { position: relative; }

.site-nav .menu-item-has-children > a::after {
  content: "▾";
  margin-left: .3em;
  font-size: .8em;
  opacity: .7;
}

.site-nav .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: -.75rem;
  z-index: 30;
  min-width: 190px;
  margin: 0;
  padding: .4rem 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .07);
}

.site-nav li:hover > .sub-menu,
.site-nav li:focus-within > .sub-menu { display: block; }

.site-nav .sub-menu li { width: 100%; }

.site-nav .sub-menu a {
  display: block;
  padding: .35rem .9rem;
  font-size: .85rem;
  white-space: nowrap;
}

/* Botão de tema (só com JS, já que depende de localStorage) */
.theme-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
}

.js .theme-toggle { display: inline-flex; }

.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--terra);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Mostra o ícone do tema para o qual o clique vai levar. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
}

/* Botão de menu (só aparece no mobile, e só com JS) */
.site-nav-toggle {
  display: none;
  align-items: center;
  gap: .45rem;
  font: inherit;
  font-size: .85rem;
  font-weight: 650;
  color: var(--fg);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .7rem;
  cursor: pointer;
}

.site-nav-toggle:hover { border-color: var(--terra); }

.site-nav-toggle-bars {
  position: relative;
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
}

.site-nav-toggle-bars::before,
.site-nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: currentColor;
}

.site-nav-toggle-bars::before { top: -5px; }
.site-nav-toggle-bars::after { top: 5px; }

@media (max-width: 640px) {
  .site-header-inner {
    flex-wrap: wrap;
    gap: .7rem 1rem;
    padding: .9rem 20px;
  }

  .js .site-nav-toggle { display: inline-flex; }
  .js .site-nav[data-collapsed="true"] { display: none; }

  .site-nav {
    order: 3;
    width: 100%;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: .55rem;
  }

  .site-nav a { font-size: .95rem; }

  /* Sem dropdown no toque: submenu vira lista indentada */
  .site-nav .sub-menu,
  .site-nav li:hover > .sub-menu {
    display: block;
    position: static;
    min-width: 0;
    margin: .4rem 0 0 .9rem;
    padding: 0;
    border: none;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .site-nav .sub-menu a { padding: .25rem 0 .25rem .8rem; }
  .site-nav .menu-item-has-children > a::after { content: none; }

  .post-shell { padding: 40px 20px; }
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  color: var(--muted);
  font-size: .85rem;
}

.site-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2rem 24px 3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--terra); }

/* =========================================================
   4. Shell do artigo + sumário lateral
   ========================================================= */

.post-shell {
  --post-max: 720px;
  --toc-w: 220px;
  /* Distância entre a coluna de texto e o sumário em telas largas. */
  --toc-gap: 138px;
  position: relative;
  max-width: calc(var(--post-max) + var(--toc-w) + 48px);
  margin: 0 auto;
  padding: 64px 24px;
}

/* Sem sumário não há segunda coluna: o shell acompanha só a coluna de texto. */
.post-shell--solo { max-width: calc(var(--post-max) + 48px); }

.post-main {
  max-width: var(--post-max);
  margin: 0 auto;
  font-family: var(--sans);
  color: var(--fg);
  line-height: 1.7;
}

.post-toc { display: none; }

@media (min-width: 1100px) {
  /*
   * Duas colunas em grid, com o sumário em position: sticky.
   * Sticky (e não fixed) é o que faz o bloco começar na altura do H1 quando
   * a página está no topo, e só grudar em --toc-top depois que a rolagem passa
   * daquele ponto. Com fixed ele ficava preso à janela e subia até o topo.
   *
   * O espaço entre a coluna e o sumário encolhe sozinho em telas de desktop
   * estreitas, para o sumário não sair da janela entre 1100px e ~1220px.
   */
  /* Só o shell com sumário vira grid. Listagens usam .post-shell--solo. */
  .post-shell:not(.post-shell--solo) {
    display: grid;
    grid-template-columns: var(--post-max) var(--toc-w);
    column-gap: min(
      var(--toc-gap),
      max(32px, calc(100vw - var(--post-max) - var(--toc-w) - 160px))
    );
    align-items: start;
    padding-left: 24px;
    padding-right: 24px;
  }

  .post-shell:not(.post-shell--solo) .post-main {
    margin-left: 0;
    margin-right: auto;
  }

  .post-toc {
    display: block;
    position: sticky;
    top: calc(var(--toc-top) + var(--header-h));
    align-self: start;
    width: var(--toc-w);
    max-height: calc(100vh - var(--toc-top) - var(--header-h) - 24px);
    overflow: auto;
    /* Alinha opticamente o rótulo com a primeira linha do H1. */
    padding-top: .5rem;
    font-size: .8rem;
    line-height: 1.35;
  }

  .post-toc-label {
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .65rem;
  }

  .post-toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
    border-left: 1px solid var(--line);
  }

  .post-toc a {
    display: block;
    margin-left: -1px;
    padding: .35rem 0 .35rem .75rem;
    border-left: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
  }

  .post-toc a:hover {
    color: var(--fg);
    text-decoration: none;
  }

  .post-toc a[data-active="true"] {
    color: var(--terra);
    border-left-color: var(--terra);
    font-weight: 650;
  }

  .post-toc .post-toc-sub a { padding-left: 1.5rem; }
}

/* Sumário em telas estreitas: acordeão acima do texto */
.post-toc-mobile {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 0 0 2rem;
  background: var(--quote-bg);
}

@media (min-width: 1100px) {
  .post-toc-mobile { display: none; }
}

.post-toc-mobile > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-toc-mobile > summary::-webkit-details-marker { display: none; }
.post-toc-mobile > summary::after { content: " +"; }
.post-toc-mobile[open] > summary::after { content: " –"; }

.post-toc-mobile ol {
  margin: 0;
  padding: 0 1rem 1rem 1rem;
  list-style: none;
}

.post-toc-mobile li { margin: .35rem 0; }

.post-toc-mobile a {
  color: var(--fg);
  font-size: .9rem;
  text-decoration: none;
}

.post-toc-mobile a:hover { color: var(--terra); }
.post-toc-mobile .post-toc-sub { padding-left: .9rem; }

/* =========================================================
   5. Cabeçalho do artigo
   ========================================================= */

.post-title {
  margin: 0 0 .6rem;
  font-size: clamp(2rem, 1.35rem + 2.2vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.post-title a { color: inherit; }
.post-title a:hover { color: var(--terra); text-decoration: none; }

.post-meta {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
  margin-bottom: 2.4rem;
}

.post-meta a { color: inherit; }
.post-meta a:hover { color: var(--terra); }

.post-thumb {
  margin: 0 0 2.2rem;
}

.post-thumb img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* =========================================================
   6. Conteúdo do artigo
   Escopado em .post-content: os cards da listagem também são <article>,
   e herdariam margens e line-height daqui se o seletor fosse genérico.
   ========================================================= */

.post-content h2 {
  margin: 2.2rem 0 .8rem;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.25;
  scroll-margin-top: calc(var(--header-h) + 32px);
}

.post-content h3 {
  margin: 1.6rem 0 .6rem;
  font-size: 1.25rem;
  font-weight: 700;
  scroll-margin-top: calc(var(--header-h) + 32px);
}

.post-content h4 {
  margin: 1.4rem 0 .5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.post-content p {
  margin: 1rem 0;
  color: var(--body-fg);
}

.post-content ul,
.post-content ol { margin: 1rem 0 1rem 1.4rem; }

.post-content li { margin: .4rem 0; }

.post-content blockquote {
  margin: 1.4rem 0;
  padding: .8rem 1.1rem;
  border-left: 3px solid var(--terra);
  border-radius: 0 8px 8px 0;
  background: var(--quote-bg);
  color: var(--quote-fg);
}

.post-content blockquote p:first-child { margin-top: 0; }
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(72vh, 1080px);
  object-fit: contain;
  margin: 1.6rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.post-content img.diagram {
  width: 100%;
  max-height: min(82vh, 960px);
  object-fit: contain;
}

.post-content figure { max-width: 100%; margin: 1.6rem 0; }
.post-content figure img { margin: 0; }

.post-content figcaption {
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.45;
  margin-top: .7rem;
}

.post-content pre {
  margin: 1.4rem 0;
  padding: 1rem 1.1rem;
  background: #1e1e2e;
  color: #e6e6e6;
  border-radius: 10px;
  font-size: .9rem;
  line-height: 1.55;
  overflow-x: auto;
  max-width: 100%;
}

.post-content code {
  font-family: var(--mono);
  font-size: .92em;
}

.post-content :not(pre) > code {
  background: var(--code-bg);
  border-radius: 5px;
  padding: .15em .4em;
  overflow-wrap: anywhere;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-content strong { font-weight: 700; }

.post-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.post-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.post-content table th,
.post-content table td {
  border-bottom: 1px solid var(--line);
  padding: .6rem .8rem;
  text-align: left;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content p,
.post-content li,
.post-content blockquote,
.post-content figcaption { overflow-wrap: break-word; }

/* Embeds responsivos (YouTube etc.) */
.wp-embed-aspect-16-9 .wp-block-embed__wrapper,
.skail-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  margin: 1.6rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
}

.wp-embed-aspect-16-9 .wp-block-embed__wrapper > iframe,
.skail-embed > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Alinhamentos do editor */
.alignleft { float: left; margin: .4rem 1.4rem 1rem 0; }
.alignright { float: right; margin: .4rem 0 1rem 1.4rem; }
.aligncenter { margin-left: auto; margin-right: auto; }

.alignwide {
  width: min(100%, calc(var(--post-max, 720px) + 120px));
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}

@media (max-width: 900px) {
  .alignwide { width: 100%; margin-left: 0; transform: none; }
}

/* Âncora de heading (# no hover) */
.diag-heading-anchor {
  color: inherit;
  text-decoration: none;
}

.diag-heading-anchor:hover { text-decoration: none; }

.diag-heading-anchor:hover::after {
  content: " #";
  color: var(--muted);
  font-weight: 500;
}

/* =========================================================
   7. Rodapé do artigo: tags, navegação, relacionados
   ========================================================= */

.post-tags {
  margin: 2.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.post-tags a {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .6rem;
  text-decoration: none;
}

.post-tags a:hover {
  color: var(--terra);
  border-color: var(--terra);
}

.post-nav {
  display: grid;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 720px) {
  .post-nav { grid-template-columns: 1fr 1fr; }
  .post-nav .post-nav-next { text-align: right; }
}

.post-nav-label {
  display: block;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .25rem;
}

.post-nav a {
  color: var(--fg);
  font-weight: 650;
  text-decoration: none;
  line-height: 1.35;
}

.post-nav a:hover { color: var(--terra); }

/* =========================================================
   8. Listagens (home, arquivo, busca)
   ========================================================= */

/* Cabeçalho da listagem: rótulo pequeno + título grande */
.archive-header { margin-bottom: 3.4rem; }

.archive-kicker {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: .55rem;
}

.archive-title {
  font-size: clamp(2rem, 1.7rem + 1vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.archive-description {
  color: var(--muted);
  margin-top: .6rem;
  max-width: 46em;
}

/* Itens: categoria em terra, título, dek e meta. Sem divisórias. */
.post-list { display: flex; flex-direction: column; }

.post-card { padding: 0; }

.post-card + .post-card { margin-top: 3.25rem; }

.post-card-kicker {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--terra);
  line-height: 1.4;
  margin-bottom: .45rem;
  text-decoration: none;
}

.post-card-kicker:hover { text-decoration: underline; }

.post-card-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: .35rem;
}

.post-card-title a { color: var(--fg); }
.post-card-title a:hover { color: var(--terra); text-decoration: none; }

.post-card-excerpt {
  color: var(--body-fg);
  font-size: .95rem;
  margin: 0 0 .7rem;
}

.post-card-meta {
  color: var(--muted);
  font-size: .82rem;
  margin: 0;
}

.skail-pagination {
  margin-top: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  font-size: .9rem;
}

.skail-pagination .page-numbers {
  display: inline-block;
  min-width: 2.1rem;
  text-align: center;
  padding: .35rem .6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
}

.skail-pagination .page-numbers:hover {
  color: var(--fg);
  border-color: var(--terra);
}

.skail-pagination .page-numbers.current {
  color: var(--on-terra);
  background: var(--terra-btn);
  border-color: var(--terra-btn);
}

/* =========================================================
   8b. Home (template-home.php)
   ========================================================= */

/* A home é mais larga que o artigo: comporta grade de 3 colunas. */
.home-shell { --post-max: 1040px; }

.home-hero {
  padding-bottom: 3.4rem;
  margin-bottom: 3.4rem;
  border-bottom: 1px solid var(--line);
}

.home-title {
  font-size: clamp(2.25rem, 1.5rem + 2.6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.025em;
}

.home-lead {
  max-width: 40em;
  margin-top: 1rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem);
  line-height: 1.6;
}

/* Busca em destaque */
.home-search {
  display: flex;
  gap: .6rem;
  max-width: 620px;
  margin-top: 2.2rem;
}

.home-search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 1.1rem;
  font: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.home-search input[type="search"]::placeholder { color: var(--muted); }

.home-search input[type="search"]:focus {
  border-color: var(--terra);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--terra) 18%, transparent);
}

.home-search button {
  height: 56px;
  padding: 0 1.5rem;
  font: inherit;
  font-weight: 700;
  color: var(--on-terra);
  background: var(--terra-btn);
  border: 1px solid var(--terra-btn);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.home-search button:hover { filter: brightness(1.06); }

.home-topics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-top: 1.1rem;
  font-size: .85rem;
  color: var(--muted);
}

.home-topics a {
  padding: .22rem .7rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.home-topics a:hover {
  color: var(--terra);
  border-color: var(--terra);
  text-decoration: none;
}

/* Texto livre da página, entre o herói e os posts */
.home-prose {
  max-width: 720px;
  margin-bottom: 3.4rem;
}

/* Cabeçalho de seção */
.home-section { margin-bottom: 3.8rem; }

.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.home-section-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-section-link {
  font-size: .85rem;
  font-weight: 650;
  white-space: nowrap;
}

/* Destaque */
.home-featured {
  display: grid;
  gap: 1.6rem;
  align-items: center;
}

@media (min-width: 860px) {
  .home-featured { grid-template-columns: 1.05fr 1fr; gap: 2.4rem; }
  .home-featured--no-media { grid-template-columns: 1fr; max-width: 46em; }
}

.home-featured-media img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.home-featured-title {
  margin: .45rem 0 .55rem;
  font-size: clamp(1.45rem, 1.15rem + 1vw, 2rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -.015em;
}

.home-featured-title a { color: var(--fg); }
.home-featured-title a:hover { color: var(--terra); text-decoration: none; }

.home-featured-excerpt {
  color: var(--body-fg);
  margin-bottom: .7rem;
}

/* Grade de últimos posts */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.4rem 2rem;
}

@media (min-width: 680px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.home-card { min-width: 0; }

.home-card-media { display: block; }

.home-card-media img,
.home-card-media--empty {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: .85rem;
}

/*
 * Post sem imagem destacada: mantém a caixa para as linhas da grade não
 * desalinharem quando só alguns cards têm foto.
 */
.home-card-media--empty { background: var(--quote-bg); }

.home-card-title {
  margin: .3rem 0 .4rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.45;
}

.home-card-title a { color: var(--fg); }
.home-card-title a:hover { color: var(--terra); text-decoration: none; }

.home-card-excerpt {
  color: var(--body-fg);
  font-size: .92rem;
  margin-bottom: .5rem;
}

/* Assuntos, no fim da home */
.home-terms {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.home-term {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  padding: .45rem .9rem;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 650;
}

.home-term:hover {
  border-color: var(--terra);
  color: var(--terra);
  text-decoration: none;
}

.home-term span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}

.home-term:hover span { color: inherit; }

@media (max-width: 560px) {
  .home-search { flex-direction: column; }

  /*
   * Empilhado, o eixo principal vira o vertical: com flex:1 a base do campo
   * zera e o height:56px é ignorado. Trava a base para manter a altura.
   */
  .home-search input[type="search"] {
    flex: 0 0 56px;
    width: 100%;
  }

  .home-search button { width: 100%; }
}

/* =========================================================
   9. Busca, comentários, 404
   ========================================================= */

.search-form {
  display: flex;
  gap: .5rem;
  margin: 1.5rem 0;
}

.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: .95rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .8rem;
}

.search-form button {
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--on-terra);
  background: var(--terra-btn);
  border: 1px solid var(--terra-btn);
  border-radius: 8px;
  padding: .55rem 1rem;
}

.comments-area {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.comments-title,
.comment-reply-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.comment-list {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}

.comment-list ol.children {
  list-style: none;
  margin: 0 0 0 1.4rem;
  padding: 0;
}

.comment-body {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.comment-meta {
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: .4rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .8rem;
}

.comment-form p { margin: .8rem 0; }

.comment-form .submit {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--on-terra);
  background: var(--terra-btn);
  border: 1px solid var(--terra-btn);
  border-radius: 8px;
  padding: .55rem 1.2rem;
}

.error-404 { padding: 2rem 0; }

/* =========================================================
   10. Impressão
   ========================================================= */

@media print {
  .site-header,
  .site-footer,
  .post-toc,
  .post-toc-mobile,
  .post-nav { display: none !important; }

  .post-shell { padding: 0; max-width: none; }
  .post-content pre { background: #f4f4f4; color: #111; }
}
