/* Nocturne — dark design system, reconstructed.
 *
 * brief.md § 5 specifies this system and names its tokens, but the real
 * Nocturne stylesheet is not in the repo (discovery.md Q2). Values the brief
 * states are used exactly; everything else is derived and marked DERIVED
 * below, with the reasoning in current/design-decisions.md.
 *
 * This file is the design system only. Page layout lives in page.css, so
 * dropping in the real Nocturne stylesheet is a replacement of this file. */

:root {
  /* Ground and surfaces */
  --color-bg: #181828;              /* was #161826 — see decisions.md */
  --color-surface: #202135;         /* DERIVED: bg hue at 16% lightness */
  --color-divider: #2c2d41;         /* DERIVED: bg hue at 21% lightness */

  /* Text */
  --color-text: #e9e9ed;            /* stated */

  /* Channel triplets for the same three colours, so translucent values stay
   * token-driven without color-mix(). color-mix() is a young function and one
   * of only two rare features this page used; both were removed while chasing
   * tile artefacts that appeared on this page and no other. rgb()/alpha is
   * the boring, universally-supported equivalent. */
  --rgb-bg: 24 24 40;
  --rgb-surface: 32 33 53;
  --rgb-text: 233 233 237;
  --rgb-accent: 145 132 217;
  --color-text-muted: rgb(var(--rgb-text) / 0.72);
  --color-text-subtle: rgb(var(--rgb-text) / 0.58);

  /* Accent — one hue. DERIVED ramp: #9184d9 is hsl(249 53% 68%); every stop
   * holds that hue and moves lightness, so the ramp is one violet. */
  --color-accent-100: #e2def7;
  --color-accent-200: #cac3ef;
  --color-accent-300: #b1a8e6;
  --color-accent-400: #a095df;
  --color-accent-500: #9184d9;      /* stated */
  --color-accent-600: #7768ca;
  --color-accent-700: #5c4bb9;
  --color-accent-800: #483b91;
  --color-accent-900: #372e6b;
  --color-accent: var(--color-accent-500);

  /* Type — Inter, stated. Weight capped at 500 for headings. */
  --font-heading: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-display: clamp(40px, 6.6vw, 68px);
  --fs-h2: clamp(25px, 4.4vw, 40px);
  --fs-h3: 22px;
  --fs-h4: 19px;
  --fs-lead: clamp(16.5px, 2vw, 19px);
  --fs-body: 16px;
  --fs-sm: 14.5px;
  --fs-xs: 13px;
  --fs-2xs: 12px;

  /* Spacing — 4px base */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 26px;
  --space-7: 32px;
  --space-8: 44px;
  --space-9: 56px;
  --space-10: 88px;
  --space-11: 96px;

  /* Layout */
  --container: 1120px;
  --gutter: clamp(20px, 4vw, 32px);   /* 32px desktop, 20px mobile — stated */
  --section-rhythm: clamp(56px, 8vw, 96px);

  /* Radius — DERIVED; only --radius-lg is referenced by the brief */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Elevation — DERIVED. On a near-black ground a cast shadow barely reads,
   * so each level pairs a hairline with a shadow. */
  --elev-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --elev-md: 0 16px 40px -16px rgb(0 0 0 / 0.65);

  --transition: 150ms ease;
}

/* Base ------------------------------------------------------------------ */

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

html {
  scroll-behavior: smooth;
  /* Anchors must not land under the sticky header */
  scroll-padding-top: 104px;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 500; /* stated: never heavier */
  margin: 0;
}

h1 {
  font-size: var(--fs-display);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -0.025em;
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h4 {
  font-size: var(--fs-h4);
  line-height: 1.25;
}

p {
  margin: 0;
}

/* Author display rules outrank the UA [hidden] rule, so state it here once —
 * the form and its success state both rely on it. */
[hidden] {
  display: none !important;
}

/* Focus — stated, and set once so no component can forget it */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-subtle {
  color: var(--color-text-subtle);
}

/* Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 16px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  font-family: var(--font-heading);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), transform var(--transition);
}

/* Primary is an accent outline on transparent, never filled — stated. */
.btn-primary {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-primary:hover {
  border-color: var(--color-accent-400);
  background: rgb(var(--rgb-accent) / 0.12);
  color: var(--color-accent-300);
}

.btn-primary:active {
  background: rgb(var(--rgb-accent) / 0.18);
  transform: translateY(1px);
}

.btn-secondary {
  border-color: var(--color-divider);
  color: var(--color-text);
}

.btn-secondary:hover {
  border-color: rgb(var(--rgb-text) / 0.28);
  background: rgb(var(--rgb-text) / 0.05);
}

.btn-secondary:active {
  background: rgb(var(--rgb-text) / 0.09);
  transform: translateY(1px);
}

.btn-lg {
  padding: 11px 20px;
  min-height: 44px;
  font-size: 15px;
}

/* Cards ----------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.elev-sm {
  box-shadow: var(--elev-sm);
}

.elev-md {
  box-shadow: var(--elev-md);
}

/* Tags — one shape, three registers of emphasis. All three stated. */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-size: var(--fs-2xs);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tag-outline {
  border-color: rgb(var(--rgb-accent) / 0.55);
  color: var(--color-accent-300);
}

.tag-neutral {
  border-color: var(--color-divider);
  color: var(--color-text-muted);
}

.tag-accent {
  /* Opaque, not accent at 12%: over a card that composited to rgb(46,45,73),
     whose red sits a third of a step off a 6-bit level. These tags only ever
     sit on a card, so the flattened value is exact — and snapped. */
  background: #2c2d49;
  color: var(--color-accent-300);
}

/* Fields ---------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label {
  font-family: var(--font-heading);
  font-size: var(--fs-2xs);
  font-weight: 500;
  color: var(--color-text-subtle);
}

.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  background: #1c1c2d; /* 0.55x bg + 0.45x surface, snapped off the bad values */
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  line-height: 1.5;
  transition: border-color var(--transition), background-color var(--transition);
}

.input::placeholder {
  color: rgb(var(--rgb-text) / 0.45);
}

.input:hover {
  border-color: rgb(var(--rgb-text) / 0.2);
}

.input:focus-visible {
  border-color: var(--color-accent);
}

textarea.input {
  min-height: 96px;
  resize: vertical;
}

/* Motion --------------------------------------------------------------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
