/* Shared components for every author page. Tokens: tokens.css.
 *
 * Each block was a Python string in pages.py injected inline into every page,
 * which made it uncacheable and invisible to a CSS linter.
 */

/* ── Info tooltip (tooltip.js) ──
 * The stylesheet loads in <head>: .info-panel is hidden here, and a rule that
 * arrived late would let every panel's explanation render inline next to its
 * figure until it applied. */
.info-tip {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-left: 5px;
}
.info-tip button {
  width: 15px;
  height: 15px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #d1d5db;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}
.info-tip button:hover { background: #9ca3af; }
.info-tip button:focus-visible { outline: 2px solid #10b981; outline-offset: 2px; }
.info-tip .info-panel {
  display: none;
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  padding: 12px 14px;
  background: #1f2937;
  color: #f9fafb;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.info-tip.open .info-panel { display: block; }
.info-tip .info-panel::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: #1f2937;
}
@media (max-width: 640px) {
  .info-tip .info-panel { width: 210px; }
}

/* ── Notice (notice.js), the replacement for alert() ── */
.ab-notice-layer {
  position: absolute; left: 0; right: 0; z-index: 2147483000;
  display: flex; justify-content: center; padding: 0 16px;
  pointer-events: none; box-sizing: border-box;
}
.ab-notice {
  pointer-events: auto; box-sizing: border-box; width: 100%; max-width: 440px;
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  background: #fff; border: 1px solid #e5e7eb; border-left: 4px solid #ef4444;
  border-radius: 12px; box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  text-align: left; animation: ab-notice-in 0.18s ease-out;
}
.ab-notice.warning { border-left-color: #f59e0b; }
.ab-notice.success { border-left-color: #10b981; }
.ab-notice-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; color: #ef4444; }
.ab-notice.warning .ab-notice-icon { color: #f59e0b; }
.ab-notice.success .ab-notice-icon { color: #047857; }
.ab-notice-body { flex: 1; min-width: 0; }
.ab-notice-title {
  margin: 0 0 4px; font-family: "Cabinet Grotesk", Inter, sans-serif;
  font-size: 15px; font-weight: 600; line-height: 1.35; color: #1f2937;
}
.ab-notice-message {
  margin: 0; font-size: 14px; line-height: 1.5; color: #4b5563;
  white-space: pre-line; overflow-wrap: anywhere;
}
.ab-notice-help { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: #6b7280; }
.ab-notice-help a { color: #047857; font-weight: 500; }
.ab-notice-close {
  flex-shrink: 0; margin: -4px -6px 0 0; padding: 4px; line-height: 0;
  background: none; border: 0; border-radius: 6px; color: #6b7280; cursor: pointer;
}
.ab-notice-close:hover { color: #1f2937; background: #f3f4f6; }
.ab-notice-close:focus-visible { outline: 2px solid #10b981; outline-offset: 1px; }
@keyframes ab-notice-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ab-notice { animation: none; } }

/* ── Modal dialogs (notice.js abOpenDialog, UX-4) ── */
/* Absolute, with `top` set beside the clicked control: the iframe is as tall
   as its content, so the browser's centred default lands out of sight (FE-3).
   No padding on the <dialog> itself: a click on it is a click on the
   backdrop, which closes it. Pages put their padding on an inner box. */
dialog.ab-modal {
  position: absolute; inset-inline: 0; margin: 0 auto; padding: 0; border: 0;
  width: fit-content; max-width: calc(100% - 32px); box-sizing: border-box;
  background: transparent; overflow: visible;
}
dialog.ab-modal::backdrop { background: rgba(17, 24, 39, 0.45); }

/* ── abConfirm: the in-page question (notice.js, UX-6) ── */
dialog.ab-dialog { width: calc(100% - 32px); max-width: 440px; }
.ab-dialog-body {
  padding: 20px; background: #fff; color: #1f2937;
  border: 1px solid #e5e7eb; border-radius: 12px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, 0.22);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ab-dialog-title {
  margin: 0 0 8px; font-family: "Cabinet Grotesk", Inter, sans-serif;
  font-size: 17px; font-weight: 600; line-height: 1.35;
}
.ab-dialog-message { margin: 0; font-size: 14px; line-height: 1.55; color: #4b5563; white-space: pre-line; }
.ab-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ab-dialog-actions button {
  padding: 9px 16px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ab-dialog-cancel { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.ab-dialog-cancel:hover { background: #f9fafb; }
.ab-dialog-confirm { background: #047857; color: #fff; border: 1px solid #047857; }
.ab-dialog-confirm:hover { background: #065f46; }
.ab-dialog-confirm.danger { background: #b91c1c; border-color: #b91c1c; }
.ab-dialog-confirm.danger:hover { background: #991b1b; }
.ab-dialog-actions button:focus-visible { outline: 2px solid #047857; outline-offset: 2px; }

/* ── Native controls (UX-3) ── */
/* A <select> styled as one of the pages' dropdown buttons. */
.ab-native-select { -webkit-appearance: none; appearance: none; }
/* Off screen but still in the tab order: e.g. a file input inside a styled
   upload zone. display:none would take it out of reach of the keyboard. */
.ab-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.upload-zone:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }
[role="button"]:focus-visible, button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ── Upload progress (upload.js, PERF-2) ── */
.ab-upload-progress {
  display: flex; align-items: center; gap: 12px; margin: 10px 0; padding: 10px 14px;
  background: var(--bg-light); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary);
}
.ab-upload-bar { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.ab-upload-bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width 0.15s linear; }
.ab-upload-text { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
.ab-upload-cancel {
  padding: 4px 12px; background: var(--bg-white); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); font: inherit; font-size: 13px; cursor: pointer;
}
.ab-upload-cancel:hover { border-color: var(--error); color: var(--error); }
