/* oss.hanzo.ai — the open-source cloud storefront.
   One page: the editorial story (hero · beliefs · makers) above a searchable
   1,030-app launcher. One stylesheet. Theme-aware (light default, dark via the
   OS or an explicit [data-theme] toggle). Responsive 390 → 768 → 1280 → 1680,
   no horizontal body scroll. CSP-strict: no external font, no external CSS, no
   inline script. Reads the same /meta.json + /blueprints/<id>/ the PaaS loader
   consumes — the machine catalog is untouched. */

/* ---- design tokens: light default, dark via OS + [data-theme] override ---- */
:root {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f7f7f8;
  --line: #e7e7ea; --line-2: #d7d7dc;
  --fg: #0a0a0b; --muted: #62626a; --faint: #9a9aa2;
  --btn-bg: #0a0a0b; --btn-fg: #ffffff; --btn-bg-hover: #262629;
  --logo-bg: #ffffff; --logo-ring: #ececef;
  --ring: rgba(10, 10, 11, 0.14);
  --shadow: 0 1px 2px rgba(10, 10, 11, 0.05), 0 8px 24px rgba(10, 10, 11, 0.04);
  --shadow-hover: 0 2px 6px rgba(10, 10, 11, 0.08), 0 14px 40px rgba(10, 10, 11, 0.08);
  --bar-bg: rgba(255, 255, 255, 0.72);
  --radius: 14px;
  --top-h: 3.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --panel: #0d0d0f; --panel-2: #08080a;
    --line: #1d1d21; --line-2: #2c2c31;
    --fg: #f6f6f7; --muted: #8c8c93; --faint: #5b5b62;
    --btn-bg: #f6f6f7; --btn-fg: #0a0a0b; --btn-bg-hover: #d6d6d8;
    --logo-bg: #ffffff; --logo-ring: #26262b;
    --ring: rgba(246, 246, 247, 0.16);
    --shadow: none; --shadow-hover: 0 0 0 1px var(--line-2);
    --bar-bg: rgba(0, 0, 0, 0.72);
    color-scheme: dark;
  }
}
/* an explicit toggle wins over the OS setting, in both directions */
:root[data-theme="light"] {
  --bg: #ffffff; --panel: #ffffff; --panel-2: #f7f7f8;
  --line: #e7e7ea; --line-2: #d7d7dc; --fg: #0a0a0b; --muted: #62626a; --faint: #9a9aa2;
  --btn-bg: #0a0a0b; --btn-fg: #ffffff; --btn-bg-hover: #262629;
  --logo-bg: #ffffff; --logo-ring: #ececef; --ring: rgba(10, 10, 11, 0.14);
  --shadow: 0 1px 2px rgba(10, 10, 11, 0.05), 0 8px 24px rgba(10, 10, 11, 0.04);
  --shadow-hover: 0 2px 6px rgba(10, 10, 11, 0.08), 0 14px 40px rgba(10, 10, 11, 0.08);
  --bar-bg: rgba(255, 255, 255, 0.72); color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000; --panel: #0d0d0f; --panel-2: #08080a;
  --line: #1d1d21; --line-2: #2c2c31; --fg: #f6f6f7; --muted: #8c8c93; --faint: #5b5b62;
  --btn-bg: #f6f6f7; --btn-fg: #0a0a0b; --btn-bg-hover: #d6d6d8;
  --logo-bg: #ffffff; --logo-ring: #26262b; --ring: rgba(246, 246, 247, 0.16);
  --shadow: none; --shadow-hover: 0 0 0 1px var(--line-2);
  --bar-bg: rgba(0, 0, 0, 0.72); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg); overflow-x: hidden;
  font: 15px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.03em; }
::selection { background: var(--fg); color: var(--bg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 6px; }
.eyebrow {
  margin: 0 0 1rem; font-size: 0.74rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint);
}

/* ---------------------------------------------------------- header / nav ---- */
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.5rem; border-bottom: 1px solid var(--line);
  background: var(--bar-bg);
  backdrop-filter: saturate(1.8) blur(14px); -webkit-backdrop-filter: saturate(1.8) blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 600; letter-spacing: -0.02em; font-size: 1.02rem; }
.brand .mark { width: 1.25rem; height: 1.25rem; display: block; border-radius: 5px; color: var(--fg); }
.brand .sub { color: var(--muted); font-weight: 500; }
.topnav { display: flex; align-items: center; gap: 0.35rem; }
.topnav a {
  color: var(--muted); font-size: 0.9rem; padding: 0.4rem 0.7rem; border-radius: 8px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.topnav a:hover { color: var(--fg); background: var(--panel-2); }
.topnav .cta { color: var(--btn-fg); background: var(--btn-bg); font-weight: 500; }
.topnav .cta:hover { color: var(--btn-fg); background: var(--btn-bg-hover); }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent;
  color: var(--muted); cursor: pointer; transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.icon-btn:hover { color: var(--fg); border-color: var(--line-2); }
.icon-btn svg { width: 16px; height: 16px; }
/* sun in dark (click → light), moon in light (click → dark) */
.icon-btn .moon { display: none; }
:root[data-theme="dark"] .icon-btn .sun { display: block; }
:root[data-theme="dark"] .icon-btn .moon { display: none; }
:root[data-theme="light"] .icon-btn .sun { display: block; }
:root[data-theme="light"] .icon-btn .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .sun { display: none; }
  :root:not([data-theme="light"]) .icon-btn .moon { display: block; }
}

/* --------------------------------------------------------------- hero ------- */
.hero { max-width: 58rem; margin: 0 auto; padding: 5rem 1.5rem 3.5rem; text-align: center; }
.hero h1 {
  margin: 0 0 1.25rem; font-size: clamp(2.4rem, 6.4vw, 4.5rem); line-height: 1.03; letter-spacing: -0.045em;
}
.hero h1 .dim { color: var(--muted); }
.lead { margin: 0 auto 2rem; max-width: 39rem; font-size: clamp(1.02rem, 2.2vw, 1.24rem); color: var(--muted); }
.lead strong { color: var(--fg); font-weight: 600; }
.cta { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; padding: 0.72rem 1.4rem;
  font-size: 0.92rem; font-weight: 600; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.btn.primary { color: var(--btn-fg); background: var(--btn-bg); }
.btn.primary:hover { background: var(--btn-bg-hover); transform: translateY(-1px); }
.btn.ghost { color: var(--fg); border-color: var(--line-2); background: transparent; }
.btn.ghost:hover { border-color: var(--muted); background: var(--panel-2); }

/* ---- philosophy band ------------------------------------------------------ */
.beliefs {
  max-width: 78rem; margin: 0 auto; padding: 3rem 1.5rem 4rem;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.belt { display: grid; gap: 2rem; grid-template-columns: repeat(3, 1fr); }
.belief h3 { font-size: 1.16rem; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.belief p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
.signature { margin: 2.75rem 0 0; text-align: center; font-size: 0.84rem; color: var(--faint); }

/* ---- makers band ---------------------------------------------------------- */
.makers { max-width: 46rem; margin: 0 auto; padding: 5rem 1.5rem; text-align: center; scroll-margin-top: var(--top-h); }
.makers h2 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); letter-spacing: -0.04em; margin-bottom: 1.1rem; }
.makers-lead { margin: 0 auto 2.25rem; max-width: 35rem; font-size: 1.08rem; color: var(--muted); }
.makers-lead strong { color: var(--fg); font-weight: 600; }
.steps { list-style: none; margin: 0 0 2.5rem; padding: 0; display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1.15rem; font-size: 0.9rem; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}
.step-n { font-size: 0.72rem; font-weight: 600; color: var(--faint); letter-spacing: 0.04em; }

/* ---- explore: section head ------------------------------------------------ */
main { max-width: 84rem; margin: 0 auto; padding: 0 1.5rem 4rem; scroll-margin-top: var(--top-h); }
.section-head { max-width: 58rem; margin: 3.5rem auto 1.75rem; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); letter-spacing: -0.035em; }
.section-head p { margin: 0.5rem 0 0; color: var(--muted); font-size: 1rem; }

/* ---- search + category chips ---------------------------------------------- */
.search-wrap { position: relative; max-width: 40rem; margin: 0 auto; }
.search-wrap .glass {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--faint); pointer-events: none;
}
.search {
  width: 100%; display: block; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px;
  color: var(--fg); font-size: 1rem; padding: 0.9rem 2.9rem 0.9rem 2.85rem; outline: none;
  box-shadow: var(--shadow); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search:focus { border-color: var(--fg); box-shadow: 0 0 0 4px var(--ring); }
.search::placeholder { color: var(--faint); }
.kbd {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  font-size: 0.72rem; color: var(--faint); border: 1px solid var(--line);
  border-radius: 6px; padding: 0.1rem 0.4rem; background: var(--panel-2);
}
.result-count { color: var(--faint); font-size: 0.82rem; margin: 0.9rem 0 0; min-height: 1.1em; text-align: center; }
.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: center; margin: 1rem auto 0; max-width: 52rem; }
.tag {
  font-size: 0.8rem; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.32rem 0.85rem; cursor: pointer; white-space: nowrap;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.tag:hover { color: var(--fg); border-color: var(--line-2); }
.tag.on { color: var(--btn-fg); background: var(--btn-bg); border-color: var(--btn-bg); }

/* ---- the grid ------------------------------------------------------------- */
.grid { display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr)); margin-top: 2rem; }
.card {
  content-visibility: auto; contain-intrinsic-size: 0 118px;
  display: flex; gap: 0.9rem; align-items: flex-start; padding: 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.logo {
  flex: 0 0 42px; width: 42px; height: 42px; border-radius: 10px;
  background: var(--logo-bg); box-shadow: inset 0 0 0 1px var(--logo-ring);
  object-fit: contain; padding: 6px; display: grid; place-items: center; overflow: hidden;
}
.logo.mono { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); font-weight: 650; font-size: 1.15rem; }
.body { min-width: 0; flex: 1; }
.name-row { display: flex; align-items: baseline; gap: 0.5rem; }
.name { font-weight: 600; letter-spacing: -0.015em; margin: 0; font-size: 0.98rem; }
.cat {
  font-size: 0.68rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.05rem 0.5rem; white-space: nowrap; text-transform: capitalize;
}
.desc {
  color: var(--muted); font-size: 0.83rem; margin: 0.28rem 0 0.7rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.deploy {
  display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-weight: 550;
  color: var(--btn-fg); background: var(--btn-bg); border-radius: 8px; padding: 0.36rem 0.75rem;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease);
}
.deploy:hover { background: var(--btn-bg-hover); color: var(--btn-fg); transform: translateY(-1px); }
.link { font-size: 0.8rem; color: var(--muted); padding: 0.36rem 0.4rem; transition: color 0.15s var(--ease); }
.link:hover { color: var(--fg); }

.more {
  display: block; margin: 2.5rem auto 0; background: var(--panel); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 0.75rem 1.75rem; cursor: pointer; font-size: 0.9rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.more:hover { border-color: var(--fg); background: var(--panel-2); }
.empty { text-align: center; color: var(--muted); padding: 4rem 1rem; font-size: 0.95rem; }

/* ---- footer --------------------------------------------------------------- */
.foot {
  max-width: 84rem; margin: 0 auto; padding: 2.5rem 1.5rem 3.5rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center;
  color: var(--faint); font-size: 0.8rem;
}
.foot a { color: var(--muted); border-bottom: 1px solid transparent; }
.foot a:hover { color: var(--fg); border-bottom-color: var(--line-2); }
.foot .links { display: flex; gap: 1.1rem; flex-wrap: wrap; }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 1024px) { .belt { gap: 1.5rem; } }
@media (max-width: 760px) {
  .top { padding: 0 1.15rem; }
  .belt { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero { padding: 3.5rem 1.25rem 2.5rem; }
  .makers { padding: 3.5rem 1.25rem; }
  .topnav .hide-sm { display: none; }
}
@media (max-width: 460px) {
  .brand .sub { display: none; }
  .kbd { display: none; }
  .grid { grid-template-columns: 1fr; }
}
@media (min-width: 1600px) {
  main, .foot { max-width: 90rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(19.5rem, 1fr)); }
}

/* ---- motion: hero rises once on load (always ends visible) ----------------- */
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: rise 0.6s var(--ease) both; }
  .hero .eyebrow { animation-delay: 0.02s; }
  .hero h1 { animation-delay: 0.08s; }
  .hero .lead { animation-delay: 0.16s; }
  .hero .cta { animation-delay: 0.24s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---- touch ergonomics ------------------------------------------------------
   A category chip and the theme button are things a THUMB aims at, and at 32/34px
   they sit under the ~44px a thumb reliably hits — measured on the live page at
   390px. Sized on a COARSE pointer only, so the dense row a mouse wants is left
   exactly as it is: one chip class, one adaptation, no second component. */
@media (pointer: coarse) {
  .tag { min-height: 44px; display: inline-flex; align-items: center; }
  .icon-btn { width: 44px; height: 44px; }
}

/* ---------------------------------------------------------------- detail --- */
/* One app's page. Native <dialog>, so focus trapping, Esc and inertness are the
   platform's job rather than hand-rolled. Every colour comes from the same tokens
   as the grid, so it follows the theme toggle with no extra rules. */
.detail {
  width: min(680px, calc(100vw - 2rem));
  max-height: min(86vh, 900px);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--fg);
  overflow: auto;
  overscroll-behavior: contain;
}
.detail::backdrop { background: rgb(0 0 0 / 0.55); }
.detail-close { position: sticky; top: 0; float: right; margin: -0.25rem -0.25rem 0 0; }
.detail-close svg { width: 18px; height: 18px; }

.detail .dhead { display: flex; gap: 0.9rem; align-items: flex-start; margin-bottom: 1rem; }
.detail .dhead .logo { width: 52px; height: 52px; flex: 0 0 auto; }
.detail .dtitle h3 { margin: 0 0 0.15rem; font-size: 1.3rem; line-height: 1.2; }
.detail .dtitle .desc { margin: 0; color: var(--muted); }

.detail .row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.1rem; }

.detail .dfacts { display: grid; gap: 0.5rem; margin-bottom: 1.25rem; }
.detail .drow { display: flex; gap: 0.75rem; font-size: 0.875rem; }
.detail .dt { flex: 0 0 92px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; padding-top: 0.15rem; }
.detail .dd { color: var(--fg); word-break: break-word; }

.detail .druns { margin-bottom: 1.25rem; }
.detail h4 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.detail .svc-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail .svc { display: flex; gap: 0.75rem; padding: 0.6rem 0.75rem; align-items: baseline; }
.detail .svc + .svc { border-top: 1px solid var(--line); }
.detail .svc-n { flex: 0 0 34%; font-weight: 600; font-size: 0.875rem; word-break: break-word; }
.detail .svc-i { color: var(--muted); font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

.detail .badge-wrap { border-top: 1px solid var(--line); padding-top: 1.1rem; }
.detail .muted { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.6rem; }
/* The snippet must be selectable and must not force the dialog to scroll sideways. */
.detail .snippet {
  margin: 0 0 0.6rem;
  padding: 0.7rem 0.8rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  overflow-x: auto;
  white-space: pre;
  user-select: all;
}
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

.submit-line { color: var(--muted); font-size: 0.9rem; }
.submit-line a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }

/* The grid card is now a control: show it, and keep the keyboard ring visible. */
.card { cursor: pointer; }
.card:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .detail[open] { animation: detail-in 140ms ease-out; }
  @keyframes detail-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
