/* KEEL static mirror — same design tokens as the origin explorer. */

:root {
  --bg: #08070f;
  --surface: #100e1d;
  --elevated: #191634;
  --fg: #eef0ff;
  --muted: #a8a6c8;
  --subtle: #716e94;
  --accent: #a78bfa;
  --accent-fg: #120a24;
  --accent-blue: #60a5fa;
  --accent-pink: #f472b6;
  --border: color-mix(in oklab, var(--accent) 18%, transparent);
  --ring: color-mix(in oklab, var(--accent) 65%, transparent);
  --healthy: #34d399;
  --flagged: #f472b6;
  --danger: #fb7185;

  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Fraunces", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-border: 0 0 0 1px color-mix(in oklab, var(--accent) 16%, transparent);
  --shadow-border-hover: 0 0 0 1px color-mix(in oklab, var(--accent-pink) 40%, transparent),
    0 4px 24px -8px color-mix(in oklab, var(--accent) 35%, transparent);
  --shadow-glow: 0 10px 30px -10px color-mix(in oklab, var(--accent) 45%, transparent);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --motion-quick: 150ms;
  --motion-fast: 250ms;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--fg);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  line-height: 1.5;
  background:
    radial-gradient(900px 480px at 6% -12%, color-mix(in oklab, var(--accent-blue) 17%, transparent), transparent 60%),
    radial-gradient(1000px 540px at 98% -6%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(900px 620px at 50% 118%, color-mix(in oklab, var(--accent-pink) 13%, transparent), transparent 62%),
    var(--bg);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--fg);
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

button {
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.4;
}

img, video {
  outline: 1px solid color-mix(in oklab, var(--fg) 10%, transparent);
  outline-offset: -1px;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: color-mix(in oklab, var(--accent) 45%, transparent);
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 768px) {
  .wrap {
    padding-inline: 1.5rem;
  }
}

/* ---------- chrome ---------- */

.skip {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 50;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

.skip:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-right: 0.5rem;
}

.brand-mark {
  width: 1rem;
  height: 1rem;
  color: var(--accent);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--muted);
  transition: color var(--motion-quick) var(--ease-out);
}

.site-nav a:hover {
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  background: var(--elevated);
  color: var(--fg);
}

.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 0;
}

.status-item b {
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#st-hash {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}

@media (max-width: 640px) {
  #st-hash {
    display: none;
  }
}

.view {
  flex: 1;
  padding-block: 2rem 4rem;
  outline: none;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--subtle);
  font-size: 0.75rem;
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-block: 2rem;
}

@media (min-width: 768px) {
  .footer-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-row p {
  max-width: 40rem;
}

.footer-actions {
  display: flex;
  gap: 1.25rem;
  flex-shrink: 0;
}

.footer-actions a,
.linklike {
  color: var(--subtle);
  transition: color var(--motion-quick) var(--ease-out);
}

.footer-actions a:hover,
.linklike:hover {
  color: var(--fg);
}

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}

/* ---------- primitives ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 4px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip-healthy { background: color-mix(in oklab, var(--healthy) 15%, transparent); color: var(--healthy); }
.chip-danger { background: color-mix(in oklab, var(--danger) 15%, transparent); color: var(--danger); }
.chip-muted { background: var(--elevated); color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 4px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-accent { background: color-mix(in oklab, var(--accent) 15%, transparent); color: var(--fg); }
.badge-warn { background: color-mix(in oklab, var(--flagged) 15%, transparent); color: var(--flagged); }
.badge-danger { background: color-mix(in oklab, var(--danger) 15%, transparent); color: var(--danger); }
.badge-default { background: var(--elevated); color: var(--muted); }
.badge-muted { background: transparent; color: var(--subtle); box-shadow: var(--shadow-border); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding-inline: 1rem;
  border: 0;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition:
    filter var(--motion-quick) var(--ease-out),
    box-shadow var(--motion-quick) var(--ease-out),
    background-color var(--motion-quick) var(--ease-out),
    transform var(--motion-quick) var(--ease-out);
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(to right, var(--accent-blue), var(--accent), var(--accent-pink));
  color: var(--accent-fg);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  color: var(--accent-fg);
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  box-shadow: var(--shadow-border);
}

.btn-outline:hover {
  background: var(--elevated);
}

.btn-sm {
  height: 2.25rem;
  padding-inline: 0.75rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.input {
  width: 100%;
  height: 2.75rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--elevated);
  color: var(--fg);
  padding-inline: 0.75rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-border);
}

.input::placeholder {
  color: var(--subtle);
}

.input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-border);
}

a.card {
  display: block;
  transition: box-shadow var(--motion-fast) var(--ease-out);
}

a.card:hover {
  box-shadow: var(--shadow-border-hover);
}

.hash {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  word-break: break-all;
}

.hashline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.hashline .lbl {
  flex-shrink: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--subtle);
}

.hashline code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.copybtn {
  position: relative;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--subtle);
  transition: color var(--motion-quick) var(--ease-out);
}

.copybtn:hover {
  color: var(--fg);
}

.copybtn svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.875rem;
  height: 0.875rem;
  transition:
    opacity var(--motion-fast) var(--ease-out),
    transform var(--motion-fast) var(--ease-out);
}

.copybtn .icon-check { opacity: 0; transform: scale(0.25); color: var(--healthy); }
.copybtn.copied .icon-copy { opacity: 0; transform: scale(0.25); }
.copybtn.copied .icon-check { opacity: 1; transform: scale(1); }

.pill {
  height: 2.75rem;
  padding-inline: 0.75rem;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  transition:
    color var(--motion-quick) var(--ease-out),
    background-color var(--motion-quick) var(--ease-out);
}

.pill:hover {
  color: var(--fg);
}

.pill[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-fg);
}

.pill.pill-soft[aria-pressed="true"] {
  background: var(--elevated);
  color: var(--fg);
}

.kicker {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--subtle);
}

.text-gradient {
  background: linear-gradient(92deg, var(--accent-blue), var(--accent) 45%, var(--accent-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.healthy { color: var(--healthy); }
.danger { color: var(--danger); }
.warn { color: var(--flagged); }

.num { font-variant-numeric: tabular-nums; }

.loading {
  color: var(--subtle);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ---------- index view ---------- */

.hero {
  display: grid;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 1024px) {
  .hero {
    grid-template-columns: 1.3fr 0.7fr;
    align-items: end;
  }
}

.hero h1 {
  margin-top: 0.75rem;
  font-size: clamp(2.4rem, 1.6rem + 3vw, 4rem);
  max-width: 36rem;
}

.hero .lede {
  margin-top: 1rem;
  max-width: 36rem;
  color: var(--muted);
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.head-card {
  padding: 1.25rem;
}

.head-card .height {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-variant-numeric: tabular-nums;
}

.head-card .hashline { margin-top: 0.5rem; }
.head-card .hashline:first-of-type { margin-top: 1rem; }

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.toolbar .input {
  max-width: 24rem;
}

.pillrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.vcard {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vcard .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--elevated);
}

.vcard .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--ease-out);
}

.vcard:hover .thumb img {
  transform: scale(1.03);
}

.vcard .thumb .placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.875rem;
  color: var(--subtle);
}

.vcard .thumb .overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem;
  background: linear-gradient(to top, color-mix(in oklab, var(--bg) 90%, transparent), transparent);
  font-size: 0.75rem;
}

.vcard .body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
}

.vcard h2 {
  font-size: 1.125rem;
  line-height: 1.3;
  transition: color var(--motion-quick) var(--ease-out);
}

.vcard:hover h2 {
  color: var(--accent);
}

.vcard .desc {
  font-size: 0.875rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vcard .rchash {
  margin-top: auto;
  padding-top: 0.25rem;
  color: var(--subtle);
}

.genesis-card {
  padding: 1.25rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .genesis-card { padding: 1.5rem; }
}

.genesis-card h2 {
  margin-top: 0.5rem;
  font-size: 1.5rem;
}

.genesis-card p {
  margin-top: 0.5rem;
  max-width: 42rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.empty {
  padding: 2rem;
  text-align: center;
  border: 1px dashed var(--border);
  background: color-mix(in oklab, var(--surface) 50%, transparent);
}

.empty h2 {
  font-size: 1.25rem;
}

.empty p {
  margin: 0.5rem auto 0;
  max-width: 28rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- watch view ---------- */

.watch-head {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .watch-head {
    flex-direction: row;
    align-items: end;
    justify-content: space-between;
  }
}

.watch-head h1 {
  margin-top: 0.25rem;
  font-size: clamp(1.85rem, 1.3rem + 1.8vw, 2.75rem);
}

.watch-head .lede {
  margin-top: 0.5rem;
  max-width: 42rem;
  color: var(--muted);
}

.watch-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .watch-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 0.9fr);
  }
}

.player {
  overflow: hidden;
}

.player video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
}

.player .player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.player .player-bar .hash {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.ptr-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.ptr-pills .pill {
  height: auto;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gate {
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
}

.gate h2 {
  font-size: 1.5rem;
}

.gate p {
  margin-top: 0.75rem;
  max-width: 28rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.gate .row {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem;
}

@media (min-width: 768px) {
  .panel { padding: 1.5rem; }
}

.panel section > .kicker {
  letter-spacing: 0.05em;
}

.panel .stack {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.panel .badges {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.ptr {
  margin-top: 0.5rem;
  border-radius: var(--radius-md);
  background: var(--elevated);
  padding: 0.5rem 0.75rem;
}

.ptr .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.ptr .note {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--subtle);
}

/* ---------- snapshots view ---------- */

.snap-list {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.snap-list li {
  padding: 1.25rem;
}

.snap-list .top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.snap-list .count {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.page-head {
  max-width: 42rem;
  margin-bottom: 2.5rem;
}

.page-head h1 {
  margin-top: 0.5rem;
  font-size: clamp(1.85rem, 1.3rem + 1.8vw, 2.75rem);
}

.page-head p {
  margin-top: 0.75rem;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.page-actions .note {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- error ---------- */

.errbox {
  margin-top: 4rem;
  text-align: center;
  padding: 2rem;
}

.errbox h1 {
  font-size: 1.5rem;
}

.errbox p {
  margin: 0.75rem auto 0;
  max-width: 30rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.errbox .row {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
