/* Comic-book layer — sits on top of the Aurora theme.
   Swaps in a hand-lettered type system and turns native tooltips into
   old-comic speech balloons. Aurora.css still owns all the color tokens;
   this file only touches type + the balloon signature. Load it LAST. */

:root {
  --comic-ink: #15120f;       /* ink-black: balloon text + outline (light theme) */
  --comic-balloon: #fffdf3;   /* warm paper white (balloons stay light in both themes) */
  --comic-outline: #15120f;   /* button ink — flips to light on dark theme below */
}
[data-theme="dark"] {
  --comic-outline: #efe7d8;   /* light "ink" so outlines/shadows still read on dark */
}

/* ----------------------------------------------------------------- *
 * Type — Comic Neue for everything, Bangers for the loud headings.  *
 * Aurora sets buttons/inputs to font-family:inherit, so they follow. *
 * ----------------------------------------------------------------- */
html, body {
  font-family: "Comic Neue", "Comic Sans MS", ui-rounded, system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: .1px;
}

h1, h2, h3, h4, h5, h6,
.motif-panel-title {
  font-family: "Bangers", "Comic Neue", cursive;
  font-weight: 400;       /* Bangers ships a single weight */
  letter-spacing: .8px;
}
h1 { font-size: 30px; letter-spacing: 1.2px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
.motif-panel-title { font-size: 20px; letter-spacing: 1px; }

/* Code stays mechanical — a comic font here would hurt readability. */
code, kbd, samp, pre, .motif-code {
  font-family: ui-monospace, "Cascadia Code", "Courier New", monospace !important;
}

/* ----------------------------------------------------------------- *
 * Comic sticker buttons: bold ink outline, hard offset shadow, and  *
 * a satisfying "press" on click. site.js prepends a comic-line icon. *
 * ----------------------------------------------------------------- */
.motif-btn {
  font-weight: 700;
  border-width: 2.5px;
  border-style: solid;
  border-color: var(--comic-outline);
  border-radius: 12px;
  box-shadow: 2px 2px 0 var(--comic-outline);
}
.motif-btn:hover { box-shadow: 3px 3px 0 var(--comic-outline); }
.motif-btn:active,
.motif-btn.is-active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--comic-outline);
}
.motif-btn-sm { border-radius: 9px; }

/* Comic line icon injected at the start of each button. */
.comic-ico {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  vertical-align: -0.15em;
}

/* Per-panel "Print" button, parked in the panel's top-right corner.
   site.js adds one to every top-level panel. */
.motif-panel { position: relative; }
/* Selector is intentionally specific (.motif-panel > …) so it outranks the
   [data-tip] { position: relative } tooltip rule this button also matches. */
.motif-panel > .rt-print-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}
/* Reserve room so a long panel title never slides under the button. */
.motif-panel-title { padding-right: 96px; }

/* ----------------------------------------------------------------- *
 * Speech-balloon tooltips (the signature).                          *
 * site.js copies each [title] to [data-tip] and removes title, so   *
 * only this styled balloon shows — never the browser's gray one.    *
 * Balloons open BELOW their element so top-nav tooltips stay on-screen.*
 * ----------------------------------------------------------------- */
[data-tip] { position: relative; }

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;

  width: max-content;
  max-width: 220px;
  padding: 8px 13px;
  white-space: normal;
  text-align: center;

  font-family: "Comic Neue", "Comic Sans MS", sans-serif;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.25;
  color: var(--comic-ink);

  background: var(--comic-balloon);
  border: 2.5px solid var(--comic-ink);
  border-radius: 18px;
  box-shadow: 3px 4px 0 var(--comic-ink);
  pointer-events: none;

  animation: comic-pop .12s ease-out;
}

/* The balloon's little pointer tail (a rotated square, inked on the
   two upper sides so its corner points up at the element). */
[data-tip]:hover::before,
[data-tip]:focus-visible::before {
  content: "";
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  z-index: 1001;

  width: 13px;
  height: 13px;
  background: var(--comic-balloon);
  border-top: 2.5px solid var(--comic-ink);
  border-left: 2.5px solid var(--comic-ink);
  pointer-events: none;
}

/* Menubar sits at the window's right edge, which clips (overflow:hidden).
   Anchor its balloons to the right so they grow inward instead of off-screen. */
.motif-menubar [data-tip]:hover::after,
.motif-menubar [data-tip]:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
  animation: none;
}
.motif-menubar [data-tip]:hover::before,
.motif-menubar [data-tip]:focus-visible::before {
  left: auto;
  right: 14px;
  transform: rotate(45deg);
}

@keyframes comic-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(.85); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0)    scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  [data-tip]:hover::after,
  [data-tip]:focus-visible::after { animation: none; }
}
