:root {
  --ground:    #E7ECEB;
  --ink:       #1C2B2E;
  --ink-soft:  #6E807F;
  --rule:      #C3CECC;
  --trace:     #34426E;

  --spine:     62%;
  --pad:       clamp(20px, 4.5vw, 46px);
  --serif:     "Young Serif", Georgia, serif;
  --mono:      "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --cycle:     8.5s;
}

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

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

body {
  margin: 0;
  min-height: 100svh;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* ---- meta rows ---- */

.meta {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.top {
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule);
}

.bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

/* Sits in the footer row, so it takes the meta type as it finds it and only
   picks up the colour change the other links on the page have. */
.address {
  color: inherit;
  text-decoration: none;
  transition: color 0.25s;
}

.address:hover,
.address:focus-visible { color: var(--trace); }

.address:focus-visible { outline: 2px solid var(--trace); outline-offset: 4px; border-radius: 1px; }

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

main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 12vh, 8rem) 0;
}

/* ---- the snare ----
   A gin is a snare: a wire strung between two anchors that waits.
   It is taut and silent, something crosses it, and it registers
   the crossing by ringing until the energy is gone. */

.wire {
  position: absolute;
  top: 0;
  left: var(--spine);
  width: 48px;
  height: 100%;
  transform: translateX(-50%);
  pointer-events: none;
  overflow: visible;
}

.wire path {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
  animation: ring var(--cycle) linear infinite;
}

/* The track ends exactly at the wire and clips, so whatever crosses
   is swallowed at the moment of contact rather than passing through. */
.track {
  position: absolute;
  left: 0;
  width: var(--spine);
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}

.track--high { top: 38%; }
.track--low  { top: 62%; }

.trace {
  position: absolute;
  top: 0;
  height: 1px;
  opacity: 0;
  background: linear-gradient(to right, transparent, var(--trace));
}

.track--high .trace { width: 130px; animation: cross-high var(--cycle) linear infinite; }
.track--low  .trace { width: 90px;  animation: cross-low  var(--cycle) linear infinite; }

/* ---- hero ---- */

.wordmark {
  position: relative;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(4.5rem, 20vw, 15rem);
  line-height: 0.86;
  letter-spacing: -0.03em;
}

.status {
  position: relative;
  margin: 1.6rem 0 0;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.contact {
  position: relative;
  margin-top: clamp(3rem, 9vh, 5.5rem);
}

.cta {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ink);
  transition: color 0.25s, border-color 0.25s;
}

.cta:hover,
.cta:focus-visible { color: var(--trace); border-color: var(--trace); }

.cta:focus-visible { outline: 2px solid var(--trace); outline-offset: 6px; border-radius: 1px; }

/* ---- subscribe ----
   The call to action used to be a link sitting on a 1px rule. The rule is now
   the input: one more wire, strung like the header and footer rules, that goes
   taut in --trace the moment you touch it. */

.subscribe-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.field {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  /* Never let the field reach the wire — at narrow widths the spine crosses
     where the rule would otherwise end. */
  max-width: min(26rem, calc(var(--spine) - 2.5rem));
  margin-top: 1.1rem;
  border-bottom: 1px solid var(--ink);
  transition: border-color 0.25s, box-shadow 0.25s;
}

/* Doubles the rule rather than thickening the border, so nothing reflows. */
.field:focus-within {
  border-color: var(--trace);
  box-shadow: 0 1px 0 var(--trace);
}

.field-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 0 6px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.field-input::placeholder { color: var(--ink-soft); opacity: 1; }
.field-input:focus { outline: none; }

/* Drawn rather than set, so the arrow is the same hairline as every other
   stroke on the page and travels the way the traces do. */
.field-submit {
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 0 6px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.25s;
}

.field-submit svg {
  display: block;
  width: 26px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.field-submit:hover { color: var(--trace); }

.field-submit:focus-visible {
  color: var(--trace);
  outline: 2px solid var(--trace);
  outline-offset: 6px;
  border-radius: 1px;
}

.field-submit[disabled] { color: var(--rule); cursor: default; }

/* Reserves its own line so the form never reflows when a message lands. */
.note {
  margin: 0.9rem 0 0;
  min-height: 1.2em;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.note[data-state="error"] { color: var(--ink); }

/* Once they are subscribed the wire has done its job — take it away, and let
   the confirmation rather than the contact line be what stands there. */
.subscribe[data-state="done"] .field { display: none; }

.subscribe[data-state="done"] .note {
  margin: 1.1rem 0 1rem;
  color: var(--ink);
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- notice ----
   The page the Worker renders for a subscribe posted without JavaScript. */

.notice-detail {
  max-width: 32rem;
  margin: 0.9rem 0 2.6rem;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.notice .cta { align-self: flex-start; }

@media (max-width: 640px) {
  :root { --spine: 78%; }
  .status { letter-spacing: 0.2em; }
}

/* ---- motion ----
   Two crossings per cycle, deliberately unalike: one high on the wire,
   hard, at 30%; one low, glancing, at 74%. Each ring is a damped
   oscillation at a fixed period with collapsing amplitude, biased
   toward the control point nearest the point of contact.

   Percentages are tuned so the ring keeps its absolute duration
   (~1.17s high, ~0.78s low) regardless of --cycle. Shortening the
   cycle must not speed the wire up — a wire's period is a property
   of the wire, not of how often something hits it. */

@keyframes ring {
  0%,   30.0% { d: path("M24 0C24 130 24 270 24 400"); }

  /* struck high */
  30.6%       { d: path("M24 0C48 130 29 270 24 400"); }
  32.5%       { d: path("M24 0C10 130 18 270 24 400"); }
  34.3%       { d: path("M24 0C38 130 28 270 24 400"); }
  36.1%       { d: path("M24 0C15 130 21 270 24 400"); }
  38.0%       { d: path("M24 0C30 130 26 270 24 400"); }
  39.8%       { d: path("M24 0C20 130 23 270 24 400"); }
  41.6%       { d: path("M24 0C26 130 25 270 24 400"); }
  43.8%, 74.0% { d: path("M24 0C24 130 24 270 24 400"); }

  /* clipped low */
  74.6%       { d: path("M24 0C26 130 42 270 24 400"); }
  76.0%       { d: path("M24 0C23 130 13 270 24 400"); }
  77.4%       { d: path("M24 0C25 130 31 270 24 400"); }
  78.7%       { d: path("M24 0C24 130 19 270 24 400"); }
  80.1%       { d: path("M24 0C24 130 27 270 24 400"); }
  81.5%       { d: path("M24 0C24 130 22 270 24 400"); }
  83.2%, 100% { d: path("M24 0C24 130 24 270 24 400"); }
}

@keyframes cross-high {
  0%,    24.8% { left: -130px; opacity: 0; }
  25.1%        { opacity: 0.9; }
  30.8%        { opacity: 0.9; }
  30.9%, 100%  { left: 100%;   opacity: 0; }
}

@keyframes cross-low {
  0%,    70.2% { left: -90px; opacity: 0; }
  70.5%        { opacity: 0.5; }
  74.6%        { opacity: 0.5; }
  74.7%, 100%  { left: 100%;  opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wire path, .trace { animation: none; }
}
