/* ═══════════════════════════════════════════════════════
   Beetle Results — inspired by terminal.css
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700&display=swap');

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  --text:     #1d1d1f;
  --text-sec: #6e6e73;
  --text-ter: #aeaeb2;

  --bg:       #ffffff;

  --card-border: rgba(0,0,0,0.08);

  --content-w: 900px;
  --header-h:  52px;

  --rb-g: rgba(104, 209,  93, 0.55);
  --rb-y: rgba(255, 195,  74, 0.55);
  --rb-o: rgba(255, 122,  74, 0.55);
  --rb-p: rgba(214,  84, 140, 0.55);
  --rb-b: rgba( 77, 124, 255, 0.55);

  --radius-pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; overflow-x: hidden; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ══════════════════════════════════════════
   HEADER — sticky frosted, matches terminal
══════════════════════════════════════════ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(255,255,255,0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.10);
}

.headerInner {
  max-width: var(--content-w);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
}

.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brandLogo {
  width: 90px;
  height: auto;
  display: block;
}

/* ── Header action buttons (Normalise CCY) ── */
.headerActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.headerBtn {
  height: 32px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 980px;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.headerBtn:hover {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.20);
}
.headerBtn--active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.headerBtn--active:hover {
  background: #3a3a3c;
}

.normBadge {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.70);
  letter-spacing: 0.04em;
}

.headerDividerSep {
  display: none;
}

/* ══════════════════════════════════════════
   HERO SEARCH — exact terminal.css dimensions
/* ══════════════════════════════════════════
   LOADING BAR — smooth trail animation
══════════════════════════════════════════ */
.loadingBar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 999;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.loadingBar.active {
  opacity: 1;
}
.loadingBar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.25), rgba(0,0,0,0.45), rgba(0,0,0,0.25), transparent);
  border-radius: 2px;
  animation: loadSlide 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes loadSlide {
  0%   { left: -40%; }
  100% { left: 100%; }
}
[data-theme="dark"] .loadingBar::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), rgba(255,255,255,0.4), rgba(255,255,255,0.2), transparent);
}

/* ══════════════════════════════════════════
   HERO SEARCH — exact terminal.css dimensions
══════════════════════════════════════════ */
.heroSearch {
  background: #ffffff;
  padding: 48px 24px 40px;
  text-align: center;
}

.heroSearchLabel {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 20px;
}

.heroSearchBar {
  position: relative;
  max-width: 560px;
  margin: 0 auto;

  height: 50px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(28px) saturate(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(1.08);
  border: 1px solid rgba(255,255,255,0.60);
  border-radius: 25px;
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.88),
    inset 0 -1px 1px rgba(0,0,0,0.055),
    0 0 0 1px rgba(255,255,255,0.25),
    0 1px 3px rgba(0,0,0,0.045);
  display: flex;
  align-items: center;
  padding: 0 18px 0 16px;
  gap: 10px;
  transition: background .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.heroSearchBar::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 27px;
  pointer-events: none;
  background: linear-gradient(90deg,
    var(--rb-g), var(--rb-y), var(--rb-o), var(--rb-p), var(--rb-b)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
  filter: blur(0.25px);
  opacity: 0.55;
}

.heroSearchBar:focus-within {
  background: rgba(255,255,255,0.96);
  border-color: rgba(255,255,255,0.74);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.92),
    inset 0 -1px 1px rgba(0,0,0,0.065),
    0 0 0 1px rgba(255,255,255,0.96),
    0 1px 4px rgba(0,0,0,0.06);
}
.heroSearchBar:focus-within::before { opacity: 0.85; }

.heroSearchIcon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: rgba(0,0,0,0.40);
  pointer-events: none;
  padding-left: 4px;
}

.heroSearchInput {
  flex: 1;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
}
.heroSearchInput::placeholder { color: rgba(0,0,0,0.35); }

/* SOC edit input — must match criteriaOverlay position exactly */
.socEditInput {
  position: absolute;
  left: 52px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  padding: 0;
  text-align: left;
}

/* Suggestions dropdown for hero bar */
.heroSearchBar .sug {
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  text-align: left;
}

/* ══════════════════════════════════════════
   CRITERIA BAR — beneath header
══════════════════════════════════════════ */
.criteriaBar {
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: #fff;
  position: relative;
  z-index: 50;
}

.criteriaBarInner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Criteria pills — match terminal miniBtn style */
.criteriaGrid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0,0,0,0.12);
  background: #f5f5f7;
  transition: background .15s, border-color .15s, box-shadow .15s;
}

.field.active,
.field:focus-within {
  background: #fff;
  border-color: rgba(0,0,0,0.22);
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.field.hidden { display: none; }

.label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-ter);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.input {
  width: 90px;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--text);
  padding: 0;
}
.input::placeholder { color: var(--text-ter); }

.pillClose {
  border: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(0,0,0,0.12);
  color: rgba(0,0,0,0.55);
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .12s;
}
.pillClose:hover {
  background: rgba(0,0,0,0.22);
  color: var(--text);
}

/* Suggestions dropdown */
.sug {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  overflow: hidden;
  display: none;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 160px;
}
.sug button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  font-family: var(--font);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.sug button:last-child { border-bottom: 0; }
.sug button:hover { background: rgba(0,0,0,0.04); }
.sug .empty { padding: 9px 12px; color: var(--text-ter); font-size: 12.5px; }

/* Add criteria button */
.addCritWrap { position: relative; }

#addCritBtn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid #0071e3;
  background: #0071e3;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: #fff;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
#addCritBtn:hover {
  background: #0077ed;
  border-color: #0077ed;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 113, 227, 0.3);
}
[data-theme="dark"] #addCritBtn {
  background: #2997ff;
  border-color: #2997ff;
}
[data-theme="dark"] #addCritBtn:hover {
  background: #40a3ff;
  border-color: #40a3ff;
}

/* Criteria dropdown menu */
#critMenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  overflow: hidden;
  display: none;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 140px;
}
#critMenu.open { display: block; }

.critItem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  font-family: var(--font);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background .12s;
}
.critItem:last-child { border-bottom: 0; }
.critItem:hover { background: rgba(0,0,0,0.04); }
.critEmpty {
  padding: 9px 14px;
  font-size: 12px;
  color: var(--text-ter);
}

/* Clear all */
#clearBtn {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text-ter);
  cursor: pointer;
  transition: color .15s, background .15s;
}
#clearBtn:hover {
  color: var(--text-sec);
  background: rgba(0,0,0,0.04);
}

/* Status line */
.socLine {
  font-size: 11.5px;
  color: var(--text-ter);
  letter-spacing: 0.01em;
}
.hint {
  font-size: 11.5px;
  color: var(--text-ter);
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════ */
.main {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.panel { width: 100%; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.between { justify-content: space-between; }

.sectionTitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-ter);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.mono {
  font-size: 11px;
  color: var(--text-ter);
  font-variant-numeric: tabular-nums;
}

/* Sort dropdown */
.mini {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #f5f5f7;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  cursor: pointer;
}

/* ══════════════════════════════════════════
   RESULT CARDS — Google-style list
══════════════════════════════════════════ */
.results {
  margin-top: 4px;
}

.result-hidden { display: none !important; }

.card {
  position: relative;
  padding: 16px 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: transparent;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  cursor: pointer;
  border-radius: 12px;
}
.card:first-child { border-top: 1px solid rgba(0,0,0,0.07); }
.card:hover {
  background: rgba(0,0,0,0.018);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  transform: translateY(-1px);
}
.card:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.card .code { display: none; }

.cardLeft {
  flex: 1;
  min-width: 0;
}

.cumValueBox {
  position: absolute;
  top: 16px;
  right: 0;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}

.cardViewCount {
  position: absolute;
  top: 38px;
  right: 0;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

.card .name {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: #5b8db8;
  text-decoration: none;
  cursor: pointer;
  display: block;
  margin-bottom: 3px;
}
.card .name:hover { text-decoration: underline; color: #4a7aa3; }

.card .name .dateString {
  font-weight: 400;
}

.card .decoded {
  font-size: 12.5px;
  color: var(--text-sec);
  line-height: 1.45;
}

.kv { margin-top: 5px; }
.k {
  font-size: 11.5px;
  color: var(--text-ter);
  font-weight: 400;
}
.v {
  font-size: 11.5px;
  color: var(--text-sec);
  font-weight: 500;
}

/* Glass spark pill — right side */
.cardRight {
  flex-shrink: 0;
  position: relative;
  width: 72px;
  height: 28px;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(140% 220% at 18% 0%,
    rgba(255,255,255,0.78) 0%,
    rgba(255,255,255,0.40) 40%,
    rgba(255,255,255,0.22) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.78),
    inset 0 -1px 0 rgba(0,0,0,0.10);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
}

.cardRight canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.cardRight::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(farthest-side,
      rgba(180,180,180,0.55) 0%,
      rgba(200,200,200,0.65) 60%,
      rgba(235,235,235,0.85) 100%
    ),
    linear-gradient(180deg,
      rgba(0,0,0,0.18) 0%,
      rgba(0,0,0,0.06) 45%,
      rgba(255,255,255,0.00) 100%
    );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 2.2px;
  z-index: 3;
}

.cardRight::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(90% 160% at 0% 50%, rgba(180,180,180,0.55) 0%, rgba(180,180,180,0.25) 40%, rgba(180,180,180,0.00) 72%),
    radial-gradient(90% 160% at 100% 50%, rgba(180,180,180,0.55) 0%, rgba(180,180,180,0.25) 40%, rgba(180,180,180,0.00) 72%),
    linear-gradient(180deg, rgba(0,0,0,0.00) 0%, rgba(0,0,0,0.00) 78%, rgba(0,0,0,0.28) 93%, rgba(0,0,0,0.00) 100%),
    radial-gradient(120% 85% at 50% 112%, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0.35) 34%, rgba(255,255,255,0.00) 70%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 2.8px;
  z-index: 4;
}

.cardRight::before { z-index: 3; }
.cardRight::after  { z-index: 4; }
.cardRight .spark  { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.cardRight .sparkFg { position: relative; z-index: 2; }

/* ══════════════════════════════════════════
   PAGER
══════════════════════════════════════════ */
.pager {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager .pageInfo {
  font-size: 12.5px;
  color: var(--text-ter);
  margin-left: auto;
}

.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0,0,0,0.12);
  background: #f5f5f7;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-sec);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn:hover {
  background: rgba(0,0,0,0.08);
  color: var(--text);
}
.btn.tiny { font-size: 12px; }

.pageBtn { min-width: 34px; justify-content: center; display: inline-flex; align-items: center; }
.pageBtn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.result-hidden { display: none !important; }

/* ══════════════════════════════════════════
   SMALL TEXT
══════════════════════════════════════════ */
.small {
  font-size: 12px;
  color: var(--text-sec);
  margin-top: 2px;
}

[data-theme="dark"] .small { color: rgba(255,255,255,0.45); }

/* ══════════════════════════════════════════
   DID YOU MEAN BANNER
══════════════════════════════════════════ */
.didYouMean {
  margin-bottom: 12px;
  font-size: 13.5px;
  color: var(--text-sec);
}

.didYouMeanLabel {
  color: var(--text-sec);
}

.didYouMeanLink {
  border: 0;
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: #0066cc;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.didYouMeanLink:hover { color: #004499; }

[data-theme="dark"] .didYouMeanLabel { color: rgba(255,255,255,0.45); }
[data-theme="dark"] .didYouMeanLink  { color: #8cbfff; }
[data-theme="dark"] .didYouMeanLink:hover { color: #aad0ff; }

/* ══════════════════════════════════════════
   MOBILE — scroll-reveal (Apple-style)
══════════════════════════════════════════ */
@media (max-width: 768px) {
  .mob-reveal {
    opacity: 0;
    transform: translateY(60px);
    will-change: opacity, transform;
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
                transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .mob-reveal--d1 { transition-delay: 0.08s; }
  .mob-reveal--d2 { transition-delay: 0.18s; }
  .mob-reveal--d3 { transition-delay: 0.28s; }
  .mob-reveal--d4 { transition-delay: 0.38s; }
  .mob-reveal--visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .headerInner { padding: 0 16px; }
  .main { padding: 16px 16px 48px; }
  .criteriaBarInner { padding: 8px 16px; flex-wrap: wrap; }
  .brandLogo { width: 80px; }
  .heroSearchBar { max-width: 100%; }
  .heroSearch { padding-left: 16px; padding-right: 16px; }
  .card { max-width: 100%; overflow: hidden; }
  .card .name .dateString { display: block; }
}
/* ── Copyright footer ─────────────────────────────────────── */
.beetle-footer {
  text-align: center;
  width: 100%;
  padding: 12px 16px 20px;
  font-size: 12px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  color: rgba(0, 0, 0, 0.35);
  letter-spacing: 0.02em;
}
.beetle-footer-link {
  color: inherit;
  text-decoration: none;
}
.beetle-footer-link:hover {
  text-decoration: underline;
}