/* Signal: the same visual language as the Gang Chat client
   (gang-chat-client docs/ui-design-system.md, lib/src/ui/tokens.dart).
   A near-black dotted canvas, dark layered surfaces, and one lime signal
   colour reserved for what is live or can be pressed. */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-Medium.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-Bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/JetBrainsMono-Medium.woff") format("woff");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/JetBrainsMono-Bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Doto";
  src: url("assets/fonts/Doto-Bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Surfaces, dark to light. */
  --surface-pressed: #000000;
  --background: #060607;
  --surface-low: #0d0d0f;
  --card: #131316;
  --surface: #17171a;
  --surface-raised: #1e1e22;
  --surface-hover: #27272c;
  --border: #222226;
  --border-strong: #323238;

  /* Text. */
  --text: #f4f4f1;
  --text-secondary: #a3a3a8;
  --text-muted: #66666d;

  /* The signal. */
  --accent: #d4ff3f;
  --accent-strong: #ccf43a;
  --accent-border: #465418;
  --accent-soft: #151a07;
  --on-accent: #0a0b05;
  --amber: #ffb224;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  --fast: 120ms;
  --standard: 180ms;

  --shadow-popover: 0 14px 32px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.2);

  --font-body: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-display: "Space Grotesk", var(--font-body);
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, var(--font-body);
  --font-dot: "Doto", var(--font-mono);

  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  background-color: var(--background);
  /* DotGridBackground: one faint dot every 18px. */
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.086) 1px, transparent 1.4px);
  background-size: 18px 18px;
  background-position: 9px 9px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  /* Leaves room for the fixed back-to-top button under the footer. */
  padding: 20px 0 88px;
}

/* Header ----------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(13, 13, 15, 0.86);
  box-shadow: var(--shadow-popover);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border-radius: var(--radius-pill);
}

.brand__logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  min-width: 76px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition:
    background var(--fast) ease,
    color var(--fast) ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.site-nav a:active {
  background: var(--surface-pressed);
}

/* Shared pieces ------------------------------------------------------------ */

/* SignalTag: a small monospace uppercase capsule. */
.signal-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  height: 24px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(163, 163, 168, 0.28);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  background: rgba(163, 163, 168, 0.1);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.signal-tag--live {
  border-color: rgba(212, 255, 63, 0.28);
  color: var(--accent);
  background: rgba(212, 255, 63, 0.1);
}

.signal-tag--amber {
  border-color: rgba(255, 178, 36, 0.32);
  color: var(--amber);
  background: rgba(255, 178, 36, 0.1);
}

.signal-tag--muted {
  border-color: var(--border-strong);
  color: var(--text-muted);
  background: transparent;
}

.signal-tag__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(212, 255, 63, 0.18);
}

/* Button: neutral dark capsule; primary is the lime signal. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--fast) ease,
    border-color var(--fast) ease,
    box-shadow var(--fast) ease,
    color var(--fast) ease;
}

.button:hover {
  background: var(--surface-hover);
}

.button:active {
  background: var(--surface-pressed);
}

.button--primary {
  border-color: var(--accent);
  color: var(--on-accent);
  background: var(--accent);
}

.button--primary:hover {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(212, 255, 63, 0.16), 0 0 24px rgba(212, 255, 63, 0.22);
}

.button--primary:active {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Hero --------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 28px;
  align-items: end;
  padding: 72px 4px 36px;
}

.hero__copy {
  display: grid;
  gap: 18px;
  min-width: 0;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(52px, 8.5vw, 104px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero__text {
  max-width: 620px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.7;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

/* The version readout is drawn like the music box's display window: a
   recessed black screen with a tighter dot grid. */
.display {
  position: relative;
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 20px 22px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background-color: var(--surface-pressed);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 0.8px, transparent 1.2px);
  background-size: 7px 7px;
  box-shadow:
    inset 0 2px 14px rgba(0, 0, 0, 0.9),
    0 0 0 6px var(--surface-low),
    0 0 0 7px var(--border);
}

.display__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.display__label,
.display__caption {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.display__caption {
  color: var(--text-muted);
}

.display__value {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-family: var(--font-dot);
  font-size: clamp(48px, 6vw, 68px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 18px rgba(212, 255, 63, 0.28);
}

/* EqualizerBars: a frozen "someone is talking" glyph. */
.equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.equalizer i {
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.equalizer i:nth-child(1) { height: 45%; }
.equalizer i:nth-child(2) { height: 90%; }
.equalizer i:nth-child(3) { height: 60%; }
.equalizer i:nth-child(4) { height: 100%; }
.equalizer i:nth-child(5) { height: 35%; }

/* Sections ----------------------------------------------------------------- */

.section-block {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(13, 13, 15, 0.94);
  scroll-margin-top: 92px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.section-heading__index {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface-pressed);
  font-family: var(--font-dot);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

/* Downloads ---------------------------------------------------------------- */

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.download-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  min-height: 236px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  transition:
    background var(--fast) ease,
    border-color var(--fast) ease;
}

.download-card:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.download-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.platform-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface-raised);
}

.platform-icon svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.platform-icon__image {
  display: block;
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.platform-icon__image--linux {
  width: 30px;
  height: 30px;
}

.download-card--soon .platform-icon {
  opacity: 0.55;
}

.download-card__body h3 {
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
}

.download-card__body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.download-action {
  width: 100%;
}

.download-action--disabled,
.download-action--disabled:hover,
.download-action--disabled:active {
  border-color: var(--border);
  color: var(--text-muted);
  background: transparent;
  cursor: default;
}

.download-note {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.7;
}

.download-note .signal-tag {
  flex: none;
  margin-top: 1px;
  /* Keep the platform's own spelling. */
  text-transform: none;
}

.download-note p {
  margin: 0;
}

.download-note p + p {
  margin-top: 6px;
}

.download-note code {
  display: inline-block;
  max-width: 100%;
  margin-top: 4px;
  padding: 2px 8px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-pressed);
  font-family: var(--font-mono);
  font-size: 12px;
  user-select: all;
}

/* Announcements ------------------------------------------------------------ */

.log-list {
  display: grid;
  gap: 8px;
}

.log-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

/* The newest announcement is the "current" row, like the playing track. */
.log-item:first-child {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.log-item time {
  padding-top: 3px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.log-item:first-child time {
  color: var(--accent);
}

.log-item h3 {
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.log-item p {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.log-item[hidden],
.log-more[hidden] {
  display: none;
}

.log-more {
  width: 100%;
  margin-top: 10px;
}

/* Footer ------------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 22px 6px 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-footer a {
  text-transform: none;
  transition: color var(--fast) ease;
}

.site-footer a:hover {
  color: var(--text);
}

/* Back to top -------------------------------------------------------------- */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow-popover);
  cursor: pointer;
  transition: background var(--fast) ease;
}

.back-to-top:hover {
  background: var(--surface-hover);
}

.back-to-top:active {
  background: var(--surface-pressed);
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Responsive --------------------------------------------------------------- */

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 56px;
  }

  .download-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-card {
    min-height: 0;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: calc(100% - 32px);
    padding-top: 12px;
  }

  .site-header {
    top: 8px;
    gap: 12px;
    padding: 8px 8px 8px 10px;
  }

  .brand__logo {
    width: 32px;
    height: 32px;
  }

  .brand__name {
    font-size: 18px;
  }

  .site-nav a {
    min-width: 0;
    padding: 8px 14px;
  }

  .hero {
    gap: 24px;
    padding: 40px 0 24px;
  }

  .hero__text {
    font-size: 16px;
  }

  .hero__actions .button {
    flex: 1 1 140px;
  }

  .section-block {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .download-grid {
    grid-template-columns: 1fr;
  }

  .download-note {
    flex-direction: column;
    gap: 8px;
  }

  .log-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
