/* ==========================================================================
   NOCTURNE — monochrome dark design system
   Plain CSS, no build step. Two page types: home (roster) and profile (clip + text).
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #000000;
  --surface: #0b0b0b;
  --surface-2: #101010;

  --line: #1c1c1c;
  --line-strong: #2b2b2b;

  --text: #e6e6e6;
  --muted: #8d8d8d;
  --faint: #5c5c5c;
  --white: #ffffff;

  --focus: #cfcfcf;

  --font: "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 6px;

  --maxw: 1080px;
  --pad: clamp(1rem, 0.6rem + 1.6vw, 2rem);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2 { margin: 0; font-weight: 500; letter-spacing: 0.01em; }

a { color: var(--text); }

:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hidden, [hidden] { display: none !important; }

.small { font-size: 0.82rem; }
.faint { color: var(--faint); }
.muted { color: var(--muted); }

/* --------------------------------------------------------------------------
   Falling dots — fixed behind the content (js/snow.js fills it in). The pages
   that hold content are lifted one level so the dots can never sit over text.
   -------------------------------------------------------------------------- */
.snow {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}

.home-inner,
.profile {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Home — art on top, a straight column of names under it, nothing else.
   -------------------------------------------------------------------------- */

/* the whole block — art above, names below — sits on the right of the screen
   with the left of the page left empty */
.page-home {
  position: relative;
  min-height: 100dvh;
  display: grid;
  align-items: center;
  justify-items: end;
}

.home-inner {
  padding: clamp(2rem, 6vh, 4.5rem) clamp(1rem, 4vw, 3.5rem) clamp(2rem, 6vh, 4.5rem) 1rem;
  text-align: right;
}

/* cap the figure by height so it shrinks on short viewports instead of pushing
   the names off-screen, and keep it flush with the names' right edge */
.art {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 clamp(0.5rem, 2vh, 1.5rem);
}

/* The source is a square whose figure only fills the middle ~42% of the width,
   and its background is an opaque near-black rather than transparent. Showing it
   through a narrow frame crops those empty sides, so the figure — not a slightly
   lighter rectangle — is what you see. Sides are square, so height drives width. */
.art-frame {
  position: relative;
  overflow: hidden;
  width: calc(min(40vh, 320px) * 0.42);
  height: min(40vh, 320px);
}

.art-frame img {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: auto;
  transform: translateX(-50%);
  /* the source's background is #040404, not #000000: a touch of contrast pulls it
     down to true black so no rectangle shows against the page */
  filter: contrast(1.08);
}

/* children are full width, so the names line up with `.home-inner`'s text-align
   rather than with an alignment here — that keeps the list reusable on the
   "not on the roster" page, which reads left to right */
.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
}

.roster li { width: 100%; }

.roster a {
  display: block;
  padding: 0.1em 0.6em;
  font-size: clamp(1.15rem, 0.95rem + 0.9vw, 1.6rem);
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 160ms ease, letter-spacing 220ms ease, text-shadow 220ms ease, transform 220ms ease;
}

.roster a:hover,
.roster a:focus-visible {
  color: var(--white);
  letter-spacing: 0.06em;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.35);
  transform: scale(1.02);
}

.home-hint {
  margin: 1.6rem 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: var(--faint);
}

/* names arrive one after another, like the reference */
.roster li {
  opacity: 0;
  animation: name-in 700ms ease forwards;
  animation-delay: calc(var(--i, 0) * 90ms + 120ms);
}

@keyframes name-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Profile
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.7rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.back {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--white); }

.site-name {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--faint);
}

.profile {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.5rem, 1rem + 3vw, 3rem) var(--pad) 4rem;
}

.profile-head { margin-bottom: 1.3rem; }

.profile-head h1 {
  font-size: clamp(1.8rem, 1.3rem + 2.2vw, 2.8rem);
  line-height: 1.1;
}

.meta {
  margin: 0.4rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.layout {
  display: grid;
  gap: clamp(1.2rem, 3vw, 2rem);
  align-items: start;
}

@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}

/* --- video stage --- */

.stage-wrap { min-width: 0; }

.player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #050505;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stage-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: clamp(180px, 34vw, 300px);
  padding: 1.5rem;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.035), transparent 60%),
    var(--surface);
}

.stage-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 0.9rem;
  margin-top: 0.6rem;
}

/* highlight while a file is dragged over the stage */
.stage-wrap.dragging .player,
.stage-wrap.dragging .stage-empty {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.clipbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.7rem;
  min-height: 2rem;
}

.clips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.22rem 0.7rem;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.chip:hover { color: var(--white); border-color: var(--line-strong); }

.chip[aria-current="true"] {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.clipbar-actions { display: flex; gap: 0.4rem; margin-left: auto; }

.status { margin: 0.6rem 0 0; font-family: var(--mono); line-height: 1.5; }

/* --- buttons --- */

.btn {
  font: inherit;
  font-size: 0.85rem;
  color: var(--bg);
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.btn:hover { background: var(--white); border-color: var(--white); }

.btn.secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--line-strong);
}

.btn.secondary:hover { border-color: var(--text); background: var(--surface); }

.btn.small { font-size: 0.78rem; padding: 0.3rem 0.7rem; }

/* --- text panel --- */

.text-wrap {
  min-width: 0;
  padding: clamp(1rem, 0.6rem + 1.4vw, 1.6rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-title {
  margin: 0 0 0.8rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--faint);
}

/* the panel heading and the owner's "edit text" button share a line */
.text-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.text-head .panel-title { margin-bottom: 0.8rem; }

/* --- the owner's own text ------------------------------------------------ */

.note-editor { margin-top: 1.1rem; }

.note-input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  resize: vertical;
  min-height: 8rem;
}

.note-input:focus-visible { outline: 1px solid var(--focus); outline-offset: 2px; }

.note-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.note-foot .small { font-family: var(--mono); }

.note-actions { display: flex; gap: 0.4rem; }

.note-editor .form-error { margin: 0.8rem 0 0; }

.bio {
  /* the text is shown exactly as written, including line breaks */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #dcdcdc;
  font-size: 0.98rem;
  max-width: 62ch;
}

/* --- not on the roster --- */

.missing { max-width: 40ch; }
.missing h1 { font-size: 1.6rem; margin-bottom: 0.6rem; }
.roster-static { margin-top: 1.4rem; }
.roster-static a { font-size: 1.2rem; }

/* --------------------------------------------------------------------------
   Accounts — the corner bar, and the two form pages (signup.html, login.html)
   -------------------------------------------------------------------------- */

.account-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.account-nav .who { color: var(--muted); }

.account-nav a,
.linklike {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  color: var(--faint);
  text-decoration: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}

.account-nav a:hover,
.account-nav a:focus-visible,
.linklike:hover,
.linklike:focus-visible {
  color: var(--white);
  border-bottom-color: var(--line-strong);
}

/* The home page has no topbar to slot into. Its account links share the last
   line of the column instead of sitting fixed in a corner, where on a short
   screen they would end up over the art. Sharing the line keeps the column the
   same height it was, so nothing that fitted the window before now scrolls. */
.home-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1.2rem;
  margin-top: 1.6rem;
}

.home-foot .home-hint { margin: 0; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-auth { position: relative; min-height: 100dvh; }

.auth {
  position: relative;
  z-index: 1;
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: clamp(2rem, 7vh, 4.5rem) var(--pad) 4rem;
}

.auth-title {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  margin-bottom: 0.55rem;
}

.auth-lede { margin: 0 0 1.6rem; max-width: 46ch; }

.auth-note { margin: 0 0 1.4rem; }
.auth-note a { color: var(--muted); }

.field { display: block; margin-bottom: 1.1rem; }

.field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--faint);
}

.field input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

.field input:focus-visible { outline: 1px solid var(--focus); outline-offset: 2px; }

/* a failed sign-in is a fact, not an alarm: a white rule, no colour */
.form-error {
  margin: 0 0 0.9rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--white);
  color: var(--text);
  font-size: 0.88rem;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.2rem;
  margin-top: 1.3rem;
}

.auth-alt {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.auth-alt:hover,
.auth-alt:focus-visible { color: var(--white); border-bottom-color: var(--text); }

.auth .status { min-height: 1.2em; }

.btn[disabled] { opacity: 0.5; cursor: default; }

/* --------------------------------------------------------------------------
   Admin — the founder panel (admin.html)
   -------------------------------------------------------------------------- */

.page-admin { position: relative; min-height: 100dvh; }

.admin {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.5rem, 1rem + 3vw, 3rem) var(--pad) 4rem;
}

.admin-title {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem);
  margin-bottom: 1.1rem;
}

.gate {
  max-width: 46ch;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gate p { margin: 0 0 0.5rem; }
.gate p:last-child { margin-bottom: 0; }

/* the standing reminder that this edits one browser and nothing else */
.notice {
  max-width: 64ch;
  margin: 0 0 1.6rem;
  padding-left: 0.8rem;
  border-left: 2px solid var(--line-strong);
}

.admin-list {
  list-style: none;
  margin: 0 0 1.8rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.admin-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.7rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.admin-row .handle { font-size: 1rem; }

.admin-row .when {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
}

.tag {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
}

.tag.founder { color: var(--bg); background: var(--text); border-color: var(--text); }

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

@media (prefers-reduced-motion: reduce) {
  .roster li { animation: none; opacity: 1; }
  .roster a, .btn, .chip,
  .account-nav a, .linklike, .auth-alt { transition: none; }
  .roster a:hover, .roster a:focus-visible { transform: none; }
}
