@font-face {
  font-family: "Doto";
  src: url("/fonts/doto.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/fonts/martian-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* charcoal silk and warp */
  --silk: #171717;
  --silk-2: #1c1c1c;
  --ink: #242424;
  --steel: #3b3b3b;
  --warp: #0f0f0f;

  /* gilded weft */
  --gold: #d9b23e;
  --gold-hi: #f2d47c;
  --gold-lo: #9c7b26;
  --gold-rule: rgb(217 178 62 / 0.42);
  --gold-faint: rgb(217 178 62 / 0.17);

  /* punch-card stock */
  --card: #f2ead3;
  --card-ink: #1c1a1f;
  --card-ink-2: #5b5546;

  /* text on silk */
  --text: #eee6d0;
  --text-2: #bdb6a1;
  --text-3: #908a78;

  --display: "Doto", "Martian Mono", ui-monospace, monospace;
  --sans: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", monospace;

  --frame: 14px;
  --pad: clamp(20px, 5vw, 72px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --notch-mask:
    linear-gradient(135deg, transparent 9px, #000 0) top left / 51% 51% no-repeat,
    linear-gradient(-135deg, transparent 9px, #000 0) top right / 51% 51% no-repeat,
    linear-gradient(45deg, transparent 9px, #000 0) bottom left / 51% 51% no-repeat,
    linear-gradient(-45deg, transparent 9px, #000 0) bottom right / 51% 51% no-repeat;
  --twill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M-1 1l2-2M0 6l6-6M5 7l2-2' stroke='%23fff' stroke-opacity='.035'/%3E%3C/svg%3E");
}

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

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--gold-lo) var(--warp);
  scrollbar-width: thin;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background-color: var(--silk);
  background-image: var(--twill);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--gold);
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--silk); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--warp); }
::-webkit-scrollbar-thumb { background: var(--gold-lo); border: 3px solid var(--warp); border-radius: 0; }

a { color: inherit; }
:focus-visible {
  outline: 1px dashed var(--gold-hi);
  outline-offset: 4px;
}

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

.skip {
  position: absolute;
  left: 24px; top: -60px;
  z-index: 50;
  padding: 12px 18px;
  background: var(--gold);
  color: var(--silk);
  font: 600 13px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: top 0.3s var(--ease);
}
.skip:focus { top: 24px; }

/* ---------- the cloth's frame ---------- */

.house {
  margin: var(--frame) var(--frame) 0;
  border: 1px solid var(--gold-rule);
  box-shadow: 0 0 0 4px var(--silk), 0 0 0 5px var(--gold-faint);
  position: relative;
}

/* ---------- masthead ---------- */

.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--gold-rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--gold);
}
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-words { display: grid; gap: 5px; }
.brand-name {
  font: 700 15px/1 var(--sans);
  font-stretch: 125%;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.brand-sub {
  font: 600 10.5px/1 var(--sans);
  font-stretch: 112%;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav { justify-self: end; display: flex; }
.nav a {
  padding: 10px 24px;
  border-left: 1px solid var(--gold-faint);
  font: 600 12px/1 var(--sans);
  font-stretch: 112%;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.25s;
}
.nav a:last-child { border-right: 1px solid var(--gold-faint); }
.nav a:hover { color: var(--gold-hi); }

/* ---------- buttons: notched like a woven label ---------- */

.btn {
  --n: 9px;
  --bg: var(--gold);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 54px;
  padding: 0 24px 0 26px;
  border: 0;
  color: var(--silk);
  font: 650 13px/1 var(--sans);
  font-stretch: 112%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  background:
    linear-gradient(135deg, transparent var(--n), var(--bg) 0) top left / 51% 51% no-repeat,
    linear-gradient(-135deg, transparent var(--n), var(--bg) 0) top right / 51% 51% no-repeat,
    linear-gradient(45deg, transparent var(--n), var(--bg) 0) bottom left / 51% 51% no-repeat,
    linear-gradient(-45deg, transparent var(--n), var(--bg) 0) bottom right / 51% 51% no-repeat;
  transition: transform 0.5s var(--ease), color 0.25s;
}
.btn:hover { --bg: var(--gold-hi); transform: translateY(-2px); }
.btn:active { transform: translateY(0); transition-duration: 0.1s; }
.btn-sm { min-height: 44px; padding: 0 18px 0 20px; font-size: 12px; }
.btn-dots { width: 10px; height: 14px; opacity: 0.8; }

/* the gold is woven: fine weft filaments across the face */
.btn-gold::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(180deg, rgb(255 248 214 / 0.2) 0 1px, transparent 1px 3px);
  -webkit-mask: var(--notch-mask);
  mask: var(--notch-mask);
  pointer-events: none;
}

.btn-thread {
  color: var(--gold);
  background: none;
}
.btn-thread::before,
.btn-thread::after {
  content: "";
  position: absolute;
  z-index: -1;
}
.btn-thread::before {
  --bg: var(--gold-rule);
  inset: 0;
  background:
    linear-gradient(135deg, transparent var(--n), var(--bg) 0) top left / 51% 51% no-repeat,
    linear-gradient(-135deg, transparent var(--n), var(--bg) 0) top right / 51% 51% no-repeat,
    linear-gradient(45deg, transparent var(--n), var(--bg) 0) bottom left / 51% 51% no-repeat,
    linear-gradient(-45deg, transparent var(--n), var(--bg) 0) bottom right / 51% 51% no-repeat;
}
.btn-thread::after {
  --bg: var(--silk);
  inset: 1px;
  background:
    linear-gradient(135deg, transparent calc(var(--n) - 0.6px), var(--bg) 0) top left / 51% 51% no-repeat,
    linear-gradient(-135deg, transparent calc(var(--n) - 0.6px), var(--bg) 0) top right / 51% 51% no-repeat,
    linear-gradient(45deg, transparent calc(var(--n) - 0.6px), var(--bg) 0) bottom left / 51% 51% no-repeat,
    linear-gradient(-45deg, transparent calc(var(--n) - 0.6px), var(--bg) 0) bottom right / 51% 51% no-repeat;
}
.btn-thread:hover { color: var(--gold-hi); }
.btn-thread:hover::before { --bg: var(--gold); }

/* ---------- hero: the loom ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  height: clamp(600px, calc(100svh - 118px), 940px);
  border-bottom: 1px solid var(--gold-rule);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 4.4vw, 72px);
  border-right: 1px solid var(--gold-rule);
}

.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.9rem, 5.6vw, 5.6rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--gold);
  text-wrap: balance;
}

.stitch {
  width: 100%;
  margin: clamp(24px, 3vw, 36px) 0;
  border: 0;
  border-top: 1px dashed var(--gold-rule);
}

.lede {
  max-width: 46ch;
  margin: 0;
  color: var(--text-2);
  font-size: clamp(16px, 1.2vw, 18px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: clamp(28px, 3vw, 40px);
}

.loom {
  margin: 0;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.loom-bar {
  display: flex;
  border-bottom: 1px solid var(--gold-rule);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-right: 1px solid var(--gold-faint);
  white-space: nowrap;
}
.tag b { font-weight: 500; color: var(--text); }

.lamp {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgb(217 178 62 / 0.18);
}
.is-weaving .lamp { animation: lamp 0.9s steps(2, jump-none) infinite; }
@keyframes lamp { 50% { background: var(--gold-lo); box-shadow: 0 0 0 3px transparent; } }

.loom-cloth {
  min-height: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  padding: 18px 18px 18px 0;
}

.row-scale {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  font: 400 10px/1 var(--mono);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.row-scale li {
  position: absolute;
  right: 12px;
  transform: translateY(-50%);
  transition: color 0.2s;
}
.row-scale li.is-on { color: var(--gold-hi); }

.cloth-frame {
  position: relative;
  min-height: 0;
  border: 1px solid var(--gold-faint);
  background: var(--warp);
  cursor: crosshair;
  touch-action: pan-y;
}
.cloth-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.loom-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  border-top: 1px solid var(--gold-rule);
}
.stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  padding: 14px 20px;
  border-right: 1px solid var(--gold-faint);
}
.stat:last-child { border-right: 0; }
.stat-k {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stat-v {
  font: 400 15px/1 var(--mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-line { display: flex; align-items: center; gap: 14px; }

.stepper { display: inline-flex; }
.step {
  display: grid;
  place-items: center;
  width: 30px; height: 28px;
  padding: 0;
  border: 1px solid var(--gold-faint);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.step + .step { border-left: 0; }
.step svg { width: 14px; height: 14px; }
.step:hover { background: var(--gold-faint); color: var(--gold-hi); }
.step:disabled { color: var(--steel); cursor: default; background: transparent; }

.lift-dots { width: 100%; height: 12px; display: block; }
.lift-dots circle { fill: var(--steel); transition: fill 0.15s; }
.lift-dots circle.on { fill: var(--gold); }
.lift-dots circle.half { fill: var(--gold-lo); }

/* ---------- sections ---------- */

.section {
  padding: clamp(72px, 9vw, 136px) var(--pad);
  border-bottom: 1px solid var(--gold-rule);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  align-items: end;
  gap: 24px 56px;
  margin-bottom: clamp(44px, 5vw, 72px);
}
.section-head p {
  max-width: 50ch;
  margin: 0;
  color: var(--text-2);
}

h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.3rem, 4.4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--gold);
  text-wrap: balance;
}

/* ---------- the card chain ---------- */

.chain {
  --gap: 24px;
  overflow-x: clip;
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  --end: 64px;
  --col: 18px;
  position: relative;
  display: grid;
  grid-template-columns: var(--end) minmax(0, 1fr) auto var(--end);
  min-height: 208px;
  color: var(--card-ink);
  background: var(--card);
}
.card.is-punched { background: none; }
.card > .stock {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.card-body, .card-field { position: relative; }
.card-body {
  grid-column: 2;
  padding: 30px 40px 30px 4px;
}
.card-title {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-weight: 760;
  font-stretch: 78%;
  font-size: clamp(1.75rem, 2.6vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.card-body p:last-child {
  max-width: 56ch;
  margin: 0;
  color: #3b382f;
}
.card-field {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 26px 12px 22px;
}
.field-holes {
  width: calc(var(--col) * 22);
  height: calc(var(--col) * 0.9 * 7);
}
.card-code {
  margin: 0;
  font: 500 9.5px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-ink-2);
  text-align: right;
}

.stock .lift circle {
  fill: var(--gold);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  transition-delay: calc(var(--i) * 28ms);
}
.card:hover .stock .lift circle { opacity: 1; }
.stock .lace { stroke: var(--gold); }

.js .chain .card {
  transition: transform 0.9s var(--ease), opacity 0.9s var(--ease);
  transition-delay: calc(var(--k, 0) * 110ms);
}
.js .chain:not(.is-in) .card {
  opacity: 0;
  transform: translateX(40px);
}

/* ---------- experience: woven bands ---------- */

.bands {
  display: grid;
  gap: clamp(32px, 4vw, 48px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.band-cloth {
  display: block;
  width: 100%;
  height: 120px;
  border-top: 1px solid var(--gold-faint);
  border-bottom: 1px solid var(--gold-faint);
  background: var(--warp);
}
.chain-note {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--text-3);
  text-align: right;
}

.band p {
  max-width: 60ch;
  margin: 14px 0 0;
  color: var(--text-2);
}

/* ---------- contact ---------- */

.contact { border-bottom: 0; }
.contact-panel {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 88px);
  border: 1px solid var(--gold-rule);
  box-shadow: inset 0 0 0 5px var(--silk), inset 0 0 0 6px var(--gold-faint);
  background: rgb(28 28 28 / 0.6);
}
.contact-panel > p {
  max-width: 52ch;
  margin: 24px 0 0;
  color: var(--text-2);
}
.mail {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: clamp(28px, 4vw, 44px);
  font-family: var(--mono);
  font-weight: 400;
  font-stretch: 87.5%;
  font-size: clamp(1.05rem, 3.1vw, 2.5rem);
  line-height: 1.2;
  color: var(--gold-hi);
  text-decoration: underline dashed var(--gold-rule) 1px;
  text-underline-offset: 0.32em;
  overflow-wrap: anywhere;
  transition: color 0.25s, text-decoration-color 0.25s;
}
.mail svg { width: 0.8em; height: 0.8em; flex: none; transition: transform 0.5s var(--ease); }
.mail:hover { color: var(--gold); text-decoration-color: var(--gold); }
.mail:hover svg { transform: translate(3px, -3px); }

.copy-icon, .done-icon { width: 16px; height: 16px; }
.done-icon { display: none; }
.is-copied .copy-icon { display: none; }
.is-copied .done-icon { display: block; }

/* ---------- selvedge and fringe ---------- */

.selvedge {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  padding: 20px var(--pad);
  border-top: 1px solid var(--gold-rule);
  font: 600 11.5px/1.6 var(--sans);
  font-stretch: 112%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.selvedge p { margin: 0; }
.selvedge a { text-decoration: none; color: var(--text-2); }
.selvedge a:hover { color: var(--gold-hi); }

.fringe {
  height: 64px;
  margin: 0 var(--frame);
  overflow: hidden;
}
.fringe svg { display: block; width: 100%; height: 100%; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .tag-wide { display: none; }
  .loom-status { grid-template-columns: auto minmax(0, 1fr) auto; }
  .stat-ground { display: none; }
}

@media (max-width: 980px) {
  :root { --frame: 8px; }
  .nav { display: none; }
  .masthead { grid-template-columns: 1fr auto; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }
  .hero-copy {
    border-right: 0;
    border-bottom: 1px solid var(--gold-rule);
    padding: 40px 24px 44px;
  }
  .display { font-size: clamp(2.5rem, 9.6vw, 4.6rem); }
  .loom-cloth { height: clamp(280px, 72vw, 520px); }

  .section-head { grid-template-columns: minmax(0, 1fr); }

  .card {
    --end: 44px;
    grid-template-columns: var(--end) minmax(0, 1fr) var(--end);
  }
  .card-body { padding: 28px 8px 8px; }
  .card-field {
    grid-column: 2;
    padding: 12px 8px 26px;
  }
  .field-holes { width: 100%; }
  .card-code { text-align: left; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 12.5px; letter-spacing: 0.16em; }
  .brand-mark { width: 28px; height: 28px; }
  .brand { gap: 10px; }
  .masthead { padding: 10px 10px 10px 12px; gap: 12px; }
  .btn-sm { min-height: 40px; padding: 0 14px; font-size: 11px; letter-spacing: 0.14em; }
  .btn-sm .btn-dots { display: none; }

  .masthead > .btn { display: none; }
  .masthead { grid-template-columns: 1fr; }
  .hero-copy { padding: 30px 20px 30px; }
  .stitch { margin: 20px 0; }
  .actions { margin-top: 24px; }
  .actions .btn { flex: 1 1 100%; }
  .hero .btn-thread { display: none; }
  .loom-cloth { height: clamp(240px, 66vw, 300px); }
  .chain-note { text-align: left; }
  .loom-bar .tag { padding: 13px 14px; }
  .loom-cloth { grid-template-columns: 40px minmax(0, 1fr); padding: 14px 12px 14px 0; }
  .row-scale li { right: 8px; }
  .loom-status { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat-lifts { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--gold-faint); border-right: 0; }
  .stat { padding: 12px 14px; }

  .section { padding-left: 18px; padding-right: 18px; }
  .card { --end: 34px; min-height: 0; }
  .card-title { font-size: 1.6rem; }
  .card-body p:last-child { font-size: 15.5px; }
  .contact-panel { padding: 32px 22px; }
  .selvedge { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .js .chain:not(.is-in) .card { opacity: 1; transform: none; }
  .is-weaving .lamp { animation: none; }
  .btn, .mail svg { transition: none; }
}
