@font-face {
  font-family: "JetBrains Mono";
  src: url("./assets/fonts/JetBrainsMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --echo-black: #000000;
  --echo-white: #ffffff;
  --echo-green: #84c98d;
  --echo-purple: #db75eb;
  --echo-orange: #ffbb7c;
  --echo-red: #ff8989;
  --echo-muted: rgb(255 255 255 / 0.5);
  --box-gap: 14px;
  --box-padding: 10px;
  --screen-padding: 14px;
  --content-width: 1040px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  min-width: 320px;
  background: var(--echo-black);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--echo-black);
  color: var(--echo-white);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
}

body > *:not(.space-background):not(.echo-topbar):not(.skip-link) {
  position: relative;
  z-index: 1;
}

a { color: inherit; }

.space-background {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Skip link: standard off-screen until keyboard focus brings it in. */
.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: inline-block;
  margin: 12px;
  padding: 10px 14px;
  border: 1px solid var(--echo-purple);
  background: var(--echo-black);
  color: var(--echo-white);
  text-decoration: none;
  transform: translateY(calc(-100% - 40px));
  opacity: 0;
  pointer-events: none;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* #main receives focus after the skip link activates; it is only a programmatic
   focus target and must not paint a full-page focus ring. */
main[tabindex="-1"]:focus { outline: none; }

/* ---------------------------------------------------------------------------
   Shared pinned top navigation. A thin translucent Echo bar. Non-home pages
   center the store buttons between the back link and the empty right side; the
   home page uses its own revealed fixed bar (see the Landing section).
--------------------------------------------------------------------------- */
body > header.echo-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgb(0 0 0 / 0.72);
  border-bottom: 1px solid rgb(255 255 255 / 0.12);
}

.echo-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 24px;
  width: min(calc(100% - clamp(32px, 7vw, 120px)), 1180px);
  margin-inline: auto;
  padding-block: 10px 12px;
}

.echo-nav-home {
  justify-self: start;
}

/* Home sticky bar keeps ECHO left and the store buttons pushed to the right. */
.landing-page .echo-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  row-gap: 10px;
}

.echo-nav a {
  color: var(--echo-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.echo-nav a:hover { color: var(--echo-white); }

.echo-nav .echo-nav-home,
.echo-nav .echo-nav-brand {
  color: var(--echo-green);
}

.echo-nav .echo-nav-home:hover,
.echo-nav .echo-nav-brand:hover {
  color: var(--echo-green);
  opacity: 0.75;
}

.echo-nav .echo-nav-arrow { color: var(--echo-muted); }

/* Right-side legal page links (Terms / Privacy / Support only). */
.echo-nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 18px;
  justify-self: end;
  letter-spacing: 0.04em;
}

.echo-nav-links .echo-nav-current,
.echo-nav-links a[aria-current="page"] {
  color: var(--echo-green);
}

/* Store buttons shared by the hero and every top bar. Purple Echo outline,
   transparent background, terminal font, no arrows or badges. */
.echo-store-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--echo-purple);
  border-radius: 0;
  background: transparent;
  color: var(--echo-purple);
  font: inherit;
  text-align: center;
  text-decoration: none;
}

.echo-store-button:hover { opacity: 0.7; }

.echo-nav-stores {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Compact store buttons used inside the top bars (home sticky + non-home). */
.echo-nav .echo-store-button {
  min-height: 32px;
  padding: 7px 14px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--echo-purple);
}

.echo-nav .echo-store-button:hover {
  color: var(--echo-purple);
  opacity: 0.7;
}

/* Larger store buttons used in the home hero. */
.hero-store-button {
  min-height: 46px;
  padding: 12px 20px;
  font-size: 12px;
  letter-spacing: 0.02em;
}

@media (max-width: 700px) {
  .echo-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .echo-nav-home { align-self: flex-start; }

  /* Legal pages keep ECHO + links on the first row and stores on the second. */
  .echo-nav--legal {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "home links"
      "stores stores";
    column-gap: 18px;
    row-gap: 10px;
    width: 100%;
  }

  .echo-nav--legal .echo-nav-home { grid-area: home; }
  .echo-nav--legal .echo-nav-stores { grid-area: stores; }
  .echo-nav--legal .echo-nav-links { grid-area: links; justify-self: end; }
}

.shell {
  width: min(calc(100% - var(--screen-padding) * 2), var(--content-width));
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding-top: 4px;
}

.terminal-info,
.status-panel {
  border: 1px solid var(--echo-white);
  background: transparent;
}

.terminal-info {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--box-padding);
}

.terminal-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  object-fit: contain;
}

.terminal-info { color: inherit; text-decoration: none; }
.terminal-copy { min-width: 0; }
.terminal-copy > span { display: block; }
.terminal-title { margin: 0; color: var(--echo-white); }
.terminal-status { margin: 5px 0 0; color: var(--echo-muted); }

.text-link,
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--echo-white);
  border-radius: 0;
  padding: 12px 16px;
  background: transparent;
  color: var(--echo-white);
  font: inherit;
  text-align: center;
  text-decoration: none;
}

.site-header .text-link {
  min-width: 92px;
  color: var(--echo-orange);
  border-color: var(--echo-orange);
}

.button-accent {
  color: var(--echo-purple);
  border-color: var(--echo-purple);
}

.button:hover,
.text-link:hover { opacity: 0.7; }

.button:disabled { cursor: wait; opacity: 0.4; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--echo-purple);
  outline-offset: 3px;
}

.cursor {
  color: var(--echo-green);
  animation: blink 1s steps(1, end) infinite;
}

.terminal-main {
  display: flex;
  flex-direction: column;
  gap: var(--box-gap);
  padding-block: var(--box-gap) 28px;
}

.command-copy { color: var(--echo-muted); }
.command-copy span { display: block; }
.command-copy span::before { content: "> "; }

.section-note,
.eyebrow,
.feed-status,
.echo-label,
.pulse-count,
.void-subtitle {
  margin: 0;
  color: var(--echo-muted);
}

/* ---------------------------------------------------------------------------
   Echo card (mirrors the mobile PublicEchoCard / Void card). Cards are the
   site's main bordered elements and grow to their content; no equal heights.
--------------------------------------------------------------------------- */
.echo-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--box-padding);
  border: 1px solid var(--echo-green);
  background: transparent;
}

.echo-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--box-gap);
}

.beacon-id { color: var(--echo-green); overflow-wrap: anywhere; }
.pulse-count { flex: 0 0 auto; }

.echo-label {
  padding-top: var(--box-padding);
  letter-spacing: 0.04em;
}

.echo-label + .echo-transmission,
.echo-label + .echo-reply { margin-top: 4px; }

.echo-transmission {
  margin: 0;
  color: var(--echo-white);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.echo-reply {
  margin: 0;
  color: var(--echo-green);
  font: inherit;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* ---------------------------------------------------------------------------
   Landing page
--------------------------------------------------------------------------- */
.landing-page .shell {
  width: min(calc(100% - clamp(36px, 8vw, 112px)), 1180px);
}

.landing-page .terminal-main {
  gap: 0;
  padding-block: 0;
}

/* Home page only: the ECHO + store bar is fixed (never reserves space) and
   stays hidden until the hero has scrolled out of view. */
.landing-page .echo-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(-120%);
  visibility: hidden;
  transition: transform 0.35s ease, visibility 0s linear 0.35s;
}

.landing-page .echo-topbar.echo-topbar--shown {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.35s ease;
}

.landing-page .hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: clamp(28px, 5vw, 96px);
  padding-block: clamp(44px, 7vh, 76px) clamp(44px, 7vh, 72px);
}

.landing-page .hero-main {
  min-width: 0;
}

.landing-page .hero-stores {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-top: clamp(8px, 2vw, 20px);
}

.landing-page .hero h1 {
  margin: 0;
  color: var(--echo-green);
  font: inherit;
  font-size: clamp(52px, 8.5vw, 96px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.landing-page .hero-copy {
  margin-top: clamp(22px, 3.5vw, 38px);
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1.9;
}

.landing-page .section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--box-gap);
  margin: 0 0 clamp(24px, 3.2vw, 40px);
}

.landing-page .section-heading h2 {
  margin: 0;
  color: var(--echo-green);
  font: inherit;
  font-size: clamp(13px, 1.3vw, 16px);
  font-weight: 400;
  letter-spacing: 0.06em;
}

.landing-page .section-note {
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* Carousel: one scrolling strip. Cards are sized to their content and keep
   their full spacing; nothing beyond this container is ever overflowed. */
.echo-carousel {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-behavior: auto;
  touch-action: pan-x pan-y;
}

.echo-carousel::-webkit-scrollbar { display: none; }

.echo-carousel-track {
  display: flex;
  align-items: flex-start;
  width: max-content;
  gap: clamp(24px, 3.4vw, 44px);
  padding-block: 8px 14px;
}

.echo-carousel-track .echo-card {
  flex: 0 0 auto;
  width: clamp(270px, 29vw, 350px);
}

/* Landing carousel bleeds edge-to-edge across the full viewport while the
   rest of the page stays inside the content shell. The scroll container keeps
   the overflow internal, so no page-level horizontal scrollbar appears. */
.landing-page .echo-carousel {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
}

.landing-page .echo-carousel .status-panel {
  margin-block: 8px 14px;
  border: 0;
}

.landing-page .section-action {
  display: flex;
  justify-content: center;
  padding-block: clamp(44px, 7vw, 72px) clamp(96px, 13vw, 150px);
}

.landing-page .section-action .button { min-width: 196px; }

/* ---------------------------------------------------------------------------
   Status panels / empty + error states
--------------------------------------------------------------------------- */
.status-panel {
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: var(--box-padding);
  border-color: var(--echo-green);
  color: var(--echo-muted);
  text-align: center;
  white-space: pre-line;
}

/* ---------------------------------------------------------------------------
   The Void
--------------------------------------------------------------------------- */
.void-page .void-main {
  display: flex;
  flex-direction: column;
  width: min(calc(100% - clamp(32px, 7vw, 120px)), 880px);
  padding-block: clamp(40px, 7vw, 84px) 120px;
}

.void-title h1 {
  margin: 0;
  color: var(--echo-green);
  font: inherit;
  font-size: clamp(40px, 7.5vw, 76px);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.void-subtitle {
  margin-top: clamp(16px, 3vw, 26px);
  font-size: clamp(13px, 1.5vw, 16px);
}

.void-feed {
  display: flex;
  flex-direction: column;
  margin-top: clamp(56px, 9vw, 110px);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: clamp(30px, 4.5vw, 54px);
}

.feed-list .echo-card { width: 100%; min-height: 0; }

.feed-status {
  margin-top: 28px;
  text-align: center;
  white-space: pre-line;
}

/* Subtle bottom cue: sits just under the last loaded Echo while more pages may
   follow. It is decorative (pointer-events: none) and disappears on its own. */
.feed-fade {
  display: grid;
  place-items: center;
  height: 118px;
  margin-top: -44px;
  background: linear-gradient(
    to bottom,
    rgb(0 0 0 / 0) 0%,
    rgb(0 0 0 / 0) 34%,
    rgb(0 0 0 / 0.78) 82%,
    rgb(0 0 0 / 0.96) 100%
  );
  pointer-events: none;
}

.feed-fade-copy {
  align-self: end;
  margin: 0 0 26px;
  color: var(--echo-muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  opacity: 0.72;
}

.feed-sentinel {
  height: 1px;
}

.void-page .feed-retry {
  align-self: center;
  margin-top: 18px;
}

/* ---------------------------------------------------------------------------
   Permalink (/echo/e/?id=...)
--------------------------------------------------------------------------- */
.permalink-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.permalink-wrap {
  width: min(100%, 720px);
  display: flex;
  flex-direction: column;
  gap: var(--box-gap);
}

.permalink-wrap .echo-card { width: 100%; min-height: 0; }

.permalink-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------------------------------------------------------------------------
   Footer
--------------------------------------------------------------------------- */
.site-footer {
  padding-block: 44px 38px;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--echo-muted);
}

.footer-meta p { margin: 0; }
.footer-meta nav { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-meta a { text-decoration: none; }
.footer-meta a:hover { color: var(--echo-white); }

.landing-page .site-footer {
  padding-top: 6px;
}

/* ---------------------------------------------------------------------------
   Legal / help pages (Terms, Privacy, Support, Help). These use the same
   terminal styling and animated particle background as every Echo page.
--------------------------------------------------------------------------- */
.legal-main {
  width: min(calc(100% - clamp(32px, 7vw, 120px)), 860px);
  margin-inline: auto;
  padding-block: clamp(40px, 7vw, 76px) 0;
}

.legal-heading h1 {
  margin: 0;
  color: var(--echo-green);
  font: inherit;
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.legal-heading .legal-meta {
  margin: 20px 0 0;
  color: var(--echo-muted);
  font-size: 13px;
}

.legal-body > section { margin-top: clamp(34px, 5vw, 54px); }

.legal-body h2 {
  margin: 0 0 16px;
  color: var(--echo-white);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.legal-body p {
  margin: 0 0 14px;
  color: rgb(255 255 255 / 0.78);
  font-size: 13px;
  line-height: 1.8;
}

.legal-body a {
  color: var(--echo-green);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-block: clamp(70px, 10vw, 120px) 40px;
  color: var(--echo-muted);
}

.legal-footer p { margin: 0; }
.legal-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.legal-footer a { color: inherit; text-decoration: none; }
.legal-footer a:hover { color: var(--echo-white); }

@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 620px) {
  .legal-main { width: calc(100% - 36px); }
  .site-header { grid-template-columns: minmax(0, 1fr) auto; }
  .terminal-info { min-height: 62px; }
  .terminal-icon { width: 32px; height: 32px; }
  .footer-meta { align-items: flex-start; flex-direction: column; }

  .echo-carousel-track { gap: 22px; }
  .echo-carousel-track .echo-card { width: min(82vw, 350px); }

  .landing-page .shell { width: calc(100% - 36px); }
  .landing-page .hero { grid-template-columns: 1fr; padding-block: 52px 56px; }
  .landing-page .hero-stores { padding-top: clamp(22px, 5vw, 34px); }
  .landing-page .section-heading { flex-direction: column; align-items: flex-start; gap: 8px; }

  .void-page .void-main { width: calc(100% - 36px); padding-top: 28px; }
  .feed-list { gap: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .landing-page .echo-topbar,
  .landing-page .echo-topbar.echo-topbar--shown { transition: none; }
}
