/* HCG Repo: "HCG Futuristic". Obsidian background, smoked graphite panels, brushed-metal controls,
   clipped architectural corners and restrained cyan edge light, matching the approved banner and icon.
   No layout-affecting animation; the only ambient effect is a slow glow on the banner frame, and it
   is disabled under prefers-reduced-motion. */
:root {
  --obsidian: #05080b;
  --graphite: #0c1217;
  --graphite-2: #111a21;
  --graphite-3: #17222a;
  --line: #24323c;
  --line-2: #33444f;
  --silver-hi: #f2f6f8;
  --silver: #dde4e8;
  --text: #c9d2d8;
  --muted: #93a1aa;
  --cyan: #2fd3e6;
  --cyan-deep: #12a9bb;
  --cyan-soft: rgba(47, 211, 230, 0.12);
  --cyan-glow: rgba(47, 211, 230, 0.35);
  --ok: #4fcf91;
  --warn: #e7b866;
  --cut: 14px;
  --cut-sm: 8px;
  --gutter: 16px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--obsidian);
  background-image:
    radial-gradient(900px 420px at 50% -120px, rgba(47, 211, 230, 0.10), transparent 70%),
    linear-gradient(180deg, #070b0f 0%, var(--obsidian) 40%);
  color: var(--text);
  font: 16px/1.6 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* Faint circuit traces, fixed behind everything; panels sit on opaque surfaces so text stays clean. */
.circuit {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='%232fd3e6' stroke-opacity='.09' stroke-width='1'%3E%3Cpath d='M0 40h60l20 20h60l20-20h80M0 160h40l20-20h40l20 20h120M60 240v-60l20-20M180 0v50l-20 20v40M120 240v-40l30-30h40'/%3E%3C/g%3E%3Cg fill='%232fd3e6' fill-opacity='.16'%3E%3Ccircle cx='80' cy='60' r='2.5'/%3E%3Ccircle cx='160' cy='40' r='2.5'/%3E%3Ccircle cx='100' cy='140' r='2.5'/%3E%3Ccircle cx='160' cy='110' r='2.5'/%3E%3Ccircle cx='150' cy='170' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 240px 240px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
          mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, rgba(0, 0, 0, 0.5) 45%, transparent 85%);
}

/* Typography */
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; letter-spacing: -0.01em; color: var(--silver); margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 750; }
h2 { font-size: clamp(1.35rem, 3.6vw, 1.7rem); font-weight: 700; margin-bottom: 0.5rem; }
h3 { font-size: 1.08rem; font-weight: 650; }
h4 { font-size: 1rem; margin: 1rem 0 0.25rem; }
/* Brushed-silver headings with a solid fallback colour for browsers without background-clip:text. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  h1, h2 {
    background: linear-gradient(180deg, var(--silver-hi) 0%, #c3ccd2 55%, #9ea9b0 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
}
p { margin: 0.6rem 0; }
a { color: var(--cyan); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, .source-url { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--graphite-3); color: var(--silver); padding: 0.08em 0.38em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: #070c10; border: 1px solid var(--line); padding: 12px 14px; overflow-x: auto; margin: 0.6rem 0; }
pre code { background: none; padding: 0; }
strong { color: var(--silver); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.lead { font-size: 1.1rem; color: var(--silver); max-width: 62ch; }
.eyebrow { margin: 0 0 0.3rem; color: var(--cyan); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.22em; text-transform: uppercase; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Focus: drawn INSIDE clipped shapes so clip-path cannot hide it. */
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.btn:focus-visible, .source-url:focus-visible, summary:focus-visible { outline: 2px solid var(--silver-hi); outline-offset: -5px; }
.btn-primary:focus-visible { outline-color: #031015; }
main:focus { outline: none; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 20; background: var(--cyan); color: #031015; padding: 10px 14px; font-weight: 700; }
.skip:focus { left: 8px; }

/* Layout */
.topbar-inner, main, .footer { max-width: var(--maxw); margin: 0 auto; padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(5, 8, 11, 0.86);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--cyan-glow) 30%, var(--cyan-glow) 70%, transparent); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--silver); text-decoration: none; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.brand img { border-radius: 7px; box-shadow: 0 0 0 1px var(--line-2); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { color: var(--text); text-decoration: none; font-size: 0.95rem; padding: 10px 10px; border-radius: 6px; }
.topbar nav a:hover { color: var(--cyan); background: var(--cyan-soft); }
@media (max-width: 380px) { .brand span { font-size: 0.95rem; } .topbar nav a { padding: 10px 7px; font-size: 0.9rem; } }

/* Clipped-corner panel with border, bevel lines on the cut corners and a cyan top edge light. */
.card {
  position: relative;
  background:
    linear-gradient(135deg, transparent calc(50% - 0.75px), var(--line-2) calc(50% - 0.75px), var(--line-2) calc(50% + 0.75px), transparent calc(50% + 0.75px)) top left / var(--cut) var(--cut) no-repeat border-box,
    linear-gradient(135deg, transparent calc(50% - 0.75px), var(--line-2) calc(50% - 0.75px), var(--line-2) calc(50% + 0.75px), transparent calc(50% + 0.75px)) bottom right / var(--cut) var(--cut) no-repeat border-box,
    linear-gradient(180deg, rgba(23, 34, 42, 0.96), rgba(12, 18, 23, 0.97)) padding-box;
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  padding: 20px;
}
.card::before {
  content: ""; position: absolute; top: 0; left: var(--cut); width: 45%; height: 1px;
  background: linear-gradient(90deg, var(--cyan), rgba(47, 211, 230, 0));
  opacity: 0.85;
}

/* Hero */
.hero { padding-top: 22px; display: grid; gap: 18px; }
.banner-frame {
  position: relative; padding: 1px;
  background: linear-gradient(120deg, #4a5963, #1a242b 30%, #2b3740 60%, #6b7a84);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.banner-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(47, 211, 230, 0.35), inset 0 0 40px rgba(47, 211, 230, 0.10);
  animation: ambient 9s ease-in-out infinite alternate;
}
@keyframes ambient { from { opacity: 0.55; } to { opacity: 1; } }
.banner-frame picture, .banner { display: block; width: 100%; height: auto; aspect-ratio: 2000 / 667; }
.banner { background: #070b0e; clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.intro { padding: 24px; }
.intro h1 { margin-bottom: 0.3rem; }

/* Source / install controls */
.source { margin-top: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.actions-primary { margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 20px;
  font: 650 0.98rem/1.1 var(--font); letter-spacing: 0.02em; text-decoration: none; cursor: pointer;
  border: 0; color: var(--silver);
  clip-path: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm));
  transition: filter 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}
.btn-primary { background: linear-gradient(180deg, #5fe3f1, var(--cyan) 45%, var(--cyan-deep)); color: #031015; }
.btn-primary:hover { filter: brightness(1.08) saturate(1.05); }
.btn-metal {
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2a353d, #172027);
  color: var(--silver-hi);
  box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn-metal:hover { color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(47, 211, 230, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.source-label { display: block; margin: 18px 0 6px !important; font-size: 0.82rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.source-row { display: flex; gap: 8px; flex-wrap: wrap; }
.source-url {
  flex: 1 1 260px; min-width: 0; min-height: 46px; padding: 12px 14px; display: flex; align-items: center;
  background: #060a0d; color: var(--silver-hi); border: 1px solid var(--line-2); border-radius: 0;
  font-size: 0.95rem; line-height: 1.35; overflow-wrap: anywhere;
  -webkit-user-select: all; user-select: all;
}
.btn-copy { flex: 0 0 auto; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn-metal[disabled]:hover { color: inherit; box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.hint:empty { display: none; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; max-width: 70ch; }
@media (max-width: 520px) {
  .actions-primary .btn { flex: 1 1 100%; }
  .btn-copy { flex: 1 1 100%; }
}

/* Sections */
.section { padding-top: 46px; }
.section-tight { padding-top: 28px; }
.section-lead { color: var(--muted); margin: 0 0 16px; max-width: 70ch; }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); }
.cards-dev { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }

/* Package cards */
.pkg-card { display: flex; flex-direction: column; gap: 6px; }
.pkg-head { display: flex; align-items: flex-start; gap: 14px; }
.pkg-title { flex: 1 1 auto; min-width: 0; }
.pkg-title h3 { font-size: 1.2rem; }
.pkg-title h3 a { color: var(--silver-hi); text-decoration: none; }
.pkg-title h3 a:hover { color: var(--cyan); text-decoration: underline; }
.pkg-meta { margin: 6px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pkg-version { color: var(--silver); font-weight: 650; font-size: 0.92rem; }
.pkg-id { margin: 4px 0 0; font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.pkg-id code { background: none; padding: 0; color: var(--muted); }
.pkg-icon { flex: none; border-radius: 14px; box-shadow: 0 0 0 1px var(--line-2), 0 6px 18px rgba(0, 0, 0, 0.5); }
.pkg-icon-lg { border-radius: 20px; }
.pkg-icon-blank { width: 64px; height: 64px; display: inline-block; background: var(--graphite-3); }
.pkg-desc { color: var(--text); margin: 6px 0 2px; }
.pkg-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 10px 0 4px; padding: 12px 0 0; border-top: 1px solid var(--line); }
.pkg-facts dt { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pkg-facts dd { margin: 2px 0 0; color: var(--silver); font-size: 0.93rem; overflow-wrap: anywhere; }
.pkg-tested { font-size: 0.86rem; color: var(--muted); margin: 6px 0 0; }
.pkg-card .actions { margin-top: auto; padding-top: 12px; }

/* Badges */
.badge {
  display: inline-block; flex: none; white-space: nowrap; vertical-align: middle;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 8px; border: 1px solid currentColor;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}
.badge-ok { color: var(--ok); background: rgba(79, 207, 145, 0.08); }
.badge-warn { color: var(--warn); background: rgba(231, 184, 102, 0.08); }
.badge-muted { color: var(--muted); }
.badge-access { color: var(--cyan); background: var(--cyan-soft); margin-left: 6px; }
.restricted-card { border-color: rgba(47, 211, 230, 0.28); border-style: solid; }

/* Empty state and in-development cards */
.empty { display: flex; gap: 18px; align-items: flex-start; }
.empty img { flex: none; opacity: 0.9; }
.empty h3 { margin-bottom: 4px; }
.dev-card { background: linear-gradient(180deg, rgba(12, 18, 23, 0.85), rgba(8, 12, 16, 0.9)) padding-box; border-style: dashed; }
.dev-card::before { opacity: 0.25; }
.dev-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dev-head h3 { color: var(--text); }
.dev-kind { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
@media (max-width: 520px) { .empty { flex-direction: column; } }

/* Prose and help */
.prose p, .prose li { max-width: 72ch; }
.prose h3 { margin: 1.4rem 0 0.4rem; }
.steps { padding-left: 1.3em; }
.steps li { margin: 0.45rem 0; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin: 16px 0; }
.note h3 { margin: 0 0 0.3rem; }
.note-warn { border-color: rgba(231, 184, 102, 0.35); }
.note-warn::before { background: linear-gradient(90deg, var(--warn), rgba(231, 184, 102, 0)); }
.product .note p { margin: 0; }
.store .actions { align-items: center; }
.store[aria-busy="true"] .actions { opacity: 0.8; }
.prose .store h2 { margin-top: 0; }
.faq details { border: 1px solid var(--line); background: rgba(12, 18, 23, 0.9); margin: 8px 0; padding: 0 16px; }
.faq summary, .repo-details summary { cursor: pointer; padding: 14px 0; font-weight: 650; color: var(--silver); list-style-position: outside; }
.faq details[open] summary { color: var(--cyan); }

/* Repository details (secondary) */
.repo-details { padding: 4px 20px 8px; }
.kv { margin: 0 0 8px; display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 0.86rem; }
.kv dd { margin: 0; color: var(--silver); overflow-wrap: anywhere; font-size: 0.93rem; }
.kv.card > div:first-child { border-top: 0; }
@media (max-width: 520px) { .kv > div { grid-template-columns: 1fr; gap: 2px; } }

/* Package detail page */
.crumbs { font-size: 0.88rem; color: var(--muted); margin: 18px 0 12px; }
.crumbs a { color: var(--muted); }
.dep-header-frame { margin-bottom: 14px; clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); box-shadow: inset 0 0 0 1px var(--line-2); }
.dep-header { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; }
.dep-title { display: flex; gap: 18px; align-items: flex-start; }
.dep-title h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.dep-title .lead { margin-top: 0.5rem; }
@media (max-width: 520px) { .dep-title { flex-direction: column; gap: 12px; } }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.shots { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.shots figure { margin: 0; flex: 0 0 min(240px, 70vw); scroll-snap-align: start; }
.shots img { width: 100%; height: auto; border: 1px solid var(--line-2); }
.shots figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.change { border-left: 2px solid var(--line-2); padding: 2px 0 2px 16px; margin: 16px 0; }
.change h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.downloads { padding-left: 1.1em; }
.downloads li { margin: 0.7rem 0; }
.downloads a { overflow-wrap: anywhere; }
.hash { font-size: 0.78em; word-break: break-all; }

/* Footer */
.footer { margin-top: 56px; padding-top: 20px; padding-bottom: max(32px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px; }
.footer p { margin: 0; }
.footer strong { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .card, .btn, .badge, .banner-frame { border: 1px solid CanvasText; clip-path: none; }
  .circuit { display: none; }
}
