/* Editorial dark system: charcoal stages, literary serif headings,
   small capsule controls and violet/teal light kept behind objects. */
:root {
  --hero-top: #15101e;
  --canvas: #121212;
  --panel: #1a1a1a;
  --header-base: rgba(34, 34, 34, 0.78);
  --edge: rgba(255, 255, 255, 0.05);
  --edge-strong: rgba(255, 255, 255, 0.1);
  --ghost: rgba(255, 255, 255, 0.05);
  --ghost-hover: rgba(255, 255, 255, 0.1);
  --ghost-active: rgba(255, 255, 255, 0.15);
  --white: #ffffff;
  --black: #000000;
  --heading: #e7e7e7;
  --secondary: #a0a0a0;
  --muted: #898989;
  --danger: #e08a7a;

  --serif: "Signifier", "Newsreader", ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --sans: "Sohne", "Inter", ui-sans-serif, system-ui, Arial, sans-serif;
  --ease: cubic-bezier(.4, 0, .2, 1);

  --r-pill: 9999px;
  --r-panel: 24px;
  --r-small: 16px;

  --shadow-large: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(var(--hero-top), var(--canvas) 900px) var(--canvas);
  color: var(--heading);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 3px; }

/* ---------- Atmosphere ---------- */
.atmosphere {
  position: absolute;
  inset: 0 0 auto 0;
  height: 1100px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}
.glow.teal {
  width: 820px; height: 560px;
  left: -180px; top: 420px;
  background: radial-gradient(closest-side, rgba(45, 170, 170, 0.15), transparent);
}
.glow.violet {
  width: 1100px; height: 620px;
  left: 50%; top: 380px;
  transform: translateX(-45%);
  background: radial-gradient(closest-side, rgba(124, 77, 220, 0.22), transparent);
}
.grain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.06; mix-blend-mode: overlay; }

/* ---------- Fixed navigation ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 64px;
  padding: 0 20px;
  background: var(--header-base);
  backdrop-filter: blur(15.6px);
  -webkit-backdrop-filter: blur(15.6px);
  z-index: 50;
  transition: all .5s var(--ease);
}
.topbar-inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo { font-size: 20px; font-weight: 500; color: var(--white); letter-spacing: -0.01em; }
#nav { display: flex; gap: 4px; }
.nav-item {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--secondary);
  font-size: 16px;
  line-height: 21px;
  font-weight: 430;
  white-space: nowrap;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.nav-item .num { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.nav-item:hover { color: var(--white); }
.nav-item.active { background: var(--ghost-hover); color: var(--white); }
.topbar-end { display: flex; align-items: center; gap: 16px; }
.studio { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* ---------- Actions ---------- */
.btn, .btn-ghost, .btn-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r-pill);
  border: 0;
  font-weight: 430;
  line-height: 1;
  white-space: nowrap;
  transition: opacity .2s var(--ease), background-color .2s var(--ease);
}
.btn { height: 44px; padding: 0 20px; font-size: 18px; background: var(--white); color: var(--black); }
.btn:hover, .btn-compact:hover { opacity: .9; }
.btn:active, .btn-compact:active { opacity: .8; }
.btn-ghost { height: 44px; padding: 0 20px; font-size: 18px; background: var(--ghost); color: var(--white); }
.btn-ghost:hover { background: var(--ghost-hover); }
.btn-ghost:active { background: var(--ghost-active); }
.btn-compact { height: 32px; padding: 0 12px; font-size: 15px; background: var(--white); color: var(--black); }
.arrow { font-size: .9em; }

/* ---------- Page structure ---------- */
.container {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 192px 80px 160px;
}
.step { display: flex; flex-direction: column; align-items: center; }

.intro { max-width: 640px; text-align: center; }
.eyebrow { margin: 0 0 16px; font-size: 16px; color: var(--muted); }
.intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 64px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--heading);
  text-wrap: balance;
}
.lead { margin: 20px auto 0; max-width: 580px; font-size: 22px; line-height: 29px; color: var(--muted); }

.stage { width: 100%; margin-top: 80px; }
.stage.narrow { max-width: 960px; }
.stage.medium { max-width: 1040px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-large);
}

.actions {
  width: 100%;
  margin-top: 40px;
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}
.stage.narrow + .actions { max-width: 960px; }
.stage.medium + .actions { max-width: 1040px; }
.actions.split { justify-content: space-between; }
.actions-end { display: flex; gap: 16px; }

/* ---------- Step 1: form ---------- */
.form { padding: 48px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px 24px; }
.field { display: flex; flex-direction: column; gap: 12px; }
.field.full { grid-column: 1 / -1; }
.field label, .label { font-size: 16px; font-weight: 500; color: var(--heading); }
.input {
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-small);
  background: var(--canvas);
  font-size: 16px;
  color: var(--heading);
  transition: background-color .2s var(--ease);
}
textarea.input { height: 96px; padding: 14px 18px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: #5f5f5f; }
.input:hover { background: #161616; }
.input:focus { outline: none; background: #262626; }

.needs { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--edge); }
.needs .label { display: block; margin-top: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--ghost);
  color: var(--secondary);
  font-size: 16px;
  font-weight: 430;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.chip:hover { background: var(--ghost-hover); color: var(--white); }
.chip.on { background: var(--white); color: var(--black); }

/* ---------- Step 2: directions ---------- */
.directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.direction {
  position: relative;
  padding: 16px 16px 24px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-panel);
  text-align: left;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.direction:hover { border-color: var(--edge-strong); }
.direction.on { border-color: rgba(255, 255, 255, 0.55); }
.direction .preview {
  height: 180px;
  border-radius: var(--r-small);
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px;
}
.direction .square { width: 140px; height: 140px; border-radius: 12px; flex: none; }
.direction .word { flex: 1; text-align: center; font-size: 44px; font-weight: 700; }
.direction .name { margin: 20px 8px 0; font-size: 20px; font-weight: 500; line-height: 1.35; color: var(--heading); }
.direction .tags { margin: 4px 8px 0; font-size: 16px; color: var(--secondary); }
.direction .check {
  position: absolute;
  right: 24px;
  bottom: 32px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--black);
  font-size: 14px;
  line-height: 28px;
}

/* ---------- Step 3: color lab ---------- */
.palette-stage { padding: 24px; }
.palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.swatch {
  height: 400px;
  border-radius: var(--r-small);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 32px;
}
.lock { width: 34px; height: 34px; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.lock span {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: grid;
  place-items: center;
  transition: background-color .2s var(--ease);
}
.lock.on span::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: currentColor; }
.swatch .hex { font-size: 18px; font-weight: 500; letter-spacing: 0.02em; }
.hex-input {
  margin-top: 12px;
  height: 44px;
  width: 100%;
  border: 1px solid var(--edge-strong);
  border-radius: var(--r-pill);
  background: var(--canvas);
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--heading);
}
.hex-input:focus { outline: none; border-color: rgba(255, 255, 255, 0.45); }
.hex-input.invalid { border-color: var(--danger); }
.hint { margin: 24px 0 0; font-size: 16px; color: var(--muted); text-align: center; }

/* ---------- Step 4: typography ---------- */
.preview-field { max-width: 580px; margin: 0 auto 48px; }
.preview-field label { text-align: center; color: var(--secondary); font-weight: 400; }
.preview-field .input { text-align: center; }
.fonts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.font-card { padding: 32px; display: flex; flex-direction: column; }
.font-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.font-card .fname { font-size: 20px; font-weight: 500; }
.font-card .fcat { font-size: 15px; color: var(--muted); }
.font-card .sample {
  margin-top: 28px;
  font-size: 44px;
  line-height: 1.2;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.font-card .glyphs { margin-top: 12px; font-size: 17px; color: var(--secondary); letter-spacing: .04em; }
.font-card .roles { display: flex; gap: 8px; margin-top: 28px; }
.role {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--ghost);
  color: var(--secondary);
  font-size: 15px;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.role:hover { background: var(--ghost-hover); color: var(--white); }
.role.on { background: var(--white); color: var(--black); }

/* ---------- Step 5: brief ---------- */
.brief { padding: 16px 16px 48px; }
.brief .hero {
  min-height: 300px;
  border-radius: var(--r-small);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.brief .hero .brand { font-size: 88px; line-height: 1.1; overflow-wrap: anywhere; }
.brief .hero .tagline { margin-top: 16px; font-size: 15px; font-weight: 500; letter-spacing: .12em; opacity: .85; }
.brief .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; padding: 48px 32px 0; }
.brief .kicker { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.brief .value { margin: 0; font-family: var(--serif); font-size: 32px; line-height: 1.25; letter-spacing: -0.01em; color: var(--heading); }
.brief .secondary-font { margin: 6px 0 0; font-size: 18px; color: var(--secondary); }
.brief .block + .block { margin-top: 40px; }
.brief .swatches { display: flex; gap: 12px; }
.brief .swatches span { width: 56px; height: 56px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--edge); }
.brief .text { margin: 0; font-size: 18px; line-height: 25px; color: var(--secondary); }
.brief .needs-list { display: flex; flex-wrap: wrap; gap: 8px; }
.brief .needs-list span { height: 32px; padding: 0 14px; border-radius: var(--r-pill); background: var(--ghost-hover); font-size: 15px; line-height: 32px; }
.brief .details {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 40px;
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--edge);
}

/* Closing invitation with threshold drawing */
.closing {
  width: 100%;
  max-width: 1200px;
  margin-top: 128px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 64px;
  align-items: center;
}
.closing h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 64px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--heading);
}
.closing p { margin: 20px 0 0; max-width: 520px; font-size: 20px; line-height: 1.35; color: var(--muted); }
.closing .actions { justify-content: flex-start; margin-top: 24px; }
.threshold { width: 100%; height: auto; display: block; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 16px);
  height: 44px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  border-radius: var(--r-pill);
  background: var(--white);
  color: var(--black);
  font-size: 16px;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive (stepped, per the system's breakpoints) ---------- */
@media (max-width: 1280px) {
  .studio { display: none; }
  .nav-item { padding: 0 10px; }
}

@media (max-width: 1024px) {
  .container { padding: 160px 48px 120px; }
  .intro h1, .closing h2 { font-size: 52px; }
  .nav-item .label-text { display: none; }
  .nav-item .num { margin-right: 0; }
  .palette { gap: 8px; }
  .swatch { height: 300px; }
  .swatch .hex { font-size: 14px; }
  .hex-input { font-size: 13px; }
  .closing { grid-template-columns: 1fr; gap: 48px; }
  .threshold { max-width: 360px; }
}

@media (max-width: 768px) {
  .directions, .fonts { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; padding: 32px 24px; }
  .brief .grid, .brief .details { grid-template-columns: 1fr; gap: 40px; padding-left: 16px; padding-right: 16px; }
  .brief .hero .brand { font-size: 56px; }
  .palette { grid-template-columns: 1fr; }
  .swatch { height: 88px; flex-direction: row; padding: 0 20px; }
  .hex-input { margin-top: 6px; }
}

@media (max-width: 640px) {
  .container { padding: 128px 16px 96px; }
  .topbar { padding: 0 16px; }
  .topbar-end { display: none; }
  .intro h1, .closing h2 { font-size: 40px; }
  .lead { font-size: 18px; line-height: 25px; }
  .stage { margin-top: 48px; }
  .actions, .actions-end { flex-direction: column-reverse; }
  .actions .btn, .actions .btn-ghost, .actions-end { width: 100%; }
  .actions > span:empty { display: none; }
  .direction .preview { gap: 16px; height: 140px; }
  .direction .square { width: 88px; height: 88px; }
  .direction .word { font-size: 30px; }
  .font-card { padding: 24px; }
  .font-card .sample { font-size: 34px; }
}

@media (max-width: 480px) {
  .nav-item { padding: 0 8px; font-size: 15px; }
  #nav { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
