/*
  Watermelon Woven — coming soon.

  Tokens are copied from src/app/globals.css rather than imported, on purpose:
  this folder ships as a static bundle and must not depend on the Next build.
  If a token changes there, change it here too.
*/

:root {
  --muslin: #faf6ee;
  --stone: #ede7dc;
  --ink: #211c17;
  --brass: #96793f;
  --zari: #c9a227;
  --flesh: #b23a4e;

  /*
    Secondary text is ink at reduced alpha, never the --concrete grey from the
    main palette. Concrete on muslin measures ~3.4:1, which is fine for large
    editorial type but fails badly at the 8-11px this page uses. These land
    around 10:1 and 6:1 and read every bit as recessive.
  */
  --ink-soft: rgba(33, 28, 23, 0.70);
  --ink-faint: rgba(33, 28, 23, 0.45);
  --hairline: rgba(33, 28, 23, 0.20);

  --ease-drape: cubic-bezier(0.16, 1, 0.3, 1);

  /*
    The monogram's circle is not centred in its own bounding box — the mask is
    trimmed to the ink and "WOVEN" overhangs the ring at top right. Measured by
    least-squares fit in tools/build-logo-masks.py. Anchoring the sweep at
    50% 50% would make it crawl unevenly around the ring.
  */
  --mark-cx: 49.6%;
  --mark-cy: 52.2%;
}

/* Only the italic ships. Nothing on this page sets Fraunces upright, and the
   normal weight is another 67 KB down a phone connection for nothing. */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-italic.woff2?v=84ddb276") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans.woff2?v=6219bc4b") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/*
  Beat 1 sweeps a conic gradient around the monogram. A colour-stop position
  cannot be animated in CSS unless the custom property driving it is registered
  with a type — hence @property. Gated behind .ww-sweep so unsupporting
  browsers get a fade instead of a discrete mid-animation pop.
*/
@property --ww-sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  background: var(--muslin);
  color: var(--ink);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

/* ---------------------------------------------------------------- ground */

.weave,
.vignette,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.weave {
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* Makes the drifting light readable: without a darker surround there is no
   range for it to brighten into, and the canvas glow simply disappears. */
.vignette {
  z-index: 1;
  background: radial-gradient(
    125% 95% at 50% 42%,
    rgba(134, 128, 122, 0) 32%,
    rgba(134, 128, 122, 0.09) 74%,
    rgba(134, 128, 122, 0.2) 100%
  );
}

/* Lifted from globals.css — a flat colour field has to read as surface. */
.grain {
  z-index: 2;
  opacity: 0.05;
  mix-blend-mode: multiply;
  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' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

.stage {
  position: relative;
  z-index: 3;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: clamp(26px, 6vh, 72px) 24px max(20px, env(safe-area-inset-bottom));
  text-align: center;
}

.stage__logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mark {
  width: clamp(92px, min(30vw, 21vh), 176px);
  aspect-ratio: 640 / 664;
  background-color: var(--ink);
  -webkit-mask: url("/assets/logo-mark.png?v=fee78e32") center / contain no-repeat;
  mask: url("/assets/logo-mark.png?v=fee78e32") center / contain no-repeat;
}

/*
  Display width is capped against the mask's own resolution. The wordmark is
  1478px of real ink, ~739px of it original — 430px on screen survives DPR 3.
  Going wider would visibly soften it. See tools/build-logo-masks.py.
*/
.wordmark {
  width: clamp(210px, min(62vw, 44vh), 430px);
  aspect-ratio: 1478 / 211;
  margin-top: clamp(13px, 3vh, 30px);
  -webkit-mask: url("/assets/logo-wordmark.png?v=d095ace0") center / contain no-repeat;
  mask: url("/assets/logo-wordmark.png?v=d095ace0") center / contain no-repeat;
  background-color: var(--ink);
  background-image: linear-gradient(
    100deg,
    transparent 40%,
    var(--zari) 50%,
    transparent 60%
  );
  background-repeat: no-repeat;
  background-size: 260% 100%;
  background-position: -90% 0;
}

.tagline {
  margin: clamp(17px, 4vh, 38px) 0 0;
  margin-right: -0.28em; /* cancels the trailing letter-space so it centres true */
  font-size: clamp(8.5px, 2.4vw, 10px);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.rule {
  width: 46px;
  height: 1px;
  margin: clamp(15px, 3.4vh, 34px) 0 0;
  background: var(--brass);
  transform-origin: center;
}

.line {
  margin: clamp(15px, 3.4vh, 34px) 0 0;
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(24px, min(7vw, 5.4vh), 40px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.line__soon {
  display: block;
  margin-top: 0.34em;
  font-family: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  font-style: normal;
  font-size: clamp(9px, 2.5vw, 10.5px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- signup */

.signup {
  margin-top: clamp(21px, 5vh, 52px);
  width: 100%;
  max-width: 320px;
}

.signup__label {
  display: block;
  font-size: clamp(10px, 2.8vw, 11px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.signup__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--hairline);
  transition: border-color 0.4s ease;
}
.signup__row:focus-within {
  border-bottom-color: var(--ink);
}

.signup__input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 2px 0;
  background: none;
  font-family: inherit;
  font-size: 15px; /* 16px-ish keeps iOS from zooming the viewport on focus */
  color: var(--ink);
}
.signup__input::placeholder {
  color: var(--ink-faint);
}

.signup__go {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color 0.4s ease,
    color 0.4s ease,
    border-color 0.4s ease;
}
.signup__go svg {
  width: 15px;
  height: 15px;
}
.signup__go:hover,
.signup__go:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--muslin);
}
.signup__go[disabled] {
  opacity: 0.4;
  cursor: default;
}

/* Off-screen rather than display:none — some bots skip anything not rendered. */
.signup__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.signup__msg {
  margin: 12px 0 0;
  min-height: 1em;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--flesh);
}
/* Not every message is a failure — the mail-client handoff is just news. */
.signup__msg--note {
  color: var(--ink-soft);
}

.signup__done {
  animation: ww-fade-up 0.9s var(--ease-drape) both;
}
.signup__thanks {
  margin: 0;
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-style: italic;
  font-size: 19px;
}
.signup__group {
  display: inline-block;
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-underline-offset: 4px;
  transition: color 0.4s ease;
}
.signup__group:hover {
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- footer */

/*
  Deliberately NOT margin-top:auto. Pinning the footer to the viewport floor
  fights the column's own centring and tears a dead hole through the middle of
  the page on anything taller than a phone. Sitting it directly under the
  signup keeps the whole thing one composed lockup.
*/
.footer {
  padding-top: clamp(24px, 5.5vh, 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  font-size: clamp(8.5px, 2.4vw, 9.5px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.footer__social {
  display: flex;
  align-items: center;
  gap: 18px;
}

/*
  44px hit area around a 19px glyph. The icon can stay small and quiet without
  becoming something you have to aim at with a thumb.
*/
.footer__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -12px;
  color: var(--ink-faint);
  transition: color 0.4s ease;
}
.footer__icon svg {
  width: 19px;
  height: 19px;
}
.footer__icon:hover,
.footer__icon:focus-visible {
  color: var(--ink);
}

/* ---------------------------------------------------------- sound toggle */

/* Top right, not the conventional bottom right: down there it collides with
   the footer links on a phone, and a control that overlaps the address is
   worse than an unconventional one. */
.sound {
  position: fixed;
  z-index: 4;
  right: max(16px, env(safe-area-inset-right));
  top: max(16px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 9px;
  /* Padding, not a pill. A bordered chip is the loudest object on a page this
     quiet; the control still gets a 40px-tall hit area from the padding. */
  padding: 12px 8px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.4s ease;
}
.sound:hover {
  color: var(--ink);
}
.sound[hidden] {
  display: none;
}

.sound__bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}
.sound__bars i {
  width: 2px;
  height: 3px;
  background: currentColor;
  transition: height 0.3s ease;
}
.sound[aria-pressed="true"] .sound__bars i {
  animation: ww-bars 1.15s ease-in-out infinite;
}
.sound[aria-pressed="true"] .sound__bars i:nth-child(2) {
  animation-delay: 0.16s;
}
.sound[aria-pressed="true"] .sound__bars i:nth-child(3) {
  animation-delay: 0.34s;
}
.sound[aria-pressed="true"] .sound__bars i:nth-child(4) {
  animation-delay: 0.5s;
}

@keyframes ww-bars {
  0%,
  100% {
    height: 3px;
  }
  50% {
    height: 11px;
  }
}

/* =========================================================== the sequence

   Everything below only applies when the head bootstrap decided animation was
   genuinely possible. The from-states live exclusively under .ww-motion, so
   without JS, or with reduced motion, the page is simply, completely there.

   The hidden pre-state is scoped to .ww-armed:not(.is-live). That matters: the
   head bootstrap drops .ww-armed after 6s if app.js never loads, so the stage
   becomes visible instead of staying blank forever. It is deliberately NOT
   gated on .ww-motion, because reduced motion gets a cross-fade sequence too.
   ======================================================================== */

.ww-armed:not(.is-live) .stage__logo,
.ww-armed:not(.is-live) .tagline,
.ww-armed:not(.is-live) .rule,
.ww-armed:not(.is-live) .line,
.ww-armed:not(.is-live) .signup,
.ww-armed:not(.is-live) .footer {
  opacity: 0;
}

/* Beat 1 + 2 — the mark resolves under a travelling light, then settles. */
.ww-motion.ww-sweep.is-live .mark {
  background-color: transparent;
  background-image: conic-gradient(
    from -90deg at var(--mark-cx) var(--mark-cy),
    var(--ink) 0deg,
    var(--ink) calc(var(--ww-sweep) - 9deg),
    var(--brass) var(--ww-sweep),
    rgba(33, 28, 23, 0) var(--ww-sweep)
  );
  animation:
    ww-sweep 1.6s cubic-bezier(0.45, 0, 0.25, 1) 0.2s both,
    ww-settle 0.9s var(--ease-drape) 1.4s both;
}

/* Fallback when @property is unavailable: no pop, just a fade and settle. */
.ww-motion.is-live:not(.ww-sweep) .mark {
  animation: ww-fade-in 1.4s var(--ease-drape) 0.2s both;
}

@keyframes ww-sweep {
  from {
    --ww-sweep: 0deg;
  }
  to {
    --ww-sweep: 360deg;
  }
}

@keyframes ww-settle {
  from {
    transform: scale(1.022);
    filter: blur(1.4px);
  }
  to {
    transform: none;
    filter: blur(0);
  }
}

/* Beat 3 + 4 — the wordmark wipes open, then a zari thread crosses it.
   The shimmer keyframe spends 87% of its cycle parked off-screen, which is how
   one 14s animation produces a glint every 14s without a timer. */
.ww-motion.is-live .wordmark {
  animation:
    ww-wipe 1.3s var(--ease-drape) 1.9s both,
    ww-shimmer 14s linear 3.6s infinite;
}

@keyframes ww-wipe {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes ww-shimmer {
  0% {
    background-position: -90% 0;
  }
  13% {
    background-position: 190% 0;
  }
  100% {
    background-position: 190% 0;
  }
}

/* Beat 5 — the tagline letter-spaces open. margin-right tracks the spacing so
   the line stays optically centred while it expands. */
.ww-motion.is-live .tagline {
  animation: ww-tagline 1.6s var(--ease-drape) 2.6s both;
}

@keyframes ww-tagline {
  from {
    opacity: 0;
    letter-spacing: 0.02em;
    margin-right: -0.02em;
  }
  to {
    opacity: 1;
    letter-spacing: 0.28em;
    margin-right: -0.28em;
  }
}

/* Beat 6 — the hairline draws. */
.ww-motion.is-live .rule {
  animation: ww-rule 1s var(--ease-drape) 3.4s both;
}

@keyframes ww-rule {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

/* Beat 7 — the words and the working parts, last and staggered. */
.ww-motion.is-live .line {
  animation: ww-fade-up 1.1s var(--ease-drape) 3.1s both;
}
.ww-motion.is-live .signup {
  animation: ww-fade-up 0.9s var(--ease-drape) 3.9s both;
}
.ww-motion.is-live .footer {
  animation: ww-fade-up 0.9s var(--ease-drape) 4.2s both;
}

@keyframes ww-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes ww-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ------------------------------------------------------------------------
   Reduced motion — a cross-fade, not a blank refusal.

   "Reduce motion" does not mean "show me nothing". What actually harms people
   with vestibular sensitivity is *movement*: translation, scale, parallax,
   and anything that loops. Opacity is not movement. And Android switches this
   setting on by itself in battery saver, so a good number of visitors land
   here having never asked for it — snapping the page into existence just
   reads as broken.

   So the same seven beats play out purely as staggered cross-fades. Nothing
   travels, nothing scales, nothing repeats.
   ------------------------------------------------------------------------ */

.ww-reduced.is-live .stage__logo {
  animation: ww-fade-in 0.8s ease 0.1s both;
}
.ww-reduced.is-live .tagline {
  animation: ww-fade-in 0.8s ease 0.45s both;
}
.ww-reduced.is-live .rule {
  animation: ww-fade-in 0.8s ease 0.65s both;
}
.ww-reduced.is-live .line {
  animation: ww-fade-in 0.8s ease 0.85s both;
}
.ww-reduced.is-live .signup {
  animation: ww-fade-in 0.8s ease 1.05s both;
}
.ww-reduced.is-live .footer {
  animation: ww-fade-in 0.8s ease 1.2s both;
}

/*
  Scoped to the .ww-reduced CLASS, not to @media (prefers-reduced-motion).

  That matters: the head bootstrap is the single place that decides whether a
  visitor is treated as reduced-motion, and it currently forces motion on for
  everyone (see FORCE_MOTION in index.html). A raw media query here would
  ignore that decision and go on killing these animations with !important.
*/
.ww-reduced .wordmark,
.ww-reduced .mark,
.ww-reduced .sound__bars i {
  animation: none !important;
}
.ww-reduced .signup__done {
  animation: ww-fade-in 0.6s ease both !important;
}
.ww-reduced *,
.ww-reduced *::before,
.ww-reduced *::after {
  transition-duration: 0.01ms !important;
}

/* ------------------------------------------------------------ wide screens */

@media (min-width: 900px) {
  .stage {
    padding-top: clamp(56px, 11vh, 96px);
  }
}

/*
  Short viewports — a phone turned sideways, or a desktop browser zoomed well
  in. Below this height the clamp *floors* are what dominate, not the vh terms,
  so the composition stops shrinking and pushes the footer off the bottom. The
  air gets cut rather than the content.
*/
@media (max-height: 560px) {
  .stage {
    padding: 18px 24px max(14px, env(safe-area-inset-bottom));
  }
  .mark {
    width: clamp(62px, 19vh, 112px);
  }
  .wordmark {
    width: clamp(180px, min(52vw, 40vh), 300px);
    margin-top: 10px;
  }
  .tagline,
  .rule,
  .line {
    margin-top: 11px;
  }
  .line {
    font-size: clamp(18px, 5vh, 26px);
  }
  .signup {
    margin-top: 15px;
  }
  .signup__row {
    margin-top: 9px;
  }
  .footer {
    padding-top: 17px;
    gap: 11px;
  }
}
