/* AbbyFlash: the base look shared by the account site (abbyflash-account) and the store (abbyflash-store). The same
   file is in both repos, at public/assets/css/style.css: a change here belongs in both. Each site adds its own rules
   in public/assets/site.css.

   Clean and modern: system fonts (nothing to download, and the CSP is 'self' only), soft surfaces, rounded corners,
   one indigo accent, light and dark themes (html[data-theme], set before the first paint by /assets/js/theme.js). */

/* ------------------------------------------------------------------ tokens */
:root {
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-head: var(--font-body);
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --solid-bg: #ffffff; /* text boxes and dropdowns */
  --sunken: #f1f3f8; /* quiet fills: code, the device code, hovered rows */
  --text: #0f172a;
  --muted: #475569;
  --faint: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --accent-soft-ink: #3730a3;
  --link: #4338ca;
  --ring: #6366f1;
  --flash: #f59e0b; /* the logo's bolt */

  --error: #dc2626;
  --error-bg: #fef2f2;
  --error-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --ok-ink: #ffffff;
  --info: var(--accent);
  --info-bg: #eef2ff;

  /* buttons: --btn-bg, --btn-ink, --btn-hover per colour */
  --grey-bg: #ffffff;
  --grey-ink: #0f172a;
  --grey-hover: #f1f5f9;
  --red-bg: #dc2626;
  --red-hover: #b91c1c;
  --green-bg: #16a34a;
  --green-hover: #15803d;
  --orange-bg: #ea580c;
  --orange-hover: #c2410c;

  --chip-bg: #f1f5f9;
  --chip-ink: #334155;

  /* the header */
  --chrome: rgb(255 255 255 / .82);
  --chrome-solid: #ffffff;
  --chrome-text: #1e293b;
  --chrome-hover: #f1f5f9;
  --chrome-line: #e2e8f0;
  --chrome-danger: #dc2626;

  --shadow: 0 1px 2px rgb(15 23 42 / .04), 0 1px 3px rgb(15 23 42 / .06);
  --shadow-lg: 0 20px 48px -12px rgb(15 23 42 / .28), 0 4px 12px rgb(15 23 42 / .08);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --wrap: 1200px;
  --wide: 1600px;
  --pad: clamp(16px, 4vw, 32px);
}
[data-theme="dark"] {
  --bg: #0b0d14;
  --surface: #131722;
  --solid-bg: #0f121b;
  --sunken: #1a1f2d;
  --text: #e5e7eb;
  --muted: #a1a8b8;
  --faint: #8a92a5;
  --line: #242a3a;
  --line-strong: #323a4f;

  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-ink: #0b0d14;
  --accent-soft: #1e2140;
  --accent-soft-ink: #c7d2fe;
  --link: #a5b4fc;
  --ring: #a5b4fc;

  --error: #f87171;
  --error-bg: #2a1215;
  --error-ink: #1a0607;
  --ok: #4ade80;
  --ok-bg: #0f2418;
  --ok-ink: #052e14;
  --info-bg: #1a1d38;

  --grey-bg: #1a1f2d;
  --grey-ink: #e5e7eb;
  --grey-hover: #242a3a;
  --red-bg: #ef4444;
  --red-hover: #f87171;
  --green-bg: #22c55e;
  --green-hover: #4ade80;
  --orange-bg: #f97316;
  --orange-hover: #fb923c;

  --chip-bg: #1f2433;
  --chip-ink: #cbd5e1;

  --chrome: rgb(11 13 20 / .8);
  --chrome-solid: #0f121b;
  --chrome-text: #e5e7eb;
  --chrome-hover: #1a1f2d;
  --chrome-line: #1f2433;
  --chrome-danger: #f87171;

  --shadow: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-lg: 0 24px 56px -12px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .04);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main { flex: 1 0 auto; }
img, svg { display: inline-block; max-width: 100%; vertical-align: middle; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { color: var(--text); letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.4rem); line-height: 1.15; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

.wrap { width: min(100%, var(--wrap) + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }
.wrap--wide { --wrap: var(--wide); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute; z-index: 100; left: 12px; top: -60px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; text-decoration: none;
  transition: top .15s var(--ease);
}
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-line);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
}
.top__bar { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; min-width: 0; flex: none; }
.brand__home {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 8px 4px 4px; margin-left: -4px;
  border-radius: 12px;
  color: var(--chrome-text); text-decoration: none;
}
a.brand__home:hover { background: var(--chrome-hover); }
.brand__logo { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand__name { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.brand__word { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand__site { font-weight: 500; font-size: 1.15rem; color: var(--faint); letter-spacing: -.01em; }

.nav { margin-left: auto; }
.nav ul { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav a, .nav button {
  position: relative;
  display: block;
  padding: 7px 12px;
  border: 0; border-radius: 9px;
  background: none;
  color: var(--chrome-text);
  font: 500 .95rem/1.5 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.nav a:hover, .nav button:hover { background: var(--chrome-hover); }
.nav a[aria-current] { color: var(--accent); background: var(--accent-soft); }
[data-theme="dark"] .nav a[aria-current] { color: var(--accent-soft-ink); }
.nav .sign-out { color: var(--chrome-danger); }

.top__actions { display: flex; align-items: center; gap: 4px; flex: none; }
.nav + .top__actions, .brand + .top__actions { margin-left: 4px; }
.brand + .top__actions { margin-left: auto; }
.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  padding: 0; border: 0; border-radius: 10px;
  background: none; color: var(--chrome-text);
  cursor: pointer;
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--chrome-hover); }
.i-sun { display: none; }
[data-theme="dark"] .i-moon { display: none; }
[data-theme="dark"] .i-sun { display: block; }
.nav-btn { display: none; }
.nav-btn .l1, .nav-btn .l2, .nav-btn .l3 { transition: transform .2s var(--ease), opacity .2s; transform-origin: 12px 12px; }
.top.is-open .nav-btn .l1 { transform: translateY(5px) rotate(45deg); }
.top.is-open .nav-btn .l2 { opacity: 0; }
.top.is-open .nav-btn .l3 { transform: translateY(-5px) rotate(-45deg); }

/* The links go behind the menu button when they don't fit beside the name: always on small screens, and between those
   and the widths they need, when site.js finds they don't fit (it marks the header .is-compact). Without JavaScript
   they wrap onto a second line instead. */
.top__bar { flex-wrap: wrap; }
.js .top__bar { flex-wrap: nowrap; }
.js .top.is-compact .nav-btn { display: grid; order: 2; margin-left: auto; }
.js .top.is-compact .top__actions { order: 3; margin-left: 0; }
.js .top.is-compact .nav {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  margin: 0;
  background: var(--chrome-solid);
  border-bottom: 1px solid var(--chrome-line);
  box-shadow: 0 18px 30px -18px rgb(15 23 42 / .35);
}
.js .top.is-compact.is-open .nav { display: block; }
.js .top.is-compact .nav ul { flex-direction: column; align-items: stretch; gap: 2px; padding: 8px var(--pad) 14px; }
.js .top.is-compact .nav a, .js .top.is-compact .nav button { width: 100%; padding: 11px 12px; text-align: left; font-size: 1rem; }
@media (max-width: 599px) {
  .js .top .nav-btn { display: grid; order: 2; margin-left: auto; }
  .js .top .top__actions { order: 3; margin-left: 0; }
  .js .top .nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    margin: 0;
    background: var(--chrome-solid);
    border-bottom: 1px solid var(--chrome-line);
    box-shadow: 0 18px 30px -18px rgb(15 23 42 / .35);
  }
  .js .top.is-open .nav { display: block; }
  .js .top .nav ul { flex-direction: column; align-items: stretch; gap: 2px; padding: 8px var(--pad) 14px; }
  .js .top .nav a, .js .top .nav button { width: 100%; padding: 11px 12px; text-align: left; font-size: 1rem; }
}
/* very narrow screens: the site's word goes first, then the name; the logo still says AbbyFlash */
@media (max-width: 299px) { .brand__site { display: none; } }
@media (max-width: 219px) { .brand__word { display: none; } }

/* ------------------------------------------------------------------ footer */
.foot { margin-top: 32px; border-top: 1px solid var(--line); background: var(--surface); }
.foot__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 24px;
  padding-block: 22px;
  color: var(--faint); font-size: .875rem;
}
.foot__copyright { margin: 0; }
.foot__links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.foot__links a { color: var(--muted); text-decoration: none; }
.foot__links a:hover { color: var(--text); text-decoration: underline; }

/* ------------------------------------------------------------------ buttons
   .btn is the accent; .btn--grey (outlined), --red, --green and --orange are the others; --small is shorter. Never
   wider than 320px. A link (a.btn) or a button. */
.btn {
  --btn-bg: var(--accent);
  --btn-ink: var(--accent-ink);
  --btn-hover: var(--accent-hover);
  --btn-line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  max-width: 320px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--btn-line); border-radius: var(--radius-sm);
  background: var(--btn-bg); color: var(--btn-ink);
  font: 600 .95rem/1 var(--font-body);
  text-decoration: none; white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(15 23 42 / .08);
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--grey { --btn-bg: var(--grey-bg); --btn-ink: var(--grey-ink); --btn-hover: var(--grey-hover); --btn-line: var(--line-strong); }
.btn--red { --btn-bg: var(--red-bg); --btn-ink: #fff; --btn-hover: var(--red-hover); }
.btn--green { --btn-bg: var(--green-bg); --btn-ink: #fff; --btn-hover: var(--green-hover); }
.btn--orange { --btn-bg: var(--orange-bg); --btn-ink: #fff; --btn-hover: var(--orange-hover); }
[data-theme="dark"] :is(.btn--red, .btn--green, .btn--orange) { --btn-ink: #0b0d14; }
.btn--small { height: 36px; padding: 0 12px; font-size: .875rem; border-radius: 9px; }
.btn--off { opacity: .5; cursor: default; pointer-events: none; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn > svg { flex: none; }
.btn .arrow { transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(2px); }
.btn:hover .arrow--out { transform: translate(2px, -2px); }
.btn__logo { width: 20px; height: 20px; border-radius: 5px; }
.btn__logo--square { border-radius: 0; }
.badge-in-btn, .btn .badge { margin-left: 2px; }

/* icon-only tool buttons (the copy buttons): square */
.tool--icon { width: 36px; padding: 0; }
.copy .copy__done { display: none; }
.copy.is-copied .copy__idle { display: none; }
.copy.is-copied .copy__done { display: inline-flex; color: var(--ok); }
.copy__idle, .copy__done { display: inline-flex; }

/* ------------------------------------------------------------------ text links with an arrow */
/* the arrow is drawn (a mask in the text's colour), so no font can turn it into an emoji */
.link-point { font-weight: 500; }
.link-point::after {
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12h15M13.5 6l6 6-6 6'/%3E%3C/svg%3E");
  content: "";
  display: inline-block;
  width: .8em; height: .8em;
  margin-left: .3em;
  vertical-align: -.05em;
  background: currentColor;
  -webkit-mask: var(--arrow) center / contain no-repeat;
  mask: var(--arrow) center / contain no-repeat;
  transition: transform .2s var(--ease);
}
.link-point[target="_blank"]::after { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8.5 7H17v8.5'/%3E%3C/svg%3E"); }
.link-point[href^="#"]::after { --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4.5v15M6 13.5l6 6 6-6'/%3E%3C/svg%3E"); }
.link-point:hover::after { transform: translateX(2px); }
.link-point[target="_blank"]:hover::after { transform: translate(2px, -2px); }
@media (forced-colors: active) { .link-point::after { background: LinkText; } }

/* ------------------------------------------------------------------ tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip-bg); color: var(--chip-ink);
  font: 600 .72rem/1.5 var(--font-body);
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--chip-bg); color: var(--chip-ink);
  font: 600 .68rem/1.5 var(--font-body);
  letter-spacing: .05em; text-transform: uppercase;
  vertical-align: middle; white-space: nowrap;
}
.feature__badge { background: var(--accent-soft); color: var(--accent-soft-ink); }

/* ------------------------------------------------------------------ other sites' logos: the mark on its square */
.site-logo { border-radius: 24%; background: #fff; forced-color-adjust: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.site-logo--apple { background: #000; }
.site-logo--discord { background: #5865f2; }
.site-logo--facebook { background: #0866ff; }
.site-logo--itch { background: #fa5c5c; }
.site-logo--google { background: #fff; box-shadow: inset 0 0 0 1px #e2e8f0; }
.site-logo--test { background: transparent; }

/* ------------------------------------------------------------------ dropdowns: a select in span.select, with its own
   arrow */
.select { position: relative; display: inline-flex; min-width: 0; }
.select select {
  width: 100%; min-height: 44px;
  padding: 8px 40px 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--solid-bg); color: var(--text);
  font: 500 1rem/1.4 var(--font-body);
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
}
.select select:hover { border-color: var(--faint); }
.select::after {
  content: "";
  position: absolute; right: 16px; top: 50%;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ------------------------------------------------------------------ windows: dialog.window with a title bar (its
   heading and a close button) and a body */
.window {
  width: min(100% - 32px, 440px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.window::backdrop { background: rgb(15 23 42 / .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.window[open] { animation: window-in .18s var(--ease); }
@keyframes window-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.window__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0 22px; }
.window__bar h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.window__close, .btn.window__close {
  --btn-bg: transparent; --btn-ink: var(--muted); --btn-hover: var(--sunken); --btn-line: transparent;
  width: 36px; height: 36px; padding: 0; margin-right: -6px;
  box-shadow: none;
}
.window__close:hover { color: var(--text); }
.window__body { padding: 14px 22px 22px; }

/* ------------------------------------------------------------------ the 404 page */
.not-found { max-width: 640px; margin: clamp(16px, 6vw, 64px) auto; text-align: center; }
.not-found__code h1 {
  margin: 0;
  font-size: clamp(5rem, 3rem + 10vw, 9rem); font-weight: 800; line-height: 1; letter-spacing: -.05em;
  background: linear-gradient(135deg, var(--accent), #a855f7 55%, var(--flash));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.not-found__text { margin: 12px 0 28px; color: var(--muted); font-size: 1.2rem; font-weight: 500; }
.not-found .btn { margin-inline: auto; }

/* ------------------------------------------------------------------ cards in a grid with a pager (the store's app
   pages): "Page N of M" and the pager over the grid, the pager again under it */
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.library__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.library__title { margin: 0; font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.library__of { color: var(--faint); font-weight: 500; }
.library__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 18px;
  margin: 0; padding: 0; list-style: none;
}
.library__grid > li { display: flex; min-width: 0; }
.library__more { margin-top: 24px; }
.library__head + .library__grid + .pager, .library__grid + .pager { margin-top: 22px; }

.card {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card:hover { border-color: var(--line-strong); box-shadow: 0 10px 28px -14px rgb(15 23 42 / .25); }
.card__art { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sunken); }
.card__fill { width: 100%; height: 100%; object-fit: cover; }
.card__body { display: flex; flex-direction: column; min-width: 0; }
.card__tags { margin-bottom: 8px; }
.card__title { margin: 0 0 6px; font-size: 1.1rem; line-height: 1.3; }
.card__main { overflow-wrap: anywhere; }
.card__desc { margin: 0; color: var(--muted); font-size: .94rem; }
@media (max-width: 419px) {
  .card { grid-template-columns: minmax(0, 1fr); }
  .card__art { aspect-ratio: 16 / 9; }
}

.pager { display: flex; align-items: center; gap: 6px; }
.pager__nums { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.pager__step, .pager__num {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font-weight: 500; font-size: .9rem; text-decoration: none;
}
a.pager__step[href]:hover, a.pager__num[href]:hover { border-color: var(--line-strong); background: var(--sunken); }
.pager__num[aria-current] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.pager__step[aria-disabled="true"] { opacity: .45; }
.pager--foot { justify-content: center; }

/* ------------------------------------------------------------------ motion and forced colours */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .btn, .chip, .badge, .card, .panel { border: 1px solid CanvasText; }
  .not-found__code h1 { color: CanvasText; background: none; }
}
@media print {
  .top, .foot, .skip { display: none; }
}
