/* ============================================================
   EARLIAN SOLUTIONS — Coming Soon
   "Earlian" draws itself · "Solutions" arrives by stamp
   ============================================================ */

:root {
  --paper:      #F5F1E6;
  --paper-deep: #EDE7D8;
  --ink:        #1C1A16;
  --ink-soft:   #57524A;
  --accent:     #1E9BD8;   /* azure — from the Messages video sky */
  --coral:      #F0715A;   /* coral — the tee tint in the video */
  --rule:       #C9C1AE;
  --brand: "Rock Salt", "Sedgwick Ave Display", "Permanent Marker", cursive;
  --serif: "Sedgwick Ave Display", "Permanent Marker", "Comic Sans MS", cursive;
  --sans:  "Special Elite", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 3D vault background (crisp, no blur) ---------- */
#vault {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.scroll-space { height: 200vh; }   /* 2-3 scrolls from intro to docked */

/* ---------- The window frames (look through them at the 3D) ---------- */
.window-pair {
  position: fixed;
  top: 47%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  gap: min(6vw, 56px);
  pointer-events: none;
}
.window-frame {
  position: relative;
  width: min(30vw, 250px, 38vh);   /* never taller than the viewport */
  aspect-ratio: 4 / 5;
  margin: 0;
  border: 10px solid var(--paper-deep);
  outline: 1px solid var(--rule);
  box-shadow: 0 24px 60px rgba(28, 26, 22, 0.12);
  opacity: 0;
  cursor: grab;
}
.window-frame:active { cursor: grabbing; }
.window-caption {
  position: absolute;
  bottom: -32px; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Info card ---------- */
.info-card {
  position: fixed;
  left: 50%;
  top: calc(47% + min(18.75vw, 156px, 23.75vh) + 56px);
  z-index: 2;
  width: min(74vw, 280px);
  padding: 16px 20px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 30px rgba(28, 26, 22, 0.10);
  text-align: left;
  opacity: 0;
}
.info-card { margin-left: calc(min(74vw, 280px) / -2); left: 50%; }
.info-kicker {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.info-title {
  font-family: var(--serif);
  font-size: 17px;
  margin-bottom: 6px;
}
.info-body {
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* ---------- Lyric annotations (scroll-driven, stamped in the margins) ---------- */
.lyrics { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.lyric {
  position: absolute;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  opacity: 0;                       /* vault.js drives opacity + drift per scroll beat */
  white-space: nowrap;
  max-width: 44vw;
}
.lyric-1 { top: 11vh;  left: 5vw; }
.lyric-2 { top: 27vh;  right: 4vw; text-align: right; }
.lyric-3 { bottom: 24vh; left: 6vw; }
.lyric-4 { bottom: 11vh; right: 7vw; text-align: right; }

/* ---------- Wordmark glitch (chromatic split, like the video cuts) ---------- */
@keyframes glitch {
  0%, 91.9%, 94.1%, 100% { filter: none; transform: translate(0, 0); }
  92%   { filter: drop-shadow(3px 0 0 rgba(30,155,216,0.75)) drop-shadow(-3px 0 0 rgba(240,113,90,0.75)); transform: translate(-2px, 1px); }
  93%   { filter: drop-shadow(-4px 0 0 rgba(30,155,216,0.75)) drop-shadow(4px 0 0 rgba(240,113,90,0.75)); transform: translate(2px, -1px); }
  94%   { filter: drop-shadow(2px 0 0 rgba(30,155,216,0.6)) drop-shadow(-2px 0 0 rgba(240,113,90,0.6)); transform: translate(0, 0); }
}

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

/* ---------- Stage ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
  animation: stageSettle 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes stageSettle {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Kicker ---------- */
.kicker {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 1.2s ease 0.5s forwards;
}

/* ---------- "Earlian" — drawn, then filled ---------- */
.word-svg {
  width: min(78vw, 640px);
  height: auto;
  display: block;
  margin: 0 auto;
  overflow: visible;
}
.draw-text {
  font-family: var(--brand);
  font-weight: 400;
  font-size: 140px;
  fill: var(--ink);
  fill-opacity: 0;
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-dasharray: 2200;           /* Rock Salt's ragged outlines are longer */
  stroke-dashoffset: 2200;
  animation:
    draw 3s cubic-bezier(0.5, 0, 0.2, 1) 0.7s forwards,
    fillIn 1.4s ease 2.9s forwards,
    glitch 9s steps(1) 8s infinite;
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
@keyframes fillIn {
  to { fill-opacity: 1; }
}

/* ---------- Rule ---------- */
.mid-rule {
  height: 1px;
  background: var(--rule);
  width: 0;
  margin: 10px auto 26px;
  animation: ruleGrow 1.1s cubic-bezier(0.22, 1, 0.36, 1) 3.1s forwards;
}
@keyframes ruleGrow {
  to { width: min(52vw, 340px); }
}

/* ---------- "Solutions" — stamped letter by letter ---------- */
.solutions {
  font-family: var(--serif);
  font-size: clamp(17px, 2.8vw, 24px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: -0.28em; /* optically recenter letterspaced text */
}
.solutions span {
  display: inline-block;
  opacity: 0;
  transform: scale(1.6);
  filter: blur(2px);
  animation: stamp 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
  animation-delay: calc(3.6s + var(--i) * 0.09s);
}
@keyframes stamp {
  60% { opacity: 1; transform: scale(0.94); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* ---------- Tagline ---------- */
.tagline {
  font-family: var(--serif);
  font-size: clamp(15px, 2vw, 19px);
  color: var(--ink-soft);
  margin-top: 34px;
  transform: rotate(-1.2deg);
  opacity: 0;
  animation: fadeUp 1.4s ease 5s forwards;
}

/* ---------- Scroll hint ---------- */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  animation: fadeUp 1.2s ease 6.6s forwards;
}
.scroll-hint span {
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.scroll-hint i {
  display: block;
  width: 1px;
  height: 26px;
  margin: 8px auto 0;
  background: var(--ink-soft);
  animation: hintDrop 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  transform-origin: top;
}
@keyframes hintDrop {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- Footer ---------- */
.soon-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 28px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0;
  animation: fadeUp 1.4s ease 5.6s forwards;
}
.footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
  margin-left: 24px;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.footer-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Shared motion ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Vignette ---------- */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(28, 26, 22, 0.08) 100%);
}

/* ---------- Sauce: live film grain + breathing light leak (subliminal) ---------- */
.grain {
  position: fixed;
  inset: -160px;                    /* oversized so the jitter never shows an edge */
  z-index: 60;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  animation: grain-jitter 0.9s steps(3) infinite;
}
@keyframes grain-jitter {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-42px, 26px); }
  66%  { transform: translate(30px, -38px); }
  100% { transform: translate(0, 0); }
}

.lightleak {
  position: fixed;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 18% 8%, rgba(255, 236, 200, 0.07), transparent 70%),
    radial-gradient(ellipse 55% 40% at 85% 92%, rgba(212, 184, 150, 0.05), transparent 70%);
  animation: leak-breathe 26s ease-in-out infinite alternate;
}
@keyframes leak-breathe {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 1.5%, 0) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .grain, .lightleak { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .draw-text { font-size: 170px; }   /* Rock Salt runs wide — keep it inside the viewBox */
  .word-svg { width: 92vw; }
  .scroll-space { height: 140vh; }   /* phones flick shorter distances — keep it to 1-2 scrolls */
  .lyric { font-size: 11px; letter-spacing: 0.1em; max-width: 62vw; white-space: normal; }
  /* one window, big enough to actually see the look */
  .frame-b { display: none; }
  .window-frame { width: min(64vw, 300px, 50vh); }
  .info-card {
    top: calc(47% + min(40vw, 188px, 31.25vh) + 44px);   /* just under the taller window */
    width: min(78vw, 300px);
  }
  .soon-footer {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-bottom: 26px;
  }
  .footer-links a { margin: 0 12px; }
}

/* tablets: windows a touch larger than desktop-relative */
@media (min-width: 601px) and (max-width: 1024px) {
  .window-frame { width: min(34vw, 280px, 40vh); }
}

/* ultrawide / big desktop: let the windows breathe */
@media (min-width: 1600px) {
  .window-frame { width: min(22vw, 340px, 42vh); }
  .window-pair { gap: min(5vw, 88px); }
}

/* notched phones: keep UI off the hardware edges */
.soon-footer { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
}
