/* ── Design tokens ──────────────────────────────────────────────── */
:root {
  --c-bg:        #0f0f13;
  --c-surface:   #17171e;
  --c-raised:    #1f1f2a;
  --c-border:    #2a2a38;
  --c-muted:     #6b7280;
  --c-body:      #d1d5db;
  --c-heading:   #f3f4f6;
  --c-accent:    #6366f1;
  --c-accent-h:  #818cf8;
  --c-green:     #34d399;
  --c-danger:    #f87171;
  --c-warning:   #fbbf24;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.4);
  --shadow-md:   0 4px 16px rgba(0,0,0,.5);
  --font-sans:   'Inter', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--c-bg);
  color: var(--c-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--c-accent-h); text-decoration: none; }
a:hover { color: var(--c-accent); }
img { max-width: 100%; display: block; }

/* ── Layout ──────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ──────────────────────────────────────────────────────── */
.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo { display: flex; align-items: center; gap: .6rem; }
.logo-text { font-size: 1.1rem; font-weight: 700; color: var(--c-heading); letter-spacing: -.02em; }
.logo-dot { color: var(--c-accent); }
.header-nav { display: flex; gap: 1.5rem; }
.nav-link { color: var(--c-muted); font-weight: 500; font-size: .9rem; transition: color .15s; }
.nav-link:hover { color: var(--c-heading); }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0 3.5rem;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,.18) 0%, transparent 70%);
}
.hero-title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; color: var(--c-heading); line-height: 1.2; }
.accent { color: var(--c-accent-h); }
.hero-sub { margin-top: .9rem; font-size: 1.05rem; color: var(--c-muted); max-width: 560px; }

/* ── Filter bar ──────────────────────────────────────────────────── */
.filter-bar { background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: 1rem 0; position: sticky; top: 0; z-index: 20; }
.filter-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filter-row-secondary { margin-top: .5rem; }
.filter-label { font-size: .82rem; color: var(--c-muted); white-space: nowrap; }
.filter-sep { color: var(--c-muted); }
.search-wrap { position: relative; flex: 1 1 220px; }
.search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--c-muted); pointer-events: none; }
#search-name { width: 100%; padding: .55rem .75rem .55rem 2.2rem; }

input[type="text"], input[type="number"], input[type="email"],
input[type="password"], select, textarea {
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-body);
  font-family: var(--font-sans);
  font-size: .9rem;
  padding: .55rem .75rem;
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--c-accent); }
select { cursor: pointer; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1.1rem;
  font-size: .9rem; font-weight: 600; font-family: var(--font-sans);
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { background: var(--c-accent-h); }
.btn-secondary { background: var(--c-raised); color: var(--c-body); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: var(--c-border); }
.btn-danger { background: #7f1d1d; color: var(--c-danger); }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-full { width: 100%; }

/* ── Models section ──────────────────────────────────────────────── */
.models-section { padding: 1rem 0 4rem; }

/* shared badge */
.badge {
  background: rgba(99,102,241,.12);
  color: var(--c-accent-h);
  font-size: .75rem; font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 999px;
}

/* variant pill */
.variant-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--c-raised); border: 1px solid var(--c-border);
  border-radius: 999px; padding: .2rem .65rem;
  font-size: .8rem; font-family: var(--font-mono); color: var(--c-body);
}

/* model name + company */
.model-name { font-size: 1rem; font-weight: 700; color: var(--c-heading); }
.model-company { font-size: .8rem; color: var(--c-muted); }
.machine-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.25);
  color: var(--c-green); font-size: .8rem; font-weight: 600;
  padding: .2rem .65rem; border-radius: 999px;
  margin: .2rem .2rem 0 0; cursor: pointer;
  transition: background .15s;
}
.machine-chip:hover { background: rgba(52,211,153,.2); }

/* ── Loading skeleton ─────────────────────────────────────────────── */
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; margin-top: 1rem; }
.skeleton-card {
  height: 220px;
  background: linear-gradient(90deg, var(--c-surface) 25%, var(--c-raised) 50%, var(--c-surface) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-lg);
}
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* ── States ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.empty-state, .error-state { text-align: center; padding: 4rem 1rem; color: var(--c-muted); font-size: 1.05rem; }

/* ── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-box {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); padding: 2rem; max-width: 540px; width: 100%;
  position: relative; box-shadow: var(--shadow-md);
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; color: var(--c-muted); font-size: 1.1rem; cursor: pointer;
}
.modal-close:hover { color: var(--c-heading); }
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--c-heading); margin-bottom: 1.2rem; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .75rem; }
.spec-row { display: contents; }
.spec-label { font-size: .82rem; color: var(--c-muted); }
.spec-value { font-size: .9rem; color: var(--c-body); font-family: var(--font-mono); }

/* ── How-to ──────────────────────────────────────────────────────── */
.howto-section { background: var(--c-surface); border-top: 1px solid var(--c-border); padding: 3.5rem 0; }
.section-title { font-size: 1.5rem; font-weight: 700; color: var(--c-heading); margin-bottom: 1.75rem; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.step-card { background: var(--c-raised); border: 1px solid var(--c-border); border-radius: var(--radius-md); padding: 1.4rem; }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--c-accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.step-card h3 { font-size: 1rem; font-weight: 600; color: var(--c-heading); margin-bottom: .4rem; }
.step-card p { font-size: .88rem; color: var(--c-muted); }

/* ── Footer ──────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--c-border); padding: 1.25rem 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--c-muted); }
.footer-admin-link { color: var(--c-muted); font-size: .82rem; }
.footer-admin-link:hover { color: var(--c-body); }

/* ── Auth page ───────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 380px; }
.auth-logo { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.5rem; }
.auth-logo-text { font-size: 1rem; font-weight: 700; color: var(--c-heading); }
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form label { display: block; font-size: .85rem; color: var(--c-muted); margin-bottom: .3rem; }
.auth-form .form-input { width: 100%; }
.form-check { display: flex; align-items: center; gap: .5rem; }

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert { padding: .65rem .9rem; border-radius: var(--radius-sm); font-size: .88rem; margin-bottom: .75rem; }
.alert-success { background: rgba(52,211,153,.12); color: var(--c-green); border: 1px solid rgba(52,211,153,.3); }
.alert-error   { background: rgba(248,113,113,.1); color: var(--c-danger); border: 1px solid rgba(248,113,113,.3); }
.alert-warning { background: rgba(251,191,36,.1);  color: var(--c-warning); border: 1px solid rgba(251,191,36,.3); }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex; flex-wrap: wrap; gap: .4rem;
  justify-content: center; padding: 1.5rem 0 2rem;
}
.page-btn {
  min-width: 36px; height: 36px; padding: 0 .65rem;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); color: var(--c-body);
  font-size: .88rem; font-family: var(--font-sans); font-weight: 500;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.page-btn:hover:not(.disabled):not(.active) { background: var(--c-raised); border-color: var(--c-accent); }
.page-btn.active { background: var(--c-accent); border-color: var(--c-accent); color: #fff; cursor: default; }
.page-btn.disabled { opacity: .35; cursor: default; }

/* ── Result bar ──────────────────────────────────────────────────── */
.result-bar { padding: .6rem 0 0; }
.result-count { font-size: .85rem; color: var(--c-muted); }

/* ── Models list ─────────────────────────────────────────────────── */
.models-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }

.model-row {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: border-color .15s;
}
.model-row:hover { border-color: var(--c-accent); }

.row-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.row-left { flex: 1 1 0; min-width: 0; }
.row-title-wrap { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-bottom: .4rem; }
.row-meta { display: flex; flex-wrap: wrap; gap: .3rem; }
.row-scores { display: flex; flex-wrap: wrap; gap: .35rem; align-items: flex-start; justify-content: flex-end; }

.row-variants { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.row-notes {
  margin-top: .55rem; padding: .5rem .65rem;
  background: var(--c-raised); border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.notes-label {
  display: block; margin-bottom: .2rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  color: var(--c-accent); text-transform: uppercase;
}
.notes-body {
  font-size: .82rem; color: var(--c-muted); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.row-machines { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }

.muted-text { color: var(--c-muted); font-size: .82rem; }

/* Loading skeleton — list style */
.skeleton-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .75rem; }
.skeleton-row {
  height: 88px;
  background: linear-gradient(90deg, var(--c-surface) 25%, var(--c-raised) 50%, var(--c-surface) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-md);
}

/* ── Variant table ───────────────────────────────────────────────── */
.row-variants { margin-top: .6rem; }
.variant-table {
  width: 100%; border-collapse: collapse;
  font-size: .82rem; margin-top: .25rem;
}
.variant-table th {
  text-align: left; color: var(--c-muted);
  font-weight: 600; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .05em; padding: .25rem .6rem .25rem 0;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.variant-table td {
  padding: .3rem .6rem .3rem 0;
  color: var(--c-body); font-family: var(--font-mono);
  border-bottom: 1px solid rgba(255,255,255,.04);
  white-space: nowrap;
}
.variant-table tr:last-child td { border-bottom: none; }
.dtype-badge {
  background: rgba(99,102,241,.15);
  color: var(--c-accent-h);
  font-size: .75rem; font-weight: 600;
  padding: .1rem .45rem; border-radius: 999px;
  font-family: var(--font-mono);
}
.dtype-badge.act {
  background: rgba(52,211,153,.12);
  color: var(--c-green);
}

/* ── HuggingFace + score chips ───────────────────────────────────── */
.hf-badge { font-size: .82rem; text-decoration: none; margin-left: .35rem; }
.hf-badge:hover { opacity: .8; }
.model-scores { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0; }
.score-chip {
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.25);
  color: var(--c-warning); font-size: .75rem; font-weight: 600;
  padding: .18rem .5rem; border-radius: 999px; font-family: var(--font-mono);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-nav { display: none; }
  .hero { padding: 2.5rem 0 2rem; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .search-wrap { flex: unset; }
  .row-main { flex-direction: column; }
  .row-scores { justify-content: flex-start; }
  .spec-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: .4rem; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-card { animation: none; }
  * { transition: none !important; }
}
