/* ─────────────────────────────────────────────────────────────
   Clew — under construction
   One sheet of paper. One thread. Nothing else.
   ───────────────────────────────────────────────────────────── */

:root {
  /* paper */
  --paper:        #fcfcfa;
  --paper-ink:    #14151a;
  --ink-soft:     #5c5f6a;
  --ink-faint:    #9a9da6;
  --thread:       #14151a;
  --rule:         #e6e5e0;

  /* type */
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans:  "Inter", -apple-system, "Segoe UI", "Noto Sans SC", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* rhythm */
  --edge: clamp(20px, 6vw, 88px);
  --dur:  900ms;
  --ease: cubic-bezier(.22, .61, .24, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #0d0e11;
    --paper-ink: #edeae3;
    --ink-soft:  #9d9fa8;
    --ink-faint: #5f626b;
    --thread:    #edeae3;
    --rule:      #23252b;
  }
  html { color-scheme: dark; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--paper-ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; }

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

/* ── header ─────────────────────────────────────────────────── */

.top {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: clamp(20px, 3.2vw, 34px) var(--edge) 0;
}

.brand {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: lowercase;
  color: var(--ink-soft);
}
.brand .dot { color: var(--ink-faint); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pulse {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-soft);
  animation: breathe 3.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}

/* ── stage ──────────────────────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: clamp(20px, 4vh, 48px) var(--edge) clamp(20px, 3.5vh, 36px);
}

.stage {
  position: relative;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) 0 clamp(32px, 8vh, 88px);
}

/* the thread */
.thread {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--thread);
  pointer-events: none;
  overflow: visible;
}

.thread .line {
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  opacity: 0;
  transition:
    stroke-dashoffset 2600ms var(--ease),
    opacity 700ms var(--ease);
}

body.ready .thread .line   { stroke-dashoffset: 0; opacity: 1; }
body.ready .line-b { transition-delay: 160ms; }
body.ready .line-c { transition-delay: 320ms; }
body.ready .line-d { transition-delay: 480ms; }

.clew {
  transform-origin: 500px 320px;
  transform: scale(.94);
  opacity: 0;
  color: var(--thread);
  transition:
    opacity 1200ms var(--ease) 700ms,
    transform 1600ms var(--ease) 700ms;
}
body.ready .clew { opacity: 1; transform: scale(1); }

/* after it is drawn, the ball turns slowly — the thread stays wound, not spinning fast */
@media (prefers-reduced-motion: no-preference) {
  body.ready .clew {
    animation: turn 90s linear 2400ms infinite;
  }
}
@keyframes turn {
  from { transform: rotate(0deg) scale(1); }
  to   { transform: rotate(360deg) scale(1); }
}

/* ── type ───────────────────────────────────────────────────── */

.eyebrow {
  position: relative;
  margin: 0 0 clamp(14px, 2.4vw, 22px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.headline {
  position: relative;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(64px, 14.5vw, 208px);
  line-height: .88;
  letter-spacing: -.028em;
  text-wrap: balance;
}
.headline em {
  font-style: italic;
  letter-spacing: -.012em;
  /* the construction word sits a touch lighter than the line above it */
  color: var(--ink-soft);
}

.lede {
  position: relative;
  margin: clamp(26px, 4vw, 40px) 0 0;
  max-width: 34ch;
  font-size: clamp(15px, 1.55vw, 18px);
  line-height: 1.65;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 5vw, 64px);
  margin: clamp(34px, 5.5vw, 60px) 0 0;
  padding-top: clamp(18px, 2.4vw, 24px);
  border-top: 1px solid var(--rule);
  max-width: 620px;
}

.meta > span { display: flex; flex-direction: column; gap: 6px; }

.meta .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.meta .v {
  font-size: 14px;
  letter-spacing: .01em;
  color: var(--paper-ink);
  text-decoration: none;
  text-transform: none;
}

a.v {
  position: relative;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 1px;
  transition: color 180ms var(--ease);
}
a.v:hover { color: var(--ink-soft); }

/* entrance — small stagger, once */
.eyebrow, .headline, .lede, .meta {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 800ms var(--ease),
    transform 800ms var(--ease);
}
body.ready .eyebrow  { opacity: 1; transform: none; transition-delay: 120ms; }
body.ready .headline { opacity: 1; transform: none; transition-delay: 220ms; }
body.ready .lede     { opacity: 1; transform: none; transition-delay: 380ms; }
body.ready .meta     { opacity: 1; transform: none; transition-delay: 520ms; }

/* ── foot ───────────────────────────────────────────────────── */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--edge) clamp(20px, 3vw, 32px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.foot a {
  text-decoration: none;
  transition: color 180ms var(--ease);
}
.foot a:hover { color: var(--paper-ink); }

/* ── focus ──────────────────────────────────────────────────── */

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

/* ── narrow / mobile ────────────────────────────────────────── */

@media (max-width: 640px) {
  .stage { padding: clamp(26px, 5vh, 44px) 0; }
  .headline { font-size: clamp(58px, 19vw, 96px); line-height: .92; }
  .lede { max-width: 30ch; }
  .thread { opacity: .62; }
  .meta { gap: 20px 36px; }
  .foot { flex-direction: column; gap: 6px; }
}

/* landscape phones: let the thread breathe without crowding the type */
@media (max-height: 520px) and (orientation: landscape) {
  .stage { padding: 20px 0; }
  .headline { font-size: clamp(44px, 10vh, 72px); }
  .lede { margin-top: 16px; font-size: 14px; }
  .meta { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }
  .thread .line { stroke-dashoffset: 0; opacity: 1; }
  .clew { opacity: 1; transform: none; }
  .eyebrow, .headline, .lede, .meta { opacity: 1; transform: none; }
}
