/* ==========================================================================
   NEVARAVERSE.COM
   Age of Almost — v0.1
   Tokens follow nevaraverse-design-spec.md exactly. Do not introduce values
   that aren't declared here.
   ========================================================================== */

:root {
  /* spacing — 8pt. --space-1 is optical only, never layout */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;
  --space-9: 128px;
  --space-10: 192px;

  --inset: 72px;              /* artifact inset */

  /* surfaces */
  --surface-room: #E9E9E7;
  --surface-direct: #EDE9E4;
  --surface-inverse: #0D0D0F;
  --surface-window: #FAFAF8;  /* flat light beyond the glass. not pure white. */

  /* ink */
  --ink-strong: #0D0D0F;
  --ink: #3A3A3E;
  --ink-muted: #66686C;
  --ink-inverse: #E9E9E7;

  /* line */
  --hairline: #B8BDC0;
  --hairline-soft: #D7DADB;

  /* the only accent. one object per view. */
  --signal: #C1121F;

  /* motion */
  --dur-state: 120ms;
  --dur-element: 240ms;
  --dur-page: 400ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --container: 1120px;
  --gutter: var(--space-4);
}

@media (min-width: 768px)  { :root { --gutter: var(--space-6); } }
@media (min-width: 1080px) { :root { --gutter: var(--space-7); } }

/* --------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--surface-room);
  background-image: url("/assets/seam.png");
  background-repeat: repeat;
  background-size: 512px 512px;
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 28px;
  font-weight: 400;
  font-synthesis-weight: none;
}

img, svg, video { display: block; max-width: 100%; }

/* radius is 0 everywhere. the only circle on the site is the signal dot. */
button, input, textarea, select, img, video { border-radius: 0; }

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: color var(--dur-state) var(--ease),
              border-color var(--dur-state) var(--ease);
}
a:hover { color: var(--ink-strong); border-bottom-color: var(--ink-strong); }

/* hover never moves anything. colour and opacity only. */

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface-room);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--hairline);
}
.skip:focus { left: var(--space-3); top: var(--space-3); z-index: 10; }

/* --------------------------------------------------------------- type */

.wordmark {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  font-stretch: 125%;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ink-strong);
  border-bottom: 0;
  margin: 0;
}

.system {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 16px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: lowercase;
}

.artifact {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 24px;
  line-height: 32px;
  font-weight: 300;
  color: var(--ink);
  text-transform: lowercase;
  margin: 0;
}

@media (min-width: 768px) {
  .wordmark  { font-size: 24px; line-height: 32px; }
  .artifact  { font-size: 36px; line-height: 44px; }
}

.small {
  font-size: 14px;
  line-height: 20px;
}

/* --------------------------------------------------------------- room */

.room {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: var(--gutter);
  gap: var(--space-6);
}

@media (min-width: 768px) {
  .room { padding: var(--inset); gap: var(--space-7); }
}

.room__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

@media (max-width: 559px) {
  .room__head { flex-direction: column; align-items: flex-start; }
}

.stream-state {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* the signal dot — the only circle, and the only looping animation */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  flex: none;
  animation: idle 2s linear infinite;
}

@keyframes idle {
  0%, 45%  { opacity: 1; }
  55%, 100% { opacity: 0.35; }
}

.room__body {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* the window: one, blank. flat white, nothing beyond it. */
.window {
  position: relative;
  width: 168px;
  height: 224px;
  background: var(--surface-window);
  border: 1px solid var(--hairline);
}

/* the reveal. flat, no shadow, no gradient — the room has no light source. */
.window::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  left: 8px;
  border: 1px solid var(--hairline-soft);
}

@media (min-width: 768px) {
  .window::after { top: 16px; right: 16px; bottom: 16px; left: 16px; }
}

@media (min-width: 768px) {
  .window { width: 264px; height: 352px; }
}

/* --------------------------------------------------------------- connect */

.connect {
  display: grid;
  gap: var(--space-4);
  max-width: 420px;
  width: 100%;
}

.connect__count {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 24px;
  line-height: 32px;
  font-weight: 300;
  color: var(--ink-strong);
  text-transform: lowercase;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .connect__count { font-size: 36px; line-height: 44px; }
}

.connect__form {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
  flex-wrap: wrap;
}

.connect__input {
  flex: 1 1 220px;
  min-width: 0;
  font-family: inherit;
  font-size: 16px;          /* 16px minimum prevents iOS zoom-on-focus */
  line-height: 28px;
  color: var(--ink-strong);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--dur-state) var(--ease);
}
.connect__input::placeholder { color: var(--ink-muted); }
.connect__input:hover { border-color: var(--ink-muted); }

.connect__button {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 16px;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-strong);
  background: transparent;
  border: 1px solid var(--ink-strong);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  flex: none;
  transition: color var(--dur-state) var(--ease),
              background-color var(--dur-state) var(--ease);
}
.connect__button:hover:not(:disabled) {
  background: var(--ink-strong);
  color: var(--ink-inverse);
}
.connect__button:disabled { color: var(--ink-muted); border-color: var(--hairline); cursor: default; }

.connect__resolved {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 24px;
  line-height: 32px;
  font-weight: 300;
  color: var(--ink-strong);
  text-transform: lowercase;
  margin: 0;
}

.connect__note {
  color: var(--ink-muted);
  margin: 0;
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------- foot */

.room__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  color: var(--ink-muted);
  border-top: 1px solid var(--hairline);
  padding-top: var(--space-4);
}

.room__foot nav {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.room__foot nav a + a { margin-left: var(--space-4); }
@supports (gap: 1px) { .room__foot nav a + a { margin-left: 0; } }

/* --------------------------------------------------------------- direct */
/* 404 and the 3am route when it is not 3am. warmer surface, no ui, no glitch. */

.direct {
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--surface-direct);
  display: grid;
  align-content: center;
  padding: var(--gutter);
  gap: var(--space-7);
}

@media (min-width: 768px) {
  .direct { padding: var(--inset); }
}

.direct__text {
  font-size: 20px;
  line-height: 32px;
  color: var(--ink);
  max-width: 34ch;
  margin: 0;
}

@media (min-width: 768px) {
  .direct__text { font-size: 24px; line-height: 36px; }
}

.direct__back {
  font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 16px;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-muted);
  border-bottom-color: transparent;
  justify-self: start;
}
.direct__back:hover { color: var(--ink-strong); border-bottom-color: var(--ink-strong); }

/* --------------------------------------------------------------- page */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-8) var(--gutter);
}

.page h1 {
  font-size: 32px;
  line-height: 40px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-strong);
  margin: 0 0 var(--space-6);
}

.page h2 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  color: var(--ink-strong);
  margin: var(--space-6) 0 var(--space-3);
}

.page p { margin: 0 0 var(--space-3); }

.page__foot {
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
  color: var(--ink-muted);
}

/* --------------------------------------------------------------- audio */

.tone {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  width: var(--space-4);
  height: var(--space-4);
  border: 1px solid var(--hairline);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background-color var(--dur-state) var(--ease),
              border-color var(--dur-state) var(--ease);
}
.tone:hover { border-color: var(--ink-muted); }
.tone[aria-pressed="true"] { background: var(--ink-strong); border-color: var(--ink-strong); }

/* --------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .dot { opacity: 1; }
}
