/* Communities Group: monochrome + cyan accent in the dark theme; the light theme is pure black/white.
   Dark by default, light via prefers-color-scheme. */
:root {
  color-scheme: dark light;
  --bg: #0a0a0b;
  --bg-elevated: #111113;
  --surface: #141416;
  --surface-hover: #1b1b1e;
  --border: #26262a;
  --border-strong: #38383d;
  --text: #ededed;
  --muted: #a1a1a6;
  --faint: #6e6e73;
  --accent: #22d3ee;
  --accent-ink: #04161a;
  --accent-soft: rgba(34, 211, 238, .10);
  --accent-border: rgba(34, 211, 238, .35);
  --glow: rgba(34, 211, 238, .10);
  --live: #5dcaa5;
  --live-soft: rgba(93, 202, 165, .12);
  --live-border: rgba(93, 202, 165, .4);
  --headline: var(--accent);
  --radius: 10px;
  --maxw: 68rem;
  --font: "Century Gothic", "Avenir Next", Futura, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-hover: #f5f5f6;
    --border: #e4e4e7;
    --border-strong: #cdcdd2;
    --text: #0a0a0b;
    --muted: #55555b;
    --faint: #8a8a90;
    --accent: #0a0a0b;
    --accent-ink: #ffffff;
    --accent-soft: rgba(10, 10, 11, .05);
    --accent-border: rgba(10, 10, 11, .25);
    --glow: rgba(10, 10, 11, .04);
    --live: #148a68;
    --live-soft: rgba(20, 138, 104, .10);
    --live-border: rgba(20, 138, 104, .4);
    --headline: #8a8a90;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 100;
  padding: .5rem 1rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; text-decoration: none; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.5rem; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 34px; width: auto; }
.topnav { display: flex; gap: 1.25rem; font-size: .9rem; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--text); text-decoration: none; }

main { flex: 1; }

/* Hero */
.hero {
  position: relative;
  padding-block: 5.5rem 4rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(60rem 22rem at 50% -8rem, var(--glow), transparent 70%),
    linear-gradient(var(--bg), var(--bg));
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1.25rem;
  padding: .2rem .7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
}
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hero h1 { margin: 0 0 1rem; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.08; letter-spacing: -.02em; font-weight: 700; }
.hero h1 span { color: var(--headline); }
.lead { max-width: 36rem; margin: 0; font-size: 1.1rem; color: var(--muted); }
.code { margin: 0 0 .75rem; font-family: var(--mono); font-size: .9rem; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

/* Sections */
.section { padding-block: 3rem; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.section-head .count { font-family: var(--mono); font-size: .8rem; color: var(--faint); }

/* Cards */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.card {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color .15s, background-color .15s;
}
a.card:hover { border-color: var(--accent-border); background: var(--surface-hover); text-decoration: none; }
/* "What we do" cards: compact, icon beside the text, so the project card stands out */
.card.info { flex-direction: row; align-items: flex-start; gap: 1rem; background: transparent; }
.card.info .card-top { flex: none; }
.card.info .icon { width: 2.2rem; height: 2.2rem; }
.card.info h3 { font-size: 1rem; }
.card.info p { margin-top: .15rem; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
}
a.card .icon { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); }
.icon svg { width: 1.3rem; height: 1.3rem; }
.tag {
  padding: .1rem .55rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--accent);
}
.card h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.card p { margin: .2rem 0 0; color: var(--muted); font-size: .92rem; }
.card-foot {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--faint);
}
.card-foot .go { color: var(--accent); }

/* Project cards */
.card.project { cursor: default; }
.js .card.project { cursor: pointer; }
.card.project:hover { border-color: var(--accent-border); background: var(--surface-hover); }
.card-media {
  position: relative;
  margin: -1.25rem -1.25rem 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #0b1020;
}
.card-media img { display: block; width: 100%; height: auto; aspect-ratio: 800 / 420; object-fit: cover; transition: transform .3s; }
.card.project:hover .card-media img { transform: scale(1.04); }
.project-head { display: flex; align-items: center; gap: .85rem; }
.project-icon { width: 3rem; height: 3rem; border-radius: 12px; flex: none; }
.project-head h3 { font-size: 1.2rem; }
.project-kind { font-family: var(--mono); font-size: .76rem; color: var(--faint); }
.live {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .15rem .65rem .15rem .55rem;
  border: 1px solid var(--live-border);
  border-radius: 999px;
  background: var(--live-soft);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--live);
}
.card-media .live { position: absolute; top: .75rem; left: .75rem; background: color-mix(in srgb, #0b1020 78%, transparent); backdrop-filter: blur(4px); color: #5dcaa5; border-color: rgba(93, 202, 165, .5); }
.live-dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70%, 100% { box-shadow: 0 0 0 .5rem transparent; }
}
.card-foot .details {
  display: none;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.js .card-foot .details { display: inline; }
.card-foot .details:hover { color: var(--text); }
.card-foot .details:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.card-foot .go { font-weight: 700; }

/* Detail dialog */
.modal {
  width: min(52rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}
.modal[open] { animation: modal-in .22s ease-out; }
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(.75rem) scale(.96); } to { opacity: 1; transform: none; } }
body.modal-open { overflow: hidden; }
.modal-close {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 1;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { border-color: var(--text); }
.modal-body { display: grid; grid-template-columns: 15rem 1fr; gap: 1.75rem; padding: 1.5rem; }
.modal-shot { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border-strong); align-self: start; }
.modal-text .project-head { margin-bottom: 1rem; }
.modal-text h3 { margin: 0 0 .3rem; font-size: 1.5rem; }
.modal-lead { margin: 0 0 1rem; color: var(--text); }
.facts { margin: 0 0 1.1rem; padding-left: 1.1rem; color: var(--muted); }
.facts li { margin-bottom: .35rem; }
.facts strong { color: var(--text); }
.specs { display: grid; gap: .5rem; margin: 0; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elevated); font-size: .88rem; }
.specs div { display: flex; gap: 1rem; }
.specs dt { flex: 0 0 5.2rem; font-family: var(--mono); font-size: .76rem; color: var(--faint); }
.specs dd { margin: 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; }
.stats[hidden], .board[hidden] { display: none; }
.stats div { padding: .6rem .5rem; border: 1px solid var(--live-border); border-radius: 8px; background: var(--live-soft); text-align: center; }
.stats strong { display: block; font-family: var(--font); font-size: 1.25rem; line-height: 1.2; color: var(--live); }
.stats span { font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.board { margin-top: 1rem; }
.board h4 { margin: 0 0 .4rem; font-family: var(--mono); font-size: .76rem; font-weight: 400; color: var(--faint); }
.board ol { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.board li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; counter-increment: rank; }
.board li:last-child { border-bottom: 0; }
.board li span:first-child::before { content: counter(rank) ". "; font-family: var(--mono); color: var(--faint); }
.board li span:last-child { font-family: var(--mono); color: var(--muted); }
.modal .actions { margin-top: 1.25rem; }
.modal .button { font-family: inherit; font-size: inherit; cursor: pointer; }
.modal .button:not(.ghost) { color: var(--accent-ink); }

@media (max-width: 40rem) {
  .modal-body { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.25rem; }
  .modal-shot { max-width: 14rem; margin-inline: auto; }
}

.button {
  display: inline-block;
  padding: .55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button.ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.button.ghost:hover { border-color: var(--text); filter: none; }

/* Contact */
.contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.contact h2 { margin: 0 0 .25rem; font-size: 1.15rem; }
.contact p { margin: 0; color: var(--muted); }

/* Legal pages */
.prose { max-width: 44rem; padding-block: 3rem 4rem; }
.prose h1 { margin: 0 0 .5rem; font-size: 2rem; }
.prose h2 { margin: 2rem 0 .5rem; font-size: 1.1rem; }
.prose p, .prose li { color: var(--muted); }
.prose ul { padding-left: 1.2rem; }
.prose .meta { font-family: var(--mono); font-size: .8rem; color: var(--faint); }
.prose strong { color: var(--text); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

/* Footer */
.footer { border-top: 1px solid var(--border); background: var(--bg-elevated); }
.footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.5rem;
  font-size: .85rem;
  color: var(--faint);
}
.footer .version { margin-left: .5rem; font-family: var(--mono); font-size: .78rem; }
.footer nav { display: flex; gap: 1.25rem; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); text-decoration: none; }

@media (max-width: 30rem) {
  .hero { padding-block: 3rem 2.5rem; }
  .brand img { height: 28px; }
  .topnav { gap: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card-media img { transition: none; }
  .live-dot, .modal[open] { animation: none; }
}
