/* ============================================================
   Leapfar Labs · "The Ledger"
   Bone paper, ink black, one vermilion stamp. Everything on this
   page is an entry: numbered, dated, ruled off.
   ============================================================ */

:root {
  --ground:      #f2efe6;
  --ground-2:    #eae6db;
  --ink:         #0b0b0b;
  --ink-soft:    #56534c;
  --line:        rgba(11, 11, 11, 0.22);
  --line-soft:   rgba(11, 11, 11, 0.12);
  --red:         #e8290b;
  --focus:       #e8290b;

  --pad:         clamp(1.15rem, 4.2vw, 4.5rem);
  --maxw:        1500px;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;

  --mark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><path fill='%23000' d='M0 33.92H28.16V64H0Z M35.84 0H64V30.08H35.84Z'/></svg>");

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:    #0b0b0b;
    --ground-2:  #141414;
    --ink:       #ece8de;
    --ink-soft:  #928d83;
    --line:      rgba(236, 232, 222, 0.24);
    --line-soft: rgba(236, 232, 222, 0.13);
    --red:       #ff3d18;
    --focus:     #ff3d18;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  line-height: 1.52;
  font-variation-settings: "wdth" 100, "wght" 420;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* paper grain, sits above the ground and below everything else */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='0.42'/></svg>");
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
  body::before { mix-blend-mode: screen; opacity: 0.16; }
}

main, header, footer { position: relative; z-index: 1; }

a { color: inherit; }

::selection { background: var(--red); color: #fff; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--ground);
  padding: 0.7rem 1rem;
  z-index: 99;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.skip:focus { left: 0; }

/* ---------- shared furniture ---------- */

.rule {
  height: 1px;
  background: var(--line);
  transform-origin: left center;
}
.rule-thick { height: 5px; background: var(--ink); }

.eyebrow,
.hero-meta,
.chip,
.facts dt,
.facts .when,
.idx,
.entry-go,
.footer-h,
.colophon,
.opt,
.status,
label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  font-weight: 500;
}

.display {
  font-family: var(--sans);
  font-variation-settings: "wdth" 70, "wght" 900;
  text-transform: uppercase;
  line-height: 0.83;
  letter-spacing: -0.028em;
  margin: 0;
  overflow-wrap: anywhere;
}

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

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--line);
}
.masthead-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.62rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
/* same two-block "leap" geometry as assets/mark.svg */
.wordmark-mark {
  width: 16px;
  height: 16px;
  display: inline-block;
  background: var(--red);
  -webkit-mask-image: var(--mark);
  mask-image: var(--mark);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.masthead-nav {
  display: flex;
  gap: clamp(0.85rem, 2.2vw, 2rem);
  align-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.masthead-nav a { text-decoration: none; padding: 0.25rem 0; border-bottom: 1px solid transparent; }
.masthead-nav a:hover { border-bottom-color: var(--red); color: var(--red); }
.masthead-nav .nav-cta {
  background: var(--ink);
  color: var(--ground);
  padding: 0.35rem 0.7rem;
  border: 0;
}
.masthead-nav .nav-cta:hover { background: var(--red); color: #fff; }
@media (max-width: 560px) {
  .masthead-nav a:not(.nav-cta) { display: none; }
}

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

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.4rem, 4vw, 3rem) var(--pad) clamp(2.5rem, 6vw, 5rem);
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  padding: 0.7rem 0;
  color: var(--ink-soft);
}
.hero-meta-end { margin-left: auto; color: var(--red); }

.hero h1 {
  margin: clamp(1.6rem, 4.5vw, 3.4rem) 0 clamp(1.8rem, 4vw, 3rem);
  font-size: clamp(3.1rem, 12.6vw, 11.2rem);
}
.d-line { display: block; }
.d-line em {
  font-style: normal;
  color: var(--red);
  position: relative;
}
.d-line em::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.1em;
  height: 0.075em;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  animation: draw 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.45s forwards;
}
@keyframes draw { to { transform: scaleX(1); } }

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.6rem, 4vw, 4rem);
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: clamp(1.2rem, 2.5vw, 2rem);
}
@media (max-width: 860px) { .hero-foot { grid-template-columns: 1fr; } }

.lede {
  margin: 0;
  font-size: clamp(1.08rem, 1.5vw, 1.4rem);
  line-height: 1.45;
  max-width: 46ch;
  font-variation-settings: "wdth" 100, "wght" 450;
}

.stamp-block {
  margin: 0;
  border: 2px solid var(--ink);
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.35rem;
  justify-self: end;
  width: min(100%, 24rem);
  transform: rotate(-1.1deg);
  background: var(--ground);
}
.stamp-block > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dotted var(--line);
  padding-bottom: 0.3rem;
}
.stamp-block > div:last-child { border-bottom: 0; padding-bottom: 0; }
.stamp-block dt {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stamp-block dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-align: right;
}

/* ---------- marquee ---------- */

.marquee {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: var(--red);
  color: #fff;
  overflow: hidden;
  padding: 0.5rem 0;
}
.marquee-track {
  display: flex;
  gap: 1.6rem;
  width: max-content;
  animation: slide 34s linear infinite;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
}
.marquee-track b { opacity: 0.6; }
@keyframes slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

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

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 7rem) var(--pad);
}
.sec-head { margin-bottom: clamp(1.8rem, 4vw, 3.2rem); }
.eyebrow { color: var(--red); margin: 0 0 0.75rem; }
.display-sm { font-size: clamp(2.2rem, 6.4vw, 5rem); }
.sec-note {
  margin: 1rem 0 0;
  max-width: 52ch;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

/* ---------- the lab ---------- */

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(1.8rem, 5vw, 5rem);
  border-top: 5px solid var(--ink);
  padding-top: clamp(1.4rem, 3vw, 2.4rem);
}
@media (max-width: 900px) { .lab-grid { grid-template-columns: 1fr; } }

.lab-intro p {
  margin: 0 0 1.1rem;
  font-size: clamp(1.02rem, 1.2vw, 1.18rem);
  max-width: 44ch;
}
.lab-list { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.lab-list li {
  display: grid;
  /* the number owns column 1 across both rows; heading and copy stay in
     column 2, or the paragraph wraps inside a 3.4rem gutter */
  grid-template-columns: 3.4rem minmax(0, 1fr);
  grid-template-areas:
    "num head"
    "num body";
  gap: 0 1rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
}
.lab-list li:first-child { border-top: 1px solid var(--line); }
.lab-list .idx { grid-area: num; color: var(--red); padding-top: 0.42rem; }
.lab-list h3 { grid-area: head; }
.lab-list p { grid-area: body; }
.lab-list h3 {
  margin: 0 0 0.3rem;
  font-size: 1.45rem;
  font-variation-settings: "wdth" 84, "wght" 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}
.lab-list p { margin: 0; color: var(--ink-soft); max-width: 46ch; }

/* ---------- product ledger ---------- */

.ledger { list-style: none; margin: 0; padding: 0; border-top: 5px solid var(--ink); }

.entry { border-bottom: 1px solid var(--line); }

.entry-link {
  display: block;
  text-decoration: none;
  padding: clamp(1.3rem, 2.8vw, 2.3rem) clamp(0.5rem, 1.5vw, 1.4rem);
  position: relative;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}
a.entry-link:hover,
a.entry-link:focus-visible {
  background: var(--ink);
  color: var(--ground);
  transform: translateX(clamp(2px, 0.6vw, 10px));
}
a.entry-link:hover .facts dt,
a.entry-link:hover .entry-desc,
a.entry-link:focus-visible .facts dt,
a.entry-link:focus-visible .entry-desc { color: color-mix(in srgb, var(--ground) 78%, var(--ink)); }
a.entry-link:hover .bar span,
a.entry-link:focus-visible .bar span { background: var(--red); }
a.entry-link:hover .entry-go,
a.entry-link:focus-visible .entry-go { color: var(--ground); }

.entry-top {
  display: flex;
  align-items: baseline;
  gap: clamp(0.7rem, 2vw, 1.6rem);
  flex-wrap: wrap;
}
.entry-top .idx { color: var(--red); }
.entry-name {
  margin: 0;
  font-size: clamp(2rem, 5.6vw, 4.2rem);
  font-variation-settings: "wdth" 72, "wght" 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 0.92;
}
.chip {
  border: 1px solid currentColor;
  padding: 0.24rem 0.55rem;
  font-size: 0.6rem;
  white-space: nowrap;
}
.chip-live { color: var(--red); }
.chip-part { color: currentColor; opacity: 0.75; }
.chip-build { color: var(--ink-soft); }
a.entry-link:hover .chip-build { color: color-mix(in srgb, var(--ground) 70%, var(--ink)); }

.entry-desc {
  margin: 0.9rem 0 1.3rem;
  max-width: 58ch;
  color: var(--ink-soft);
  transition: color 0.22s ease;
}

.facts {
  margin: 0 0 1.3rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.9rem clamp(1rem, 3vw, 2.6rem);
}
.facts > div { display: grid; gap: 0.15rem; align-content: start; }
.facts dt { color: var(--ink-soft); transition: color 0.22s ease; }
.facts dd {
  margin: 0;
  font-size: 1.02rem;
  font-variation-settings: "wdth" 92, "wght" 620;
}
.facts .when {
  font-size: 0.62rem;
  font-weight: 400;
  color: var(--red);
  letter-spacing: 0.1em;
}

.bar {
  height: 6px;
  background: var(--line-soft);
  overflow: hidden;
  margin-bottom: 0.8rem;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1), background 0.22s ease;
}

.entry-go {
  color: var(--red);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.entry-go::after { content: "\2197"; font-size: 0.95em; }

/* ---------- house rules (inverted slab) ---------- */

.section-invert {
  --ground: #0b0b0b;
  --ink: #ece8de;
  --ink-soft: #99948a;
  --line: rgba(236, 232, 222, 0.22);
  --line-soft: rgba(236, 232, 222, 0.12);
  --red: #ff3d18;
  background: var(--ground);
  color: var(--ink);
  max-width: none;
  padding-inline: 0;
}
@media (prefers-color-scheme: dark) {
  .section-invert {
    --ground: #ece8de;
    --ink: #0b0b0b;
    --ink-soft: #56534c;
    --line: rgba(11, 11, 11, 0.22);
    --line-soft: rgba(11, 11, 11, 0.12);
    --red: #d81f00;
  }
}
.section-invert > * {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* explicit column counts, never auto-fit: four rules must land 1x4 or 2x2,
   an auto-fit 3+1 leaves an orphan with half a row of dead space */
.rules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 620px) { .rules { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .rules { grid-template-columns: repeat(4, 1fr); } }

.rules article {
  padding: clamp(1.4rem, 2.6vw, 2.2rem) clamp(1rem, 2vw, 1.8rem) clamp(1.8rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.rules article:last-child { border-right: 0; }
@media (min-width: 620px) and (max-width: 1079.98px) {
  .rules article:nth-child(2n) { border-right: 0; }
}
@media (max-width: 619.98px) {
  .rules article { border-right: 0; }
}
.rules h3 {
  margin: 0 0 0.7rem;
  font-size: 1.35rem;
  font-variation-settings: "wdth" 80, "wght" 800;
  text-transform: uppercase;
  letter-spacing: -0.008em;
}
.rules h3::before {
  content: "";
  display: block;
  width: 2.1rem;
  height: 4px;
  background: var(--red);
  margin-bottom: 0.8rem;
}
.rules p { margin: 0; color: var(--ink-soft); }

/* ---------- enquiry ---------- */

.section-enquiry { padding-bottom: clamp(3.5rem, 8vw, 7rem); }

.form { border-top: 5px solid var(--ink); padding-top: clamp(1.6rem, 3vw, 2.6rem); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1.2rem, 2.6vw, 2.2rem);
}
.field { margin: 0; display: grid; gap: 0.45rem; }
.field-wide { grid-column: 1 / -1; }
.field label { color: var(--ink-soft); }
.opt { color: var(--red); letter-spacing: 0.08em; }

input[type="text"],
input[type="email"],
select,
textarea {
  font: inherit;
  font-family: var(--sans);
  font-variation-settings: "wdth" 96, "wght" 500;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem 0.1rem;
  border-radius: 0;
  width: 100%;
  transition: border-color 0.18s ease, background 0.18s ease;
}
textarea { resize: vertical; min-height: 7.5rem; line-height: 1.5; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 0.8rem center, right 0.45rem center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 1.8rem;
}
select option { background: var(--ground); color: var(--ink); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--red);
  background: color-mix(in srgb, var(--red) 6%, transparent);
}
input[aria-invalid="true"],
textarea[aria-invalid="true"] { border-bottom-color: var(--red); }

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

.consent {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: clamp(1.4rem, 3vw, 2.2rem) 0 0;
  max-width: 62ch;
}
.consent input {
  appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid var(--ink);
  flex: 0 0 auto;
  margin-top: 0.22rem;
  display: grid;
  place-content: center;
  cursor: pointer;
}
.consent input:checked { background: var(--red); border-color: var(--red); }
.consent input:checked::after {
  content: "";
  width: 0.5rem;
  height: 0.28rem;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.consent label,
.consent span {
  font-family: var(--sans);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.consent label { cursor: pointer; }
.consent a { color: var(--red); }

.form-foot {
  margin-top: clamp(1.6rem, 3vw, 2.4rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.2rem;
}
.submit {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--ground);
  border: 0;
  padding: 1rem 1.6rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  transition: background 0.18s ease, gap 0.18s ease;
}
.submit:hover:not(:disabled) { background: var(--red); color: #fff; gap: 1.5rem; }
.submit:disabled { opacity: 0.55; cursor: progress; }
.submit-arrow { transition: transform 0.18s ease; }

.status { margin: 0; color: var(--ink-soft); max-width: 40ch; line-height: 1.5; }
.status.ok { color: var(--red); }
.status.err { color: var(--red); }

.form.sent .form-grid,
.form.sent .consent,
.form.sent .submit { display: none; }
.form.sent .form-foot { margin-top: 0; }
.form.sent .status {
  font-family: var(--sans);
  text-transform: none;
  letter-spacing: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
  font-variation-settings: "wdth" 88, "wght" 700;
  color: var(--ink);
  max-width: 34ch;
}

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

.footer { margin-top: clamp(2rem, 5vw, 4rem); }
.footer-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.8rem, 4vw, 3.2rem) var(--pad) clamp(2.4rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 0.7fr)) minmax(0, 1.2fr);
  gap: clamp(1.6rem, 3vw, 3rem);
  align-items: start;
}
@media (max-width: 880px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .colophon { grid-column: 1 / -1; }
}
.footer p { margin: 0 0 0.6rem; font-size: 0.86rem; line-height: 1.55; color: var(--ink-soft); }
.footer-name {
  font-family: var(--sans);
  font-variation-settings: "wdth" 80, "wght" 800;
  text-transform: uppercase;
  font-size: 1.15rem !important;
  color: var(--ink) !important;
  letter-spacing: -0.01em;
}
.footer a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.footer a:hover { color: var(--red); border-bottom-color: var(--red); }
.footer-h { color: var(--red) !important; margin-bottom: 0.8rem !important; }
.footer-links ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.footer-links li { font-size: 0.88rem; }
.colophon { font-size: 0.68rem !important; line-height: 1.8 !important; }

/* ---------- scroll reveal ---------- */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1; transform: none; transition: none; }
  .d-line em::after { animation: none; transform: scaleX(1); }
  .bar span { transition: none; }
}

/* ---------- privacy / prose page ---------- */

.prose {
  max-width: 68ch;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) var(--pad) clamp(3rem, 8vw, 6rem);
}
.prose h1 { font-size: clamp(2.2rem, 7vw, 4.4rem); margin-bottom: 1.6rem; }
.prose h2 {
  font-family: var(--sans);
  font-variation-settings: "wdth" 84, "wght" 800;
  text-transform: uppercase;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  margin: 2.4rem 0 0.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
.prose p, .prose li { color: var(--ink-soft); }
.prose a { color: var(--red); }
.prose ul { padding-left: 1.1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose .back {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--red);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 2rem;
}
