/* ============================================================
   CIPHER & SKULL — monochrome film-reel detective agency
   Palette: pure monochrome, zero hue. "Signal" = black/white inversion.
   Type:   Jost (display + body) · Space Mono (data, labels, decoder)
   ============================================================ */

:root {
  --ink:      #000000;   /* true black — the card */
  --bone:     #ffffff;   /* white — text & perforations */
  --smoke:    #111111;   /* raised panels */
  --graphite: #242424;   /* hairlines, borders */
  --iron:     #3a3a3a;   /* stronger borders / hover */
  --ash:      #aaaaaa;   /* secondary text */
  --fog:      #c9c9c9;   /* body text (softer than pure white) */

  --rail-w: 76px;

  --font-display: "Jost", "Century Gothic", "Futura", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1180px;
  --pad-x: clamp(1.5rem, 6vw, 5rem);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--fog);
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--bone); color: var(--ink); }

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

/* ============================================================
   FILM-STRIP RAILS — the card's edge dots, made structural
   ============================================================ */
.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--rail-w);
  z-index: 4;
  pointer-events: none;
}
.rail--left  { left: 0; border-right: 1px solid var(--graphite); }
.rail--right { right: 0; border-left: 1px solid var(--graphite); }

.rail__perfs {
  position: absolute;
  inset: 0;
  /* a perforation every 72px, tiled vertically; offset by JS for reel drift */
  background-image: radial-gradient(circle at center,
      rgba(255,255,255,0.55) 0 7px, transparent 8px);
  background-size: 100% 72px;
  background-repeat: repeat-y;
  background-position: center 0;
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1.5rem, 6vw, 5rem);
  background: linear-gradient(to bottom, rgba(0,0,0,0.92), rgba(0,0,0,0));
  transition: border-color 0.4s var(--ease), background 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: rgba(0,0,0,0.9);
  border-bottom-color: var(--graphite);
  backdrop-filter: blur(6px);
}

.nav__brand { display: flex; align-items: center; gap: 0.7rem; }
.nav__brandtext {
  font-size: 0.95rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--bone);
  font-weight: 400;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.3rem);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.nav__links a { color: var(--ash); transition: color 0.25s var(--ease); }
.nav__links a:hover { color: var(--bone); }
.nav__cta {
  color: var(--bone) !important;
  border: 1px solid var(--iron);
  padding: 0.5rem 0.9rem;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav__cta:hover { background: var(--bone); color: var(--ink) !important; }

/* ============================================================
   MONOGRAM (small, reused in nav + footer)
   ============================================================ */
.monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  color: var(--bone);
  border: 1px solid var(--bone);
}
.monogram--sm {
  width: 2.1rem;
  height: 2.1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ============================================================
   LAYOUT — sections as "frames"
   ============================================================ */
main { display: block; }

.section {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(4.5rem, 11vw, 9rem) var(--pad-x);
  border-top: 1px solid var(--graphite);
}

.section__head { max-width: 46rem; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.section__title {
  font-size: clamp(2rem, 6vw, 3.6rem);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: var(--bone);
}
.section__lead {
  margin-top: 1.1rem;
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ash);
  font-weight: 300;
}
.section__lead strong { color: var(--bone); font-weight: 500; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ash);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--iron);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 7rem var(--pad-x) 4rem;
  position: relative;
}
.hero__inner { display: grid; justify-items: center; }

.hero__code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--ash);
  margin-bottom: 1.6rem;
}

/* Title decrypts from its A1Z26 cipher on load; the "&" is a skull. */
.hero__title {
  font-size: clamp(2.4rem, 9vw, 5.8rem);
  font-weight: 300;
  text-transform: uppercase;
  color: var(--bone);
  line-height: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.06em;
  letter-spacing: 0.06em;
}
.hero__title [data-word] { white-space: nowrap; } /* a word never breaks mid-decrypt */
.hero__title .g {
  position: relative;
  display: inline-block;
  min-width: 0.5em;
  text-align: center;
}
.hero__title .g__sizer { visibility: hidden; }    /* reserves the final letter's width — zero reflow */
.hero__title .g__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.hero__title .g__face.num {
  font-family: var(--font-mono);
  font-size: 0.4em;
  letter-spacing: 0;
  color: var(--ash);
}
.hero__title .g__face.flip { animation: chflip 0.5s var(--ease) both; }

/* ampersand + skull fused: a faint & sits behind the hairline skull */
.hero__amp {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: clamp(48px, 7vw, 92px);
  flex: 0 0 auto;
  margin: 0 0.02em;
}
.hero__amp-ghost {
  position: absolute;
  z-index: 0;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(3.4rem, 8vw, 6rem);
  line-height: 1;
  color: #565656;
  transform: translateY(-0.03em);
}
.hero__amp svg {
  position: relative;
  z-index: 1;
  width: clamp(32px, 4.6vw, 50px);
  height: auto;
  color: var(--bone);
  /* optical centering: the ampersand's mass sits left of its geometric center */
  transform: translateX(-12%);
}
.skull-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hero__sub {
  margin-top: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ash);
}
.hero__tagline {
  margin-top: 2rem;
  max-width: 30rem;
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  color: var(--fog);
  font-weight: 300;
}
.hero__scroll {
  margin-top: 3.2rem;
  display: inline-grid;
  justify-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ash);
  transition: color 0.25s var(--ease);
}
.hero__scroll:hover { color: var(--bone); }
.hero__arrow {
  font-size: 1.1rem;
  letter-spacing: 0;
  animation: bob 2s var(--ease) infinite;
}

/* ============================================================
   DETECTIVES
   ============================================================ */
.detectives {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--graphite);
  border: 1px solid var(--graphite);
}
.detective {
  background: var(--ink);
  padding: clamp(1.8rem, 4vw, 2.8rem);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}
.detective:hover { background: var(--smoke); }

.detective__badge {
  width: 4.4rem;
  height: 4.4rem;
  border: 1px solid var(--iron);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--bone);
}
.detective__role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ash);
}
.detective__name {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 300;
  color: var(--bone);
  letter-spacing: 0.01em;
  margin-top: -0.6rem;
}
.detective__bio { color: var(--fog); font-weight: 300; }

.detective__stats {
  margin-top: auto;
  display: grid;
  gap: 0.55rem;
  border-top: 1px solid var(--graphite);
  padding-top: 1.3rem;
}
.detective__stats > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}
.detective__stats dt {
  color: var(--ash);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.detective__stats dd { color: var(--bone); text-align: right; }

.detectives__note {
  margin-top: 1.8rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--ash);
  max-width: 40rem;
}

/* ============================================================
   CASES
   ============================================================ */
.cases {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1px;
  background: var(--graphite);
  border: 1px solid var(--graphite);
}
.case {
  background: var(--ink);
  padding: clamp(1.6rem, 3.5vw, 2.3rem);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 13rem;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
/* the inversion signal — cards flip to white-on-black on hover/focus */
.case:hover,
.case:focus-within {
  background: var(--bone);
  color: var(--ink);
}
.case__no {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
  transition: color 0.3s var(--ease);
}
.case:hover .case__no,
.case:focus-within .case__no { color: var(--iron); }
.case__title {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--bone);
  transition: color 0.3s var(--ease);
}
.case:hover .case__title,
.case:focus-within .case__title { color: var(--ink); }
.case__desc {
  font-size: 0.96rem;
  font-weight: 300;
  margin-top: auto;
}
.case__desc a { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   DECODER — the signature interactive moment
   ============================================================ */
.section--decoder { position: relative; }

.decoder {
  border: 1px solid var(--iron);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px),
    var(--smoke);
  padding: clamp(1.6rem, 4vw, 2.6rem);
  max-width: 44rem;
}

.decoder__modes {
  display: inline-flex;
  border: 1px solid var(--iron);
  margin-bottom: 1.6rem;
}
.decoder__mode {
  background: transparent;
  color: var(--ash);
  border: none;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.decoder__mode + .decoder__mode { border-left: 1px solid var(--iron); }
.decoder__mode.is-active { background: var(--bone); color: var(--ink); }

.decoder__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ash);
  display: block;
  margin-bottom: 0.6rem;
}

.decoder__input {
  width: 100%;
  resize: vertical;
  background: var(--ink);
  border: 1px solid var(--graphite);
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  line-height: 1.6;
  padding: 1rem 1.1rem;
  transition: border-color 0.25s var(--ease);
}
.decoder__input:focus { outline: none; border-color: var(--bone); }

.decoder__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}
.chip {
  background: transparent;
  border: 1px solid var(--graphite);
  color: var(--ash);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.75rem;
  transition: all 0.2s var(--ease);
}
.chip:hover { border-color: var(--bone); color: var(--bone); }

.decoder__arrow {
  text-align: center;
  color: var(--iron);
  font-size: 1.2rem;
  margin: 1.4rem 0 1.1rem;
}

.decoder__output {
  display: block;
  min-height: 3.6rem;
  background: var(--ink);
  border: 1px solid var(--graphite);
  padding: 1rem 1.1rem;
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  letter-spacing: 0.12em;
  color: var(--bone);
  word-break: break-word;
  white-space: pre-wrap;
}
.decoder__output .ch {
  display: inline-block;
  opacity: 0;
  animation: chflip 0.45s var(--ease) forwards;
}
.decoder__output .ch--space { width: 0.5em; }

.decoder__hint {
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ash);
  line-height: 1.6;
}

/* ============================================================
   HIRE FORM
   ============================================================ */
.hire {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
  max-width: 44rem;
}
.field { display: flex; flex-direction: column; gap: 0.55rem; }
.field--full { grid-column: 1 / -1; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ash);
}
.field__opt { color: var(--iron); text-transform: none; letter-spacing: 0.05em; }
.field input,
.field textarea {
  background: var(--ink);
  border: 1px solid var(--graphite);
  color: var(--bone);
  font-family: var(--font-display);
  font-size: 1rem;
  padding: 0.85rem 1rem;
  transition: border-color 0.25s var(--ease);
}
.field input::placeholder,
.field textarea::placeholder { color: #5a5a5a; }
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--bone); }
.field textarea { resize: vertical; }

.hire__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 0.4rem;
}
.btn {
  background: var(--bone);
  color: var(--ink);
  border: 1px solid var(--bone);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.95rem 1.8rem;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.btn:hover { background: transparent; color: var(--bone); }
.hire__confirm {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--bone);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--graphite);
  padding: clamp(3rem, 7vw, 5rem) var(--pad-x);
}
.footer__inner {
  max-width: var(--maxw);
  margin-inline: auto;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 0.9rem;
}
.footer__name {
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--bone);
  margin-top: 0.3rem;
}
.footer__url,
.footer__code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  color: var(--ash);
}
.footer__tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--iron);
  margin-top: 0.4rem;
}

/* ============================================================
   REVEAL ANIMATIONS (driven by IntersectionObserver)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.in-view { opacity: 1; transform: none; }

@keyframes bob    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes chflip {
  0%   { opacity: 0; transform: rotateX(-90deg); }
  100% { opacity: 1; transform: rotateX(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .nav__brandtext { display: none; }
  .detectives { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --rail-w: 26px; }
  .rail__perfs {
    background-image: radial-gradient(circle at center,
      rgba(255,255,255,0.4) 0 3px, transparent 4px);
    background-size: 100% 48px;
  }
  .section, .hero, .nav { padding-inline: clamp(2.2rem, 9vw, 3rem); }
  .hire { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .nav__links a:not(.nav__cta) { display: none; }
  .decoder__modes { width: 100%; }
  .decoder__mode { flex: 1; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero__title .g__face { animation: none; }
  .decoder__output .ch { opacity: 1; animation: none; }
}
