/* Shared by every page of the Lint site: tokens, light and dark theme, language switch, top bar, buttons, screenshots, footer. */
:root {
  color-scheme: dark;
  --bg: #0b0a1a;
  --bg-elev: rgba(255,255,255,0.045);
  --border: rgba(255,255,255,0.10);
  --text: #f5f3ff;
  --text-dim: #b7b2d6;
  --indigo: #241c58;
  --violet: #7c3aed;
  --violet-light: #a78bfa;
  --violet-glow: #8b5cf6;
  --green: #86efac;
  --amber: #fcd34d;
  --radius: 16px;
  /* What differs between the themes beyond the colors above. */
  --topbar-bg: rgba(11,10,26,0.8);
  --surface-band: rgba(255,255,255,0.02);
  --surface-chip: rgba(255,255,255,0.06);
  --surface-ctl: rgba(255,255,255,0.08);
  --surface-key: rgba(255,255,255,0.10);
  --note-bg: rgba(252,211,77,0.07);
  --note-border: rgba(252,211,77,0.25);
  --title-from: #ffffff;
  --title-to: var(--violet-light);
  --glow-opacity: 0.35;
  --switch-on: #ffffff;
  --switch-off: var(--text);
}

/* Light theme. The page head sets data-theme before the first paint (the saved choice, else the system's),
   and the button in the top bar changes it (site.js). The screenshots are dark and stay as they are. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9ff;
  --bg-elev: #ffffff;
  --border: rgba(36,28,88,0.13);
  --text: #1b1736;
  --text-dim: #5a5679;
  --indigo: #e7dfff;
  --violet-light: #6d28d9; /* the accent as text: links, ticks, numbers */
  --green: #15803d;
  --amber: #92400e;
  --topbar-bg: rgba(250,249,255,0.82);
  --surface-band: rgba(36,28,88,0.03);
  --surface-chip: rgba(36,28,88,0.05);
  --surface-ctl: rgba(36,28,88,0.07);
  --surface-key: rgba(36,28,88,0.08);
  --note-bg: rgba(217,119,6,0.08);
  --note-border: rgba(180,83,9,0.30);
  --title-from: #1b1736;
  --title-to: #7c3aed;
  --glow-opacity: 0.22;
  --switch-off: var(--text-dim);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: 76px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Segoe UI", "Microsoft JhengHei", Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p { margin: 0; }

.wrap { max-width: var(--maxw, 1080px); margin: 0 auto; padding: 0 24px; }

/* Language switch: pure CSS, remembered across pages by site.js.
   !important keeps it ahead of any component rule that sets display on the same element. */
.zh { display: none !important; }
body:has(#lang-toggle:checked) .en { display: none !important; }
body:has(#lang-toggle:checked) span.zh { display: inline !important; }
body:has(#lang-toggle:checked) :is(p, div, ul, ol, h1, h2, h3, figure, a.shot).zh { display: block !important; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--violet-light);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.topnav { display: flex; align-items: center; gap: 18px; }
.page-links { display: flex; align-items: center; gap: 18px; }

.nav-link { display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text-dim); font-size: 14px; }
.nav-link:hover { color: var(--text); }
.nav-link[aria-current="page"] { color: var(--text); font-weight: 600; }

.lang-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 62px;
  height: 30px;
  padding: 0 3px;
  background: var(--surface-ctl);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.lang-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 24px;
  border-radius: 999px;
  background: var(--violet-glow);
  transition: transform 0.2s ease;
}
body:has(#lang-toggle:checked) .lang-switch::before { transform: translateX(29px); }
.lang-switch span { position: relative; z-index: 1; width: 27px; text-align: center; font-size: 11px; font-weight: 700; color: var(--switch-off); }
.lang-switch span:first-child { color: var(--switch-on); }
body:has(#lang-toggle:checked) .lang-switch span:first-child { color: var(--switch-off); }
body:has(#lang-toggle:checked) .lang-switch span:last-child { color: var(--switch-on); }
.lang-toggle:focus-visible + .lang-switch { outline: 2px solid var(--violet-light); outline-offset: 3px; }

/* Light / dark switch: shows the theme it switches to. Hidden until site.js runs, since it needs JavaScript. */
.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  background: var(--surface-ctl);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
}
.theme-switch[hidden] { display: none; }
.theme-switch:hover { background: var(--surface-key); }
.theme-switch svg { display: none; }
:root[data-theme="dark"] .theme-switch .icon-sun,
:root[data-theme="light"] .theme-switch .icon-moon { display: block; }

/* Buttons and keys */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:hover { background: #6d28d9; transform: translateY(-1px); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-chip); }
.btn-small { padding: 8px 16px; font-size: 13px; border-radius: 10px; }

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 8px;
  background: var(--surface-ctl);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.kbd-inline {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-key);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  white-space: nowrap;
}

/* Screenshots */
figure { margin: 18px 0 0; }
.shot { display: block; margin: 0 auto; width: fit-content; max-width: 100%; }
.shot img { border-radius: 10px; }
.shot.flat img { border: 1px solid var(--border); }
figcaption { margin-top: 8px; text-align: center; font-size: 13px; color: var(--text-dim); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 30px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.footer-inner p { color: var(--text-dim); font-size: 13px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-nav a { color: var(--text-dim); text-decoration: none; font-size: 13px; }
.footer-nav a:hover { color: var(--text); }

@media (max-width: 680px) {
  .topbar-inner { padding: 12px 16px; }
  .topnav, .page-links { gap: 12px; }
  .nav-link.github span { display: none; }
}
@media (max-width: 520px) {
  /* The theme switch needs room: the top bar drops what the footer and the page already offer. */
  .topbar-inner, .topnav, .page-links { gap: 8px; }
  .nav-link.github { display: none; }
  .topnav .btn-small { padding: 8px 12px; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
}
@media (max-width: 380px) {
  .topnav .btn-primary { display: none; }
}

/* Floating screenshot (site.js) */
.shot img { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: rgba(5,4,15,0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox-image { max-width: min(1400px, 100%); max-height: 100%; width: auto; height: auto; object-fit: contain; }
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  /* The overlay is dark in both themes, so the button does not take the theme's colors. */
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #f5f3ff;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
html.lightbox-open { overflow: hidden; }
