/* Antipedia V2 — one small stylesheet, no frameworks. */
:root {
  --bg: #f6f6f6;
  --ink: #111;
  --muted: #7a7a7a;
  --faint: #a8a8a8;
  --line: #e2e2e2;
  --panel: #fff;
  --hl: rgba(0, 0, 0, .09);
  --link: #36c;
  --nav: #111;
  --nav-ink: #818181;
  --serif: 'Crimson Text', Georgia, 'Times New Roman', serif;
  --shadow: 0 10px 30px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 var(--serif);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---- Side navigation ---- */
.sidenav {
  position: fixed;
  inset: 0 auto 0 0;
  width: 200px;
  padding-top: 20px;
  background: var(--nav);
  z-index: 40;
}
.sidenav a {
  display: block;
  padding: 6px 8px 6px 16px;
  font-size: 20px;
  color: var(--nav-ink);
  transition: color .15s;
}
.sidenav a:hover, .sidenav a[aria-current="page"] { color: #f1f1f1; text-decoration: none; }

.main {
  margin-left: 200px;
  padding: 20px 40px 80px;
  max-width: 1280px;
}

/* ---- Masthead ---- */
.masthead {
  display: flex;
  align-items: center;
  gap: 30px;
  padding-top: 10px;
}
.masthead img { width: 200px; height: auto; flex: none; }
.masthead h1 {
  margin: 0 0 -3px;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.2;
}
.masthead h1 a { color: inherit; }
.masthead h1 a:hover { text-decoration: none; }
.masthead h1 .big { font-size: 45px; }
.masthead .slogan { font-weight: 700; font-size: 16px; }

/* ---- Search ---- */
.search { position: relative; margin-top: 40px; max-width: 980px; }
.search-box {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: transparent;
  transition: background-color .2s, box-shadow .2s;
}
.search-box:focus-within { background: rgba(255, 255, 255, .7); box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: none;
  cursor: pointer;
  font-size: 15px;
  letter-spacing: .06em;
  color: #444;
  transition: background-color .15s;
}
.lang-btn:hover { background: rgba(0, 0, 0, .04); }
.lang-btn svg { width: 16px; height: 16px; flex: none; }
.lang-btn .chev { width: 10px; height: 10px; transition: transform .2s var(--ease); }
.lang-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

#search {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  background: none;
  font-size: 20px;
  line-height: 1.6;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#search::-webkit-search-cancel-button { -webkit-appearance: none; }
#search::placeholder { color: var(--faint); }

.submit {
  display: grid;
  place-items: center;
  width: 52px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink);
  transition: color .15s;
}
.submit:hover { color: var(--muted); }
.submit svg { width: 20px; height: 20px; }

.hint { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.hint kbd {
  font: 13px/1 ui-monospace, Consolas, monospace;
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #fff;
}

/* Popovers (suggestions + language panel) */
.suggestions, .lang-panel {
  position: absolute;
  top: calc(100% + 6px);
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 30;
  animation: pop .14s var(--ease);
  transform-origin: top left;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }

.suggestions { left: 0; right: 0; overflow: hidden; }
.sugg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 14px;
  cursor: pointer;
}
.sugg + .sugg { border-top: 1px solid #f0f0f0; }
.sugg.is-active { background: #f2f2f2; }
.sugg img, .sugg-ph {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 3px;
  object-fit: cover;
  background: #eee;
}
.sugg-ph { background: linear-gradient(135deg, #eee, #e3e3e3); }
.sugg-text { display: flex; flex-direction: column; min-width: 0; }
.sugg-title { font-size: 18px; line-height: 1.25; color: #333; }
.sugg-title b { color: var(--ink); font-weight: 600; }
.sugg-desc {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-panel { left: 0; width: min(380px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.lang-head { padding: 12px 12px 8px; border-bottom: 1px solid #eee; }
.lang-filter {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  outline: none;
  background: #fafafa;
}
.lang-filter:focus { border-color: var(--ink); background: #fff; }
.lang-detected { margin: 8px 2px 0; font-size: 14px; line-height: 1.35; color: #444; }
.lang-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: min(340px, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lang-group {
  padding: 8px 14px 4px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}
.lang-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 10px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: 16px;
}
.lang-row.is-active { background: #f2f2f2; }
.lang-row.is-current .lang-native { font-weight: 600; }
.lang-row.is-current .lang-native::after { content: ' ✓'; color: var(--muted); font-weight: 400; }
.lang-english { font-size: 14px; color: var(--muted); }
.lang-c { font: 12px ui-monospace, Consolas, monospace; color: var(--faint); min-width: 3.5em; text-align: right; }
.lang-empty { padding: 10px 14px; font-size: 14px; color: var(--muted); }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---- Status + results ---- */
#intro { margin-top: 40px; font-size: 20px; }
.status { min-height: 1.5em; margin: 28px 0 8px; font-size: 18px; color: var(--muted); max-width: 980px; }
.status b { color: var(--ink); }

.spinner {
  display: inline-block;
  width: .8em;
  height: .8em;
  margin-right: .5em;
  vertical-align: -.05em;
  border: 2px solid #ccc;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.results {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.entry {
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
  animation: rise .35s var(--ease) both;
  content-visibility: auto;
  contain-intrinsic-size: auto 140px;
  transition: opacity .25s;
}
.entry.is-gone { opacity: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 14px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}
.entry-meta a { color: var(--muted); text-decoration: underline; text-decoration-color: #ccc; text-underline-offset: 2px; }
.entry-meta a:hover { color: var(--ink); text-decoration-color: currentColor; }
.entry-why { font-style: italic; max-width: 100%; overflow-wrap: anywhere; }

.entry-body .line {
  margin: 0 0 .45em;
  font-size: 17px;
  line-height: 1.55;
  color: #8f8f8f;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.entry-body .line.whole { color: var(--ink); }
.entry-body del {
  text-decoration: none;
  color: var(--ink);
  background: var(--hl);
  border-radius: 2px;
  padding: 0 1px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.sk {
  display: block;
  height: 14px;
  margin: 8px 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #e8e8e8 25%, #f2f2f2 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.sk.short { width: 60%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Removed media */
.media-item {
  margin: 0 0 22px;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.media-item.loaded { opacity: 1; }
.media-item img, .media-item video {
  display: block;
  width: 100%;
  height: auto;
  background: #eaeaea;
}
.media-item figcaption {
  margin-top: 4px;
  font-size: 13px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.more { margin: 24px 0; }
.dig {
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  font-size: 17px;
  transition: background-color .15s;
}
.dig:hover:not(:disabled) { background: rgba(0, 0, 0, .05); }
.dig:disabled { cursor: progress; color: var(--muted); border-color: #bbb; }
.did-you-mean { font-size: 18px; color: var(--muted); }

/* ---- Content pages (about / podcast) ---- */
.page { margin-top: 70px; max-width: 640px; font-size: 20px; color: #6f6f6f; }
.page h2 { font-size: 30px; font-weight: 400; color: var(--ink); margin: 0 0 12px; }
.page h3 { font-size: 22px; font-weight: 600; color: #444; margin: 40px 0 12px; }
.page audio { width: 100%; margin-top: 8px; }

/* ---- Small screens ---- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .sidenav {
    position: sticky;
    inset: 0 0 auto 0;
    width: auto;
    display: flex;
    gap: 4px;
    padding: 8px 8px;
    overflow-x: auto;
  }
  .sidenav a { padding: 4px 10px; font-size: 18px; }
  .main { margin-left: 0; padding: 16px 16px 60px; }
  .masthead { gap: 16px; }
  .masthead img { width: 84px; }
  .masthead h1 { font-size: 26px; }
  .masthead h1 .big { font-size: 34px; }
  .masthead .slogan { font-size: 14px; }
  .search { margin-top: 24px; }
  #search { font-size: 18px; }
  .lang-btn { padding: 0 8px 0 10px; }
  .lang-btn .globe { display: none; }
  .hint { display: none; }
  .results { grid-template-columns: 1fr; gap: 0; }
  #media { order: -1; columns: 2; column-gap: 12px; }
  #media:empty { display: none; }
  .media-item { break-inside: avoid; margin-bottom: 12px; }
  .page { margin-top: 40px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
