/*
 * MCP — visual system per NOIR's STYLEGUIDE.md.
 *
 * Tokens, type stacks, easing, layering, atmosphere, and the button, field and
 * panel vocabulary (§13) are the apps' own, unchanged. --signal is not spent:
 * the page has one thing to take away, the endpoint, and nothing hides it.
 */

:root {
  color-scheme: dark;

  /* --- guide tokens, verbatim --- */
  --bg: #000000;
  --fg: #ffffff;
  --fg-dim: rgba(255, 255, 255, 0.58);
  --fg-faint: rgba(255, 255, 255, 0.14);
  --fg-body: rgba(255, 255, 255, 0.72);
  --fg-punct: rgba(255, 255, 255, 0.38);

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

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --mx: 50%;
  --my: 26%;

  --rule: 1px solid var(--fg-faint);
  --pad: clamp(1rem, 3vw, 1.8rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------------------------------------------------------- atmosphere -- */

.glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    58vmax 58vmax at var(--mx) var(--my),
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02) 34%,
    transparent 68%
  );
  opacity: 0;
  animation: rise-in 2.4s var(--ease) 0.1s forwards;
}

.grain {
  position: fixed;
  inset: -150%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 700ms steps(1) infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(135% 100% at 50% 34%, transparent 54%, rgba(0, 0, 0, 0.66) 100%);
}

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

@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-6%, 3%); }
  40%  { transform: translate(4%, -5%); }
  60%  { transform: translate(-3%, -2%); }
  80%  { transform: translate(5%, 4%); }
  100% { transform: translate(0, 0); }
}

/* --------------------------------------------------------------- header -- */

.bar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: calc(var(--pad) * 0.8) var(--pad);
  border-bottom: var(--rule);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.14em;
  line-height: 1;
  text-decoration: none;
}

.brand__name {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.9vw, 1.42rem);
  font-weight: 900;
  letter-spacing: 0.17em;
  margin-right: -0.17em;
  color: var(--fg);
}

.brand__by {
  font-family: var(--font-mono);
  font-size: clamp(0.56rem, 0.85vw, 0.68rem);
  letter-spacing: 0.19em;
  margin-right: -0.19em;
  color: var(--fg-dim);
}

.brand:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

.privacy {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0 0 0 auto;
  padding: 0.4em 0.75em;
  border: var(--rule);
  font-size: clamp(0.56rem, 0.8vw, 0.66rem);
  letter-spacing: 0.2em;
  color: var(--fg-dim);
  white-space: nowrap;
}

.privacy__label { margin-right: -0.2em; }

.privacy__dot {
  width: 5px;
  height: 5px;
  background: var(--fg);
  border-radius: 50%;
  flex: 0 0 auto;
}

/* -------------------------------------------------------------- controls -- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.6em 0.95em;
  border: var(--rule);
  background: transparent;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 0.82vw, 0.68rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn:hover, .btn:focus-visible { color: var(--fg); border-color: var(--fg-dim); outline: none; }
.btn:focus-visible { border-color: var(--fg); }
.btn--ghost { border-color: transparent; }
.btn--ghost:hover, .btn--ghost:focus-visible { border-color: var(--fg-faint); }

.field {
  width: 100%;
  min-width: 0;
  padding: 0.7em 0.85em;
  border: var(--rule);
  background: transparent;
  color: var(--fg-body);
  font-family: var(--font-mono);
  font-size: clamp(0.66rem, 0.95vw, 0.78rem);
  letter-spacing: 0.04em;
}

.field:focus-visible { outline: none; border-color: var(--fg); color: var(--fg); }

/* The endpoint is the one thing to take away: full white, a size up. */
.field--strong {
  color: var(--fg);
  font-size: clamp(0.78rem, 1.3vw, 0.95rem);
  letter-spacing: 0.06em;
}

.copyrow { display: flex; gap: 0.4rem; align-items: stretch; }

/* ----------------------------------------------------------------- sheet -- */

.sheet {
  position: relative;
  z-index: 4;
  flex: 1;
  width: 100%;
  max-width: 58rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 4rem) var(--pad) clamp(3rem, 8vh, 5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(2.2rem, 5vh, 3.4rem);
}

/* Section heads: §13's panel-header type. */
.label {
  display: block;
  margin: 0 0 0.9rem;
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.95vw, 0.74rem);
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--fg);
}

/* ----------------------------------------------------------------- intro -- */

.intro { animation: rise-in 0.8s var(--ease) 0.15s both; }

.intro .label { color: var(--fg-dim); }

.intro__lede {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-wrap: balance;
}

.intro__text {
  max-width: 46ch;
  margin: 0;
  font-size: clamp(0.72rem, 1.05vw, 0.82rem);
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--fg-body);
}

/* ------------------------------------------------------------------ block -- */

.block {
  padding-top: 1.4rem;
  border-top: var(--rule);
  animation: rise-in 0.8s var(--ease) 0.3s both;
}

.steps { margin: 0; display: flex; flex-direction: column; gap: 1.1rem; }

.steps__row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1.2rem;
  align-items: baseline;
}

.steps dt {
  font-size: clamp(0.68rem, 0.9vw, 0.72rem);
  letter-spacing: 0.18em;
  color: var(--fg-dim);
}

.steps dd {
  margin: 0;
  font-size: clamp(0.72rem, 1.05vw, 0.8rem);
  line-height: 1.8;
  letter-spacing: 0.04em;
  color: var(--fg-body);
}

/* The apps' tools: two by two, one column on a phone. */
.apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.6rem 2.4rem;
}

.apps__name {
  margin: 0 0 0.7rem;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.3vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.17em;
}

.apps__name a { color: var(--fg); text-decoration: none; }
.apps__name a:hover, .apps__name a:focus-visible { text-decoration: underline; text-underline-offset: 0.3em; outline: none; }

.apps__tools {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.apps__tools li {
  font-size: clamp(0.68rem, 0.95vw, 0.76rem);
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: var(--fg-body);
}

.apps__tools code {
  display: block;
  font-family: var(--font-mono);
  font-size: 1em;
  color: var(--fg);
  letter-spacing: 0.02em;
}

.note,
.prose {
  margin: 1.4rem 0 0;
  max-width: 64ch;
  font-size: clamp(0.72rem, 1.05vw, 0.8rem);
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--fg-body);
}

.block > .prose:first-of-type { margin-top: 0; }

.note, .prose--dim { color: var(--fg-dim); }

.prose a {
  color: var(--fg);
  text-decoration: underline 1px var(--fg-dim);
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.45s var(--ease);
}

.prose a:hover, .prose a:focus-visible { text-decoration-color: var(--fg); outline: none; }

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

.foot {
  position: relative;
  z-index: 4;
  padding: var(--pad);
  border-top: var(--rule);
  text-align: center;
}

.foot p {
  margin: 0 0 0.6rem;
  font-size: clamp(0.55rem, 0.8vw, 0.64rem);
  letter-spacing: 0.14em;
  line-height: 1.9;
  color: var(--fg-punct);
}

/* ----------------------------------------------------------------- toast -- */

.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 0.6em 1.1em;
  border: 1px solid var(--fg-dim);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  animation: rise-in 0.3s var(--ease) both;
}

/* ------------------------------------------------------------- utilities -- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  padding: 0.6em 1em;
  background: var(--bg);
  border: 1px solid var(--fg);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
}

.skip-link:focus { left: 0.5rem; top: 0.5rem; }

[hidden] { display: none !important; }

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 42rem) {
  .apps { grid-template-columns: minmax(0, 1fr); }
  .steps__row { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
}

@media (max-width: 30rem) {
  .copyrow { flex-wrap: wrap; }
  .copyrow .field { flex-basis: 100%; }
}

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

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

  .glow, .intro, .block, .toast {
    animation-duration: 0.01ms;
    animation-delay: 0s;
  }

  * { transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------- site nav -- */

/*
 * The same map of noirapps.io that closes every page of the site — apps, site,
 * legal, contact — so every page reaches every other. Groups wrap as units.
 * Links are root-relative because the app lives one directory down.
 * STYLEGUIDE §6, "Footer".
 */
.sitenav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem clamp(1.6rem, 3vw, 2.6rem);
}

.sitenav__group {
  display: flex;
  gap: clamp(0.9rem, 1.6vw, 1.3rem);
}

.sitenav a {
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.9vw, 0.72rem);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-decoration: none;
  text-underline-offset: 0.45em;
  transition: color 0.45s var(--ease);
}

.sitenav a:hover,
.sitenav a:focus-visible {
  color: var(--fg);
  text-decoration: underline;
  outline: none;
}

.sitenav a[aria-current="page"] { color: var(--fg); }

/* An address is data, not a label: barely tracked. */
.sitenav .sitenav__mail { letter-spacing: 0.06em; }

.foot .sitenav { margin-top: 1rem; }
