/* =============================================
   TFT — Sketch / Hand-Drawn Theme
   Aplicado globalmente
   Paleta: Hextra (blue accent, clean light/dark)
   ============================================= */

/* ---------------------------------------------
   1. VARIÁVEIS (tema sketch — Hextra light mode)
   --------------------------------------------- */
:root {
  /* Surfaces */
  --sketch-bg: #ffffff;
  --sketch-bg-lines: #f9fafb;
  --sketch-card: #ffffff;

  /* Text */
  --sketch-foreground: #111827;
  --sketch-muted: #6b7280;

  /* Accents (Hextra primary blue: hsl(212, 100%, 50%) ≈ #2563eb) */
  --sketch-primary: #2563eb;
  --sketch-secondary: #2563eb;
  --sketch-accent: #1d4ed8;

  /* Structural */
  --sketch-border: #e5e7eb;

  /* Fontes manuscritas */
  --font-heading: 'Kalam', 'Patrick Hand', cursive;
  --font-body: 'Patrick Hand', 'Kalam', cursive;
}

/* Modo dark via html[data-theme="dark"] */
html[data-theme="dark"] {
  --sketch-bg: #111111;
  --sketch-bg-lines: #1a1a1a;
  --sketch-card: #1f1f1f;
  --sketch-foreground: #f3f4f6;
  --sketch-muted: #9ca3af;
  --sketch-primary: #0ea5e9;
  --sketch-secondary: #38bdf8;
  --sketch-accent: #0ea5e9;
  --sketch-border: #404040;
}



/* ---------------------------------------------
   2. BACKGROUND — Papel amassado
   --------------------------------------------- */
body {
  color: var(--sketch-foreground);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.6;
}

/* Layout sticky footer via flexbox */
html {
  height: 100% !important;
  min-height: 100% !important;
  position: static !important;
  background-color: var(--sketch-bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(17, 24, 39, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(17, 24, 39, 0.025) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(17, 24, 39, 0.02) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 100%, 100% 100%, 256px 256px;
}

body {
  min-height: 100%;
  margin: 0 !important;
  display: flex;
  flex-direction: column;
  background: transparent;
}

main#content {
  flex: 1 0 auto;
  padding-bottom: 2rem;
}

/* ---------------------------------------------
   3. TIPOGRAFIA
   --------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: #0f172a;
  letter-spacing: 0.02em;
}

h1 { font-size: 2.2rem; margin-bottom: 0.8em; }
h2 { font-size: 1.8rem; margin-bottom: 0.6em; }
h3 { font-size: 1.4rem; margin-bottom: 0.5em; }

/* Headings dentro dos artigos ganham linha decorativa */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  border-bottom: 2px solid var(--sketch-border);
  padding-bottom: 0.3em;
}

p, li {
  font-family: var(--font-body);
  color: var(--sketch-foreground);
}

/* ---------------------------------------------
   4. LINKS
   --------------------------------------------- */
a {
  color: var(--sketch-secondary);
  text-decoration: none;
  position: relative;
}

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

/* Links sem underline nem decoração visual */
p a, .post-content a, .list-posts a,
p a:hover, .post-content a:hover, .list-posts a:hover {
  background: none;
  padding-bottom: 0;
}

/* ---------------------------------------------
   5. NAVEGAÇÃO (header)
   --------------------------------------------- */
.header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sketch-border);
  display: flex;
  align-items: center;
}

.header-nav {
  font-family: var(--font-heading);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links .nav-icons-divider {
  margin: 0 2px;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: #0f172a !important;
}

.nav-brand:hover {
  color: var(--sketch-accent) !important;
}

html[data-theme="dark"] .nav-brand {
  color: #f3f4f6 !important;
}

html[data-theme="dark"] .nav-brand:hover {
  color: var(--sketch-secondary) !important;
}

.nav-link a {
  font-family: var(--font-heading);
  color: #374151;
  background: none;
  padding: 0;
}

.nav-link a:hover {
  color: var(--sketch-secondary);
  background: none;
}

html[data-theme="dark"] .nav-link a {
  color: #d1d5db;
}

html[data-theme="dark"] .nav-link a:hover {
  color: var(--sketch-secondary);
}

/* Theme toggle icon */
.dark-theme-toggle {
  display: flex;
  align-items: center;
}

.nav-hamburger-list .dark-theme-toggle {
  justify-content: center;
}

.dark-theme-toggle .feather {
  color: #374151;
  vertical-align: middle;
}

html[data-theme="dark"] .dark-theme-toggle .feather {
  color: #d1d5db;
}

.dark-theme-toggle:hover .feather {
  color: var(--sketch-secondary) !important;
  fill: none !important;
}

/* Hamburger menu */
.nav-hamburger-list {
  background: var(--sketch-card);
  top: 100%;
}

.nav-item a {
  font-family: var(--font-heading);
}

/* ---------------------------------------------
   6. CONTAINER PRINCIPAL (lista)
   --------------------------------------------- */
.list-posts {
  box-sizing: border-box;
  max-width: 800px;
  margin: 2rem auto 4rem auto;
  padding: 2rem;
  background: var(--sketch-card);
  border: 2px solid var(--sketch-border);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 6px 6px 0px rgba(17, 24, 39, 0.06);
}

.list-posts .list-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  border-radius: 0 0 255px 15px / 0 0 15px 225px;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

/* ---------------------------------------------
   7. POST ITEM (na lista)
   --------------------------------------------- */
.post-item {
  padding: 0.1rem 0;
}

.post-item a {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--sketch-foreground);
  background: none;
  padding: 0;
}

.post-item a:hover {
  color: var(--sketch-secondary);
  background: none;
}

.post-date {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--sketch-muted);
  margin-right: 0.5rem;
}

/* Separador por ano */
.list-posts .posts-year {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-top: 2rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #0f172a;
}

html[data-theme="dark"] .list-posts .posts-year {
  border-bottom-color: #f3f4f6;
}

/* Mês dentro de cada seção */
.list-posts .posts-month {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--sketch-muted);
  border-bottom: 1px solid var(--sketch-muted);
  padding-bottom: 0.3rem;
}

/* ---------------------------------------------
   8. POST INDIVIDUAL
   --------------------------------------------- */
.post.container {
  background: var(--sketch-card);
  border: 2px solid var(--sketch-border);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 6px 6px 0px rgba(17, 24, 39, 0.06);
  padding: 2rem;
  margin: 2rem auto;
  max-width: 800px;
}

.post-header-section h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.post-date {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--sketch-muted);
}

.post-icon {
  font-size: 1.1rem;
  margin-right: 0.25rem;
}

.post-description {
  font-style: italic;
  color: var(--sketch-muted);
  margin: 0.8rem 0;
  font-family: var(--font-body);
}

.post-content {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.7;
}

.post-content h2, .post-content h3 {
  margin-top: 2rem;
}

.sketch-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--sketch-border);
}

.prev-link, .next-link {
  font-family: var(--font-heading);
  color: var(--sketch-foreground);
  background: none;
  padding: 0;
  border: 2px solid var(--sketch-border);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 0.5rem 1rem;
  box-shadow: 3px 3px 0px rgba(17, 24, 39, 0.05);
  transition: all 0.1s ease;
  display: inline-block;
}

.prev-link:hover, .next-link:hover {
  color: var(--sketch-secondary);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px rgba(37, 99, 235, 0.05);
  background: none;
}

/* ---------------------------------------------
   9. SEPARADOR RABISCADO (divisor)
   --------------------------------------------- */
.sketch-divider {
  border: none;
  height: 24px;
  margin: 2rem auto;
  max-width: 810px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='810' height='24'%3E%3Cpath d='M 0 12 Q 50.6 4, 101.2 12 T 202.5 12 T 303.7 12 T 405 12 T 506.2 12 T 607.5 12 T 708.7 12 T 810 12' stroke='%23e5e7eb' stroke-width='2.5' fill='none' opacity='0.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ---------------------------------------------
   10. FOOTER
   --------------------------------------------- */
.footer {
  flex-shrink: 0;
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  margin-left: 0 !important;
  width: 100% !important;
  background: var(--sketch-card);
  border-top: 1px solid var(--sketch-border);
  box-shadow: -3px -3px 0px rgba(17, 24, 39, 0.03);
  padding: 2rem 0;
  color: var(--sketch-muted);
  font-family: var(--font-body);
  font-size: 0.95rem;
  box-sizing: border-box;
}

.footer a {
  color: var(--sketch-secondary);
  background: none;
  padding: 0;
}

.footer a:hover {
  color: var(--sketch-accent);
}

/* ---------------------------------------------
   11. TAGS
   --------------------------------------------- */
/* Desativa estilo padrão do Gokarna para tags */
.post-tags .post-tag {
  border: none;
  border-radius: 0;
  background: none;
}

.post-tags .post-tag a {
  padding: 0;
}

.tag {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  background: var(--sketch-bg-lines);
  border: 1.5px solid var(--sketch-border);
  border-radius: 85% 15% 80% 20% / 15% 85% 15% 85%;
  padding: 2px 10px;
  margin: 2px;
  color: var(--sketch-foreground);
  box-shadow: 2px 2px 0px rgba(17, 24, 39, 0.04);
}

.tag:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px rgba(37, 99, 235, 0.04);
  color: var(--sketch-secondary);
}

/* Lista de tags na página /tags/ */
.tags-section {
  list-style: none;
  padding: 0;
  margin: 1rem 0 3rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags-section .tag {
  font-size: 0.9rem;
  padding: 4px 14px;
}

.tag-name {
  font-weight: 500;
}

.tag-posts-count {
  font-size: 0.75rem;
  color: var(--sketch-muted);
  margin-left: 4px;
}

/* ---------------------------------------------
   12. BLOCKQUOTE (estilo anotação)
   --------------------------------------------- */
blockquote {
  border-left: 3px solid var(--sketch-primary);
  border-radius: 0 85% 15% 85% / 85% 15% 85% 15%;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--sketch-bg-lines);
  font-style: italic;
  color: var(--sketch-muted);
  box-shadow: 3px 3px 0px rgba(17, 24, 39, 0.03);
}

/* ---------------------------------------------
   13. CÓDIGO (estilo escrito a mão)
   --------------------------------------------- */
code {
  font-family: 'Courier New', monospace;
  background: var(--sketch-bg-lines);
  border: 1px solid rgba(17, 24, 39, 0.06);
  border-radius: 6px 4px 8px 3px;
  padding: 0.1em 0.35em;
  font-size: 0.8em;
  color: #374151;
}

pre {
  background: var(--sketch-bg-lines);
  border: 2px solid var(--sketch-border);
  border-radius: 85% 15% 80% 20% / 15% 85% 15% 85%;
  box-shadow: 4px 4px 0px rgba(17, 24, 39, 0.04);
  padding: 1.2rem;
  overflow-x: auto;
}

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

/* ---------------------------------------------
   14. RESPONSIVIDADE
   --------------------------------------------- */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.2rem; }

  body {
    font-size: 1.05rem;
  }
}

/* ---------------------------------------------
   15. DARK MODE — Hextra dark
   --------------------------------------------- */

/* === DARK MODE VARIABLES e RULES === */
/* data-theme é definido inline no head.html (localStorage + prefers-color-scheme),
   e sincronizado com o toggle do Gokarna. Não usamos @media para evitar conflito
   entre preferência do SO e toggle manual. */

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
  color: #f1f5f9;
}

html[data-theme="dark"] .list-title,
html[data-theme="dark"] .posts-year {
  border-bottom-color: #404040;
}

html[data-theme="dark"] .header {
  background: rgba(17, 17, 17, 0.8);
  backdrop-filter: blur(8px);
  border-bottom-color: var(--sketch-border);
}

html[data-theme="dark"] .nav-brand {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .nav-link a {
  color: #d1d5db;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(243, 244, 246, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(243, 244, 246, 0.015) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(243, 244, 246, 0.01) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
}

html[data-theme="dark"] {
  background-color: var(--sketch-bg);
}

html[data-theme="dark"] .sketch-divider {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='810' height='24'%3E%3Cpath d='M 0 12 Q 50.6 4, 101.2 12 T 202.5 12 T 303.7 12 T 405 12 T 506.2 12 T 607.5 12 T 708.7 12 T 810 12' stroke='%23404040' stroke-width='2.5' fill='none' opacity='0.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .list-posts,
html[data-theme="dark"] .post.container {
  box-shadow: 6px 6px 0px rgba(243, 244, 246, 0.06);
}

html[data-theme="dark"] .prev-link,
html[data-theme="dark"] .next-link {
  box-shadow: 3px 3px 0px rgba(243, 244, 246, 0.05);
}

html[data-theme="dark"] .prev-link:hover,
html[data-theme="dark"] .next-link:hover {
  box-shadow: 1px 1px 0px rgba(14, 165, 233, 0.05);
}

html[data-theme="dark"] .footer {
  box-shadow: -3px -3px 0px rgba(243, 244, 246, 0.03);
}

html[data-theme="dark"] .tag {
  box-shadow: 2px 2px 0px rgba(243, 244, 246, 0.04);
}

html[data-theme="dark"] .tag:hover {
  box-shadow: 1px 1px 0px rgba(14, 165, 233, 0.04);
}

html[data-theme="dark"] blockquote {
  box-shadow: 3px 3px 0px rgba(243, 244, 246, 0.03);
}

html[data-theme="dark"] pre {
  box-shadow: 4px 4px 0px rgba(243, 244, 246, 0.04);
}

html[data-theme="dark"] code {
  border-color: rgba(243, 244, 246, 0.08);
  color: #d1d5db;
}

@media (max-width: 768px) {
  html[data-theme="dark"] .list-posts {
    box-shadow: 4px 4px 0px rgba(243, 244, 246, 0.05);
  }
}
