/* Paleta estilo estudio: oscuro navy + oro; claro papel cálido */
:root {
  color-scheme: light;
  --bg: #f2ebe0;
  --bg-elevated: #faf6ef;
  --surface: #fffcf7;
  --text: #1f1c18;
  --muted: #5e584f;
  --gold: #8a6b2f;
  --gold-bright: #a07c38;
  --border: rgba(138, 107, 47, 0.22);
  --reader-max: 100%;
  --reader-pad-x: clamp(0.65rem, 2.2vw, 1.15rem);
  --reader-base: clamp(1.15rem, 0.85vw + 1rem, 1.45rem);
  --reader-scale: 1;
  --heading-scale: 1;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-read: "Lora", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --quote-bg: rgba(138, 107, 47, 0.09);
  --code-bg: rgba(31, 28, 24, 0.06);
  --shadow: 0 2px 20px rgba(31, 28, 24, 0.06);
  --link: #7a5c28;
  --link-hover: #5a4319;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e131a;
  --bg-elevated: #121a24;
  --surface: #151d28;
  --text: #e9e6e1;
  --muted: #9d988f;
  --gold: #c9a85c;
  --gold-bright: #dfc07a;
  --border: rgba(201, 168, 92, 0.28);
  --quote-bg: rgba(201, 168, 92, 0.09);
  --code-bg: rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 28px rgba(0, 0, 0, 0.4);
  --link: #dfc07a;
  --link-hover: #f0d58f;
}

/* Pizarra: verde encerado alternativo */
[data-theme="pizarra"] {
  color-scheme: dark;
  --bg: #152019;
  --bg-elevated: #1a2820;
  --surface: #1e2a22;
  --text: #e6eee8;
  --muted: #93a898;
  --gold: #b8cf88;
  --gold-bright: #d4e8a8;
  --border: rgba(184, 207, 136, 0.3);
  --quote-bg: rgba(184, 207, 136, 0.1);
  --code-bg: rgba(0, 0, 0, 0.32);
  --shadow: 0 4px 28px rgba(0, 0, 0, 0.38);
  --link: #d4e8a8;
  --link-hover: #e8fac0;
}

* { box-sizing: border-box; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(201, 168, 92, 0.07), transparent 50%);
  color: var(--text);
  line-height: 1.5;
  --reader-size: calc(var(--reader-base) * var(--reader-scale));
  padding-top: calc(2.85rem + env(safe-area-inset-top, 0px));
}

[data-theme="dark"] body {
  background-image: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(201, 168, 92, 0.06), transparent 55%);
}

[data-theme="pizarra"] body {
  background-image: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(184, 207, 136, 0.07), transparent 55%), linear-gradient(180deg, #152019 0%, #0f1611 100%);
}

.app {
  flex: 1 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  transition: grid-template-columns 0.25s ease;
}

@media (min-width: 960px) {
  .app {
    grid-template-columns: minmax(15rem, 21rem) minmax(0, 1fr);
  }
}

body.reader-focus .app {
  grid-template-columns: minmax(0, 1fr) !important;
}

body.reader-focus .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(22rem, 90vw);
  height: 100vh;
  max-height: 100vh;
  max-height: 100dvh;
  z-index: 120;
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  box-shadow: var(--shadow);
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.reader-focus.drawer-open .sidebar {
  transform: translateX(0);
}

body.reader-focus .reader-wrap {
  padding-left: max(var(--reader-pad-x), env(safe-area-inset-left));
  padding-right: max(var(--reader-pad-x), env(safe-area-inset-right));
}

body.reader-focus {
  --reader-max: 100%;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1100;
  padding: 0.5rem 1rem;
  background: var(--gold-bright);
  color: var(--bg-elevated);
  border-radius: 8px;
  outline: 2px solid var(--text);
}

/* Barra fija: GTranslate arriba a la derecha (como Torah Viviente) */
.site-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) var(--reader-pad-x) 0.35rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-top-bar-inner {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.gtranslate-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--gold) 8%);
  max-width: min(100%, 18rem);
  flex-wrap: wrap;
}

.gtranslate-bar--file {
  max-width: min(100%, 26rem);
  border-style: dashed;
}

.gtranslate-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.gtranslate-label--muted {
  font-weight: 500;
  color: var(--muted);
  white-space: normal;
}

.gtranslate_wrapper {
  font-size: 0.82rem;
  min-width: 0;
}

.gtranslate_wrapper select {
  max-width: min(72vw, 14rem);
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

[data-theme="dark"] .gtranslate_wrapper select,
[data-theme="pizarra"] .gtranslate_wrapper select {
  background: var(--bg);
}

.sidebar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
}

@media (min-width: 960px) {
  .sidebar {
    border-bottom: none;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    max-height: 100vh;
    max-height: 100dvh;
    align-self: start;
    overflow: hidden;
  }

  body.reader-focus .sidebar {
    z-index: 120;
  }

  .sidebar-menu-toggle {
    display: inline-flex;
  }

  body.sidebar-menu-collapsed:not(.reader-focus) .app {
    grid-template-columns: auto minmax(0, 1fr);
  }

  body.sidebar-menu-collapsed .sidebar-body {
    display: none !important;
  }

  body.sidebar-menu-collapsed:not(.reader-focus) .sidebar {
    overflow: visible;
  }
}

/* Cuerpo lateral: el índice (nav) hace scroll; cabecera y publicación quedan fijos */
.sidebar-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
}

.sidebar-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar-menu-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

@media (min-width: 960px) {
  .sidebar-header .toolbar {
    display: none;
  }
}

/* Botones generales sidebar */
button,
.file-label {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

button:hover,
.file-label:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
}

button.primary {
  background: linear-gradient(145deg, var(--gold-bright), var(--gold));
  color: #121820 !important;
  border-color: transparent;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme="light"] button.primary {
  color: #2a2218 !important;
  text-shadow: none;
}

button.primary:hover {
  filter: brightness(1.08);
}

button.ghost {
  background: transparent;
}

/* Cabecera: flujo normal del documento (un solo scroll, sin tapar el texto) */
.reader-chrome {
  padding: 1.25rem var(--reader-pad-x) 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  position: relative;
  z-index: 1;
}

.reader-chrome-banner {
  width: 100%;
  margin: 0 0 0.45rem;
  padding: 0.35rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
}

.reader-chrome-aux {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  margin: 0 0 0.4rem;
}

.share-feedback {
  margin: 0 0 0.65rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--gold-bright);
  text-align: center;
  border-radius: 8px;
  background: rgba(201, 168, 92, 0.12);
  border: 1px solid rgba(201, 168, 92, 0.35);
  min-height: 0;
}

[data-theme="light"] .share-feedback {
  background: rgba(138, 107, 47, 0.1);
  border-color: rgba(138, 107, 47, 0.3);
  color: var(--gold);
}

[data-theme="pizarra"] .share-feedback {
  background: rgba(184, 207, 136, 0.12);
  border-color: rgba(184, 207, 136, 0.35);
  color: var(--gold-bright);
}

.share-feedback--error {
  color: #c75c5c;
  border-color: rgba(199, 92, 92, 0.45);
  background: rgba(199, 92, 92, 0.08);
}

.reader-kicker {
  margin: 0;
  width: 100%;
  max-width: none;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3.5vw + 0.45rem, 2.35rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold);
  text-wrap: balance;
  text-align: center;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.reader-chrome-hint {
  margin: 0 0 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: none;
}

.doc-title {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.5vw + 0.85rem, 1.65rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.22;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.reading-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-sans);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-pill:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(201, 168, 92, 0.08);
}

[data-theme="pizarra"] .btn-pill:hover {
  background: rgba(184, 207, 136, 0.1);
}

.btn-pill svg {
  flex-shrink: 0;
  opacity: 0.9;
}

.btn-pill--url {
  padding: 0.35rem 0.75rem;
  font-size: 0.65rem;
}

.theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-icon svg {
  display: block;
}

.font-circle-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(201, 168, 92, 0.05);
}

[data-theme="light"] .font-circle-group {
  background: rgba(138, 107, 47, 0.06);
}

.btn-circle {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.15s;
}

.btn-circle:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  transform: scale(1.05);
}

.focus-sidebar-btn {
  display: none;
}

body.reader-focus .focus-sidebar-btn {
  display: inline-flex;
}

.mobile-drawer-toggle {
  display: inline-flex;
}

@media (min-width: 960px) {
  .mobile-drawer-toggle {
    display: none;
  }

  #close-drawer {
    display: none;
  }
}

.nav-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.75rem 0 1rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.index-list {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem;
}

.index-list-item {
  margin: 0;
  padding: 0;
}

.index-item-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}

.index-title-btn {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  text-align: left;
  border: none;
  background: transparent;
  padding: 0.65rem 0.75rem;
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
}

.index-share-btn {
  flex-shrink: 0;
  width: 2.4rem;
  min-width: 2.4rem;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.index-share-btn:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(201, 168, 92, 0.1);
}

[data-theme="light"] .index-share-btn:hover {
  background: rgba(138, 107, 47, 0.08);
}

[data-theme="pizarra"] .index-share-btn:hover {
  background: rgba(184, 207, 136, 0.12);
}

.index-title-btn:hover {
  background: rgba(201, 168, 92, 0.12);
}

[data-theme="light"] .index-title-btn:hover {
  background: rgba(138, 107, 47, 0.1);
}

[data-theme="pizarra"] .index-title-btn:hover {
  background: rgba(184, 207, 136, 0.14);
}

.index-title-btn.active {
  background: rgba(201, 168, 92, 0.2);
  font-weight: 600;
  color: var(--gold-bright);
}

[data-theme="light"] .index-title-btn.active {
  background: rgba(138, 107, 47, 0.15);
  color: var(--gold);
}

[data-theme="pizarra"] .index-title-btn.active {
  background: rgba(184, 207, 136, 0.2);
}

.upload-panel {
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-grow: 0;
  background: var(--surface);
}

.upload-panel h2 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.upload-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upload-row input[type="text"] {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.upload-row input[type="file"] {
  font-size: 0.78rem;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.upload-panel .hint code {
  font-size: 0.7rem;
  padding: 0.12em 0.4em;
  background: var(--code-bg);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.hint {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
  line-height: 1.5;
}

.status {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  min-height: 1.25em;
}

.status.error { color: #dc2626; }
[data-theme="dark"] .status.error,
[data-theme="pizarra"] .status.error { color: #fca5a5; }
.status.ok { color: var(--gold-bright); }

.main {
  min-width: 0;
  width: 100%;
  display: block;
}

.reader-wrap {
  width: 100%;
  padding: 2rem var(--reader-pad-x) 4.5rem;
}

@media (min-width: 640px) {
  .reader-wrap {
    padding: 2.5rem var(--reader-pad-x) 5.5rem;
  }
}

.reader.md-prose {
  max-width: var(--reader-max);
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  font-family: var(--font-read);
  font-size: var(--reader-size);
  line-height: 1.82;
  letter-spacing: 0.018em;
  color: var(--text);
  text-wrap: pretty;
  font-weight: 400;
}

.md-prose > *:first-child { margin-top: 0; }

.md-prose h1,
.md-prose h2,
.md-prose h3,
.md-prose h4,
.md-prose h5,
.md-prose h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  margin: 1.5em 0 0.5em;
  color: var(--gold);
}

.md-prose h1 {
  font-size: calc(1.85em * var(--heading-scale));
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4em;
  margin-top: 0.25em;
}

.md-prose h2 {
  font-size: calc(1.42em * var(--heading-scale));
  letter-spacing: 0.04em;
}

.md-prose h3 {
  font-size: calc(1.22em * var(--heading-scale));
  font-style: italic;
}

.md-prose h4 { font-size: calc(1.08em * var(--heading-scale)); }
.md-prose h5 { font-size: calc(1.02em * var(--heading-scale)); opacity: 0.95; }
.md-prose h6 { font-size: 1em; opacity: 0.9; }

.md-prose p {
  margin: 0 0 1.05em;
}

.md-prose a {
  color: var(--link);
  text-underline-offset: 0.22em;
}

.md-prose a:hover {
  color: var(--link-hover);
}

.md-prose strong {
  font-weight: 700;
  color: var(--text);
}

.md-prose em { font-style: italic; }

.md-prose del { opacity: 0.8; }

.md-prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.2em 0;
}

.md-prose ul,
.md-prose ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

.md-prose li {
  margin: 0.4em 0;
}

.md-prose li::marker {
  color: var(--gold-bright);
}

.md-prose blockquote {
  margin: 1.2em 0;
  padding: 0.85em 1.15em;
  border-left: 3px solid var(--gold);
  background: var(--quote-bg);
  font-style: italic;
  color: var(--muted);
}

.md-prose blockquote p:last-child { margin-bottom: 0; }

.md-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.md-prose :not(pre) > code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.14em 0.42em;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.md-prose pre {
  margin: 1.25em 0;
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 0.8em;
  line-height: 1.6;
}

.md-prose pre code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  font-size: inherit;
}

.md-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.35em 0;
  font-size: 0.92em;
}

.md-prose th,
.md-prose td {
  border: 1px solid var(--border);
  padding: 0.55em 0.8em;
  text-align: left;
}

.md-prose th {
  background: var(--quote-bg);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85em;
  color: var(--gold);
}

.md-prose tr:nth-child(even) td {
  background: rgba(201, 168, 92, 0.04);
}

[data-theme="light"] .md-prose tr:nth-child(even) td {
  background: rgba(138, 107, 47, 0.06);
}

[data-theme="pizarra"] .md-prose tr:nth-child(even) td {
  background: rgba(184, 207, 136, 0.06);
}

.md-prose input[type="checkbox"] {
  margin-right: 0.45em;
  accent-color: var(--gold);
}

.empty-state {
  max-width: var(--reader-max);
  margin: 3rem auto;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  padding: 0 1rem;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.55);
  z-index: 90;
}

body.drawer-open .overlay {
  display: block;
}

@media (max-width: 959px) {
  body:not(.drawer-open) .sidebar-body {
    display: none;
  }

  body.drawer-open .app {
    position: relative;
  }

  body.drawer-open .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(20rem, 92vw);
    z-index: 100;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
}

@media (min-width: 960px) {
  .overlay { display: none !important; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.site-footer {
  flex-shrink: 0;
  padding: 1.75rem var(--reader-pad-x) 2rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--surface) 40%);
  text-align: center;
}

.site-footer-inner {
  max-width: 42rem;
  margin: 0 auto;
}

.site-footer-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.2vw + 0.75rem, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.site-footer-text {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.site-footer-cite {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
}

.site-footer-link-wrap {
  margin: 0;
}

.site-footer-link {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--link);
  text-decoration: none;
  word-break: break-all;
}

.site-footer-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.site-footer-paypal {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.site-footer .paypal-buttons {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  box-sizing: border-box;
}

.site-footer .paypal-button {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #003087;
  background: #ffc439;
  font: 800 14px Arial, sans-serif;
  text-decoration: none;
  transition: filter 0.15s ease;
  box-sizing: border-box;
}

.site-footer .paypal-button:hover {
  filter: brightness(1.06);
}

.site-footer .paypal-button strong {
  color: #003087;
}

.site-footer .paypal-button span {
  color: #0070e0;
}

@media (max-width: 520px) {
  .site-footer .paypal-buttons {
    grid-template-columns: 1fr;
  }
}

[data-theme="light"] .site-footer {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}

[data-theme="pizarra"] .md-prose .hljs,
[data-theme="dark"] .md-prose .hljs {
  background: transparent;
}

body:fullscreen .reader-chrome,
body:-webkit-full-screen .reader-chrome {
  background: var(--surface);
}

/* Evitar que el pie quede bajo la barra del sistema en móvil */
@supports (padding: env(safe-area-inset-bottom)) {
  .site-footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}
