/* Ad Astra link shortener: a dark take on the archive's skin (purple bar #3b0054, magenta #c40055, Georgia headings). */
:root {
  --bg: #0e0014;
  --head: #170021;
  --nav: #3b0054;
  --nav-hi: #571a75;
  --surface: #1b0826;
  --surface-2: #241031;
  --border: #3e2650;
  --text: #ede6f2;
  --muted: #b9a9c6;
  --accent: #c40055;        /* archive magenta, used as fills with white text */
  --accent-hi: #dc1a6c;
  --link: #ff7db0;          /* lighter magenta for text on dark */
  --ok: #8fe0b0;
  --err-bg: #4a0008;
  --err-border: #a00;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Lucida Grande", "Lucida Sans Unicode", "GNU Unifont", Verdana, Helvetica, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: #ffb3d1; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.mono { font-family: var(--mono); font-size: .92em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }

/* masthead, like the archive's header */
.masthead { background: var(--head); display: flex; align-items: flex-end; gap: 10px 14px; flex-wrap: wrap; padding: 10px 16px 8px; border-bottom: 1px solid #2a0a3a; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.brand img { filter: drop-shadow(0 0 6px rgba(255, 200, 120, .25)); }
.brand-name { font: 1.75rem/1.1 var(--serif); }
.brand .sep { color: var(--muted); }
.tagline { font: italic .9rem var(--serif); color: var(--muted); padding-bottom: 4px; }

/* purple tab bar, like the archive's nav */
.tabs { background: var(--nav); display: flex; flex-wrap: wrap; padding: 0 12px; box-shadow: inset 0 -1px 0 #24003a, 0 2px 0 #24003a; }
.tabs button { background: none; border: 0; color: #fff; font: 1rem var(--sans); padding: 9px 12px; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button:hover { background: var(--nav-hi); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--link); background: rgba(255, 255, 255, .06); }

main { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; }
h1, h2 { font-family: var(--serif); font-weight: normal; color: #fff; }
h1 { font-size: 1.9rem; margin: 0 0 6px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
h2 { font-size: 1.3rem; margin: 26px 0 8px; }
.lede { color: var(--muted); margin: 4px 0 20px; max-width: 65ch; }
.hint { color: var(--muted); font-size: .9rem; }

.field { margin: 0 0 18px; }
.field label { display: flex; align-items: center; gap: 6px; font-weight: bold; margin-bottom: 6px; }
.row { display: flex; gap: 8px; }
input[type=url], textarea {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 4px;
  font: 1rem var(--mono); padding: 11px 12px;
}
input[type=url]:focus, textarea:focus { border-color: var(--link); outline: none; box-shadow: 0 0 0 3px rgba(255, 125, 176, .18); }
textarea { resize: vertical; font-family: var(--sans); line-height: 1.5; }
textarea[readonly] { background: var(--surface-2); }
::placeholder { color: #8a7898; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 4px;
  font: bold .95rem var(--sans); padding: 8px 16px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-hi); color: #fff; }
.btn.alt { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn.alt:hover { border-color: var(--link); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.link-btn { background: none; border: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: .85rem var(--sans); padding: 0 4px; }

.info {
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--muted); background: transparent; color: var(--muted);
  font: bold 12px/1 var(--sans); cursor: help; padding: 0; flex: none;
}
.info:hover, .info:focus-visible, .info[aria-expanded="true"] { color: #fff; border-color: var(--link); background: var(--accent); }

.error-text { background: var(--err-bg); border: 1px solid var(--err-border); border-radius: 4px; padding: 8px 12px; margin: 8px 0 0; }
.notice.error { background: var(--err-bg); border: 1px solid var(--err-border); padding: 10px 14px; }

.result { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 6px; padding: 16px 18px; margin: 0 0 18px; }
.result-label { margin: 0; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.badge { background: var(--nav); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: .75rem; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.short-link { font: bold 1.7rem/1.25 var(--mono); margin: 4px 0 10px; overflow-wrap: anywhere; }
.short-link a { color: #fff; text-decoration-color: var(--link); }
.facts { margin: 0 0 14px; display: grid; gap: 4px; }
.facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.copied { min-height: 1.4em; margin: 8px 0 0; color: var(--ok); font-size: .9rem; }

.options { margin: 4px 0 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.qr { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }
.qr canvas { background: #fff; border-radius: 6px; width: 180px; height: 180px; image-rendering: pixelated; }
.qr-side { flex: 1 1 220px; }
.qr-side p { margin: 0 0 10px; color: var(--muted); }

.recent h2 { display: flex; align-items: baseline; gap: 8px; font-size: 1.1rem; }
.recent ul { list-style: none; padding: 0; margin: 0; }
.recent li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.recent .r-what { color: var(--muted); font-size: .9rem; }
.recent button { margin-left: auto; }

.meter { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: -6px 0 14px; color: var(--muted); font-size: .9rem; }
.limit { border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; }
.limit.ok { color: var(--ok); border-color: #2f6b4a; }
.limit.over { color: #fff; background: var(--err-bg); border-color: var(--err-border); }

.bookmarklet-wrap { margin: 18px 0 24px; }
.bookmarklet { display: inline-block; background: var(--nav); color: #fff; border: 2px dashed var(--link); border-radius: 22px; padding: 10px 20px; font-weight: bold; text-decoration: none; cursor: grab; }
.bookmarklet:hover { color: #fff; background: var(--nav-hi); }
.steps ol { padding-left: 1.3em; }
.steps li { margin: 4px 0; }
kbd { font: .85em var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; }

.table-wrap { overflow-x: auto; }
.guide { border-collapse: collapse; width: 100%; font-size: .92rem; }
.guide th, .guide td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.guide th { font-family: var(--serif); font-weight: normal; color: #fff; background: var(--surface-2); }
.guide b { color: var(--link); font-weight: bold; }
details { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; margin: 8px 0; padding: 0 14px; }
summary { cursor: pointer; padding: 10px 0; font-weight: bold; }
details p { margin: 0 0 12px; color: var(--muted); }

.foot { border-top: 1px solid var(--border); color: var(--muted); text-align: center; font-size: .85rem; padding: 14px 16px 24px; }

/* tooltips */
.tooltip {
  position: fixed; z-index: 50; max-width: min(300px, calc(100vw - 24px)); background: #f6eefb; color: #1a0624;
  border-radius: 6px; padding: 8px 11px; font: .85rem/1.4 var(--sans); box-shadow: 0 6px 22px rgba(0, 0, 0, .55); pointer-events: none;
}
.tooltip::after { content: ""; position: absolute; left: var(--arrow-x, 50%); border: 6px solid transparent; transform: translateX(-50%); }
.tooltip.above::after { top: 100%; border-top-color: #f6eefb; }
.tooltip.below::after { bottom: 100%; border-bottom-color: #f6eefb; }

@media (max-width: 560px) {
  .brand-name { font-size: 1.35rem; }
  .tagline { display: none; }
  .tabs { padding: 0 4px; }
  .tabs button { padding: 8px 9px; font-size: .9rem; }
  h1 { font-size: 1.5rem; }
  .short-link { font-size: 1.3rem; }
  .facts div { grid-template-columns: 1fr; gap: 0; }
  .actions .btn { flex: 1 1 calc(50% - 8px); }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .tabs button, .info { transition: background-color .15s, border-color .15s, color .15s; }
}
