/* =========================================================================
   Misfits — themisfits.ai
   Vanilla CSS, mobile-first. Espresso / cream / amber editorial register.
   ========================================================================= */

/* ---- Fonts (self-hosted woff2) ---------------------------------------- */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-400.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/cormorant-garamond-600.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/dm-sans-400.woff2") format("woff2");
}
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/dm-sans-500.woff2") format("woff2");
}

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --espresso: #0E0B09;
  --espresso-soft: #15100b;
  --cream: #E8DFCB;
  --cream-dim: #b9b0a0;     /* muted cream for secondary text */
  --amber: #C9A16B;
  --amber-bright: #d9b481;
  --line: rgba(232, 223, 203, 0.14);

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 760ms;

  --gutter: clamp(1.25rem, 6vw, 5rem);
  --maxw: 1200px;
}

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

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

body {
  margin: 0;
  background: var(--espresso);
  color: var(--cream);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

h1, h2, h3 { margin: 0; font-weight: 500; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Honeypot: off-screen decoy input. Real users never see or tab to it;
   bots that auto-fill every field trip the server check in collectBetaSignup. */
.hp {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* ---- Cursor glow ------------------------------------------------------- */
.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 60vmax; height: 60vmax;
  margin: -30vmax 0 0 -30vmax;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    closest-side,
    rgba(201, 161, 107, 0.10),
    rgba(201, 161, 107, 0.04) 45%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 1200ms var(--ease);
  will-change: transform;
}
.cursor-glow.is-on { opacity: 1; }
/* Once the user has signed up, the idle amber drift reads as visual noise behind
   the success/manifesto state (it catches the faded image edges). Fade it out
   and keep it out, regardless of pointer activity. */
body.is-signed-up .cursor-glow { opacity: 0 !important; }

/* ---- Masthead ---------------------------------------------------------- */
.masthead {
  position: relative;
  z-index: 3;
  padding: clamp(1.4rem, 4vw, 2.4rem) var(--gutter);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--cream);
  text-decoration: none;
}

/* ---- Shared section frame --------------------------------------------- */
main { position: relative; z-index: 1; }

section { padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---- Reveal animation (IntersectionObserver toggles .is-visible) ------ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ===== 1. HERO ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: clamp(2rem, 6vh, 4rem);
  padding-bottom: clamp(3rem, 8vh, 5rem);
  overflow: hidden;
}

/* Media layer: full-bleed crossfading stack behind content on mobile */
.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1600ms var(--ease);
  will-change: opacity, transform;
}
.hero__media img.is-active {
  opacity: 0.5;
  animation: kenburns 22s var(--ease) infinite alternate;
}
/* Scrim so cream text stays legible over imagery */
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  /* Mobile scrim, lightened ~13% (was 0.55→0.78 / 0.85) so the look reads
     better behind the text. Contrast verified against the brightest of the
     7 hero images (look-01): cream headline 11:1, cream-dim subline 7:1. */
  background:
    linear-gradient(180deg, rgba(14,11,9,0.48) 0%, rgba(14,11,9,0.68) 100%),
    radial-gradient(120% 90% at 20% 30%, transparent, rgba(14,11,9,0.74) 80%);
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  margin-inline: auto;
  width: 100%;
}

.hero__headline {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.9rem, 11vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.hero__subline {
  margin: 1.4rem 0 2.4rem;
  max-width: 30ch;
  color: var(--cream-dim);
  font-size: clamp(1.05rem, 1rem + 0.6vw, 1.3rem);
  line-height: 1.5;
}

@keyframes kenburns {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to   { transform: scale(1.12) translate3d(-2%, -2.5%, 0); }
}

/* ---- Signup form ------------------------------------------------------- */
.signup { max-width: 30rem; }
.signup__row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.signup__input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--cream);
  background: rgba(232, 223, 203, 0.04);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.95rem 1.05rem;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.signup__input::placeholder { color: rgba(185, 176, 160, 0.55); }
.signup__input:focus {
  outline: none;
  border-color: var(--amber);
  background: rgba(232, 223, 203, 0.06);
}
.signup__input[aria-invalid="true"] { border-color: var(--amber); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.95rem 1.5rem;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              transform 300ms var(--ease), opacity var(--dur) var(--ease);
}
.btn--amber {
  background: var(--amber);
  color: var(--espresso);
}
.btn--amber:hover { background: var(--amber-bright); }
.btn--amber:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: default; }

.signup__consent {
  margin: 1.1rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--cream-dim);
  max-width: 38ch;
}
.signup__consent a { color: var(--cream); text-underline-offset: 3px; }

.signup__status {
  margin: 0.85rem 0 0;
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--cream-dim);
  opacity: 0;
  transition: opacity 400ms var(--ease);
}
.signup__status.is-shown { opacity: 1; }

/* Success state — crossfade swap, no layout jump (JS measures + locks height) */
.signup,
.signup__success {
  transition: opacity 600ms var(--ease);
}
.signup__success[hidden] { display: none; }
.signup__success {
  max-width: 30rem;
}
.signup__success-line {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.05;
  margin: 0 0 1.4rem;
}
.is-fading { opacity: 0; }

/* Manifesto beat — fades in below the success copy, staggered ~400ms after it
   lands (JS adds .is-revealed). Stays collapsed (grid 0fr) through the
   crossfade so the swap never jumps, then expands + fades into the void.
   Future waitlist phases slot in here: position line above, share CTA below. */
.manifesto {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows var(--dur) var(--ease),
              opacity var(--dur) var(--ease);
}
.manifesto.is-revealed { grid-template-rows: 1fr; opacity: 1; }
.manifesto__inner { overflow: hidden; min-height: 0; }
.manifesto__layout {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 1.6rem;
}
.manifesto__media {
  position: relative;
  width: 100%;
}
.manifesto__img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.92);
}
/* Hard editorial crop on three sides; dissolve only at the bottom. The gradient
   is fully opaque espresso at the bottom edge (solid 0-12%) so the image never
   seams against the page, then fades up. No mask, no top/side vignette. */
.manifesto__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--espresso) 0%,
    var(--espresso) 12%,
    rgba(14, 11, 9, 0) 50%
  );
  pointer-events: none;
}
.manifesto__copy { margin-top: 0.3rem; }
.manifesto__copy p {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.25rem, 1.12rem + 0.55vw, 1.5rem);
  line-height: 1.5;
  color: var(--cream);
  margin: 0 0 0.5rem;
  max-width: 34ch;
}
.manifesto__copy p:last-child { margin-bottom: 0; }
@media (min-width: 680px) {
  .manifesto__layout { flex-direction: row; align-items: center; gap: 1.5rem; }
  .manifesto__media { width: 46%; max-width: 220px; flex: none; }
  .manifesto__copy { margin-top: 0; }
}

/* ===== 2. HOW IT WORKS ================================================= */
.how {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-top: clamp(5rem, 14vh, 9rem);
  padding-bottom: clamp(5rem, 14vh, 9rem);
}
.how__list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: clamp(3rem, 8vw, 4.5rem);
}
.how__beat { max-width: 30rem; }
.how__num {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.2rem, 9vw, 4.6rem);
  line-height: 1;
  color: var(--amber);
  letter-spacing: 0.01em;
}
.how__name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  margin: 0.7rem 0 0.5rem;
}
.how__copy {
  margin: 0;
  color: var(--cream-dim);
  font-size: 1.05rem;
  line-height: 1.55;
}

/* ===== 3. VISUAL BAND ================================================== */
.band {
  position: relative;
  padding-left: 0; padding-right: 0;
  padding-top: clamp(1rem, 3vh, 2rem);
  padding-bottom: clamp(1rem, 3vh, 2rem);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.band__track {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-inline: var(--gutter);
  scrollbar-width: none;
}
.band__track::-webkit-scrollbar { display: none; }
.band__img {
  flex: 0 0 auto;
  width: clamp(150px, 42vw, 300px);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  scroll-snap-align: center;
  filter: saturate(0.92);
}

/* ===== 4. CTA REPRISE ================================================= */
.reprise {
  padding-top: clamp(6rem, 16vh, 11rem);
  padding-bottom: clamp(6rem, 16vh, 11rem);
  text-align: center;
}
.reprise__inner {
  max-width: 34rem;
  margin-inline: auto;
}
.reprise__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1.05;
  margin-bottom: 2.4rem;
}
.reprise .signup,
.reprise .signup__success { margin-inline: auto; }
.reprise .signup__consent { margin-inline: auto; }

/* ===== FOOTER ========================================================= */
.colophon {
  border-top: 1px solid var(--line);
  padding: 2.4rem var(--gutter) 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--cream-dim);
}
.colophon__legal { margin: 0; }
.colophon__nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.colophon__nav a {
  color: var(--cream-dim);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}
.colophon__nav a:hover { color: var(--cream); }
.colophon__made { color: var(--cream-dim); }

/* ===== RESPONSIVE ===================================================== */
@media (min-width: 680px) {
  .signup__row { flex-direction: row; align-items: stretch; }
  .signup__submit { flex: 0 0 auto; }
}

@media (min-width: 920px) {
  .hero {
    padding-inline: 0;
  }
  .hero__media {
    left: auto;
    right: 0;
    width: 46%;
    /* Dissolve the inner edge into the espresso: no hard column, no seam. */
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
  }
  .hero__media::after {
    background:
      linear-gradient(90deg, var(--espresso) 0%, rgba(14,11,9,0.55) 30%, rgba(14,11,9,0.15) 100%),
      linear-gradient(0deg, rgba(14,11,9,0.4), rgba(14,11,9,0.1));
  }
  .hero__media img.is-active { opacity: 0.85; }
  .hero__content {
    margin-inline: 0;
    padding-left: var(--gutter);
    max-width: min(40rem, 54vw);
  }

  .how__list {
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(2rem, 4vw, 3.5rem);
    align-items: start;
  }

  .colophon {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 1280px) {
  .hero__content { padding-left: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + 1.5rem)); }
}

/* ===== 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; }
  .manifesto { grid-template-rows: 1fr; opacity: 1; }
  .hero__media img.is-active { animation: none; }
  .cursor-glow { display: none; }
}
