/* ==========================================================================
   Kerygma — estilo minimalista focado em leitura
   ========================================================================== */

:root {
  --paper: #faf8f4;
  --surface: #ffffff;
  --ink: #1f1d1a;
  --ink-soft: #5c5750;
  --line: #e6e1d8;
  --accent: #7a2e2e;        /* bordô litúrgico */
  --accent-soft: #f3e9e6;
  --gold: #a8874a;
  --success: #2f6b45;
  --danger: #a3302a;

  /* Gentium Book Plus: latim + grego politônico; Noto Serif Hebrew assume os glifos hebraicos */
  --font-serif: "Gentium Book Plus", "Noto Serif Hebrew", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-hebrew: "Noto Serif Hebrew", "SBL Hebrew", "Ezra SIL", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius: 6px;
  --measure: 40rem;
  --wide: 60rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151412;
    --surface: #1d1b19;
    --ink: #ece7df;
    --ink-soft: #a39c91;
    --line: #2f2c28;
    --accent: #d98b7e;
    --accent-soft: #2c1f1d;
    --gold: #c9a96a;
    --success: #7cc393;
    --danger: #ef8a82;
    color-scheme: dark;
  }
}

/* Reset enxuto ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
code { font-family: var(--font-mono); font-size: .9em; background: var(--accent-soft); padding: .1em .35em; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { top: 1rem; }
.muted { color: var(--ink-soft); }

/* Layout ------------------------------------------------------------------ */
.container { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: 1.25rem; }
.container--narrow { max-width: calc(var(--measure) + 2.5rem); }
main.container { flex: 1; padding-block: 2.5rem 4rem; }

.site-header { border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.1rem; }
.brand { display: flex; align-items: baseline; gap: .6rem; color: var(--ink); text-decoration: none; }
.brand__name { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 600; letter-spacing: .02em; }
/* Seletor mais específico que :lang(grc) (que deixa o grego dos textos reto) para manter o itálico no logo */
.brand .brand__greek { font-family: var(--font-serif); font-style: italic; color: var(--gold); font-size: .95rem; }

.site-nav { display: flex; align-items: center; gap: 1.25rem; font-size: .95rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--ink); }

.site-footer { border-top: 1px solid var(--line); padding-block: 1.5rem; font-size: .9rem; color: var(--ink-soft); text-align: center; }
.site-footer p { margin: 0; }

/* Home ---------------------------------------------------------------------- */
.hero { max-width: var(--measure); margin: 1rem auto 3rem; text-align: center; }
.hero__title { font-size: clamp(2.4rem, 6vw, 3.4rem); letter-spacing: .01em; margin-bottom: .2em; }
.hero__tagline { font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); font-size: 1.15rem; }

.search { display: flex; gap: .5rem; max-width: 26rem; margin: 1.75rem auto 0; }
.search input { flex: 1; }
.search-summary { max-width: var(--measure); margin-inline: auto; }

.post-list { max-width: var(--measure); margin-inline: auto; }
.post-card { padding-block: 1.75rem; border-bottom: 1px solid var(--line); }
.post-card:first-child { padding-top: 0; }
.post-card__title { font-size: 1.6rem; margin-bottom: .35em; }
.post-card__title a { color: var(--ink); text-decoration: none; }
.post-card__title a:hover { color: var(--accent); }
.post-card__excerpt { color: var(--ink-soft); font-family: var(--font-serif); font-size: 1.1rem; }
.post-meta { font-size: .85rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.read-more { font-size: .95rem; text-decoration: none; }

.pagination { max-width: var(--measure); margin: 2.5rem auto 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .95rem; }
.empty { text-align: center; color: var(--ink-soft); padding-block: 3rem; font-family: var(--font-serif); font-style: italic; }

/* Artigo -------------------------------------------------------------------- */
.article__header { text-align: center; margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.article__title { font-size: clamp(2rem, 5vw, 2.8rem); margin-block: .3em; }
.article__author { font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); }
.article__footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }

.prose { font-family: var(--font-serif); font-size: 1.2rem; line-height: 1.75; hyphens: auto; overflow-wrap: break-word; }
.prose h2 { font-size: 1.6rem; margin-top: 2em; }
.prose h3 { font-size: 1.3rem; margin-top: 1.75em; }
.prose h4 { font-size: 1.1rem; margin-top: 1.5em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.25em; }
.prose li + li { margin-top: .35em; }
.prose blockquote {
  margin: 1.75em 0; padding: .25em 0 .25em 1.4em;
  border-left: 3px solid var(--gold); color: var(--ink-soft); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; text-align: center; margin: 2.5em 0; }
.prose hr::after { content: "✠"; color: var(--gold); font-size: 1.1rem; }
.prose sup { font-size: .7em; line-height: 0; }
.prose a { overflow-wrap: anywhere; }
.prose figure { margin: 2em 0; }
.prose figure img { display: block; margin-inline: auto; border-radius: var(--radius); }
.prose img { max-width: 100%; height: auto; }
.prose figcaption { margin-top: .6em; text-align: center; font-size: .88em; font-style: italic; color: var(--ink-soft); }

/* Tabelas (comparações) ----------------------------------------------------------- */
.table-scroll { margin: 2em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.prose table { width: 100%; border-collapse: collapse; font-size: .9em; line-height: 1.5; font-variant-numeric: tabular-nums; }
.table-scroll > table { margin: 0; }
.prose caption { caption-side: top; padding-bottom: .6em; text-align: left; font-style: italic; color: var(--ink-soft); }
.prose th, .prose td { padding: .6em .9em; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose thead th { border-bottom: 2px solid var(--gold); font-weight: 700; white-space: nowrap; }
.prose tbody tr:last-child td, .prose tbody tr:last-child th { border-bottom: 0; }
.prose tbody th { font-weight: 600; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.prose th[dir="rtl"], .prose td[dir="rtl"] { text-align: right; }
.prose td p, .prose th p { margin: 0; }
.prose td > :first-child, .prose th > :first-child { margin-top: 0; }

/* No editor as células ficam visíveis mesmo vazias */
.editor__area table { margin: 1.5em 0; }
.editor__area th, .editor__area td,
.editor__area tbody tr:last-child td, .editor__area tbody tr:last-child th { border: 1px dashed color-mix(in srgb, var(--ink-soft) 45%, transparent); min-width: 5em; }
.editor__area thead th { border-bottom: 2px solid var(--gold); }
.editor__area caption { outline: 1px dashed color-mix(in srgb, var(--ink-soft) 30%, transparent); }

.editor__tabletools {
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem;
  padding: .35rem .4rem; border-bottom: 1px solid var(--line);
  background: var(--accent-soft); font-family: var(--font-sans); font-size: .82rem;
}
.editor__tabletools[hidden] { display: none; }
.editor .editor__tabletools button {
  height: 1.9rem; padding: 0 .55rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
}
.editor .editor__tabletools button:hover { border-color: var(--gold); }
.editor .editor__tabletools button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.editor .editor__tabletools .is-danger { color: var(--danger); }
.editor__tabletools-label { font-weight: 600; margin-right: .2rem; }
.editor__tabletools-hint { margin-left: auto; color: var(--ink-soft); }
.checkbox { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }

/* Línguas bíblicas ------------------------------------------------------------ */
:lang(grc), :lang(el), .font-greek { font-family: "Gentium Book Plus", var(--font-serif); font-style: normal; }
/* Hebraico não tem itálico: evita a inclinação artificial dentro de citações e <em> */
:lang(he), :lang(arc), .font-hebrew { font-family: var(--font-hebrew); font-style: normal; }
.prose :lang(he), .prose :lang(arc) { font-size: 1.15em; line-height: 1.5; }
.prose [dir="rtl"] { text-align: right; }
.prose blockquote[dir="rtl"] { border-left: 0; border-right: 3px solid var(--gold); padding: .25em 1.4em .25em 0; }

/* Formulários ----------------------------------------------------------------- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; padding: .65rem .8rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 25%, transparent); }
textarea { resize: vertical; line-height: 1.6; }

.form { display: grid; gap: 1.1rem; max-width: 28rem; }
.form--wide { max-width: none; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .92rem; }
.field label .muted { font-weight: 400; }
.field--error input, .field--error textarea, .field--error select { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .88rem; margin: 0; }
.form__actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.input--title { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 600; }
.form__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.1rem; }

/* Editor visual ---------------------------------------------------------------- */
.editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-family: var(--font-sans); }
.editor:focus-within { border-color: var(--gold); }
.editor.is-busy { cursor: progress; }

.editor__toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: .2rem;
  padding: .4rem; background: var(--surface); font-family: var(--font-sans);
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.editor__toolbar button, .editor__toolbar select { font-family: var(--font-sans); }
/* A barra de tabela fica dentro da barra fixa, ocupando uma linha inteira */
.editor__toolbar > .editor__tabletools { flex-basis: 100%; margin: .3rem -.4rem -.4rem; border-top: 1px solid var(--line); border-bottom: 0; }
.editor__toolbar select { width: auto; padding: .3rem .5rem; font-size: .88rem; }
.editor__toolbar button, .editor__palette button {
  min-width: 2rem; height: 2rem; padding: 0 .4rem;
  border: 1px solid transparent; border-radius: 4px; background: none;
  font-size: .9rem; color: var(--ink); cursor: pointer; line-height: 1;
}
.editor__toolbar button:hover, .editor__palette button:hover { background: var(--accent-soft); }
.editor__toolbar button[aria-pressed="true"], .editor__toolbar button[aria-expanded="true"],
.editor__palette button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--line); color: var(--accent); }
.editor__sep { width: 1px; align-self: stretch; margin: .2rem .25rem; background: var(--line); }
.editor__toolbar .editor__source-btn { font-family: var(--font-mono); font-size: .78rem; }
.editor.is-source .editor__toolbar button:not(.editor__source-btn),
.editor.is-source .editor__toolbar select { opacity: .35; pointer-events: none; }

.editor__palette { padding: .5rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.palette__row { display: flex; flex-wrap: wrap; gap: .2rem; margin-bottom: .3rem; }
.editor__palette button { font-size: 1.2rem; min-width: 2.3rem; height: 2.3rem; background: var(--surface); border-color: var(--line); }
.editor__palette.font-hebrew button { font-size: 1.35rem; }
.editor__palette .palette__wide { font-family: var(--font-sans); font-size: .8rem; }
.palette__hint { margin: .3rem 0 0; font-family: var(--font-sans); font-size: .8rem; color: var(--ink-soft); }

.editor__area { position: relative; min-height: 26rem; padding: 1.5rem 1.75rem; outline: none; font-size: 1.15rem; }
.editor__area > :first-child { margin-top: 0; }
.editor__area.is-empty::before {
  content: attr(data-placeholder); position: absolute; top: 1.5rem; left: 1.75rem;
  color: var(--ink-soft); font-style: italic; pointer-events: none;
}
.editor__area img { cursor: default; }
.editor .editor-source { border: 0; border-radius: 0; min-height: 26rem; font-family: var(--font-mono); font-size: .88rem; }

.editor__status { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .8rem; border-top: 1px solid var(--line); font-size: .82rem; }
.editor__status .is-error { color: var(--danger); }
.editor-source { font-family: var(--font-mono); font-size: .9rem; }

.dialog { width: min(32rem, calc(100vw - 2rem)); padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog h2 { font-size: 1.25rem; }
.dialog .form { max-width: none; }
.dialog__preview { max-height: 12rem; width: auto; margin-inline: auto; border-radius: var(--radius); }

.button, .search button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .65rem 1.2rem; border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer; transition: opacity .15s ease;
}
.button:hover, .search button:hover { opacity: .88; }
.button--ghost { background: transparent; color: var(--ink); }
.button--small { padding: .35rem .8rem; font-size: .85rem; }

.link-button { background: none; border: 0; padding: 0; color: var(--ink-soft); cursor: pointer; font-size: inherit; }
.link-button:hover { color: var(--ink); text-decoration: underline; }
.link-button--danger { color: var(--danger); }
.link-button--danger:hover { color: var(--danger); }
.inline-form { display: inline; margin: 0; }

/* Alertas ------------------------------------------------------------------ */
.alert { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1.5rem; border: 1px solid var(--line); background: var(--surface); font-size: .95rem; }
.alert p { margin: 0; }
.alert--success { border-color: color-mix(in srgb, var(--success) 40%, transparent); color: var(--success); }
.alert--error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
.alert--info { border-color: color-mix(in srgb, var(--gold) 50%, transparent); }

/* Autenticação e erros ------------------------------------------------------- */
.auth-card { max-width: 24rem; margin: 2rem auto; }
.auth-card .form { max-width: none; }
.error-page { text-align: center; padding-block: 3rem; }
.error-page__code { font-family: var(--font-serif); font-size: 4rem; color: var(--gold); margin: 0; line-height: 1; }

/* Painel ---------------------------------------------------------------------- */
.admin-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 2rem; font-size: .95rem; }
.admin-nav a { color: var(--ink-soft); text-decoration: none; padding-bottom: .75rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-nav a:hover { color: var(--ink); }
.admin-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.admin-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-header h1 { margin: 0; font-size: 1.8rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: .75rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 600; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions > * + * { margin-left: .9rem; }
.table tr.is-inactive td { opacity: .5; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge--published { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge--draft { background: var(--accent-soft); color: var(--ink-soft); }

.panel { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.panel h2 { font-size: 1.35rem; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0; }
.details dt { color: var(--ink-soft); }
.details dd { margin: 0; }

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .prose { font-size: 1.1rem; }
  .site-nav { gap: 1rem; }
  .search { flex-direction: column; }
}

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