/* ==========================================================================
   Oxton Journals — leitor de PDF nativo (pdf.js)
   Plano: sem sombras, transições, transformações decorativas ou animações.
   Inter · pesos 400/500/600 · azul #1A3AF0 · âmbar #F59E0B · cinza #F6F5F4
   ========================================================================== */

:root {
  --oxr-primary: #1A3AF0;
  --oxr-amber: #F59E0B;
  --oxr-bg: #fff;
  --oxr-stage: #EFEDEB;
  --oxr-soft: #F6F5F4;
  --oxr-line: #E6E4E1;
  --oxr-line-2: #D4D1CD;
  --oxr-text: #1F2430;
  --oxr-text-2: #3A4050;
  --oxr-muted: #5F6577;
  --oxr-paper-line: #D4D1CD;
  --oxr-hl: rgba(245, 158, 11, .38);
  --oxr-hl-on: rgba(26, 58, 240, .32);
  --oxr-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --oxr-side: 300px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.oxr { margin: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--oxr-stage); color: var(--oxr-text); font: 400 14px/1.5 var(--oxr-font); -webkit-font-smoothing: antialiased; }
.oxr a { color: var(--oxr-primary); text-decoration: none; }
.oxr a:hover { text-decoration: underline; }
.oxr button, .oxr input, .oxr select { font: inherit; color: inherit; }
.oxr :focus-visible { outline: 2px solid var(--oxr-primary); outline-offset: 1px; }
.oxr [hidden] { display: none !important; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.oxr-skip { position: absolute; left: -9999px; top: 6px; z-index: 50; background: var(--oxr-primary); color: #fff !important; padding: 8px 12px; border-radius: 6px; }
.oxr-skip:focus { left: 8px; }

/* Barra de progresso do carregamento */
.oxr-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 60; pointer-events: none; }
.oxr-progress span { display: block; height: 100%; width: 0; background: var(--oxr-amber); }

/* ---------------------------------------------------------------- Barra do artigo */
.oxr-top { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 14px 0 8px; background: var(--oxr-bg); border-bottom: 1px solid var(--oxr-line); }
.oxr-back { display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 12px 0 6px; border-radius: 8px; color: var(--oxr-text) !important; font-weight: 600; text-decoration: none !important; flex: 0 0 auto; border: 1px solid transparent; }
.oxr-back:hover { background: var(--oxr-soft); border-color: var(--oxr-line); }
.oxr-back__j { font-size: 14px; color: var(--oxr-primary); letter-spacing: .02em; }
.oxr-top__id { display: flex; flex-direction: column; min-width: 0; flex: 1; padding-left: 14px; border-left: 1px solid var(--oxr-line); line-height: 1.3; }
.oxr-top__title { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oxr-top__meta { display: flex; gap: 0; font-size: 12.5px; color: var(--oxr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oxr-top__meta span { overflow: hidden; text-overflow: ellipsis; }
.oxr-top__meta span + span::before { content: "·"; margin: 0 7px; }
.oxr-top__actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* Botões */
.oxr-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--oxr-line-2); background: var(--oxr-bg); color: var(--oxr-text) !important; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.oxr-btn:hover { border-color: var(--oxr-primary); color: var(--oxr-primary) !important; }
.oxr-btn--primary { background: var(--oxr-primary); border-color: var(--oxr-primary); color: #fff !important; }
.oxr-btn--primary:hover { color: #fff !important; filter: brightness(.93); }
.oxr-btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.oxr-ibtn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--oxr-text-2); cursor: pointer; flex: 0 0 auto; }
.oxr-ibtn:hover { background: var(--oxr-soft); border-color: var(--oxr-line); color: var(--oxr-primary); }
.oxr-ibtn[aria-pressed="true"] { background: #EEF1FE; border-color: #D5DCFD; color: var(--oxr-primary); }
.oxr-ibtn:disabled { opacity: .4; cursor: default; background: transparent; border-color: transparent; }
.oxr-ibtn--sm { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- Ferramentas */
.oxr-tools { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 6px 12px; background: var(--oxr-bg); border-bottom: 1px solid var(--oxr-line); }
.oxr-tools__group { display: flex; align-items: center; gap: 4px; min-width: 0; }
.oxr-tools__right { gap: 8px; }
.oxr-sep { width: 1px; height: 22px; background: var(--oxr-line); margin: 0 6px; }
.oxr-pageno { display: inline-flex; align-items: center; gap: 7px; margin-left: 6px; font-size: 13.5px; color: var(--oxr-muted); }
.oxr-pageno input { width: 46px; height: 32px; padding: 0 6px; text-align: center; border: 1px solid var(--oxr-line-2); border-radius: 7px; background: var(--oxr-bg); color: var(--oxr-text); }
.oxr-pageno b { font-weight: 500; color: var(--oxr-text); }
.oxr-select { height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--oxr-line-2); border-radius: 7px; background: var(--oxr-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%235F6577' stroke-width='1.6'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center; -webkit-appearance: none; appearance: none; font-size: 13.5px; cursor: pointer; min-width: 150px; }
.oxr-find { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 3px 0 11px; border: 1px solid var(--oxr-line-2); border-radius: 17px; color: var(--oxr-muted); background: var(--oxr-bg); }
.oxr-find:focus-within { border-color: var(--oxr-primary); }
.oxr-find input { width: 190px; border: 0; outline: 0; background: transparent; font-size: 13.5px; color: var(--oxr-text); min-width: 0; padding-left: 4px; }
.oxr-find input::-webkit-search-cancel-button { cursor: pointer; }
.oxr-find__count { font-size: 12px; color: var(--oxr-muted); white-space: nowrap; min-width: 0; }
.oxr-find__count:empty { display: none; }
.oxr-modes { display: inline-flex; border: 1px solid var(--oxr-line-2); border-radius: 8px; overflow: hidden; }
.oxr-modes button { height: 32px; padding: 0 11px; border: 0; border-right: 1px solid var(--oxr-line-2); background: var(--oxr-bg); font-size: 12.5px; font-weight: 500; color: var(--oxr-text-2); cursor: pointer; }
.oxr-modes button:last-child { border-right: 0; }
.oxr-modes button:hover { color: var(--oxr-primary); }
.oxr-modes button[aria-pressed="true"] { background: var(--oxr-primary); color: #fff; }

/* ---------------------------------------------------------------- Corpo */
.oxr-body { flex: 1 1 auto; display: flex; min-height: 0; position: relative; }
.oxr-side { flex: 0 0 var(--oxr-side); width: var(--oxr-side); display: flex; flex-direction: column; background: var(--oxr-bg); border-right: 1px solid var(--oxr-line); min-height: 0; }
.oxr-tabs { display: flex; align-items: center; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--oxr-line); }
.oxr-tabs [role="tab"] { height: 36px; padding: 0 11px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 13px; font-weight: 500; color: var(--oxr-muted); cursor: pointer; margin-bottom: -1px; }
.oxr-tabs [role="tab"]:hover { color: var(--oxr-primary); }
.oxr-tabs [role="tab"][aria-selected="true"] { color: var(--oxr-primary); border-bottom-color: var(--oxr-primary); }
.oxr-side__close { margin-left: auto; margin-bottom: 4px; }
.oxr-panel { flex: 1 1 auto; overflow: auto; min-height: 0; }

.oxr-thumbs { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 12px 24px; }
.oxr-thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border: 1px solid transparent; border-radius: 8px; background: none; cursor: pointer; color: var(--oxr-muted); font-size: 12px; }
.oxr-thumb:hover { background: var(--oxr-soft); }
.oxr-thumb__img { display: block; width: 120px; background: #fff; border: 1px solid var(--oxr-paper-line); }
.oxr-thumb__img canvas { display: block; width: 100%; height: 100%; }
.oxr-thumb.is-current { border-color: #D5DCFD; background: #EEF1FE; color: var(--oxr-primary); font-weight: 600; }
.oxr-thumb.is-current .oxr-thumb__img { border-color: var(--oxr-primary); }

.oxr-outline { padding: 10px 8px 24px; font-size: 13.5px; }
.oxr-outline ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.oxr-outline > ul { padding-left: 0; }
.oxr-outline button { display: block; width: 100%; text-align: left; padding: 6px 10px; border: 0; border-radius: 6px; background: none; cursor: pointer; color: var(--oxr-text-2); line-height: 1.4; }
.oxr-outline button:hover { background: var(--oxr-soft); color: var(--oxr-primary); }
.oxr-outline > ul > li > button { font-weight: 500; color: var(--oxr-text); }
.oxr-outline__empty { padding: 14px; color: var(--oxr-muted); font-size: 13px; }

.oxr-info { padding: 18px 18px 28px; }
.oxr-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; background: #EEF1FE; color: var(--oxr-primary); font-size: 12px; font-weight: 500; }
.oxr-info__title { font-size: 16px; font-weight: 600; line-height: 1.35; margin: 10px 0 12px; }
.oxr-info__authors { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.oxr-info__authors li { display: flex; flex-direction: column; font-size: 13.5px; line-height: 1.35; }
.oxr-info__authors span { font-weight: 500; }
.oxr-info__authors small { color: var(--oxr-muted); font-size: 12.5px; }
.oxr-info__authors a { font-size: 12px; }
.oxr-facts { margin: 0 0 16px; border-top: 1px solid var(--oxr-line); }
.oxr-facts > div { display: grid; grid-template-columns: 82px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--oxr-line); font-size: 13px; }
.oxr-facts dt { color: var(--oxr-muted); }
.oxr-facts dd { margin: 0; word-break: break-word; }
.oxr-cite { border: 1px solid var(--oxr-line); border-radius: 9px; padding: 12px; margin-bottom: 14px; }
.oxr-cite__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--oxr-muted); }
.oxr-cite__text { font-size: 13px; line-height: 1.55; color: var(--oxr-text-2); word-break: break-word; }
.oxr-cite__export { display: flex; gap: 14px; margin-top: 8px; font-size: 12.5px; font-weight: 500; }
.oxr-info__links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- Páginas */
.oxr-stage { flex: 1 1 auto; overflow: auto; position: relative; outline: 0; min-width: 0; }
.oxr-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 16px 40px; min-width: min-content; }
.oxr-page { position: relative; flex: 0 0 auto; background: #fff; outline: 1px solid var(--oxr-paper-line); overflow: hidden; }
.oxr-page canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.oxr-page__num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--oxr-line-2); pointer-events: none; }
.oxr-page.is-ready .oxr-page__num { display: none; }
.oxr-links { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.oxr-links a { position: absolute; pointer-events: auto; display: block; }
.oxr-links a:hover { background: rgba(26, 58, 240, .08); outline: 1px solid rgba(26, 58, 240, .35); text-decoration: none; }
.oxr-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; text-align: center; color: var(--oxr-muted); font-size: 14px; z-index: 4; }
.oxr-state p { margin: 0; }
.oxr-state__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px !important; }

/* Camada de texto do pdf.js (seleção e busca) */
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 2; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer span[role="img"] { -webkit-user-select: none; user-select: none; cursor: default; }
.textLayer .oxr-hl { position: static; margin: -1px; padding: 1px; border-radius: 3px; background-color: var(--oxr-hl); color: transparent; }
.textLayer .oxr-hl.is-on { background-color: var(--oxr-hl-on); }
.textLayer ::selection { background: rgba(26, 58, 240, .25); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; -webkit-user-select: none; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }

/* ---------------------------------------------------------------- Modos de leitura */
.oxr[data-mode="sepia"] { --oxr-stage: #E9E2D3; }
.oxr[data-mode="sepia"] .oxr-page { background: #F8F1E3; outline-color: #D8CBB2; }
.oxr[data-mode="sepia"] .oxr-page canvas { filter: sepia(.32) saturate(.92) brightness(.98); }
.oxr[data-mode="noturno"] { --oxr-stage: #171C2B; }
.oxr[data-mode="noturno"] .oxr-page { background: #222838; outline-color: #2E3548; }
.oxr[data-mode="noturno"] .oxr-page canvas { filter: invert(.89) hue-rotate(180deg) brightness(1.05); }
.oxr[data-mode="noturno"] .oxr-page__num { color: #4A5268; }

/* ---------------------------------------------------------------- Responsivo */
@media (max-width: 1180px) {
  .oxr-modes { display: none; }
  .oxr-find input { width: 150px; }
}
@media (max-width: 980px) {
  .oxr-side { position: absolute; left: 0; top: 0; bottom: 0; z-index: 20; }
  .oxr-select { min-width: 0; }
  .oxr-hide-sm { display: none !important; }
}
@media (max-width: 760px) {
  .oxr-top { gap: 8px; padding-right: 10px; }
  .oxr-top__id { padding-left: 8px; }
  .oxr-top__meta { display: none; }
  .oxr-back__j { display: none; }
  .oxr-tools { flex-wrap: wrap; gap: 6px; }
  .oxr-tools__zoom .oxr-select { display: none; }
  .oxr-tools__right { order: 3; width: 100%; }
  .oxr-find { flex: 1; }
  .oxr-find input { width: auto; flex: 1; }
  .oxr-pages { padding: 10px 8px 30px; gap: 10px; }
  :root { --oxr-side: min(86vw, 320px); }
}
@media (max-width: 480px) {
  .oxr-hide-xs { display: none; }
  .oxr-top__actions .oxr-btn--primary { width: 38px; padding: 0; }
}
@media print {
  .oxr-top, .oxr-tools, .oxr-side, .oxr-progress { display: none !important; }
}
.oxr-back__mark { display: inline-flex; color: var(--oxr-primary); margin: 0 2px 0 2px; }
@media (max-width: 760px) { .oxr-back__mark { display: none; } }
