/* ==========================================================================
   Nocturne — Converged Labs design system
   Single source of truth for the site's look. Ported from the design canvas
   bundle; tokens keep their original names so canvas exports stay comparable.
   ========================================================================== */

/* --- Inter (variable, 100-900). Two subsets only: latin + latin-ext. ------ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Surfaces */
  --color-bg: #161826;
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-section: #262a60;

  /* Accent ramp */
  --color-accent: #9184d9;
  --color-accent-100: #f5f4ff;
  --color-accent-200: #e7e5fe;
  --color-accent-300: #d2cefd;
  --color-accent-400: #b5abfc;
  --color-accent-500: #968ae0;
  --color-accent-600: #796cbf;
  --color-accent-700: #5d5294;
  --color-accent-800: #423a6a;
  --color-accent-900: #2b2741;

  /* Neutral ramp */
  --color-neutral-100: #f3f5fe;
  --color-neutral-200: #e4e7f5;
  --color-neutral-300: #cfd3e5;
  --color-neutral-400: #b2b6ca;
  --color-neutral-500: #9397ab;
  --color-neutral-600: #75798c;
  --color-neutral-700: #595d6c;
  --color-neutral-800: #3f424d;
  --color-neutral-900: #292b31;

  /* Status — used by the contact form only */
  --color-danger: #ff9b93;
  --color-danger-bg: #2a1215;
  --color-danger-border: #5c2b2e;
  --color-success: #9fe0c0;

  /* Type */
  --font-heading: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Fluid type scale */
  --step-hero: clamp(2.75rem, 1.6rem + 5.75vw, 6.5rem);
  --step-2xl: clamp(2rem, 1.45rem + 2.75vw, 3.875rem);
  --step-xl: clamp(1.875rem, 1.55rem + 1.6vw, 3rem);
  --step-lg: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-md: 1.3125rem;
  --step-body-lg: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-body: 0.9375rem;
  --step-sm: 0.875rem;
  --step-xs: 0.8125rem;
  --step-2xs: 0.6875rem;

  /* Spacing */
  --space-1: 0.175rem;
  --space-2: 0.35rem;
  --space-3: 0.525rem;
  --space-4: 0.7rem;
  --space-6: 1.05rem;
  --space-8: 1.4rem;
  --space-10: 2rem;
  --space-12: 2.75rem;
  --space-16: 4rem;

  /* Shape */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  /* Layout */
  --measure: 1120px;
  --gutter: clamp(1.25rem, 0.65rem + 3vw, 2.5rem);
  --section-y: clamp(3.5rem, 2rem + 7vw, 5.75rem);

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  text-wrap: balance;
}

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

a { color: var(--color-accent-300); text-decoration: none; }
a:hover { color: var(--color-accent-200); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--color-accent-800); color: var(--color-accent-100); }

/* --- Utilities ----------------------------------------------------------- */
.wrap {
  max-width: var(--measure);
  margin-inline: auto;
}

.section { padding: var(--section-y) var(--gutter); }

/* Skip link — visible only once focused. */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 100;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--color-accent-900);
  color: var(--color-accent-100);
  font-size: var(--step-sm);
  transform: translateY(-160%);
  transition: transform 0.18s var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Eyebrow: small uppercase label above a heading. */
.eyebrow {
  margin: 0;
  font-size: var(--step-2xs);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent-300);
}

.lede {
  font-size: var(--step-body-lg);
  line-height: 1.6;
  color: var(--color-neutral-200);
}

.rule {
  display: block;
  width: 26px;
  height: 1px;
  background: var(--color-accent);
  border: 0;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.375rem;
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-sm);
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.btn-primary {
  border-color: var(--color-accent);
  color: var(--color-accent-200);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-900);
  color: var(--color-accent-100);
}
.btn-secondary:hover { border-color: var(--color-neutral-600); color: var(--color-text); }
.btn-sm { padding: 0.5rem 0.95rem; font-size: 0.75rem; }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* --- Header -------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: 0.8rem var(--gutter);
  background: color-mix(in srgb, var(--color-bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: var(--step-sm);
  font-weight: 500;
}
.brand:hover { color: var(--color-text); }

/* The mark bobs gently — the one ambient motion on the page. */
.brand-mark {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--color-accent);
  animation: bob 3.4s ease-in-out infinite;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  font-size: var(--step-xs);
}
.site-nav a { color: var(--color-neutral-300); }
.site-nav a:hover { color: var(--color-text); }
@media (max-width: 33rem) {
  .site-nav .site-nav-link { display: none; }
}

/* --- Hero ---------------------------------------------------------------- */
.hero {
  padding-block: clamp(3.5rem, 1.5rem + 9vw, 5.75rem) clamp(3.25rem, 1.5rem + 8vw, 5.25rem);
  background: radial-gradient(115% 85% at 12% 0%,
    color-mix(in srgb, var(--color-section) 62%, transparent), transparent 60%);
}

.hero-tag {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-10);
  animation: riseIn 0.6s ease both;
}
.hero-tag .rule {
  width: 40px;
  transform-origin: left;
  animation: drawX 0.8s 0.1s var(--ease-out) both;
}

.hero-title {
  max-width: 20ch;
  margin: 0;
  font-size: var(--step-hero);
  line-height: 0.96;
  letter-spacing: -0.045em;
  animation: riseIn 0.7s 0.06s ease both;
}

/* Hero signature: the last word cycles on click. Styled as a word, not a
   control, so it reads as type until you hover it. */
.word-cycler {
  padding: 0 2px;
  border: none;
  border-bottom: 2px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent-300);
  font: inherit;
  font-weight: 300;
  cursor: pointer;
  transition: color 0.2s var(--ease-out);
}
.word-cycler:hover { color: var(--color-accent-200); }

.hero-hint {
  margin: var(--space-8) 0 0;
  font-size: var(--step-xs);
  color: var(--color-neutral-500);
  animation: riseIn 0.7s 0.2s ease both;
}

.hero-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: clamp(1.75rem, 1rem + 3vw, 3.5rem);
  margin-top: var(--space-12);
  align-items: start;
}
.hero-body > p { max-width: 46ch; margin: 0; animation: riseIn 0.7s 0.16s ease both; }

.hero-actions {
  display: grid;
  gap: var(--space-6);
  justify-items: start;
  animation: riseIn 0.7s 0.24s ease both;
}
.hero-actions .actions { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.hero-note { margin: 0; font-size: var(--step-xs); color: var(--color-neutral-400); }

/* --- Stats band ---------------------------------------------------------- */
.stats {
  background-image: radial-gradient(
    color-mix(in srgb, var(--color-accent) 34%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  padding-block: clamp(3rem, 1.5rem + 6vw, 4.75rem);
}
.stats .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: var(--space-10) 3rem;
}
.stat-value {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 1.5rem + 2.6vw, 3.375rem);
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-label {
  margin: 0;
  max-width: 22ch;
  font-size: var(--step-xs);
  line-height: 1.5;
  color: var(--color-neutral-300);
}
.stat .rule { margin: var(--space-6) 0; }

/* --- Section headers ----------------------------------------------------- */
.section-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: clamp(1.75rem, 1rem + 3vw, 3.25rem);
  align-items: end;
  margin-bottom: var(--space-12);
}
.section-title {
  max-width: 20ch;
  margin: var(--space-6) 0 0;
  font-size: var(--step-xl);
  line-height: 1.06;
  letter-spacing: -0.035em;
}
.section-head > p:last-child {
  max-width: 36ch;
  margin: 0;
  font-size: var(--step-body);
  line-height: 1.6;
  color: var(--color-neutral-300);
}

/* --- Work cards ---------------------------------------------------------- */
.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: var(--space-10);
}
.case {
  display: grid;
  grid-template-rows: auto auto 1fr;
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  transition: transform 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}
@media (hover: hover) {
  .case:hover { transform: translateY(-4px); border-color: var(--color-accent-700); }
}
/* Browser chrome: these are shipped products, so the card frames them as one. */
.case-chrome {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--color-neutral-800);
}
.case-dots { display: flex; gap: 4px; }
.case-dots i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-neutral-700);
}
.case-url {
  flex: 1;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--color-neutral-900);
  font-size: var(--step-2xs);
  color: var(--color-neutral-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.case-shot {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  text-align: center;
  background-image: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--color-text) 6%, transparent) 0 1px, transparent 1px 10px);
  font-size: var(--step-2xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-neutral-400);
}
.case-body {
  display: flex;
  flex-direction: column;
  padding: var(--space-8) 1.125rem 1.25rem;
}
.case-meta {
  margin: 0 0 var(--space-3);
  font-size: var(--step-2xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-neutral-400);
}
.case-name {
  margin: 0 0 var(--space-4);
  font-size: var(--step-md);
  letter-spacing: -0.02em;
}
.case-summary {
  margin: 0 0 var(--space-8);
  font-size: var(--step-sm);
  line-height: 1.55;
  color: var(--color-neutral-300);
}
.case-result {
  margin: auto 0 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-neutral-800);
  font-size: var(--step-sm);
  line-height: 1.5;
  color: var(--color-accent-200);
}

/* --- Process ------------------------------------------------------------- */
.process .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr));
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  align-items: start;
}
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: var(--space-8);
  padding: var(--space-10) 0;
  border-top: 1px solid var(--color-neutral-800);
}
/* Numbers are real here: the steps happen in this order, weeks apart. */
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-size: var(--step-xs);
  color: var(--color-accent-300);
  font-variant-numeric: tabular-nums;
}
.step h3 {
  margin: 0 0 var(--space-3);
  font-size: var(--step-lg);
  letter-spacing: -0.015em;
}
.step p {
  margin: 0;
  max-width: 50ch;
  font-size: var(--step-body);
  line-height: 1.6;
  color: var(--color-neutral-300);
}

/* --- Contact ------------------------------------------------------------- */
.contact {
  background: radial-gradient(110% 100% at 90% 100%,
    color-mix(in srgb, var(--color-section) 66%, transparent), transparent 64%);
}
.contact .wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr));
  gap: clamp(2.25rem, 1rem + 4.5vw, 4.25rem);
  align-items: start;
}
.contact-title {
  max-width: 15ch;
  margin: var(--space-6) 0 var(--space-8);
  font-size: var(--step-2xl);
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.contact-details {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-10);
  font-size: var(--step-sm);
}
.contact-details span { color: var(--color-neutral-400); }

/* The caret blinks after "Say hello" — a terminal tic, kept to one instance. */
.caret { animation: blink 1.4s steps(1) infinite; }

/* --- Form ---------------------------------------------------------------- */
.form {
  display: grid;
  gap: var(--space-6);
  padding: clamp(1.25rem, 0.9rem + 1.6vw, 1.625rem);
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
}
.field { display: grid; gap: var(--space-3); }
.field > span {
  font-size: var(--step-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-neutral-300);
}
.input {
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--color-neutral-800);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.5;
  caret-color: var(--color-accent);
}
.input:hover { border-color: var(--color-neutral-600); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { resize: vertical; min-height: 6.5rem; }

.form-note { margin: 0; font-size: var(--step-xs); color: var(--color-neutral-400); }
.form-note[data-state='error'] {
  padding: var(--space-4) var(--space-6);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-md);
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.form-note[data-state='success'] { color: var(--color-success); }

/* Honeypot: off-screen and skipped by keyboard. Bots fill it, people can't. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-10) var(--gutter);
  border-top: 1px solid var(--color-neutral-800);
  font-size: var(--step-xs);
  color: var(--color-neutral-400);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.375rem; }

/* --- Editorial placeholder ----------------------------------------------- */
/* Marks copy that is not yet true. Delete the class with the placeholder. */
.placeholder {
  position: relative;
  border-style: dashed;
  border-color: var(--color-accent-700);
}
.placeholder-tag {
  align-self: start;
  margin: 0 0 var(--space-6);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent-900);
  color: var(--color-accent-200);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* --- Error page ---------------------------------------------------------- */
.centered {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-6);
  padding: var(--section-y) var(--gutter);
  max-width: var(--measure);
  margin-inline: auto;
}
.centered h1 {
  margin: 0;
  font-size: var(--step-2xl);
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.centered p { margin: 0; max-width: 42ch; color: var(--color-neutral-300); }

/* --- Motion -------------------------------------------------------------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes drawX {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0.15; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Scroll reveal. JS adds .is-revealed; without JS the initial state never
   applies, so content is visible by default. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}
.js [data-reveal].is-revealed { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}
