/* ============================================================
   hf-theme.css — Hugging Face Space chrome (light, clean)
   Wraps the dark Matrix CLI app embed.
   ============================================================ */

:root {
  --hf-bg:        #ffffff;
  --hf-bg-soft:   #f9fafb;
  --hf-bg-mute:   #f3f4f6;
  --hf-border:    #e5e7eb;
  --hf-border-2:  #d1d5db;
  --hf-ink:       #111827;
  --hf-ink-2:     #374151;
  --hf-ink-3:     #6b7280;
  --hf-ink-4:     #9ca3af;
  --hf-yellow:    #ffd21e;
  --hf-yellow-d:  #f7c948;
  --hf-link:      #2563eb;
  --hf-green:     #16a34a;
  --hf-green-bg:  #dcfce7;
  --hf-purple:    #7c3aed;

  --hf-font: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --hf-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --hf-r: 8px;
  --hf-r-lg: 12px;
  --hf-shadow: 0 1px 2px rgba(16,24,40,0.05);
  --hf-shadow-md: 0 4px 14px rgba(16,24,40,0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--hf-bg);
  color: var(--hf-ink);
  font-family: var(--hf-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

::selection { background: #ffe9a8; color: #111827; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; border: 3px solid var(--hf-bg); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; background-clip: padding-box; }

/* ---------- top nav ---------- */
.hf-nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--hf-bg);
  border-bottom: 1px solid var(--hf-border);
}
.hf-nav-inner {
  max-width: 1536px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; min-height: 56px;
}
.hf-logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.hf-logo .mark { font-size: 24px; line-height: 1; }
.hf-logo .word { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--hf-ink); white-space: nowrap; }

.hf-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--hf-bg-mute);
  border: 1px solid transparent; border-radius: 999px;
  padding: 0 14px; height: 40px; width: 280px; max-width: 32vw;
  color: var(--hf-ink-3); transition: all .15s ease;
}
.hf-search:focus-within { background: #fff; border-color: var(--hf-border-2); box-shadow: var(--hf-shadow); }
.hf-search input { border: none; outline: none; background: transparent; flex: 1; min-width: 0; font-size: 14px; color: var(--hf-ink); }
.hf-search kbd {
  font-family: var(--hf-mono); font-size: 11px; color: var(--hf-ink-4);
  border: 1px solid var(--hf-border); border-radius: 5px; padding: 1px 6px; background: #fff;
}

.hf-navlinks { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.hf-navlink {
  padding: 7px 10px; border-radius: 7px; font-size: 15px; font-weight: 600; white-space: nowrap;
  color: var(--hf-ink-2); display: inline-flex; align-items: center; gap: 7px;
  transition: background .12s ease;
}
.hf-navlink:hover { background: var(--hf-bg-mute); }
.hf-navlink .ic { font-size: 15px; }
.hf-divider { width: 1px; height: 24px; background: var(--hf-border); margin: 0 6px; }
.hf-btn-ghost {
  padding: 7px 12px; border-radius: 8px; font-size: 15px; font-weight: 600; white-space: nowrap;
  color: var(--hf-ink-2); background: transparent; border: none;
}
.hf-btn-ghost:hover { background: var(--hf-bg-mute); }
.hf-btn-solid {
  padding: 7px 14px; border-radius: 8px; font-size: 15px; font-weight: 700; white-space: nowrap;
  color: #2d2200; background: var(--hf-yellow); border: 1px solid var(--hf-yellow-d);
  box-shadow: var(--hf-shadow);
}
.hf-btn-solid:hover { background: #ffdb47; }

.hf-burger { display: none; }

/* ---------- space header ---------- */
.hf-space-head {
  border-bottom: 1px solid var(--hf-border);
  background: var(--hf-bg);
}
.hf-space-inner { max-width: 1536px; margin: 0 auto; padding: 18px 24px 0; }

.hf-crumb { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hf-avatar {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, #34d399, #059669);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.hf-title { display: flex; align-items: center; gap: 8px; font-size: 19px; }
.hf-title .owner { color: var(--hf-ink-3); font-weight: 600; }
.hf-title .slash { color: var(--hf-ink-4); }
.hf-title .repo { color: var(--hf-ink); font-weight: 700; }
.hf-title .copy { color: var(--hf-ink-4); cursor: pointer; padding: 2px; border-radius: 5px; }
.hf-title .copy:hover { background: var(--hf-bg-mute); color: var(--hf-ink-2); }

.hf-badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 7px;
  border: 1px solid var(--hf-border); background: var(--hf-bg-soft); color: var(--hf-ink-2);
}
.hf-badge.like { cursor: pointer; }
.hf-badge.like:hover { background: #fff; border-color: var(--hf-border-2); }
.hf-badge.running { color: var(--hf-green); background: var(--hf-green-bg); border-color: #bbf7d0; }
.hf-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--hf-green); box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }

.hf-tabs { display: flex; align-items: center; gap: 2px; margin-top: 16px; }
.hf-tab {
  padding: 9px 14px; font-size: 14.5px; font-weight: 600; color: var(--hf-ink-3);
  border: none; background: transparent; border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: -1px;
}
.hf-tab:hover { color: var(--hf-ink); }
.hf-tab.active { color: var(--hf-ink); border-bottom-color: #111827; }
.hf-tab .ic { font-size: 14px; opacity: 0.7; }
.hf-tab .count { font-size: 12px; color: var(--hf-ink-4); font-weight: 700; }

.hf-tab-spacer { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.hf-icbtn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--hf-ink-3); display: inline-flex; align-items: center; justify-content: center;
}
.hf-icbtn:hover { background: var(--hf-bg-mute); color: var(--hf-ink); }

/* ---------- app embed region ---------- */
.hf-console { height: 600px; }
.hf-app-wrap { max-width: 1536px; margin: 0 auto; padding: 22px 24px 40px; }
.hf-app-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; border: 1px solid var(--hf-border);
  border-bottom: none; border-radius: var(--hf-r-lg) var(--hf-r-lg) 0 0;
  background: var(--hf-bg-soft); font-size: 13px; color: var(--hf-ink-3);
}
.hf-app-bar .left { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.hf-app-bar .sdk {
  font-family: var(--hf-mono); font-size: 11.5px; color: var(--hf-ink-3);
  background: #fff; border: 1px solid var(--hf-border); border-radius: 6px; padding: 2px 8px;
}
.hf-app-frame {
  border: 1px solid var(--hf-border); border-radius: var(--hf-r-lg);
  overflow: hidden; background: #000402;
  box-shadow: var(--hf-shadow-md);
}

.hf-footnote {
  margin-top: 14px; font-size: 13px; color: var(--hf-ink-3);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.hf-footnote .pill {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 9px;
  border: 1px solid var(--hf-border); border-radius: 7px; background: var(--hf-bg-soft);
}

@media (max-width: 980px) {
  .hf-navlinks .hf-navlink, .hf-search { display: none; }
  .hf-burger { display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
    width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--hf-border); background: #fff; color: var(--hf-ink-2); }
  .hf-navlinks .hf-divider, .hf-navlinks .hf-btn-ghost { display: none; }
  .hf-console { height: 540px; }
}
@media (max-width: 640px) {
  .hf-nav-inner { padding: 8px 14px; min-height: 52px; gap: 10px; }
  .hf-logo .word { display: none; }
  .hf-space-inner { padding: 14px 14px 0; }
  .hf-app-wrap { padding: 14px 12px 28px; }
  .hf-app-bar { padding: 7px 10px; font-size: 12px; }
  .hf-app-bar .sdk { display: none; }
  .hf-console { height: 74vh; min-height: 460px; max-height: 660px; }
  .hf-console .hf-sub { display: none; }
  .hf-console .hf-ver { display: none; }
  .hf-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hf-tab-spacer { display: none; }
  .hf-title { font-size: 17px; }
}
@supports (padding: env(safe-area-inset-bottom)) {
  .hf-app-wrap { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}
