/* Tarka: one stylesheet for the home, results and crawler pages.
   Vync's purple on a faint lilac white, or on Vync's near-black in dark mode.
   Purple is kept for what the eye should find first: the logo's dot, the
   search button, links. Everything else is ink and quiet greys. */

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

:root {
  --paper:     #fbfaff;
  --raised:    #ffffff;
  --hover:     #f3f0ff;
  --ink:       #14121f;
  --soft:      #5d5a73;
  --faint:     #8f8ba6;
  --rule:      #e7e3f6;
  --accent:    #6650e5;
  --accent-2:  #5540d4;
  --accent-bg: #eeeaff;
  --on-accent: #ffffff;
  --link:      #4a35c9;
  --visited:   #7b4aa6;
  --ring:      rgba(102, 80, 229, .28);
  --aura:      rgba(135, 105, 251, .16);
  --shadow:    0 1px 2px rgba(20, 18, 31, .04), 0 10px 30px rgba(74, 53, 201, .08);

  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --deva: "Noto Serif Devanagari", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #0d0e12;
    --raised:    #12131a;
    --hover:     #161722;
    --ink:       #f4f3ff;
    --soft:      #a2a4b8;
    --faint:     #6e7086;
    --rule:      #262730;
    --accent:    #8769fb;
    --accent-2:  #9a80ff;
    --accent-bg: #1d1936;
    --on-accent: #ffffff;
    --link:      #b3a2ff;
    --visited:   #d0a3e8;
    --ring:      rgba(135, 105, 251, .4);
    --aura:      rgba(135, 105, 251, .2);
    --shadow:    0 1px 2px rgba(0, 0, 0, .4), 0 12px 36px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The mark and the name */
.logo { display: block; flex: none; color: var(--ink); }
.logo .dot-a { fill: var(--accent); }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font: 800 26px/1 var(--display); letter-spacing: -.03em;
  color: var(--ink); text-decoration: none;
}
.brand .logo { width: 28px; height: 28px; }

/* The search field, shared by home and results */
.search {
  position: relative; display: flex; align-items: center; gap: 4px;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 5px 5px 5px 22px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 4px var(--ring); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 400 17px/1.3 var(--text); padding: 11px 0; outline: none;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent;
  color: var(--faint); cursor: pointer; display: grid; place-items: center;
}
.search .clear:hover { color: var(--ink); background: var(--hover); }
.search .clear svg { width: 15px; height: 15px; }
.search .clear[hidden] { display: none; }
.search .go {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
  display: grid; place-items: center; transition: transform .12s, background .15s;
}
.search .go:hover { background: var(--accent-2); }
.search .go:active { transform: scale(.94); }
.search .go svg { width: 19px; height: 19px; }
.search kbd {
  flex: none; font: 500 12px/1 var(--mono); color: var(--faint);
  border: 1px solid var(--rule); border-radius: 6px; padding: 4px 7px; margin-right: 6px;
}
.search:focus-within kbd, .search kbd[hidden] { display: none; }

/* Suggestions under the field */
.sugg {
  position: absolute; z-index: 5; left: -1px; right: -1px; top: calc(100% + 8px);
  list-style: none; margin: 0; padding: 6px; text-align: left;
  background: var(--raised); border: 1px solid var(--rule); border-radius: 20px;
  box-shadow: var(--shadow);
}
.sugg[hidden] { display: none; }
.sugg li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px;
  font-size: 16px; line-height: 1.3; color: var(--soft); cursor: pointer;
}
.sugg li b { color: var(--ink); font-weight: 600; }
.sugg li[aria-selected="true"] { background: var(--hover); color: var(--ink); }
.sugg-i { flex: none; display: grid; place-items: center; color: var(--faint); }
.sugg-i svg { width: 17px; height: 17px; }
.sugg li[aria-selected="true"] .sugg-i { color: var(--accent); }

/* Home */
.home {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: 1fr auto;
  background: radial-gradient(60% 46% at 50% 34%, var(--aura), transparent 70%);
}
.home-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px 12vh; text-align: center;
}
.home-mark { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 20px); }
.home-mark .logo { width: clamp(52px, 11vw, 84px); height: auto; }
.home-mark h1 { margin: 0; font: 800 clamp(56px, 13vw, 104px)/.9 var(--display); letter-spacing: -.045em; }
.home-deva { margin: 14px 0 0; font: 500 18px/1 var(--deva); color: var(--faint); letter-spacing: .02em; }
.home .search { width: min(100%, 620px); margin-top: 36px; }
.home-line { margin: 22px 0 0; color: var(--soft); font-size: 15px; }
.home-line b { color: var(--ink); font-weight: 600; }
.tries { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; max-width: 620px; }
.tries a {
  font-size: 14px; color: var(--soft); text-decoration: none;
  border: 1px solid var(--rule); border-radius: 999px; padding: 6px 14px;
  transition: color .15s, border-color .15s, background .15s;
}
.tries a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-bg); }

.foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px;
  padding: 20px; font-size: 13px; color: var(--faint);
}
.foot a { color: var(--soft); text-decoration: none; }
.foot a:hover { color: var(--ink); text-decoration: underline; }

/* Results: the bar */
.bar {
  position: sticky; top: 0; z-index: 2;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--rule);
}
.bar-in { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 22px; }
.bar .search { flex: 1; max-width: 640px; padding: 3px 3px 3px 18px; box-shadow: none; }
.bar .search:focus-within { box-shadow: 0 0 0 4px var(--ring); }
.bar .search input { font-size: 16px; padding: 9px 0; }
.bar .search .go { width: 38px; height: 38px; }
.bar .search .go svg { width: 17px; height: 17px; }

/* Results: the list */
.page {
  max-width: 1180px; margin: 0 auto; padding: 0 24px 56px;
  display: grid; grid-template-columns: minmax(0, 736px) minmax(0, 360px); gap: 0 44px; align-items: start;
}
.main { min-width: 0; }
.side { margin-top: 22px; position: sticky; top: 84px; }
.side[hidden] { display: none; }

/* The card: what an encyclopedia says about the thing searched for */
.card {
  background: var(--raised); border: 1px solid var(--rule); border-radius: 20px;
  padding: 18px; box-shadow: var(--shadow); animation: rise .3s ease-out both;
}
.card-img { display: block; width: 100%; max-height: 260px; object-fit: cover; object-position: center 20%; border-radius: 12px; margin-bottom: 16px; background: var(--hover); }
.card h2 { margin: 0; font: 800 26px/1.12 var(--display); letter-spacing: -.025em; }
.card-sub { margin: 5px 0 0; font-size: 14px; color: var(--soft); }
.card-text { margin: 14px 0 0; font-size: 14.5px; line-height: 1.6; }
.card-text a, .card-facts a, .card-src a { color: var(--link); text-decoration: none; }
.card-text a:hover, .card-facts a:hover, .card-src a:hover { text-decoration: underline; }
.card-facts { margin: 16px 0 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); border-top: 1px solid var(--rule); }
.card-facts dt, .card-facts dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14px; line-height: 1.45; }
.card-facts dt { color: var(--faint); padding-right: 18px; }
.card-facts dd { overflow-wrap: anywhere; }
.card-src { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: var(--faint); }
.meta { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 10px; min-height: 22px; font-size: 13px; color: var(--faint); }
.meta b { color: var(--soft); font-weight: 500; }
.results { list-style: none; margin: 0 -16px; padding: 0; max-width: 736px; }
.results li {
  position: relative; padding: 16px; border-radius: 16px;
  transition: background .15s;
  animation: rise .28s ease-out both; animation-delay: calc(var(--i, 0) * 28ms);
}
.results li:hover { background: var(--hover); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* The answer to a question, above everything */
.answer {
  max-width: 736px; margin: 6px 0 14px; padding: 20px 22px 16px; border-radius: 20px;
  background: var(--accent-bg); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  animation: rise .28s ease-out both;
}
.answer[hidden] { display: none; }
.answer-q { margin: 0; font-size: 14px; color: var(--soft); }
.answer-v { margin: 6px 0 0; font: 800 clamp(26px, 5vw, 36px)/1.15 var(--display); letter-spacing: -.03em; color: var(--ink); overflow-wrap: anywhere; }
.answer-n { margin: 6px 0 0; font-size: 15px; color: var(--soft); }
.answer-s { margin: 14px 0 0; font-size: 12px; color: var(--faint); }
.answer-s a { color: var(--link); text-decoration: none; }
.answer-s a:hover { text-decoration: underline; }

/* Top stories, above the results */
.stories { max-width: 736px; margin: 6px 0 14px; padding: 16px 16px 6px; border: 1px solid var(--rule); border-radius: 20px; background: var(--raised); animation: rise .28s ease-out both; }
.stories[hidden] { display: none; }
.stories h2 { margin: 0 0 6px; font: 700 15px/1.2 var(--display); letter-spacing: -.005em; color: var(--soft); }
.stories ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.stories li { position: relative; padding: 12px 0; border-top: 1px solid var(--rule); min-width: 0; }
.stories li:nth-child(-n+2) { border-top: 0; }
.stories .tile { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; }
.stories .tile img { width: 15px; height: 15px; }
.story {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 8px; font: 600 15.5px/1.38 var(--text); letter-spacing: -.005em; color: var(--link); text-decoration: none;
}
.story::after { content: ""; position: absolute; inset: 0; }
.story:visited { color: var(--visited); }
.stories li:hover .story { text-decoration: underline; text-underline-offset: 3px; }

.where { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tile {
  flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-bg); color: var(--accent); font: 800 13px/1 var(--display); text-transform: uppercase;
}
/* Site icons are drawn for a light background, so a tile holding one is
   white in both modes. */
.tile.has-icon { background: #ffffff; box-shadow: 0 0 0 1px var(--rule); }
.tile img { display: block; width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
/* The front page of the website the search named */
.official {
  flex: none; font: 600 11px/1 var(--text); letter-spacing: .02em; color: var(--accent);
  background: var(--accent-bg); border-radius: 999px; padding: 4px 8px;
}
.crumbs { min-width: 0; font-size: 13px; line-height: 1.3; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs b { color: var(--ink); font-weight: 500; }
.crumbs i { font-style: normal; opacity: .6; padding: 0 5px; }
.title {
  display: inline-block; margin: 9px 0 4px; font: 600 20px/1.3 var(--text); letter-spacing: -.012em;
  color: var(--link); text-decoration: none; overflow-wrap: anywhere;
}
/* The whole row opens the result, not only its title. */
.title::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.title:visited { color: var(--visited); }
.results li:hover .title { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.snippet {
  margin: 0; color: var(--soft); font-size: 15px; line-height: 1.6; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.snippet mark { background: none; color: var(--ink); font-weight: 600; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.pager a {
  font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none;
  background: var(--raised); border: 1px solid var(--rule); border-radius: 999px; padding: 9px 18px;
  transition: border-color .15s, background .15s, color .15s;
}
.pager a:hover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.pager span { font-size: 13px; color: var(--faint); }

.empty { max-width: 520px; padding: 44px 0 20px; }
.empty .logo { width: 44px; height: 44px; color: var(--rule); margin-bottom: 18px; }
.empty .logo .dot-a { fill: var(--accent); }
.empty h2 { margin: 0 0 8px; font: 800 28px/1.15 var(--display); letter-spacing: -.025em; }
.empty p { margin: 0; color: var(--soft); }

/* Placeholder rows while a search is on its way */
.ghost { padding: 16px 0; max-width: 704px; }
.ghost i { display: block; height: 12px; border-radius: 6px; background: var(--rule); margin-bottom: 11px; animation: pulse 1.2s ease-in-out infinite; }
.ghost i:nth-child(1) { width: 24%; } .ghost i:nth-child(2) { width: 58%; height: 20px; } .ghost i:nth-child(3) { width: 94%; } .ghost i:nth-child(4) { width: 71%; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .ghost i, .results li { animation: none; }
  * { transition: none !important; }
}

/* Prose pages (the crawler page) */
.prose { max-width: 680px; margin: 0 auto; padding: 28px 20px 80px; font-size: 17px; line-height: 1.65; }
.prose h1 { font: 800 clamp(38px, 7vw, 54px)/1.05 var(--display); letter-spacing: -.035em; margin: 44px 0 14px; }
.prose h2 { font: 700 21px/1.3 var(--display); letter-spacing: -.01em; margin: 44px 0 10px; }
.prose p { margin: 0 0 14px; }
.prose .lead { font-size: 19px; color: var(--soft); }
.prose ul { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose code, .prose pre { font-family: var(--mono); font-size: 14px; }
.prose code { background: var(--raised); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
.prose pre {
  background: var(--raised); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; overflow-x: auto; line-height: 1.5;
}
.prose footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 13px; color: var(--faint); }

@media (max-width: 1000px) {
  .page { grid-template-columns: minmax(0, 1fr); max-width: 784px; }
  /* On a narrow screen the card comes first, above the results. */
  .side { position: static; order: -1; margin-top: 20px; }
  .card-img { max-height: 220px; }
}

@media (max-width: 600px) {
  .bar-in { gap: 12px; padding: 10px 16px; }
  .bar .brand span { display: none; }
  .search kbd { display: none; }
  .page { padding-left: 16px; padding-right: 16px; }
  .results { margin: 0 -10px; }
  .stories ul { grid-template-columns: minmax(0, 1fr); }
  .stories li:nth-child(2) { border-top: 1px solid var(--rule); }
  .results li { padding: 14px 10px; }
  .title { font-size: 18px; }
  .prose { padding-left: 16px; padding-right: 16px; }
}
