/* ==========================================================================
   Professor Fábio Izidio — tema editorial + blocos
   Claro por padrão; escuro via [data-theme="dark"] ou preferência do sistema.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --ink: #111827;
  --muted: #374151;
  --faint: #4B5563;
  --rule: #D6DAE1;
  --accent: #1E3A8A;
  --on-accent: #FFFFFF;
  --math-bg: #E3ECFF;  --math-fg: #1D4ED8;
  --prog-bg: #D7F4E6;  --prog-fg: #047857;
  --teo-bg: #FDE8C8;   --teo-fg: #92400E;
  --inv-bg: #111827;   --inv-ink: #F3F4F6;
  --code-bg: #EBEEF3;
  --hl-keyword: #B4232C; --hl-string: #0B6B3A; --hl-number: #1E3A8A; --hl-comment: #4B5563; --hl-title: #6D28D9;
  --moon-display: block;
  --sun-display: none;
  --frame-filter: none;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 20px;
  --header-h: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1420;
  --surface: #171D2B;
  --ink: #EEF1F6;
  --muted: #B8C0CE;
  --faint: #9AA5B5;
  --rule: #2B3345;
  --accent: #8FA8FF;
  --on-accent: #0F1420;
  --math-bg: #1B2A52;  --math-fg: #A9C0FF;
  --prog-bg: #14392B;  --prog-fg: #6EE0A8;
  --teo-bg: #44301A;   --teo-fg: #F5C27A;
  --inv-bg: #EEF1F6;   --inv-ink: #0F1420;
  --code-bg: #1E2536; --hl-keyword: #FF9AA2; --hl-string: #7EE2A8; --hl-number: #9DB4FF; --hl-comment: #9AA5B5; --hl-title: #C4A7FF;
  --moon-display: none;
  --sun-display: block;
  --frame-filter: invert(1) hue-rotate(180deg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0F1420;
    --surface: #171D2B;
    --ink: #EEF1F6;
    --muted: #B8C0CE;
    --faint: #9AA5B5;
    --rule: #2B3345;
    --accent: #8FA8FF;
    --on-accent: #0F1420;
    --math-bg: #1B2A52;  --math-fg: #A9C0FF;
    --prog-bg: #14392B;  --prog-fg: #6EE0A8;
    --teo-bg: #44301A;   --teo-fg: #F5C27A;
    --inv-bg: #EEF1F6;   --inv-ink: #0F1420;
    --code-bg: #1E2536; --hl-keyword: #FF9AA2; --hl-string: #7EE2A8; --hl-number: #9DB4FF; --hl-comment: #9AA5B5; --hl-title: #C4A7FF;
    --moon-display: none;
    --sun-display: block;
    --frame-filter: invert(1) hue-rotate(180deg);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  transition: background-color .2s ease, color .2s ease;
}
a { color: inherit; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
img, svg { max-width: 100%; }
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: 8px;
}
.skip-link:focus { left: 8px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

/* ---------- Cabeçalho fixo ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  max-width: 1200px; margin: 0 auto; padding: 8px 40px;
  min-height: var(--header-h);
  display: grid; align-items: center; column-gap: 20px;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "brand nav toggle";
}
.brand {
  grid-area: brand; justify-self: start;
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  text-decoration: none; padding: 12px 0; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.site-nav {
  grid-area: nav; min-width: 0;
  display: flex; gap: 0 28px; font-size: 15px; overflow-x: auto; scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  display: inline-block; padding: 14px 0; white-space: nowrap; text-decoration: none;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); font-weight: 600; }

.theme-toggle {
  grid-area: toggle; width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-moon { display: var(--moon-display); }
.theme-toggle .icon-sun  { display: var(--sun-display); }

/* ---------- Conteúdo (Franklin) ---------- */
.franklin-content { max-width: 760px; margin: 0 auto; padding: 48px 24px 96px; }
.home .franklin-content, .wide .franklin-content { max-width: none; padding: 0; }

.franklin-content h1, .franklin-content h2, .franklin-content h3, .franklin-content h4 {
  font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em;
}
.franklin-content h1 { font-size: clamp(34px, 5vw, 48px); margin: 0 0 24px; }
.franklin-content h2 { font-size: 30px; margin: 48px 0 16px; }
.franklin-content h3 { font-size: 24px; margin: 36px 0 12px; }
.franklin-content p, .franklin-content li { color: var(--muted); }
/* Só links "soltos" do texto; links com classe (botões, blocos) têm as suas cores. */
.franklin-content a:not([class]) { color: var(--accent); text-underline-offset: 3px; }
.franklin-content blockquote {
  margin: 24px 0; padding: 4px 24px; border-left: 3px solid var(--rule); color: var(--muted);
}
.franklin-content code, .franklin-content kbd {
  font-family: var(--mono); font-size: .9em; background: var(--code-bg);
  padding: .15em .4em; border-radius: 6px;
}
.franklin-content pre {
  background: var(--code-bg); padding: 18px 20px; border-radius: 14px; overflow-x: auto; line-height: 1.55;
}
.franklin-content pre code { background: none; padding: 0; }
/* highlight.js: usa as cores do tema em vez das do github.min.css */
.franklin-content pre code.hljs { background: transparent !important; color: inherit !important; padding: 0 !important; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: var(--hl-keyword) !important; }
.hljs-string, .hljs-regexp, .hljs-symbol { color: var(--hl-string) !important; }
.hljs-number, .hljs-attr, .hljs-variable { color: var(--hl-number) !important; }
.hljs-comment, .hljs-quote { color: var(--hl-comment) !important; font-style: italic; }
.hljs-title, .hljs-section, .hljs-function { color: var(--hl-title) !important; }
.franklin-content table { border-collapse: collapse; display: block; overflow-x: auto; }
.franklin-content th, .franklin-content td { border: 1px solid var(--rule); padding: 8px 14px; text-align: left; }
.franklin-content hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }

/* ---------- Home: hero ---------- */
.hero { padding: 72px 0 48px; display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.hero__text { flex: 1 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.kicker { font-size: 13px; letter-spacing: .14em; font-weight: 600; color: var(--accent); text-transform: uppercase; }
.hero h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(44px, 6vw, 80px); line-height: 1.02; letter-spacing: -0.02em;
}
.hero p { margin: 0; font-size: 20px; line-height: 1.55; max-width: 500px; color: var(--muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }

.btn {
  display: inline-block; padding: 14px 26px; border-radius: 12px;
  font-weight: 600; font-size: 16px; text-decoration: none; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--ghost { border-color: var(--ink); color: var(--ink); }

/* ---------- Blocos ---------- */
.tiles { flex: 1 1 440px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 10px; padding: 28px;
  border-radius: var(--radius); text-decoration: none; color: var(--ink);
}
.tile:hover { text-decoration: none; transform: translateY(-2px); }
.tile { transition: transform .15s ease; }
.tile--wide { grid-column: span 2; padding: 32px; }
.tile h2, .tile h3 { margin: 0; font-family: var(--sans); font-size: 22px; font-weight: 600; }
.tile--wide h2 { font-size: 24px; }
.tile p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.tile__glyph { font-size: 34px; font-weight: 600; line-height: 1; }
.tile__formula { font-family: var(--serif); font-style: italic; font-size: 46px; line-height: 1.1; }
.tile__formula sup { font-size: .55em; }
.tile--math { background: var(--math-bg); } .tile--math .tile__formula { color: var(--math-fg); }
.tile--prog { background: var(--prog-bg); min-height: 180px; } .tile--prog .tile__glyph { color: var(--prog-fg); }
.tile--teo  { background: var(--teo-bg);  min-height: 180px; } .tile--teo svg { color: var(--teo-fg); }
.tile--inv  { background: var(--inv-bg); color: var(--inv-ink); padding: 32px; }
.tile--inv p, .tile--inv h3 { color: var(--inv-ink); }
.tile--inv .tile__label { font-size: 13px; font-weight: 600; letter-spacing: .12em; }
.tile--inv h3 { font-family: var(--serif); font-size: 30px; }
.tile--plain { background: var(--surface); border: 1px solid var(--rule); padding: 32px; }
.tile--plain h3 { font-family: var(--serif); font-size: 26px; }

.row { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px 0 24px; }
.row > .tile--inv { flex: 2 1 420px; }
.row > .tile--plain { flex: 1 1 240px; }

/* ---------- Posts ---------- */
.section { padding: 48px 0 96px; }
.section__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 20px; }
.section__head h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 34px; }
.link-more { display: inline-block; padding: 12px 0; font-size: 15px; font-weight: 600; }

.post-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.post-card {
  flex: 1 1 300px; min-width: 0; max-width: 100%;
  display: flex; flex-direction: column; gap: 14px; padding: 28px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
}
.post-card:hover { text-decoration: none; border-color: var(--accent); }
.post-card__tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.post-card__title { font-family: var(--serif); font-size: 24px; line-height: 1.25; }
.post-card__date { font-size: 14px; color: var(--faint); }

.pill { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.pill--matematica { background: var(--math-bg); color: var(--math-fg); }
.pill--programacao { background: var(--prog-bg); color: var(--prog-fg); }
.pill--teologia { background: var(--teo-bg); color: var(--teo-fg); }
.pill--outros { background: var(--code-bg); color: var(--muted); }
.fmt {
  font-size: 12px; font-weight: 600; letter-spacing: .06em; border-radius: 6px;
  border: 1px solid var(--accent); color: var(--accent); padding: 3px 8px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.chip {
  font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.post-card[hidden] { display: none; }

/* ---------- Cabeçalho de um post ---------- */
.post-header { margin: 0 0 32px; padding-bottom: 24px; border-bottom: 1px solid var(--rule); }
.post-header .post-card__tags { margin-bottom: 16px; }
.post-header h1 { margin: 0 0 12px; }
.post-header__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; color: var(--faint); font-size: 15px; }
.btn--pdf {
  padding: 10px 18px; font-size: 15px; border: 1px solid var(--accent); color: var(--accent);
  background: transparent; border-radius: 10px;
}

/* ---------- Posts em Typst ---------- */
.typst-post { color: var(--muted); }
.typst-post h1, .typst-post h2, .typst-post h3 { color: var(--ink); }
.typst-post figure { margin: 28px 0; text-align: center; }
.typst-post figure svg { margin-left: auto; margin-right: auto; }
.typst-post figcaption { font-size: 15px; color: var(--faint); margin-top: 8px; }
.typst-post .eq { margin: 24px 0; text-align: center; overflow-x: auto; }
.typst-post svg { filter: var(--frame-filter); }
/* O Typst grava cores de realce de sintaxe pensadas para fundo claro;
   neutraliza-as para manter o contraste nos dois temas. */
.typst-post pre span[style] { color: inherit !important; }
.typst-post math { font-size: 1.1em; }
.typst-post math[display="block"] { display: block math; margin: 24px 0; overflow-x: auto; scrollbar-width: none; }
.typst-post table { margin: 24px 0; }
.typst-pages { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.typst-pages img { width: 100%; height: auto; background: #fff; border-radius: 6px; filter: var(--frame-filter); }

/* ---------- Rodapé ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 28px 40px; text-align: center; font-size: 14px; color: var(--faint); }
.site-footer a { color: inherit; }

/* ---------- Responsivo ---------- */
@media (max-width: 760px) {
  .container { padding-left: 20px; padding-right: 20px; }
  .site-header__inner {
    padding: 4px 20px 0; min-height: 0; row-gap: 0;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand toggle" "nav nav";
  }
  .brand { font-size: 20px; padding: 6px 0; }
  .site-nav { gap: 0 22px; }
  .site-nav a { padding: 11px 0 10px; }
  :root { --header-h: 100px; }
  .hero { padding: 40px 0 32px; gap: 32px; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile--wide { grid-column: auto; }
  .franklin-content { padding: 32px 20px 72px; }
  .site-footer { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .tile:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .theme-toggle { display: none; }
  :root, :root[data-theme="dark"] { --bg: #fff; --ink: #000; --muted: #222; --frame-filter: none; }
}

/*math {
  font-family: "Latin Modern Math", "STIX Two Math", "Cambria Math", serif;
}*/

