/* hub-specific styles. Tokens, the reset, base body colors/type, the .btn
 * component and the .soc-flash toast come from ardegazu-theme (imported
 * before this file in main.ts) — nothing shared is duplicated here. */

html { scroll-behavior: smooth; }
/* hub layout on body — the theme sets colors and type only */
body {
  padding-bottom: 90px;
  overflow-x: hidden;
}

/* soft geometric horizon, monument-valley style */
.horizon {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.horizon svg { position: absolute; right: -140px; top: -60px; opacity: var(--horizon-op); }
@media (max-width: 900px) {
  .horizon svg { opacity: calc(var(--horizon-op) * .3); right: -240px; }
}

main { position: relative; z-index: 1; max-width: 660px; margin: 0 auto; padding: 72px 22px 0; }

/* ---- views: one section on at a time, switched by the hash router ------- */
.view { display: none; }
.view.on { display: block; }

/* ---- nav tabs: inline row up top on desktop, fixed bar on phones -------- */
#tabs {
  display: flex; gap: 6px; align-items: center;
  margin: 0 0 34px;
}
#tabs a {
  text-decoration: none; color: var(--ink-soft);
  font-size: 14px; font-weight: 600; letter-spacing: .04em;
  padding: 8px 14px; border-radius: 10px; border: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
#tabs a:hover { color: var(--ink); }
#tabs a[aria-current="page"] {
  color: var(--ink); background: var(--card); border-color: var(--line);
}
@media (max-width: 720px) {
  #tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    margin: 0; gap: 0; justify-content: space-around;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  #tabs a { flex: 1; text-align: center; padding: 9px 4px; }
  #tabs a[aria-current="page"] { background: var(--code-bg); }
  /* keep content and toasts clear of the fixed tab bar */
  body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .soc-flash, .update-banner { bottom: calc(70px + env(safe-area-inset-bottom)); }
  /* narrow screens: avatar + text share the first row, actions get their own */
  .id-head { flex-wrap: wrap; }
  .id-who { flex: 1 1 calc(100% - 72px); }
  .id-actions { flex: 1 1 100%; justify-content: flex-start; }
  .soc-actions { flex-wrap: wrap; }
}

header h1 {
  font-size: 46px; line-height: 1.1; letter-spacing: -1px; font-weight: 700;
}
header .tag {
  margin: 18px 0 10px; font-size: 19px; color: var(--ink-soft); line-height: 1.55;
}

.rule {
  display: flex; gap: 7px; margin: 44px 0 40px; align-items: center;
}
.rule i { width: 11px; height: 11px; transform: rotate(45deg); border-radius: 2px; }

.apps { display: flex; flex-direction: column; gap: 18px; }
.app {
  display: grid; grid-template-columns: 96px 1fr; gap: 20px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 24px 20px 14px; text-decoration: none; color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.app:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.app .glyph { display: flex; justify-content: center; }
.app h2 { font-size: 22px; font-weight: 650; letter-spacing: -.3px; }
.app h2 small {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  margin-left: 10px; vertical-align: 2px;
}
.app p { margin-top: 5px; font-size: 15px; color: var(--ink-soft); line-height: 1.5; }
.app .url {
  margin-top: 7px; font-size: 13px; color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.app .url b { font-weight: 600; }
.app .app-badge {
  display: block; margin-top: 6px; font-size: 13px; font-weight: 650;
  color: var(--sage-d);
}

/* catalog status badges: quiet pills next to an app's name */
.status-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  border-radius: 6px; padding: 2px 7px; margin-left: 8px; vertical-align: 2px;
}
.status-badge.new { color: var(--paper); background: var(--sage-d); }
.status-badge.beta { color: var(--paper); background: var(--peach-d); }

.rose  h2 small, .rose  .url b { color: var(--rose-d); }
.peach h2 small, .peach .url b { color: var(--peach-d); }
.sage  h2 small, .sage  .url b { color: var(--sage-d); }
.lilac h2 small, .lilac .url b { color: var(--lilac-d); }
.sky   h2 small, .sky   .url b { color: var(--sky-d); }
.gold  h2 small, .gold  .url b { color: var(--gold-d); }
.rose:hover  { border-color: var(--rose); }
.peach:hover { border-color: var(--peach); }
.sage:hover  { border-color: var(--sage); }
.lilac:hover { border-color: var(--lilac); }
.sky:hover   { border-color: var(--sky); }
.gold:hover  { border-color: var(--gold); }

/* ---- your identity: one seed, every app ------------------------------- */
.id-card {
  display: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 22px; margin: 0 0 18px;
}
.id-card.on { display: block; }
.id-head { display: flex; gap: 16px; align-items: center; }
.id-avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px;
  background: var(--code-bg); user-select: none;
}
.id-who { flex: 1; min-width: 0; }
.id-who h2 { font-size: 18px; font-weight: 650; letter-spacing: -.2px; }
.id-who h2 small {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  margin-left: 10px; vertical-align: 2px; color: var(--ink-soft);
}
.id-who .fp { margin-top: 3px; font-size: 15px; letter-spacing: 2px; cursor: default; }
.id-who p.hint { margin-top: 4px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; }
.id-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

/* the identity card builds bare <button>s (no class hook), so the theme's
   .btn can't reach them — this scoped rule mirrors .btn value-for-value */
.id-card button {
  font: 600 13.5px/1 inherit; color: var(--ink);
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 14px; cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.id-card button:hover { border-color: var(--sage); transform: translateY(-1px); }
.id-card button.armed { border-color: var(--rose); color: var(--rose); }

.id-card input[type="text"], .id-card input[type="password"] {
  font: 15px/1.4 inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px; min-width: 0; width: 100%;
}
.id-card input:focus { outline: none; border-color: var(--sage); }
.id-card input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; }

.id-details { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: none; }
.id-details.on { display: block; }
.id-details h3 {
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-soft); margin: 14px 0 8px;
}
.id-details h3:first-child { margin-top: 0; }
.id-details p.hint { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin: 6px 0 10px; }
.id-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.id-row input[type="range"] { flex: 1; accent-color: var(--sage-d); }
.id-row .glyph-in { width: 74px; flex: none; text-align: center; font-size: 20px; }
.id-hex {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-soft); word-break: break-all;
}
/* pairing QR (always on white — scanners want the quiet zone light) */
.id-qr { margin: 8px 0; }
.id-qr svg { display: block; border-radius: 10px; max-width: 200px; height: auto; }
.id-qr p.hint { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }
/* #key= import confirmation + post-import sync status */
.id-import-confirm {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin: 0 0 14px;
}
.id-import-confirm p { margin: 0 0 4px; font-weight: 600; }
.id-who .sync-line { margin-top: 4px; font-size: 13px; color: var(--ink-soft); }

/* ---- friends: the social side of the hub ------------------------------ */
.soc {
  display: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 22px; margin: 0 0 18px;
}
.soc.on { display: block; }
.soc h3 {
  font-size: 12.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 10px;
}
.soc h4 {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-soft); margin: 16px 0 6px;
}
.soc .hint { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.soc-linkrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; }
.soc-paste { gap: 8px; margin-top: 8px; }
.soc-paste input {
  flex: 1; min-width: 200px; font: 14px/1.4 inherit; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px;
}
.soc-paste input:focus { outline: none; border-color: var(--sage); }
.soc-row {
  display: flex; gap: 12px; align-items: center;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.soc-row.dim { opacity: .65; }
.soc-row:first-of-type { border-top: 0; }
.soc-dot {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--code-bg); position: relative;
}
.soc-dot.online::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--sage); animation: soc-pulse 2.4s ease infinite;
}
@keyframes soc-pulse { 50% { opacity: .35; } }
.soc-who { flex: 1; min-width: 0; }
.soc-name { font-weight: 650; font-size: 15.5px; }
.soc-sub { font-size: 13px; color: var(--ink-soft); }
/* the brains line: what a resident is playing with right now. One row, dimmer
   than the sub, and it must survive peer-supplied text. Chips DON'T shrink
   (equal shrinking ellipsizes all of them into mush on a phone) — the leading
   ones stay readable and the row simply clips what doesn't fit; every chip
   also carries its full text as a title. A single pathological value is
   bounded by max-width so it can never eat the whole row. */
.soc-brains {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12px; color: var(--ink-soft);
  margin-top: 1px; min-width: 0; overflow: hidden; white-space: nowrap;
}
.soc-brains-k { flex: none; opacity: .7; }
.soc-brain { flex: none; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
.soc-brain + .soc-brain { padding-left: 8px; border-left: 1px solid var(--line); }
.soc-brain b { font-weight: 600; color: var(--ink); opacity: .8; }
.soc-brain-v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
/* the bank line: the resident's public bank, from the validated catalog. A
   plain link — the link IS the bank — kept as quiet as the brains row. */
.soc-bank {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 12px; color: var(--ink-soft);
  margin-top: 1px; min-width: 0; overflow: hidden; white-space: nowrap;
}
.soc-bank-name { flex: none; max-width: 18em; overflow: hidden; text-overflow: ellipsis; }
.soc-bank-open { flex: none; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.soc-actions { display: flex; gap: 6px; flex: none; }
/* the soc rows also build plain <button>s — smaller than the theme's .btn,
   with its own quiet hover; scoped here for the same class-hook reason */
.soc button {
  font: 600 13px/1 inherit; color: var(--ink); cursor: pointer;
  background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; transition: border-color .15s ease;
}
.soc button:hover { border-color: var(--sage); }
.soc button.go { border-color: var(--sage-d); }
.soc button.armed { border-color: var(--rose); color: var(--rose); }
.soc-sub button { padding: 3px 8px; font-size: 12px; }
.soc-picker { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 10px 24px; }
.soc-add {
  border: 1px dashed var(--sage-d); border-radius: 10px;
  padding: 12px 14px; margin: 8px 0 12px;
}
.soc-add .soc-actions { margin-top: 10px; }
.soc-petin {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--sage); border-radius: 7px; padding: 3px 8px; width: 12em;
}
#lb { margin-top: 18px; }
.lb-picker { padding: 0 0 4px; }
.lb-rank {
  flex: none; width: 26px; text-align: center; font-weight: 700;
  color: var(--ink-soft); font-size: 14px;
}
.lb-best { flex: none; font-weight: 700; font-size: 17px; color: var(--gold); }

/* ---- update banner: the toast aesthetic, but it stays until tapped ----- */
.update-banner {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; z-index: 999;
  box-shadow: var(--shadow); animation: soc-toast-in .25s ease;
}

/* ---- about / manifesto ------------------------------------------------- */
/* .manifesto shares section.about's voice — the long-form why lives there */
section.about, .manifesto { margin-top: 64px; }
.view > section.about:first-child, .view > .manifesto:first-child { margin-top: 8px; }
section.about h3, .manifesto h3 {
  font-size: 12.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-soft); margin-bottom: 14px;
}
.manifesto h3 { margin-top: 34px; }
.manifesto h3:first-child { margin-top: 0; }
section.about p, .manifesto p { color: var(--ink); font-size: 16px; margin-bottom: 12px; }
section.about p a, .manifesto p a { color: var(--sage); }
section.about code, .manifesto code {
  font: 13.5px ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg); border-radius: 5px; padding: 2px 8px;
}

footer {
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--ink-soft);
}
footer a { color: inherit; }

@media (max-width: 560px) {
  header h1 { font-size: 36px; }
  .app { grid-template-columns: 72px 1fr; gap: 12px; padding: 16px 18px 16px 8px; }
  .app svg { width: 64px; height: 64px; }
  .id-head { flex-wrap: wrap; }
  .id-actions { justify-content: flex-start; }
}
