/* Colors and type follow terrahutton.io (Webflow tokens). */
:root {
  --navy: #091b2c;
  --navy-deep: #06121e;
  --surface: #0e2336;
  --surface-2: #132c43;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --muted: #9da4ab;
  --faint: #6b7680;
  --orange: #ff6230;
  --pink: #dd23bb;
  --pink-light: #ffaefe;
  --blue-light: #d9e5ff;
  --green: #4fd67a;
  --green-soft: #cef5ca;
  --red: #ff5a5f;
  --yellow: #f5d547;
  --radius: 10px;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Alliance No.1', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--navy);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 40px;
}

.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0;
}

.accent { color: var(--orange); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(9, 27, 44, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}
.brand img { display: block; height: 28px; width: auto; }
.topbar-meta { display: flex; align-items: center; gap: 16px; }
.updated { color: var(--muted); font-size: 13px; }

.btn {
  font: 500 14px var(--sans);
  color: var(--text);
  background: var(--orange);
  border: 0;
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .chip:focus-visible, summary:focus-visible {
  outline: 2px solid #2d62ff;
  outline-offset: 2px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.tab {
  font: 500 14px var(--sans);
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 6px 18px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected='true'] { background: var(--text); color: var(--navy); }
.tab:focus-visible { outline: 2px solid #2d62ff; outline-offset: 2px; }

/* Globe view */
.globe-view {
  position: relative;
  height: calc(100vh - 69px);
  height: calc(100dvh - 69px);
  min-height: 520px;
  overflow: hidden;
}
.globe-stage { position: absolute; inset: 0; }
.globe-stage canvas { display: block; touch-action: none; }
.globe-panel {
  position: absolute;
  top: 24px;
  left: 24px;
  bottom: 24px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: rgba(9, 27, 44, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.legend { display: flex; flex-direction: column; gap: 4px; }
.legend .chip { display: flex; align-items: center; gap: 8px; text-align: left; border-radius: 6px; }
.legend .chip .n { margin-left: auto; }
.site-list { overflow-y: auto; margin: 0 -8px; }
.site-item {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 2px 10px;
  width: 100%;
  padding: 8px;
  text-align: left;
  color: inherit;
  font: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.site-item:hover, .site-item.active { background: var(--surface-2); }
.site-item .dot { margin-top: 7px; }
.site-item .who { font-weight: 600; font-size: 14px; }
.site-item .where { grid-column: 2; color: var(--faint); font-size: 12px; }
.site-card {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 340px;
  max-height: calc(100% - 48px);
  overflow-y: auto;
  padding: 20px;
  background: rgba(14, 35, 54, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
}
.site-card .close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.site-card .close:hover { color: var(--text); }
.site-card h2 { margin: 0; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; padding-right: 28px; }
.site-card .sub { color: var(--muted); font-size: 14px; margin: -6px 0 0; }
.site-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 13px; }
.site-card dt { color: var(--faint); }
.site-card dd { margin: 0; }
.site-card .reasons { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.site-card .project { padding-top: 10px; }
.site-card .logo { height: 32px; }
.globe-hint {
  position: absolute;
  bottom: 20px;
  right: 24px;
  margin: 0;
  color: var(--faint);
  font: 400 12px var(--mono);
  pointer-events: none;
}
.globe-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
  pointer-events: none;
}

/* Hero */
.hero { padding: 56px 0 32px; }
.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 14px 0 18px;
}
.viewer-line { color: var(--muted); margin: 0; font-size: 14px; }
.viewer-line code { font-family: var(--mono); color: var(--blue-light); font-size: 13px; }
.notice {
  margin: 16px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--orange);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.notice.error { border-left-color: var(--red); color: var(--text); }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 40px;
}
.stat {
  background: var(--navy);
  padding: 20px 24px;
  text-align: left;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.stat:hover { background: var(--surface); }
.stat .num {
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat .num small { font-size: 18px; color: var(--faint); font-weight: 400; }
.stat .cap { color: var(--muted); font-size: 13px; margin-top: 8px; }
.stat.ok .num .dot { background: var(--green); }
.stat.bad .num { color: var(--red); }
.stat.warn .num { color: var(--orange); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: start;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.toolbar input, .toolbar select {
  font: 400 14px var(--sans);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 16px;
}
.toolbar input { flex: 1 1 160px; min-width: 0; }
.toolbar input::placeholder { color: var(--faint); }
.toolbar select { cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: 500 13px var(--sans);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed='true'] { color: var(--navy); background: var(--text); border-color: var(--text); }
.chip .n { opacity: 0.6; margin-left: 4px; }

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
}
.logo {
  height: 36px;
  max-width: 190px;
  object-fit: contain;
  object-position: left center;
}
.logo-fallback {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 17px;
}
.logo-fallback .mono {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--blue-light);
}
.card-head .name { color: var(--muted); font-size: 13px; text-align: right; }

.project {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 8px;
}
.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.variant { font-weight: 600; font-size: 14px; }
.variant .repo { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--faint); margin-left: 6px; }
.variant .repo.solo { margin-left: 0; }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.status.up .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(79, 214, 122, 0.15); }
.status.down .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 90, 95, 0.18); animation: pulse 1.6s infinite; }
.status.down { color: var(--red); }
.status .ms { color: var(--faint); font-family: var(--mono); font-size: 12px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 90, 95, 0); } }

.change { font-size: 14px; color: var(--text); margin: 0; overflow-wrap: anywhere; }
.change .when { color: var(--faint); margin-left: 6px; white-space: nowrap; font-size: 13px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  border-radius: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: var(--green-soft); border-color: rgba(206, 245, 202, 0.25); }
.badge.warn { color: var(--orange); border-color: rgba(255, 98, 48, 0.4); }
.badge.bad { color: var(--red); border-color: rgba(255, 90, 95, 0.45); }
.badge.pink { color: var(--pink-light); border-color: rgba(221, 35, 187, 0.45); }

.missing summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.missing summary::-webkit-details-marker { display: none; }
.missing summary::after { content: 'Show what it lacks'; font-size: 12px; color: var(--faint); }
.missing[open] summary::after { content: 'Hide'; }
.missing summary:hover::after { color: var(--orange); }
.missing ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px 12px;
  border-left: 2px solid rgba(255, 98, 48, 0.4);
  background: rgba(255, 98, 48, 0.05);
  border-radius: 0 6px 6px 0;
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.missing li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.missing li time { color: var(--faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.missing li.more { color: var(--faint); font-style: italic; }
.links { display: flex; gap: 16px; font-size: 13px; }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--orange); }

/* Activity */
.side { position: sticky; top: 92px; }
.activity { list-style: none; margin: 16px 0 0; padding: 0; }
.activity li {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.activity li .dot { margin-top: 6px; }
.activity li.success .dot { background: var(--green); }
.activity li.failed .dot { background: var(--red); }
.activity li.building .dot { background: var(--yellow); }
.activity .who { font-weight: 600; font-size: 14px; }
.activity .who span { color: var(--faint); font-weight: 400; }
.activity .what { grid-column: 2; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.activity .when { grid-column: 2; color: var(--faint); font-size: 12px; font-family: var(--mono); }

/* Other repos */
.others {
  margin: 56px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-deep);
}
.others summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
}
.others summary::-webkit-details-marker { display: none; }
.others .count { color: var(--muted); font-size: 13px; }
.chev {
  margin-left: auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.others[open] .chev { transform: rotate(-135deg); }
#others-body { padding: 0 24px 16px; }
.kind { margin-top: 12px; }
.kind h3 {
  font: 500 12px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 16px 0 4px;
}
.repo-row {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr) 110px 64px;
  gap: 16px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.repo-row.is-hidden { opacity: 0.55; }
.repo-name { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; text-decoration: none; }
.repo-name:hover { color: var(--orange); }
.hide-btn, .show-hidden {
  font: 500 12px var(--sans);
  color: var(--faint);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  justify-self: end;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.repo-row:hover .hide-btn, .hide-btn:focus-visible, .repo-row.is-hidden .hide-btn { opacity: 1; }
.hide-btn:hover, .show-hidden:hover { color: var(--orange); border-color: var(--orange); }
.show-hidden { opacity: 1; margin-top: 16px; padding: 6px 14px; }
@media (hover: none) { .hide-btn { opacity: 1; } }
.repo-msg { color: var(--muted); overflow-wrap: anywhere; }
.repo-msg em { font-style: normal; color: var(--faint); }
.repo-when { color: var(--faint); font-size: 13px; text-align: right; white-space: nowrap; }

.footer {
  display: flex;
  justify-content: space-between;
  padding-top: 48px;
  padding-bottom: 40px;
  color: var(--faint);
  font-size: 13px;
}
.empty { color: var(--muted); }

/* Loading skeleton */
.skeleton { min-height: 200px; }
.skeleton div {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2), #1a3753, var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
.skeleton div:first-child { height: 32px; width: 50%; }
.skeleton div:last-child { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  .stat .num { font-size: 32px; }
  .repo-row { grid-template-columns: 1fr auto auto; }
  .repo-msg { grid-column: 1 / -1; grid-row: 2; }
  .updated { display: none; }
  .others summary, #others-body { padding-left: 16px; padding-right: 16px; }
  .brand img { height: 22px; }
  .tab { padding: 6px 12px; }
  .topbar-meta .btn { padding: 8px 14px; }
  .globe-view { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .globe-stage { position: relative; inset: auto; height: 60vh; }
  .globe-panel { position: static; width: auto; margin: 16px; max-height: none; }
  .site-list { max-height: 50vh; }
  .site-card { left: 16px; right: 16px; top: 16px; width: auto; max-height: calc(60vh - 32px); }
  .globe-hint { display: none; }
  .globe-loading { height: 60vh; bottom: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
