/* Pages on templates/site_base.html (public pages, arXiv, reading notes,
   errors). The look comes from theme.css (Corona); these tokens just point
   the older names at it. */
:root {
  --bg: var(--aw-bg);
  --surface: var(--aw-panel);
  --surface-2: var(--aw-panel-2);
  --border: var(--aw-line);
  --text: var(--aw-text);
  --muted: var(--aw-muted);
  --accent: var(--aw-accent);
  --accent-2: var(--aw-soft-text);
  --ok: var(--aw-ok);
  --radius: var(--aw-radius);
}

body.site { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; }
.site-wrap { max-width: var(--aw-max); margin: 0 auto; padding: 0 var(--aw-gutter); box-sizing: border-box; }
.site-main { padding-top: 0; padding-bottom: 96px; }

.hero { margin-bottom: 36px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; margin-bottom: 6px; }
.hero p { color: var(--muted); max-width: 680px; margin: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 0 14px; }
.section-head h2 { font-size: 1.2rem; font-weight: 650; margin: 0; }
.section-head .more { font-size: .9rem; }

.card-x { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.stack > * + * { margin-top: 12px; }

.paper-title { font-weight: 600; font-size: 1rem; line-height: 1.4; color: var(--text) !important; }
.meta { color: var(--muted); font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: .78rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.chip.accent { color: var(--accent); }

.note-card h3 { font-size: 1rem; font-weight: 650; margin: 0 0 2px; }
.note-body { margin-top: 10px; overflow-wrap: anywhere; }
.note-body img { max-width: 100%; height: auto; border-radius: 8px; }
.note-body p:last-child { margin-bottom: 0; }

.empty { color: var(--muted); font-style: italic; }

/* Public paper page and reading notes: title + main column + side panel */
.doc-title { font-size: clamp(30px, 3.6vw, 46px) !important; max-width: 1100px; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 1000px) { .doc-layout { grid-template-columns: minmax(0, 1fr) 340px; } .doc-facts { position: sticky; top: 16px; } }
.abstract-body { font-size: 15px; line-height: 1.7; max-width: 900px; color: #e2dfd6; }
.abstract-body p:last-child { margin-bottom: 0; }
.doc-facts dl { margin: 0; padding: 8px 24px 20px; }
.doc-facts dl > div { padding: 12px 0; border-bottom: 1px solid var(--aw-line); }
.doc-facts dl > div:last-child { border-bottom: 0; }
.doc-facts dt { font-family: var(--aw-mono); font-size: 10.5px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--aw-muted); margin-bottom: 4px; }
.doc-facts dd { margin: 0; font-size: 14px; }
.doc-cats { display: flex; flex-wrap: wrap; gap: 5px; }
.doc-authors { color: var(--aw-muted); font-size: 13px !important; line-height: 1.5; }
.stmt-section { padding: 20px 24px 6px; border-bottom: 1px solid var(--aw-line); }
.stmt-section:last-child { border-bottom: 0; }
.stmt { padding: 0 0 16px 14px; margin-bottom: 16px; border-left: 2px solid var(--aw-line-strong); font-size: 14.5px; line-height: 1.62; }
.stmt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; font-size: 12.5px; color: var(--aw-muted); }

/* Reading notes */
.rd-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; padding: 16px 24px; border-bottom: 1px solid var(--aw-line); transition: background .15s ease; }
.rd-row:last-child { border-bottom: 0; }
.rd-row:hover { background: rgba(32, 31, 28, .55); }
.rd-row h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; line-height: 1.35; }
.rd-row h3 a { color: var(--aw-text); }
.rd-row h3 a:hover { color: var(--aw-accent); }
.rd-authors { font-size: 13px; }
.rd-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.reading-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
@media (min-width: 992px) { .reading-layout { grid-template-columns: 260px minmax(0, 1fr); } }
.toc { position: sticky; top: 16px; padding: 18px 20px; font-size: 13.5px; max-height: calc(100vh - 32px); overflow-y: auto; }
.toc a { display: block; color: var(--aw-muted); padding: 5px 0 5px 10px; border-left: 2px solid transparent; line-height: 1.35; }
.toc a:hover { color: var(--aw-text); border-left-color: var(--aw-accent); }
@media (max-width: 991px) { .toc { position: static; max-height: none; } }
.rnote { scroll-margin-top: 16px; }
.rnote .aw-panel-head h2 { font-size: 18px; }
.rnote-refs { display: flex; gap: 6px; align-items: center; }
.rnote .note-body code { color: var(--aw-soft-text); }
.line-ref { display: inline-block; font-family: var(--aw-mono); font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--aw-soft); border: 1px solid #4a3415; color: var(--aw-soft-text); }
.line-ref:hover { background: var(--aw-accent); color: var(--aw-on-accent); border-color: var(--aw-accent); }

.lines-panel { position: fixed; top: 0; right: 0; height: 100vh; width: min(600px, 100vw); background: var(--aw-panel); border-left: 1px solid var(--aw-line);
  box-shadow: -24px 0 60px rgba(0, 0, 0, .5); transform: translateX(100%); transition: transform .22s ease; z-index: 1040; display: flex; flex-direction: column; }
.lines-panel.open { transform: none; }
.lines-panel header { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 0 20px; border-bottom: 1px solid var(--aw-line); }
.lines-panel header strong { font-weight: 600; font-size: 17px; }
.lines-panel header button { background: none; border: 1px solid var(--aw-line); border-radius: 999px; width: 36px; height: 36px; color: var(--aw-muted); font-size: 1.2rem; line-height: 1; }
.lines-panel header button:hover { color: var(--aw-accent); border-color: var(--aw-accent); }
.lines-body { overflow-y: auto; padding: 10px 0; font-family: var(--aw-mono); font-size: 12.5px; line-height: 1.6; }
.lines-body .ln { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 1px 20px; }
.lines-body .ln .no { color: #6f6d65; text-align: right; user-select: none; }
.lines-body .ln.cited { background: color-mix(in srgb, var(--aw-accent) 13%, transparent); box-shadow: inset 2px 0 0 var(--aw-accent); }
.lines-body .page { color: var(--aw-accent); padding: 12px 20px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; }

/* Flash messages (site_base.html) */
.site-messages { padding-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.site-msg { border: 1px solid var(--aw-line); border-left: 3px solid var(--aw-accent); background: var(--aw-panel); border-radius: var(--aw-radius-sm); padding: 10px 14px; font-size: 14px; }
.site-msg.error { border-left-color: var(--aw-bad); }
.site-msg.success { border-left-color: var(--aw-ok); }

/* arXiv feed and settings */
.arx-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0 0 24px; width: fit-content; max-width: 100%;
  background: var(--aw-panel); border: 1px solid var(--aw-line); border-radius: 999px; }
.arx-tabs .arx-tab { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  font-family: var(--aw-mono); font-size: 12.5px; color: var(--aw-muted); }
.arx-tabs .arx-tab:hover { color: var(--aw-text); background: var(--aw-panel-2); }
.arx-tabs .arx-tab.active { background: var(--aw-accent); color: var(--aw-on-accent); }
.arx-tabs .arx-tab span { font-size: 10px; }
.arx-list > .arx-paper { border-bottom: 1px solid var(--aw-line); }
.arx-list > .arx-paper:last-child { border-bottom: 0; }
.arx-paper { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 6px 24px; padding: 18px 24px 20px; transition: background .15s ease; }
.arx-paper:hover { background: rgba(32, 31, 28, .55); }
.arx-paper.is-match { box-shadow: inset 3px 0 0 var(--aw-ok); }
.arx-side { display: flex; flex-direction: column; gap: 4px; padding-top: 3px; }
.arx-date { font-family: var(--aw-mono); font-size: 11.5px; color: var(--aw-accent); white-space: nowrap; }
.arx-id { font-family: var(--aw-mono); font-size: 11px; color: var(--aw-muted); }
.arx-main h3 { margin: 0 0 6px; font-size: 16px; font-weight: 500; line-height: 1.38; letter-spacing: -0.005em; text-wrap: pretty; }
.arx-main h3 a { color: var(--aw-text); }
.arx-main h3 a:hover { color: var(--aw-accent); }
.arx-authors { font-size: 13px; line-height: 1.45; color: var(--aw-muted); }
.arx-comment { margin-top: 4px; font-size: 12.5px; font-style: italic; color: var(--aw-muted); }
.arx-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.arx-abstract { margin-top: 10px; }
.arx-abstract summary { cursor: pointer; width: fit-content; font-family: var(--aw-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--aw-muted); }
.arx-abstract summary:hover { color: var(--aw-accent); }
.arx-abstract div { margin-top: 8px; max-width: 920px; font-size: 14px; line-height: 1.62; color: #d8d5cc; }
.arx-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-top: 10px; font-size: 13px; }
.arx-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--aw-line); font-size: 12.5px; }
.site mark { background: color-mix(in srgb, var(--aw-ok) 24%, transparent); color: inherit; padding: 0 2px; border-radius: 3px; }

.arx-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 24px; align-items: start; }
.arx-wide { grid-column: 1 / -1; }
.arx-settings .meta { font-size: 13.5px; line-height: 1.55; }
.arx-settings .aw-panel-body h3 { font-size: 15px; font-weight: 600; margin: 24px 0 4px; padding-top: 18px; border-top: 1px solid var(--aw-line); }
.arx-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.arx-row .form-control, .arx-row .form-select { flex: 1 1 220px; width: auto; }
.arx-check { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; }
.arx-branches { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
.arx-keywords { margin: 10px 0 4px; }
.arx-keywords { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.keyword { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 6px 4px 12px; background: var(--aw-soft); border: 1px solid #4a3415; color: var(--aw-soft-text); font-family: var(--aw-mono); font-size: 12px; }
.chip.keyword button { display: inline-flex; background: none; border: 0; color: var(--aw-soft-text); padding: 0 2px; line-height: 1; border-radius: 999px; }
.chip.keyword button:hover { color: var(--aw-bad); }
.arx-job { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--border); color: var(--text); }
.arx-job:first-child { border-top: 0; }
.arx-status { font-family: var(--aw-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.arx-status.s-running, .arx-status.s-queued { color: var(--accent); border-color: var(--accent); }
.arx-status.s-done { color: var(--ok); border-color: var(--ok); }
.arx-status.s-failed { color: var(--aw-bad); border-color: #5c2a25; }
@media (max-width: 640px) {
  .arx-paper { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .arx-side { flex-direction: row; gap: 12px; }
  .arx-pager { padding: 12px 16px; }
}

/* Error pages (templates/4xx.html) */
.aw-error { max-width: 760px; padding: 96px 0 40px; }
.aw-error-code { display: block; font-family: var(--aw-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--aw-accent); margin-bottom: 14px; }
.aw-error h1 { font-family: var(--aw-serif); font-weight: 400; font-size: clamp(44px, 7vw, 76px); line-height: 1; letter-spacing: -0.02em; margin: 0 0 14px; }
.aw-error .aw-actions { margin-top: 28px; }
