/* ============================================================
   ComputerVisionAIHub — catalog styles
   Edit the tokens in :root to rebrand. Everything below derives
   from these. The "signature" of the design is the bounding-box
   card frame + corner label tab (see .model-card), now in the
   brand's navy / blue / mint palette (see assets/icon.svg).
   ============================================================ */

:root {
  /* ---- palette (brand: deep navy + sky blue + mint teal) ---- */
  --paper:    #F2F5F9;   /* page background        */
  --surface:  #FFFFFF;   /* cards                  */
  --ink:      #042C53;   /* primary text / brand navy (dark UI surfaces) */
  --ink-soft: #55677E;   /* muted text             */
  --line:     #DCE4EE;   /* hairlines              */

  /* ---- detection colors: used like YOLO box colors ---- */
  --box:        #185FA5; /* primary accent (brand blue)          */
  --box-2:      #0C8567; /* secondary accent (brand mint/teal)   */
  --box-bright: #378ADD; /* decorative highlight (glows, gradients) */
  --mint-bright:#5DCAA5; /* bright mint for use on dark surfaces */
  --sky:        #85B7EB; /* light blue for text on dark surfaces */

  /* ---- type ---- */
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;
  --body:    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 12px;
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: 24px; }

a { color: var(--box); }

/* ============ HEADER (hero) ============ */
.site-header {
  background: linear-gradient(135deg, #042C53 0%, #0B3D6E 60%, #103F71 100%);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding-block: 26px;
}
.brand { display: flex; align-items: center; gap: 14px; }

/* The brand mark is the aperture icon from assets/icon.svg. */
.brand-mark {
  width: 36px; height: 36px; flex: none;
  border-radius: 9px;
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
}

.brand-name {
  font-family: var(--display);
  font-weight: 700; font-size: 1.45rem;
  margin: 0; letter-spacing: -0.02em;
  color: #fff;
}
.brand-name .accent { color: var(--mint-bright); }
.brand-tag { margin: 2px 0 0; color: var(--sky); font-size: 0.9rem; }

.ghost-btn {
  font-family: var(--mono); font-size: 0.82rem;
  text-decoration: none; color: #fff;
  border: 1px solid rgba(255,255,255,.32); border-radius: 8px;
  padding: 9px 14px; white-space: nowrap;
  transition: border-color .15s, color .15s, background-color .15s;
}
.ghost-btn:hover { border-color: var(--mint-bright); color: var(--mint-bright); background: rgba(255,255,255,.06); }
.ghost-btn:focus-visible { outline: 2px solid var(--mint-bright); outline-offset: 1px; }

/* ============ LAUNCH PANEL ============ */
.launch-panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 18px 22px; margin-top: 24px;
  box-shadow: 0 12px 28px -18px rgba(4,44,83,.35);
}
.launch-text { flex: 1 1 260px; }
.launch-text h2 {
  font-family: var(--display); font-weight: 500; font-size: 1.05rem;
  margin: 0 0 4px; letter-spacing: -0.01em;
}
.launch-text p { margin: 0; color: var(--ink-soft); font-size: 0.85rem; }
.launch-text code { font-family: var(--mono); font-size: 0.82rem; }
.launch-run { flex: 2 1 380px; margin: 0; }
.launch-guide-link { display: inline-flex; margin-top: 14px; }

/* ============ TOOLBAR ============ */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  padding-top: 28px;
}
.search {
  flex: 1 1 280px;
  font-family: var(--body); font-size: 0.95rem;
  padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
}
.search:focus-visible { outline: 2px solid var(--box); outline-offset: 1px; border-color: var(--box); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: var(--mono); font-size: 0.78rem;
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); cursor: pointer;
  transition: all .15s;
}
.pill:hover { border-color: var(--box); color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill:focus-visible { outline: 2px solid var(--box); outline-offset: 1px; }

.count {
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--ink-soft); margin: 18px auto 4px;
}

/* ============ DISCLAIMER ============ */
.disclaimer {
  margin-top: 20px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--box) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--box) 22%, var(--line));
  border-left: 3px solid var(--box);
  border-radius: 8px;
}
.disclaimer p { margin: 0; color: var(--ink-soft); font-size: 0.85rem; line-height: 1.6; }
.disclaimer strong { color: var(--ink); }
.disclaimer a { color: var(--box); font-weight: 500; }

/* ============ GRID ============ */
.grid {
  display: grid; gap: 20px; padding-block: 12px 60px;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}

/* ---- THE SIGNATURE: a model card framed like a detection box ---- */
.model-card {
  position: relative;
  min-width: 0;                          /* let long command text scroll instead of stretching the grid track */
  background: var(--surface);
  border: 2px solid var(--ink);          /* the "bounding box" */
  border-radius: var(--radius);
  padding: 26px 22px 20px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 1px 2px rgba(4,44,83,.05), 0 10px 24px -18px rgba(4,44,83,.3);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.model-card:hover {
  border-color: var(--box);
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -16px rgba(24,95,165,.35);
}

/* The corner label tab — mimics YOLO stamping "class conf" on a box edge. */
.card-tab {
  position: absolute; top: -2px; left: -2px;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  color: #fff; background: var(--ink);
  padding: 4px 10px; border-radius: 8px 0 8px 0;
  transition: background .18s;
}
.model-card:hover .card-tab { background: var(--box); }

/* Preview image — a sample of what the model detects. */
.card-image {
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) - 6px);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
}
.card-image img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.card-image.placeholder {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed;
}
.card-image.placeholder::after {
  content: "no preview yet";
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--ink-soft); letter-spacing: .02em;
}

.card-head { display: flex; flex-direction: column; gap: 6px; }
.card-name {
  font-family: var(--display); font-weight: 500; font-size: 1.18rem;
  margin: 0; letter-spacing: -0.01em;
}
.card-summary { color: var(--ink-soft); font-size: 0.9rem; margin: 0; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-family: var(--mono); font-size: 0.72rem;
  padding: 3px 8px; border-radius: 6px;
  background: var(--paper); border: 1px solid var(--line);
  color: var(--ink-soft);
}
.badge.base { color: var(--box); border-color: color-mix(in srgb, var(--box) 35%, var(--line)); }
.badge.task-detection { color: var(--box); border-color: color-mix(in srgb, var(--box) 35%, var(--line)); }
.badge.task-obb { color: var(--box-2); border-color: color-mix(in srgb, var(--box-2) 35%, var(--line)); }

/* class chips — colored like detection labels */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 0.72rem;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--box) 12%, transparent);
  color: color-mix(in srgb, var(--box) 78%, var(--ink));
}
.chip.more { background: var(--paper); color: var(--ink-soft); }

/* ---- mAP rendered as confidence bars ---- */
.metrics { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.metric { display: grid; grid-template-columns: 86px 1fr 46px; align-items: center; gap: 10px; }
.metric-label { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); }
.bar { height: 7px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--box); border-radius: 999px; }
.metric-val { font-family: var(--mono); font-size: 0.75rem; text-align: right; }

.card-meta {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft);
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px;
}

/* ---- actions ---- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
  text-decoration: none; cursor: pointer;
  padding: 9px 14px; border-radius: 8px; border: 1px solid transparent;
  transition: all .15s;
}
.btn.primary {
  background: linear-gradient(135deg, var(--box), color-mix(in srgb, var(--box) 65%, var(--box-2)));
  color: #fff;
  box-shadow: 0 2px 10px -3px color-mix(in srgb, var(--box) 65%, transparent);
}
.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--box) 70%, transparent);
}
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--ink); }
.btn:focus-visible { outline: 2px solid var(--box); outline-offset: 1px; }

/* copyable command / URL box, with an optional label above it.
   The copy button comes first in the markup and stays pinned to the
   left edge (position: sticky) so it's visible immediately — the
   command text scrolls underneath it instead of pushing it off-screen. */
.run-group { display: flex; flex-direction: column; gap: 4px; }
.run-label {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em;
}
.run {
  font-family: var(--mono); font-size: 0.72rem;
  background: var(--ink); color: #E6E8E6;
  border-radius: 10px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px;
  overflow-x: auto;
}
.run code { white-space: nowrap; padding: 4px 8px 4px 2px; }
.copy-btn {
  position: sticky; left: 0; z-index: 1;
  flex: none;
  font-family: var(--mono); font-size: 0.68rem;
  background: color-mix(in srgb, var(--ink) 92%, #000 8%);
  color: #C7CDD6; border: 1px solid rgba(255,255,255,.16);
  border-radius: 6px; padding: 5px 10px; cursor: pointer;
  box-shadow: 10px 0 10px -6px var(--ink);
}
.copy-btn:hover { color: #fff; border-color: rgba(255,255,255,.35); }
.copy-btn:focus-visible { outline: 2px solid var(--mint-bright); outline-offset: 1px; }

/* multi-line variant, for install scripts rather than one-line commands */
.run.multiline { align-items: flex-start; }
.run.multiline code { white-space: pre; padding: 8px 8px 8px 2px; line-height: 1.6; }
.run.multiline .copy-btn { margin-top: 2px; }

/* ============ STATE (empty / error) ============ */
.state {
  text-align: center; padding: 60px 24px; color: var(--ink-soft);
  font-family: var(--mono); font-size: 0.9rem;
}

/* ============ INSTALLATION GUIDE ============ */
.install-guide { padding-block: 44px 60px; border-top: 1px solid var(--line); }
.install-guide h2 {
  font-family: var(--display); font-weight: 500; font-size: 1.3rem;
  margin: 0 0 8px; letter-spacing: -0.01em;
}
.install-intro { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 28px; max-width: 640px; }

.guide-block { margin-bottom: 28px; }
.guide-block:last-child { margin-bottom: 0; }
.guide-block h3 {
  font-family: var(--display); font-weight: 500; font-size: 1rem;
  margin: 0 0 6px; letter-spacing: -0.01em;
}
.guide-block h3 .optional { color: var(--ink-soft); font-weight: 400; font-size: 0.85rem; }
.guide-block > p { color: var(--ink-soft); font-size: 0.88rem; margin: 0 0 10px; }
.install-note { color: var(--ink-soft); font-size: 0.8rem; margin: 8px 0 0; }
.install-note code {
  font-family: var(--mono); font-size: 0.78rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px;
}
.install-links { margin: 8px 0 0; padding-left: 20px; color: var(--ink-soft); font-size: 0.88rem; }
.install-links li { margin: 3px 0; }

/* ============ FOOTER ============ */
.site-footer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding-block: 22px; margin-top: 40px;
}
.site-footer p { margin: 0; color: var(--ink-soft); font-size: 0.82rem; }

/* ============ MOTION (staggered card reveal) ============ */
@media (prefers-reduced-motion: no-preference) {
  .model-card { animation: rise .4s ease both; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}

@media (max-width: 560px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .grid { grid-template-columns: 1fr; }
}
