:root {
  --harbor: #12233b;      /* the board */
  --harbor-2: #1b3150;    /* raised surfaces on the board */
  --paper: #f3f6f4;       /* notes and main text */
  --saffron: #ffc94d;     /* hype notes, live accents */
  --mint: #5fd3a6;        /* healthy */
  --mint-pale: #cdefe0;   /* feedback notes */
  --rose: #ff7a7a;        /* down / rejected */
  --mist: #8fa5bc;        /* secondary text on the board */
  --ink: #15202e;         /* text on notes */

  --font: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', sans-serif;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-hero: clamp(2.6rem, 6.5vw, 6rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--harbor);
  color: var(--paper);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 21rem;
  grid-template-areas:
    "masthead stack"
    "compose  stack"
    "board    stack";
  grid-template-rows: auto auto 1fr;
  gap: 1.5rem 3rem;
  min-height: 100vh;
  padding: 2.5rem 3rem;
}

/* Masthead: the headline is the brand moment, set tight and heavy. */
.masthead { grid-area: masthead; }
.masthead h1 {
  margin: 0;
  font-size: var(--step-hero);
  font-weight: 800;
  font-variation-settings: 'opsz' 96;
  line-height: 0.92;
  letter-spacing: -0.035em;
}
.lede {
  margin: 0.9rem 0 0;
  max-width: 34rem;
  color: var(--mist);
  font-size: var(--step-1);
  line-height: 1.35;
}

/* Compose */
.compose { grid-area: compose; }
#post-form {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  max-width: 56rem;
}
.field { display: grid; gap: 0.35rem; }
.field span { font-size: 0.9rem; color: var(--mist); }
.field input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border: 2px solid transparent;
  border-radius: 0.6rem;
  background: var(--harbor-2);
  color: var(--paper);
  font: inherit;
}
.field input::placeholder { color: #6c829a; }
.field input:focus { outline: none; border-color: var(--saffron); }
button {
  padding: 0.85rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--saffron);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: #ffd673; }
button:disabled { opacity: 0.6; cursor: progress; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.form-status { min-height: 1.45em; margin: 0.6rem 0 0; color: var(--mist); }
.form-status.is-error { color: var(--rose); }

/* Board: notes pinned to a dark harbor, tinted by mood. */
.board { grid-area: board; min-width: 0; }
.notes {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 16rem auto;
  column-gap: 1rem;
}
.note {
  break-inside: avoid;
  margin: 0 0 1rem;
  padding: 1rem 1.1rem 0.85rem;
  border-radius: 0.3rem;
  background: var(--paper);
  color: var(--ink);
  rotate: var(--tilt, 0deg);
}
.note[data-mood="hype"] { background: var(--saffron); }
.note[data-mood="feedback"] { background: var(--mint-pale); }
.note-message {
  margin: 0;
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
}
.note-meta .who { font-weight: 700; opacity: 1; }

/* A queued note is a ghost outline until the worker publishes it. */
.note[data-status="queued"] {
  background: transparent;
  color: var(--paper);
  outline: 2px dashed var(--mist);
  outline-offset: -2px;
  rotate: 0deg;
}
.note[data-status="rejected"] {
  background: transparent;
  color: var(--rose);
  outline: 2px solid var(--rose);
  outline-offset: -2px;
}
.note[data-status="rejected"] .note-message { text-decoration: line-through; opacity: 0.7; }

/* The one orchestrated moment: a note flips from ghost to live. */
.note.just-published { animation: go-live 700ms cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes go-live {
  from { transform: rotateX(80deg) scale(0.9); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

.empty { color: var(--mist); font-size: var(--step-1); }

/* Stack panel: the live map of NEO App services. */
.stack {
  grid-area: stack;
  align-self: start;
  position: sticky;
  top: 2.5rem;
  display: grid;
  gap: 1.5rem;
}
.stack h2 { margin: 0; font-size: var(--step-1); font-weight: 700; }
.pipeline { list-style: none; margin: 0; padding: 0; position: relative; }
.pipeline::before {
  content: '';
  position: absolute;
  left: 0.45rem;
  top: 0.9rem;
  bottom: 0.9rem;
  width: 2px;
  background: var(--harbor-2);
}
.pipeline li, .side-node {
  position: relative;
  display: grid;
  grid-template-columns: 0.9rem 1fr;
  gap: 0.9rem;
  align-items: start;
  padding: 0.55rem 0;
}
.pipeline strong, .side-node strong { display: block; font-weight: 700; }
.detail { display: block; color: var(--mist); font-size: 0.9rem; }
.dot {
  width: 0.9rem;
  height: 0.9rem;
  margin-top: 0.3rem;
  border-radius: 50%;
  background: var(--mist);
  box-shadow: 0 0 0 4px var(--harbor);
}
[data-state="ok"] .dot { background: var(--mint); }
[data-state="down"] .dot { background: var(--rose); }
[data-state="busy"] .dot { background: var(--saffron); }
.side-node {
  padding: 0.75rem 0.9rem;
  margin-left: -0.9rem;
  border-radius: 0.6rem;
  background: var(--harbor-2);
}

.pulse { display: grid; gap: 0.15rem; }
.pulse p { margin: 0; }
.pulse-count { font-size: var(--step-2); font-weight: 700; line-height: 1.1; }
.pulse-rate { color: var(--mist); }
.pulse .pulse-when { margin-top: 0.5rem; color: var(--mist); font-size: 0.85rem; }
.pulse-words { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 0; padding: 0; }
.pulse-words li {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--harbor-2);
  font-size: 0.9rem;
}

.join { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; margin: 0; }
.qr { padding: 0.5rem; border-radius: 0.4rem; background: var(--paper); line-height: 0; }
.qr:empty { display: none; }
.qr img, .qr canvas { width: 7rem; height: 7rem; }
.join figcaption { color: var(--mist); }

/* Projector mode (?screen=wall): no form, bigger QR. */
.is-wall .compose { display: none; }
.is-wall .qr img, .is-wall .qr canvas { width: 10rem; height: 10rem; }

@media (max-width: 1100px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "masthead" "compose" "board" "stack";
    grid-template-rows: auto;
    padding: 2rem 1.5rem;
  }
  .stack { position: static; }
  .join { display: none; }
}

@media (max-width: 640px) {
  .page { padding: 1.5rem 1rem; gap: 1.25rem; }
  #post-form { grid-template-columns: minmax(0, 1fr); }
  button { justify-self: start; }
  .notes { columns: 1; }
  .note-message { font-size: var(--step-1); }
}

@media (prefers-reduced-motion: reduce) {
  .note.just-published { animation: none; }
  .note { rotate: 0deg; }
}
