/* Kohra coming soon. Same tokens as the Shopify theme (theme/assets/theme.css).
   Motion lives in the two prefers-reduced-motion: no-preference blocks at the bottom; everything above is the
   finished, still page, which is what people who ask for reduced motion get. */

:root {
  --paper: #f4f1ec;
  --fog: #e5e1d9;
  --ink: #26211d;
  --wine: #4f1b27;
  --foil: #a5844f;

  --ink-soft: color-mix(in srgb, var(--ink) 68%, var(--paper));
  --line: color-mix(in srgb, var(--ink) 38%, transparent);

  --display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 72px);
  --max: 1240px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

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

body {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* a low bank of fog along the bottom edge, with two softer banks drifting inside it */
.mist {
  position: fixed;
  inset: auto 0 0 0;
  height: 42vh;
  overflow: hidden;
  background: linear-gradient(to top, color-mix(in srgb, var(--fog) 90%, transparent), transparent);
  pointer-events: none;
  z-index: 0;
}
.mist::before,
.mist::after {
  content: "";
  position: absolute;
  bottom: -14%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--fog), transparent);
  opacity: 0.7;
}
.mist::before { left: -12%; width: 64%; }
.mist::after { right: -16%; width: 72%; }

/* the mist that lifts off the page when it loads; off screen and invisible until the motion block runs it */
body::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 165vh;
  background: linear-gradient(to bottom, var(--fog) 0%, var(--fog) 60%, transparent 100%);
  transform: translateY(-110%);
  pointer-events: none;
  z-index: 5;
}

.page, .foot { position: relative; z-index: 1; }

img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 1em; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a, button, input, label { touch-action: manipulation; }

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus { top: 12px; }

/* layout: logo first on a phone, copy left and logo right from tablet up */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding: clamp(28px, 6vh, 72px) var(--gutter);
  display: grid;
  gap: clamp(20px, 4vw, 96px);
  align-items: center;
}

.logo { position: relative; order: -1; width: min(52vw, 230px); justify-self: center; }
.logo img { width: 100%; height: auto; }

/* a thin bank of fog across the foot of the mountain, once the stole has settled */
.logo::after {
  content: "";
  position: absolute;
  left: -14%;
  right: -14%;
  top: 63%;
  height: 20%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--fog) 85%, transparent), transparent);
  opacity: 0;
  pointer-events: none;
}

.copy { max-width: 28rem; justify-self: center; width: 100%; }

@media (min-width: 860px) {
  .page { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
  .copy { justify-self: start; }
  .logo { order: 0; width: min(100%, 26rem); }
  .logo img { max-height: 76vh; max-height: 76svh; width: auto; margin-inline: auto; }
}

/* type */
h1 {
  margin: 0 0 0.3em;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3.4rem, 8.4vw, 6.6rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 .line { display: inline-block; }

.lede {
  max-width: 34ch;
  margin-bottom: 2.1rem;
  font-size: 1.125rem;
  color: var(--ink-soft);
}

/* waitlist form */
.join { transition: opacity 0.3s ease, transform 0.3s ease; }
.join.is-leaving { opacity: 0; transform: translateY(-6px); pointer-events: none; }

.field { position: relative; margin-bottom: 1.35rem; }
.field label { display: block; margin-bottom: 2px; font-size: 0.875rem; color: var(--ink-soft); transition: color 0.25s ease; }
.field:focus-within label { color: var(--ink); }
.optional { color: var(--ink-soft); }

.field input {
  display: block;
  width: 100%;
  padding: 11px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 1.0625rem;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus { outline: none; }

/* the heavier line that draws along the field from the left while it has focus */
.field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease), background-color 0.25s ease;
}
.field:focus-within::after { transform: scaleX(1); }
.field.is-invalid::after { background: var(--wine); transform: scaleX(1); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 0 28px;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 0;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform 0.15s ease;
}
/* wine fills the button from the left on hover and keyboard focus */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--wine);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
.btn:hover::before,
.btn:focus-visible::before { transform: scaleX(1); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline-offset: 4px; }
.btn[disabled] { cursor: progress; }

/* a gold thread runs along the foot of the button while the signup is being saved */
.btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40%;
  height: 2px;
  background: var(--foil);
  opacity: 0;
  transform: translateX(-100%);
}
.btn[aria-busy="true"]::after { opacity: 1; }

.status { min-height: 1.6em; margin: 0.9rem 0 0; font-size: 0.9375rem; color: var(--wine); }

.fine { margin: 0.4rem 0 0; font-size: 0.875rem; color: var(--ink-soft); }

/* shown in place of the form once the email is saved */
.done[hidden] { display: none; }
.done { padding: 4px 0 18px; }
.done:focus { outline: none; }
.done__rule { height: 1px; background: var(--line); transform-origin: left; }
.done__peak { display: block; width: 64px; height: auto; margin: 22px 0 14px; overflow: visible; }
.done__peak path { fill: var(--fog); stroke: var(--foil); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.done__title { margin: 0 0 6px; font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 4vw, 2.6rem); line-height: 1.05; }
.done p:last-child { margin-bottom: 0; }

.foot {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding: 0 var(--gutter) 28px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.foot p { margin: 0; }

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

/* one choreographed arrival: the mist lifts, the headline rises out of it, the rest follows, and the
   logo (which plays its own 7 second animation) is left to do that on its own */
@media (prefers-reduced-motion: no-preference) {
  @keyframes mist-lift {
    from { transform: translateY(0); }
    to { transform: translateY(-110%); }
  }
  @keyframes line-rise {
    from { clip-path: inset(0 0 100% 0); transform: translateY(0.4em); }
    to { clip-path: inset(-12% -6% -28% -6%); transform: none; }
  }
  @keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes drift-a { from { transform: translateX(-6%); } to { transform: translateX(12%); } }
  @keyframes drift-b { from { transform: translateX(8%); } to { transform: translateX(-14%); } }
  @keyframes mist-in { from { opacity: 0; } to { opacity: 0.85; } }
  @keyframes mist-sway { from { transform: translateX(-7%); } to { transform: translateX(7%); } }
  @keyframes thread { to { transform: translateX(250%); } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes settle { from { fill-opacity: 0; } to { fill-opacity: 1; } }

  body::before { animation: mist-lift 2.3s cubic-bezier(0.55, 0, 0.25, 1) 0.15s both; }

  h1 .line { animation: line-rise 1s var(--ease) both; }
  h1 .line:nth-child(1) { animation-delay: 0.75s; }
  h1 .line:nth-child(2) { animation-delay: 0.92s; }
  .lede { animation: rise 0.8s var(--ease) 1.4s both; }
  .join .field:nth-of-type(1) { animation: rise 0.7s var(--ease) 1.6s both; }
  .join .field:nth-of-type(2) { animation: rise 0.7s var(--ease) 1.72s both; }
  .join .btn { animation: rise 0.7s var(--ease) 1.86s both; }
  .fine { animation: fade 0.9s ease 2.1s both; }
  .foot { animation: fade 0.9s ease 2.3s both; }

  /* the banks of fog never stop moving, very slowly */
  .mist::before { animation: drift-a 28s ease-in-out infinite alternate; }
  .mist::after { animation: drift-b 36s ease-in-out infinite alternate; }

  /* once the logo has finished (about 7 s) a haze settles across the foot of the mountain and sways */
  .logo::after { animation: mist-in 2.6s ease 6.6s both, mist-sway 15s ease-in-out 6.6s infinite alternate; }

  .btn[aria-busy="true"]::after { animation: thread 1s linear infinite; }

  .status:not(:empty) { animation: rise 0.35s var(--ease) both; }

  /* confirmation: the rule draws, the peak is traced in gold and fills with fog, the words follow */
  .done:not([hidden]) .done__rule { animation: rule-draw 0.6s var(--ease) both; }
  .done:not([hidden]) .done__peak path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 1.3s var(--ease) 0.2s forwards, settle 0.6s ease 1.3s both;
  }
  .done:not([hidden]) .done__title { animation: rise 0.7s var(--ease) 0.5s both; }
  .done:not([hidden]) p:last-child { animation: rise 0.7s var(--ease) 0.7s both; }
}
