/* Zugzwang — shared styles */

:root {
  --bg: #000;
  --fg: #f5f5f5;
  --muted: rgba(245, 245, 245, 0.5);
  --faint: rgba(245, 245, 245, 0.12);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(20px, 5vw, 64px);
}

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

html { background: var(--bg); color-scheme: dark; }

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--fg); color: var(--bg); }

a { color: inherit; text-decoration: none; }

/* ---------- Background ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Faint chessboard that dissolves toward the edges */
.board {
  position: absolute;
  inset: -10%;
  background-image: conic-gradient(
    rgba(255,255,255,0.028) 0 25%, transparent 0 50%,
    rgba(255,255,255,0.028) 0 75%, transparent 0
  );
  background-size: clamp(80px, 11vw, 150px) clamp(80px, 11vw, 150px);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 100%, #000 0%, transparent 75%);
          mask-image: radial-gradient(ellipse 60% 55% at 50% 100%, #000 0%, transparent 75%);
  transform: perspective(900px) rotateX(58deg) translateY(18%);
  transform-origin: 50% 100%;
}

/* Horizon glow */
.glow {
  position: absolute;
  left: 50%;
  bottom: -55vh;
  width: 140vw;
  height: 90vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,0.22), rgba(255,255,255,0.06) 55%, transparent);
  filter: blur(40px);
  animation: breathe 9s ease-in-out infinite;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@keyframes breathe {
  0%, 100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
  50%      { opacity: 1;    transform: translateX(-50%) scale(1.04); }
}

/* ---------- Layout ---------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  padding-inline: var(--gutter);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block: 28px;
}

.wordmark {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.nav-link {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-link:hover { color: var(--fg); }

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 5vh;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(48px, 8vh, 72px);
  align-items: center;
  max-width: 1280px;
}

@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(48px, 6vw, 104px); }
  .hero h1 { font-size: clamp(4rem, 8.6vw, 9.5rem); }
  .zz { justify-self: end; }
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 28px;
}

h1 {
  font-weight: 200;
  font-size: clamp(3.4rem, 13vw, 11.5rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  margin-left: -0.05em;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,0.45));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.meaning {
  margin-top: clamp(28px, 5vh, 48px);
  max-width: 34ch;
  font-size: clamp(1.25rem, 2.4vw, 1.9rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: rgba(245, 245, 245, 0.88);
}
.meaning em {
  font-style: normal;
  color: var(--fg);
  font-weight: 400;
}

.gloss {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.pill {
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--faint);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  vertical-align: middle;
}
.pill:hover { color: var(--fg); border-color: rgba(245,245,245,0.4); }

/* ---------- Board ---------- */
.zz {
  --arrow: 40px;
  --stage-gap: 16px;
  width: 100%;
  max-width: 560px;
}

.zz-head, .zz-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  padding-inline: calc(var(--arrow) + var(--stage-gap));
}
.zz-head { margin-bottom: 16px; align-items: baseline; }

.zz-title {
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.zz-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}

.zz-stage {
  display: grid;
  grid-template-columns: var(--arrow) minmax(0, 1fr) var(--arrow);
  align-items: center;
  gap: var(--stage-gap);
}

.zz-arrow {
  width: var(--arrow);
  height: var(--arrow);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s, transform 0.2s;
}
.zz-arrow svg {
  width: 14px; height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zz-arrow:hover {
  color: var(--fg);
  border-color: rgba(245, 245, 245, 0.4);
  background: rgba(255, 255, 255, 0.06);
}
#zz-prev:hover { transform: translateX(-2px); }
#zz-next:hover { transform: translateX(2px); }
.zz-arrow:focus-visible, .pill:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 3px;
}

@media (max-width: 520px) {
  .zz { --arrow: 30px; --stage-gap: 8px; }
}

/* Side-by-side layout: size the board to the window height so the page fits one screen. */
@media (min-width: 960px) {
  .zz { max-width: min(560px, calc(90svh - 140px)); }
}

.swap { animation: swap 0.45s cubic-bezier(.2,.7,.2,1); }
@keyframes swap {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: none; }
}

.zz-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--faint);
  background: rgba(8, 8, 8, 0.7);
  box-shadow: 0 50px 140px -30px rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  touch-action: none;
  -webkit-user-select: none;
          user-select: none;
}
.zz-board.active { cursor: grab; }

.zz-squares {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.zz-sq { position: relative; }
.zz-sq.light { background: rgba(255, 255, 255, 0.075); }
.zz-sq.dark  { background: rgba(255, 255, 255, 0.015); }

.zz-sq.last::before,
.zz-sq.sel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
}
.zz-sq.sel::before { background: rgba(255, 255, 255, 0.16); }

.zz-sq.dot::after,
.zz-sq.ring::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.zz-sq.dot::after {
  left: 50%; top: 50%;
  width: 24%; height: 24%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.4);
}
.zz-sq.ring::after {
  inset: 7%;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.zz-pieces { position: absolute; inset: 0; pointer-events: none; }

.zz-piece {
  position: absolute;
  left: 0; top: 0;
  width: 12.5%; height: 12.5%;
  transition: transform 0.34s cubic-bezier(.2,.7,.2,1), opacity 0.3s ease;
}
.zz-piece svg { display: block; width: 100%; height: 100%; padding: 7%; }
.zz-piece.w svg {
  fill: #f4f4f4;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.15));
}
.zz-piece.b svg {
  fill: #0b0b0b;
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}
.zz-piece.dragging { transition: none; z-index: 2; }
.zz-piece.gone { opacity: 0; }

.zz-foot { margin-top: 18px; }
#zz-status { font-size: 0.95rem; color: rgba(245, 245, 245, 0.85); }
.zz-actions { display: flex; gap: 8px; flex-shrink: 0; }

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-block: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Entrance ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  animation: in 1.1s cubic-bezier(.2,.7,.2,1) forwards;
}
.d1 { animation-delay: .05s; }
.d2 { animation-delay: .2s; }
.d3 { animation-delay: .45s; }
.d4 { animation-delay: .6s; }
.d5 { animation-delay: .8s; }

@keyframes in {
  to { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; filter: none; }
  .glow, .swap { animation: none; }
  .zz-piece { transition: opacity 0.3s ease; }
}

/* ---------- Nav ---------- */
.nav { display: flex; gap: 28px; }
.nav-link[aria-current="page"] { color: var(--fg); }

/* ---------- Updates ---------- */
.updates {
  width: 100%;
  max-width: 880px;
  padding-block: 10vh 12vh;
}

.page-title {
  font-weight: 200;
  font-size: clamp(3rem, 9vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin-left: -0.04em;
  padding-bottom: 0.1em;
  background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,0.45));
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
}

.page-lede {
  margin-top: 20px;
  max-width: 44ch;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.5;
  color: rgba(245, 245, 245, 0.7);
}

.post-list {
  list-style: none;
  margin-top: clamp(48px, 9vh, 88px);
  border-top: 1px solid var(--faint);
}

.post-link {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px 32px;
  padding-block: 28px;
  border-bottom: 1px solid var(--faint);
  transition: background-color 0.3s ease;
}
.post-link:hover { background: rgba(255, 255, 255, 0.025); }

.post-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-link h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 300;
  letter-spacing: -0.015em;
}
.post-link p {
  margin-top: 8px;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 52ch;
}

.post-arrow {
  color: var(--muted);
  transition: transform 0.25s ease, color 0.25s ease;
}
.post-link:hover .post-arrow { color: var(--fg); transform: translateX(4px); }

@media (max-width: 640px) {
  .post-link { grid-template-columns: minmax(0, 1fr); }
  .post-arrow { display: none; }
}

/* ---------- Article ---------- */
.article {
  width: 100%;
  max-width: 680px;
  padding-block: 8vh 12vh;
}

.back-link {
  display: inline-block;
  margin-bottom: clamp(40px, 8vh, 72px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease;
}
.back-link:hover { color: var(--fg); }

.article .page-title { font-size: clamp(2.8rem, 8vw, 5.2rem); }
.article .post-meta { margin-top: 24px; display: block; }

.prose {
  margin-top: clamp(40px, 7vh, 64px);
  font-size: clamp(1.05rem, 1.4vw, 1.15rem);
  line-height: 1.75;
  color: rgba(245, 245, 245, 0.82);
}
.prose p + p { margin-top: 1.4em; }
.prose h3 {
  margin-top: 2.4em;
  margin-bottom: 0.8em;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.prose blockquote {
  margin: 2em 0;
  padding-left: 22px;
  border-left: 1px solid rgba(245, 245, 245, 0.3);
  font-size: 1.25em;
  line-height: 1.5;
  color: var(--fg);
}

.product-cta { margin-top: clamp(32px, 5vh, 48px); }
.product-cta .pill { display: inline-block; }

.signoff {
  margin-top: 3em;
  padding-top: 28px;
  border-top: 1px solid var(--faint);
  font-size: 1.05rem;
  color: var(--fg);
}

/* ---------- Contact form ---------- */
.contact-form {
  width: 100%;
  max-width: 680px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 32px;
  padding-block: 10vh;
}
.field-wide { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .contact-form { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

.field { display: flex; flex-direction: column; gap: 10px; }
.field label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.optional { color: rgba(245, 245, 245, 0.3); letter-spacing: 0.08em; }

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(245, 245, 245, 0.2);
  border-radius: 0;
  padding: 6px 0 12px;
  outline: none;
  resize: vertical;
  transition: border-color 0.25s ease;
}
.field textarea { min-height: 7.5em; line-height: 1.5; }
.field input:hover,
.field textarea:hover { border-color: rgba(245, 245, 245, 0.4); }
.field input:focus,
.field textarea:focus { border-color: var(--fg); }
.field.invalid input,
.field.invalid textarea { border-color: #ff8a80; }
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px #000 inset;
}

.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.form-status { font-size: 0.9rem; color: var(--muted); min-height: 1.4em; }

.send {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  color: #000;
  background: var(--fg);
  border: 0;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.send span { transition: transform 0.25s ease; }
.send:hover { background: #fff; }
.send:hover span { transform: translateX(3px); }
.send:disabled { opacity: 0.5; cursor: default; }
.send:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

.form-done { padding-block: 10vh; text-align: center; }
.form-done-title {
  font-weight: 200;
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  letter-spacing: -0.04em;
  line-height: 1;
}
.form-done-sub { margin-top: 16px; color: var(--muted); font-size: 1.05rem; }

/* Four nav links don't fit beside the wordmark on a phone: stack the header. */
@media (max-width: 640px) {
  header { flex-wrap: wrap; row-gap: 16px; padding-block: 22px; }
  .nav { gap: 18px; flex-wrap: wrap; }
  .nav-link { font-size: 11px; letter-spacing: 0.1em; }
}
