/* ==========================================================================
   Search — app.css
   Plain CSS, no build step, no external assets.

   Sections
     01. Design tokens (light / dark)
     02. Reset & base
     03. Header, brand, search box, tabs
     04. Menus (theme / language)
     05. Landing
     06. Results: meta, cards, states, pager, related
     07. Footer
     08. Responsive
     09. Motion & a11y preferences
   ========================================================================== */

/* ---------------------------------------------------------- 01. tokens -- */

:root {
  color-scheme: light;

  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --page-max: 816px;
  --radius-xs: 7px;
  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 16px;

  --bg: #fbfbfd;
  --bg-soft: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;

  --text: #16181f;
  --text-soft: #3b414f;
  --muted: #5f6675;
  --faint: #8b91a1;

  --border: #e8eaf0;
  --border-strong: #d8dbe5;

  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --accent-softer: rgba(79, 70, 229, 0.055);
  --on-accent: #ffffff;
  --visited: #7c3aed;

  --chip: #f0f1f7;
  --hover: rgba(22, 24, 31, 0.045);
  --header-bg: rgba(251, 251, 253, 0.82);
  --glow: rgba(99, 102, 241, 0.14);
  --mark-bg: rgba(79, 70, 229, 0.13);
  --mark-text: #2c27b0;
  --ring: 0 0 0 4px rgba(79, 70, 229, 0.15);

  --shadow-1: 0 1px 2px rgba(16, 18, 27, 0.05);
  --shadow-2: 0 10px 30px -14px rgba(16, 18, 27, 0.26), 0 2px 8px -4px rgba(16, 18, 27, 0.1);
  --shadow-pop: 0 20px 46px -22px rgba(16, 18, 27, 0.42), 0 3px 10px -4px rgba(16, 18, 27, 0.12);

  --sk-base: #eef0f5;
  --sk-hi: #f8f9fc;

  --badge-official: #4f46e5;
  --badge-edu: #0f766e;
  --badge-media: #b45309;
  --badge-wiki: #475569;
  --badge-ugc: #7c3aed;
  --badge-fresh: #15803d;
  --badge-key: #0e7490;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0c0d12;
  --bg-soft: #101219;
  --surface: #14161e;
  --surface-2: #181b24;

  --text: #e8eaf1;
  --text-soft: #cdd1dc;
  --muted: #9aa1b1;
  --faint: #798192;

  --border: #23262f;
  --border-strong: #313644;

  --accent: #8f8bff;
  --accent-strong: #a8a4ff;
  --accent-soft: rgba(143, 139, 255, 0.16);
  --accent-softer: rgba(143, 139, 255, 0.08);
  --on-accent: #131320;
  --visited: #c4b5fd;

  --chip: #1b1e28;
  --hover: rgba(232, 234, 241, 0.06);
  --header-bg: rgba(12, 13, 18, 0.78);
  --glow: rgba(129, 140, 248, 0.16);
  --mark-bg: rgba(143, 139, 255, 0.24);
  --mark-text: #d9d7ff;
  --ring: 0 0 0 4px rgba(143, 139, 255, 0.2);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-2: 0 12px 34px -16px rgba(0, 0, 0, 0.75), 0 2px 10px -4px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 22px 50px -22px rgba(0, 0, 0, 0.85), 0 3px 12px -4px rgba(0, 0, 0, 0.6);

  --sk-base: #1b1e27;
  --sk-hi: #252a37;

  --badge-official: #a5a1ff;
  --badge-edu: #5eead4;
  --badge-media: #fbbf24;
  --badge-wiki: #cbd5e1;
  --badge-ugc: #c4b5fd;
  --badge-fresh: #86efac;
  --badge-key: #67e8f9;
}

/* ---------------------------------------------------------- 02. reset -- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(58% 48% at 50% -8%, var(--glow) 0%, transparent 72%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

body[data-view="landing"]::before {
  opacity: 1;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

kbd {
  font: inherit;
  font-size: 11.5px;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-1);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 100;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.16s ease;
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
  text-decoration: none;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  display: inline-block;
  flex: none;
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ------------------------------------------------- 03. header & search -- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

body[data-view="results"] .topbar {
  border-bottom-color: var(--border);
}

body[data-view="landing"] .topbar {
  position: static;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
}

.topbar__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

body[data-view="landing"] .topbar__inner {
  position: relative;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: clamp(24px, 7vh, 56px) 20px 0;
}

@media (min-width: 760px) {
  body[data-view="landing"] .topbar__inner {
    padding-top: clamp(64px, 14vh, 156px);
  }
}

/* Brand ------------------------------------------------------------------ */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 3px 4px;
  margin-left: -4px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand:hover .brand__name {
  color: var(--accent);
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: none;
  box-shadow: 0 2px 8px -3px rgba(79, 70, 229, 0.55);
}

.brand__name {
  transition: color 0.15s ease;
  white-space: nowrap;
}

body[data-view="landing"] .brand {
  font-size: 2rem;
  gap: 14px;
  margin-left: 0;
}

body[data-view="landing"] .brand__mark {
  width: 52px;
  height: 52px;
  border-radius: 15px;
}

/* Search form ------------------------------------------------------------ */

.search-form {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 9px;
  flex: 1 1 auto;
  min-width: 0;
}

body[data-view="landing"] .search-form {
  width: 100%;
  max-width: 664px;
}

.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  padding: 0 8px 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

body[data-view="landing"] .searchbox {
  height: 56px;
  padding-left: 18px;
  border-radius: var(--radius-lg);
}

.searchbox:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border-strong));
}

.searchbox:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.searchbox__icon {
  width: 19px;
  height: 19px;
  flex: none;
  color: var(--faint);
  transition: color 0.15s ease;
}

.searchbox:focus-within .searchbox__icon {
  color: var(--accent);
}

.searchbox__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15.5px;
  letter-spacing: -0.005em;
}

body[data-view="landing"] .searchbox__input {
  font-size: 16.5px;
}

.searchbox__input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.searchbox__input::-webkit-search-cancel-button,
.searchbox__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.searchbox__clear {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--faint);
  transition: background 0.15s ease, color 0.15s ease;
}

.searchbox__clear svg {
  width: 14px;
  height: 14px;
}

.searchbox__clear:hover {
  background: var(--hover);
  color: var(--text);
}

.form-error {
  position: absolute;
  top: calc(100% + 7px);
  left: 6px;
  right: 6px;
  z-index: 65;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, #dc2626 36%, var(--border));
  color: #dc2626;
  font-size: 12.5px;
  line-height: 1.35;
  box-shadow: var(--shadow-2);
}

:root[data-theme="dark"] .form-error {
  color: #fca5a5;
}

/* Suggestion listbox ------------------------------------------------------ */

.suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  max-height: 338px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  margin: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
}

.suggest__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.3;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.12s ease, color 0.12s ease;
}

.suggest__item:hover {
  background: var(--hover);
}

.suggest__item.is-active,
.suggest__item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.suggest__icon {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--faint);
}

.suggest__item.is-active .suggest__icon,
.suggest__item[aria-selected="true"] .suggest__icon {
  color: var(--accent);
}

.suggest__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest__label mark.hl {
  padding: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
}

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.28), 0 6px 16px -10px rgba(79, 70, 229, 0.7);
}

.btn--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn--primary:active {
  transform: translateY(1px);
}

.btn--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--muted);
}

.btn--icon:hover {
  background: var(--hover);
  color: var(--text);
}

.search-form__submit {
  height: 48px;
  padding: 0 18px;
  flex: none;
  white-space: nowrap;
}

body[data-view="landing"] .search-form__submit {
  height: 56px;
  padding: 0 24px;
  border-radius: var(--radius-lg);
  font-size: 15px;
}

.search-form__submit-icon {
  width: 17px;
  height: 17px;
  display: none;
}

/* Header tools ----------------------------------------------------------- */

.topbar__tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-left: auto;
}

body[data-view="landing"] .topbar__tools {
  position: absolute;
  top: 12px;
  right: 16px;
}

.lang-toggle {
  width: auto;
  padding: 0 9px;
  gap: 6px;
}

.lang-toggle__code {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: inherit;
}

.theme-toggle__icon {
  display: none;
}

.theme-toggle[data-theme-pref="light"] .theme-toggle__icon--sun,
.theme-toggle[data-theme-pref="dark"] .theme-toggle__icon--moon,
.theme-toggle[data-theme-pref="auto"] .theme-toggle__icon--auto {
  display: block;
}

/* Tabs ------------------------------------------------------------------- */

.tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 11px 11px;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: var(--hover);
}

.tab[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}

.tab__count {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab[aria-current="page"] .tab__count {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Loading progress ------------------------------------------------------- */

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.progress::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 38%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: progress-slide 1.05s ease-in-out infinite;
}

@keyframes progress-slide {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(300%);
  }
}

/* ---------------------------------------------------------- 04. menus -- */

.menu {
  position: relative;
}

.menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 196px;
  z-index: 70;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  animation: pop-in 0.12s ease-out;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu__panel [data-value] {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.menu__panel [data-value]:hover {
  background: var(--hover);
}

.menu__panel [data-value][aria-checked="true"] {
  color: var(--accent);
  font-weight: 600;
}

.menu__panel [data-value][aria-checked="true"]::after {
  content: "";
  margin-left: auto;
  width: 5px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
}

/* -------------------------------------------------------- 05. landing -- */

.landing {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(14px, 3.4vh, 30px) 20px 48px;
}

.landing__tagline {
  max-width: 58ch;
  text-align: center;
  color: var(--muted);
  font-size: clamp(14.5px, 1.5vw, 16.5px);
  line-height: 1.45;
  margin-bottom: clamp(26px, 5vh, 46px);
  text-wrap: balance;
}

.landing__block {
  width: 100%;
  max-width: 664px;
}

.landing__label {
  margin-bottom: 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13.5px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease;
}

.hint:hover {
  border-color: var(--accent);
  background: var(--accent-softer);
  color: var(--accent);
  box-shadow: var(--shadow-1);
}

.hint__icon {
  width: 14px;
  height: 14px;
  color: var(--faint);
  transition: color 0.15s ease;
}

.hint:hover .hint__icon {
  color: var(--accent);
}

.landing__status {
  margin-top: 26px;
  color: var(--faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.landing__shortcut {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 34px;
  color: var(--faint);
  font-size: 12.5px;
}

/* -------------------------------------------------------- 06. results -- */

.results {
  padding-bottom: 56px;
}

.results .container {
  padding-top: 22px;
}

.results__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 22px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Empty/error states carry the message themselves: keep the live region for
   screen readers but take it out of the visual flow. */
.results__meta.is-quiet {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.results__page {
  color: var(--faint);
}

.spinner {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  border: 1.6px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Spell suggestion -------------------------------------------------------- */

.spell {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent-softer);
  border: 1px solid var(--accent-soft);
  color: var(--muted);
  font-size: 13.5px;
}

.spell__link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Result card ------------------------------------------------------------ */

.result {
  padding: 16px 19px 15px;
  margin-bottom: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.16s ease, box-shadow 0.2s ease;
}

.result:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}

.result__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 7px;
  font-size: 12.5px;
  color: var(--faint);
}

.result__favicon {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 6px;
  background: var(--chip);
  overflow: hidden;
}

.result__letter {
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1;
  text-transform: uppercase;
}

.result__favicon-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface);
  border-radius: 6px;
}

.result__url {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12.5px;
}

.result__date {
  flex: none;
  margin-left: auto;
  padding-left: 10px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.result__title {
  margin-bottom: 5px;
  font-size: 18px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result__link {
  color: var(--accent);
}

.result__link:visited {
  color: var(--visited);
}

.result__link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result__snippet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 14.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

mark.hl {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--mark-bg);
  color: var(--mark-text);
  font-weight: 600;
}

/* In titles the mark reads better as a highlighter stroke than as a chip. */
.result__title mark.hl {
  padding: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-weight: 700;
  box-shadow: inset 0 -0.45em 0 var(--mark-bg);
}

.result__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 11px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--badge-color, var(--muted)) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color, var(--muted)) 22%, transparent);
  color: var(--badge-color, var(--muted));
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.badge--official {
  --badge-color: var(--badge-official);
}
.badge--edu {
  --badge-color: var(--badge-edu);
}
.badge--media {
  --badge-color: var(--badge-media);
}
.badge--wiki {
  --badge-color: var(--badge-wiki);
}
.badge--ugc {
  --badge-color: var(--badge-ugc);
}
.badge--fresh {
  --badge-color: var(--badge-fresh);
}
.badge--key {
  --badge-color: var(--badge-key);
}

.result__sources {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--faint);
  font-size: 11.5px;
  min-width: 0;
}

.result__sources-icon {
  width: 13px;
  height: 13px;
  flex: none;
}

.result__sources-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Skeleton --------------------------------------------------------------- */

.results__list[aria-busy="true"] {
  cursor: progress;
}

.skeleton {
  padding: 17px 19px;
  margin-bottom: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.skeleton__row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sk {
  display: block;
  height: 11px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sk-base) 0%, var(--sk-hi) 45%, var(--sk-base) 90%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.sk--favicon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex: none;
}

.sk--url {
  width: 38%;
  height: 9px;
}

.sk--title {
  width: 62%;
  height: 15px;
  margin-bottom: 12px;
}

.sk--line {
  width: 100%;
  margin-bottom: 8px;
}

.sk--w92 {
  width: 92%;
}

.sk--w74 {
  width: 74%;
  margin-bottom: 0;
}

@keyframes shimmer {
  from {
    background-position: 180% 0;
  }
  to {
    background-position: -80% 0;
  }
}

/* Empty / error states --------------------------------------------------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 6px 12px;
}

.state__img {
  width: 112px;
  height: 112px;
  margin-bottom: 14px;
  opacity: 0.92;
}

.state__title {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.state__text {
  max-width: 48ch;
  color: var(--muted);
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.state__hint {
  margin-top: 12px;
  color: var(--faint);
  font-size: 13px;
}

.state__code {
  margin: 10px 0 18px;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.state--error .btn {
  height: 42px;
  padding: 0 18px;
}

.advice {
  display: grid;
  gap: 8px;
  max-width: 46ch;
  margin: 18px auto 4px;
  text-align: left;
}

.advice li {
  display: flex;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.advice li::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

/* Related searches ------------------------------------------------------- */

.related {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.related__title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-softer);
  color: var(--accent);
}

/* Pager ------------------------------------------------------------------ */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 28px 0 8px;
}

.pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.pager__btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-softer);
}

.pager__btn[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.pager__btn:disabled {
  opacity: 0.42;
  cursor: default;
}

.pager__btn .icon {
  width: 15px;
  height: 15px;
}

.pager__btn-label {
  white-space: nowrap;
}

.pager__gap {
  padding: 0 3px;
  color: var(--faint);
  font-size: 14px;
  user-select: none;
}

/* ----------------------------------------------------------- 07. footer -- */

.footer {
  flex: none;
  margin-top: auto;
  padding: 22px 20px 26px;
  color: var(--faint);
  font-size: 12.5px;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: var(--page-max);
  margin: 0 auto;
  text-align: center;
}

.footer__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* -------------------------------------------------------- 08. responsive -- */

@media (max-width: 760px) {
  .container {
    padding: 0 20px;
  }

  .topbar__inner {
    padding: 10px 20px;
  }

  body[data-view="landing"] .topbar__inner {
    padding: 20px 18px 0;
  }

  body[data-view="results"] .topbar__inner {
    flex-wrap: wrap;
    row-gap: 10px;
    padding-bottom: 10px;
  }

  body[data-view="results"] .search-form {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .tabs {
    padding: 0 20px;
  }

  .result {
    padding: 15px 16px 14px;
  }

  .result__title {
    font-size: 17px;
  }

  .pager__btn-label {
    display: none;
  }

  .pager__btn--prev,
  .pager__btn--next {
    padding: 0 10px;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 15px;
  }

  .footer__meta .dot {
    display: none;
  }

  .topbar__inner {
    padding: 9px 15px;
  }

  body[data-view="landing"] .topbar__inner {
    padding: 16px 15px 0;
    gap: 20px;
  }

  body[data-view="landing"] .brand {
    font-size: 1.65rem;
    gap: 11px;
  }

  body[data-view="landing"] .brand__mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .tabs {
    padding: 0 15px;
  }

  .tab {
    padding: 8px 9px 10px;
    font-size: 13.5px;
  }

  .tab__count {
    display: none;
  }

  .search-form__submit {
    width: 48px;
    padding: 0;
  }

  body[data-view="landing"] .search-form__submit {
    width: 56px;
    padding: 0;
  }

  .search-form__submit-label {
    display: none;
  }

  .search-form__submit-icon {
    display: block;
  }

  .results__meta {
    margin: 16px 0 12px;
    font-size: 12.5px;
  }

  .result {
    padding: 14px 14px 13px;
    border-radius: 12px;
  }

  .result__title {
    font-size: 16.5px;
  }

  .result__snippet {
    font-size: 14px;
    -webkit-line-clamp: 4;
    line-clamp: 4;
  }

  .result__sources {
    margin-left: 0;
  }

  .state {
    padding: 28px 2px 8px;
  }

  .state__img {
    width: 92px;
    height: 92px;
  }

  .state__title {
    font-size: 18.5px;
  }

  .pager {
    gap: 4px;
  }

  .pager__btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 9px;
    font-size: 13.5px;
  }

  .landing__shortcut {
    margin-top: 26px;
  }
}

@media (max-width: 380px) {
  .topbar__tools {
    gap: 0;
  }

  .lang-toggle {
    padding: 0 6px;
    gap: 4px;
  }

  .hint {
    font-size: 13px;
    padding: 6px 11px 6px 9px;
  }

  .result__url {
    max-width: 46%;
  }
}

/* --------------------------------------------- 09. motion / preferences -- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (forced-colors: active) {
  .result,
  .searchbox,
  .skeleton,
  .chip,
  .hint {
    border: 1px solid CanvasText;
  }
}
