/*
Purpose: Industrial visual system, ink-pour intro and lockup choreography for Dual Ink.
Last modified: 2026-06-12
Change summary: Single continuous mark poured from real artwork; Jost lockup typography; page background carries all colour.
*/
:root {
  --void: #050505;
  --paper: #f3f0ea;
  --graphite: #282725;
  --ink: #11100f;
  --cream: #e4d08a;

  /* JS-driven */
  --p: 0;            /* sticky scroll progress 0..1 */
  --markP: 0;        /* lockup formation 0..1 */
  --moonP: 0;        /* intro: moon fade-in */
  --wB: 0;           /* black pour wipe 0..118 */
  --wC: 0;           /* cream pour wipe 0..118 */
  --sB: 1;           /* black pour stretch */
  --sC: 1;           /* cream pour stretch */
  --settle: 0;       /* final settle 0..1 */
  --dripP: 0;        /* droplets burst */
  --fgMix: 0;        /* 0 = light text, 1 = dark text */
  --stageBg: #050505;

  --fg-light: #f5f3ec;
  --fg-dark: #161514;
  --fg: color-mix(in srgb, var(--fg-light) calc((1 - var(--fgMix)) * 100%), var(--fg-dark) calc(var(--fgMix) * 100%));

  --mark-init: min(62vmin, 560px);
  --mark-final: clamp(150px, 18vw, 260px);
  --lockup-gap: clamp(40px, 4.2vw, 76px);
  --wordmark-size: clamp(64px, 8.4vw, 124px);
  --text-w: calc(var(--wordmark-size) * 6.2);
  --lockup-total: calc(var(--mark-final) + var(--lockup-gap) + var(--text-w));

  --ease-heavy: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Jost", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--void);
  color: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--void);
  overflow-x: hidden;
}

/* film grain / industrial atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: calc(var(--markP) * 0.10);
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.08), transparent 32%),
    radial-gradient(circle at 70% 90%, rgba(0,0,0,0.22), transparent 38%);
  mix-blend-mode: overlay;
}

a { color: inherit; }

.fx-defs { position: absolute; }

/* ---------- film / stage ---------- */

.film {
  height: 330vh;
  background: var(--graphite);
}

.stage {
  position: sticky;
  top: 0;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--stageBg);
}

.mechanical-grid {
  position: absolute;
  inset: 0;
  opacity: calc(var(--markP) * 0.16);
  background-image:
    linear-gradient(color-mix(in srgb, var(--fg) 24%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--fg) 24%, transparent) 1px, transparent 1px);
  background-size: 8vw 8vw;
  transform: translate3d(calc(var(--p) * -2vw), calc(var(--p) * -3vw), 0);
}

/* ---------- the mark: one continuous element ---------- */

.hero-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--mark-init);
  aspect-ratio: 930 / 981;
  z-index: 3;
  transform:
    translate3d(
      calc(-50% - var(--markP) * (var(--lockup-total) / 2 - var(--mark-final) / 2)),
      calc(-50% - var(--markP) * 2vh),
      0
    )
    scale(calc((1 - var(--settle) * -0.035) * (1 - var(--markP) * (1 - 0.464))));
  will-change: transform;
}

.piece {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  filter: contrast(1.12) saturate(1.18) brightness(0.99);
}

/* moon — visible from the start, breathing softly on black */
.piece-moon {
  clip-path: inset(38% 40.5% 35% 42%);
  opacity: var(--moonP);
  animation: moonBreath 4.2s ease-in-out infinite;
}

/* the original ink film — page colour is sampled from it live, so it sits seamless */
.hero-video {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--mark-init) * 1.12);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 2;
  opacity: 1;
  transition: opacity 550ms ease;
  pointer-events: none;
  /* soften the frame edges so the pour reads as entering from off-screen */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 95%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 9%, #000 95%, transparent 100%);
}

.hero-video.done {
  opacity: 0;
}

@keyframes moonBreath {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

/* black ink — falls as a narrow stream, widens into the left crescent */
.piece-black {
  --kB: min(calc(var(--wB) / 100), 1);
  clip-path: inset(0 49.5% 0 0);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--wB) * 1%), transparent calc(var(--wB) * 1% + 16%));
  mask-image: linear-gradient(to bottom, #000 calc(var(--wB) * 1%), transparent calc(var(--wB) * 1% + 16%));
  transform-origin: 28% 2%;
  transform:
    translateY(calc((1 - var(--kB)) * -16%))
    rotate(calc((1 - var(--kB)) * 7deg))
    scaleX(calc(0.2 + var(--kB) * 0.8))
    scaleY(var(--sB));
  will-change: transform, mask-image;
}

/* cream ink — same, a beat later, from the right */
.piece-cream {
  --kC: min(calc(var(--wC) / 100), 1);
  clip-path: inset(2% 0 0 50%);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(var(--wC) * 1%), transparent calc(var(--wC) * 1% + 16%));
  mask-image: linear-gradient(to bottom, #000 calc(var(--wC) * 1%), transparent calc(var(--wC) * 1% + 16%));
  transform-origin: 72% 2%;
  transform:
    translateY(calc((1 - var(--kC)) * -16%))
    rotate(calc((1 - var(--kC)) * -7deg))
    scaleX(calc(0.2 + var(--kC) * 0.8))
    scaleY(var(--sC));
  will-change: transform, mask-image;
}

/* ---------- lockup copy ---------- */

.hero-copy {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max-content;
  transform: translate3d(
    calc(-50% + var(--lockup-total) / 2 - var(--text-w) / 2 + (1 - var(--markP)) * 56px),
    -50%,
    0
  );
  opacity: clamp(0, calc((var(--markP) - 0.12) * 4), 1);
  z-index: 4;
  pointer-events: none;
  color: var(--fg);
}

.metal-wordmark {
  margin: 0;
  white-space: nowrap;
  font-family: "Jost", "Helvetica Neue", Arial, sans-serif;
  font-weight: 200;
  font-size: var(--wordmark-size);
  letter-spacing: 0.28em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--fg);
  clip-path: inset(0 calc((1 - clamp(0, (var(--markP) - 0.26) / 0.5, 1)) * 100%) 0 0);
}

.studio-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
  margin: clamp(16px, 1.8vw, 26px) 0 0;
  font-family: "Jost", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  font-size: clamp(19px, 2.1vw, 32px);
  letter-spacing: clamp(0.28em, 0.5vw, 0.42em);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fg);
  opacity: clamp(0, calc((var(--markP) - 0.55) * 3.4), 1);
}

.studio-line::before,
.studio-line::after {
  content: "";
  display: block;
  height: 1px;
  background: currentColor;
  transform-origin: center;
  transform: scaleX(clamp(0, calc((var(--markP) - 0.66) * 3.2), 1));
}

/* ---------- industrial chrome ---------- */

.calibration {
  position: absolute;
  left: clamp(18px, 3vw, 44px);
  right: clamp(18px, 3vw, 44px);
  bottom: clamp(18px, 3vw, 42px);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--fg);
  opacity: 0.6;
  font-family: "Courier New", monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  z-index: 5;
}

/* ---------- contact ---------- */

.contact-band {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(32px, 7vw, 96px);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.045), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 9vw),
    var(--graphite);
  color: var(--paper);
}

.contact-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  border: 1px solid rgba(243,240,234,0.3);
  background: rgba(5,5,5,0.16);
}

.contact-aside {
  padding: clamp(28px, 5vw, 72px);
  border-right: 1px solid rgba(243,240,234,0.3);
}

.system-label {
  margin: 0 0 18px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.contact-aside h2 {
  margin: 0;
  text-transform: uppercase;
  font-weight: 200;
  letter-spacing: 0.02em;
  line-height: 0.94;
  font-size: clamp(40px, 6.4vw, 96px);
  max-width: 9ch;
}

.contact-lines {
  display: grid;
  gap: 12px;
  margin-top: 42px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-lines a {
  width: fit-content;
  text-decoration: none;
  border-bottom: 1px solid rgba(243,240,234,0.42);
}

.contact-lines a:hover,
.contact-lines a:focus-visible {
  color: var(--cream);
  border-color: var(--cream);
}

.contact-form {
  display: grid;
  gap: 18px;
  padding: clamp(28px, 5vw, 72px);
}

.field-decoy { display: none; }

label {
  display: grid;
  gap: 8px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(243,240,234,0.34);
  border-radius: 0;
  background: rgba(5,5,5,0.22);
  color: var(--paper);
  padding: 15px 14px;
  font: 16px/1.4 "Courier New", monospace;
  outline: none;
  transition: border-color 260ms var(--ease-heavy), background 260ms var(--ease-heavy);
}

input:focus-visible,
textarea:focus-visible {
  border-color: var(--cream);
  background: rgba(5,5,5,0.36);
}

textarea { resize: vertical; }

button {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--paper);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 7px 7px 7px 20px;
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 360ms var(--ease-heavy), background 360ms var(--ease-heavy);
}

button:hover { transform: translate3d(3px, -3px, 0); }
button:active { transform: translate3d(1px, -1px, 0) scale(0.98); }
button:disabled { cursor: wait; opacity: 0.66; }
button:focus-visible { outline: 1px solid var(--cream); outline-offset: 3px; }

.button-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 18px;
}

.form-status {
  min-height: 22px;
  color: rgba(243,240,234,0.86);
  font-family: "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- mobile ---------- */

@media (max-width: 760px) {
  :root {
    --mark-init: min(78vw, 380px);
    --mark-final: min(38vw, 190px);
  }

  .film { height: 300vh; }

  .mechanical-grid { background-size: 22vw 22vw; }

  /* vertical lockup: mark rises, copy sits below it */
  .hero-mark {
    transform:
      translate3d(
        -50%,
        calc(-50% - var(--markP) * 24vh),
        0
      )
      scale(calc((1 - var(--settle) * -0.035) * (1 - var(--markP) * 0.5)));
  }

  .hero-copy {
    width: min(92vw, 460px);
    text-align: center;
    transform: translate3d(-50%, calc(-50% + 5vh + (1 - var(--markP)) * 40px), 0);
  }

  .metal-wordmark {
    font-size: clamp(36px, 10.5vw, 62px);
    letter-spacing: clamp(0.1em, 1.4vw, 0.18em);
  }

  .studio-line {
    font-size: clamp(14px, 4.4vw, 22px);
    letter-spacing: clamp(0.18em, 2vw, 0.3em);
    gap: 12px;
  }

  .calibration {
    align-items: flex-end;
    flex-direction: column;
    text-align: right;
  }

  .contact-band { padding: 24px; }
  .contact-shell { grid-template-columns: 1fr; }
  .contact-aside {
    border-right: 0;
    border-bottom: 1px solid rgba(243,240,234,0.3);
  }
}

/* ---------- reduced motion ---------- */

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

  .piece-moon { animation: none; }

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