/* ==========================================================================
   lat.dev
   Every colour comes from a variable. No literal hex below :root blocks.
   No border-radius, no shadows, no gradients as decoration, one typeface.
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #000000;
  --canvas: #0a0a0a;
  --ink: #f3efe6;
  --line: #5c5952;
  --line-hi: #9a958a;
  --stripe: #131313;
  --a1: #f3efe6;
  --a2: #f3efe6;
  --a3: #f3efe6;
  --a4: #5c5952;
}

[data-theme="light"] {
  --bg: #f3efe6;
  --canvas: #e8e3d8;
  --ink: #000000;
  --line: #57524a;
  --line-hi: #16150f;
  --stripe: #e2ddd1;
  --a1: #000000;
  --a2: #000000;
  --a3: #000000;
  --a4: #57524a;
}

[data-theme="chroma"] {
  --bg: #000000;
  --canvas: #0a0a0a;
  --ink: #f3efe6;
  --line: #5c5952;
  --line-hi: #9a958a;
  --stripe: #131313;

  /* hex first for engines without oklch; the oklch line wins elsewhere */
  --a1: #e0876b;  --a1: oklch(0.74 0.15 32);
  --a2: #4fbd87;  --a2: oklch(0.74 0.15 148);
  --a3: #5ea6e0;  --a3: oklch(0.74 0.15 248);
  --a4: #d986cf;  --a4: oklch(0.74 0.15 318);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html { background: var(--canvas); }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.78;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

h1, h2, h3, p, figure { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
i { font-style: normal; }

:focus { outline: none; }
:focus-visible { outline: none; }

.display {
  font-size: 132px;
  font-weight: 300;
  letter-spacing: -0.05em;
  line-height: 0.86;
}

.statement {
  font-size: 64px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.framing {
  font-size: 19px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.72;
  max-width: 52ch;
  text-wrap: pretty;
}

.micro {
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.22em;
  line-height: 1.6;
  color: var(--line);
}

.micro--sig i { color: var(--a1); margin-right: 10px; }

.nano {
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.20em;
  line-height: 1.9;
  color: var(--line);
}

.nano i { color: var(--a1); }

.arrow {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--line);
  transition: color 120ms ease-out;
}

.arrow--mute { opacity: 0.45; }

.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1;
  transition: border-color 120ms ease-out;
}

.mark > span { display: block; transform: translateY(-0.5px); }

a.mark:hover,
button.mark:hover,
a.mark:focus-visible,
button.mark:focus-visible { border-color: var(--line-hi); }

.mark[data-stack] { border-color: var(--a4); }

.frame {
  display: flex;
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1680px;
  margin-inline: auto;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

@media (min-width: 1681px) {
  .frame {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

.spine {
  flex: 0 0 80px;
  width: 80px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 26px 0 34px;
}

.spine__sigil {
  font-size: 15px;
  color: var(--a1);
  letter-spacing: 0.02em;
}

.spine__wordmark {
  writing-mode: vertical-rl;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--line);
}

.spine__tick {
  width: 1px;
  height: 56px;
  background: var(--line);
}

.column {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header {
  flex: 0 0 80px;
  height: 80px;
  border-bottom: 1px solid var(--line);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__wordmark {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav__item {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--line);
  transition: color 120ms ease-out;
}

.nav__sigil {
  color: transparent;
  margin-right: 8px;
  transition: color 120ms ease-out;
}

.nav__item:hover { color: var(--ink); }

.nav__item[aria-current="page"] { color: var(--ink); }
.nav__item[aria-current="page"] .nav__sigil { color: var(--a1); }
.nav__item[data-nav="work"][aria-current="page"] .nav__sigil { color: var(--a2); }
.nav__item[data-nav="contact"][aria-current="page"] .nav__sigil { color: var(--a3); }

.theme { cursor: none; }

.menu {
  display: none;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: var(--line);
  transition: color 120ms ease-out;
}

.menu:hover { color: var(--ink); }

.drawer { display: none; }

.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-thumb { background: var(--line); }

.view { display: none; }

.view[data-active] {
  display: block;
  animation: fade 140ms ease-out both;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.index {
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
}

.index__body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  min-width: 0;
}

.index__lede .framing { margin-top: 34px; }

.index__marks {
  display: flex;
  align-items: center;
  gap: 12px;
}

.index__marks .micro { margin-left: 10px; }

.rail {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.rail__block {
  padding: 22px 40px 22px 26px;
  border-bottom: 1px solid var(--line);
}

.rail__now {
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.8;
  color: var(--line);
  margin-top: 12px;
}

.rail__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
  letter-spacing: 0.10em;
  color: var(--line);
  transition: color 120ms ease-out;
}

.rail__link:hover { color: var(--ink); }
.rail__link:hover .arrow { color: var(--ink); }

.rail__spacer { flex: 1 1 auto; }

.rail__foot {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ledger__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 34px 40px 20px;
}

.ledger { border-top: 1px solid var(--line); }

.row {
  position: relative;
  display: grid;
  grid-template-columns: 72px 1fr 300px 120px;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 26px 40px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: none;
  transition: none;
}

.row__gutter {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--a1);
  opacity: 0;
  transition: opacity 120ms ease-out;
}

.row__index {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--line);
  transition: color 120ms ease-out;
}

.row__name {
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}

.row__blurb {
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.7;
  color: var(--line);
  transition: color 120ms ease-out;
}

.row__stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.row:hover .row__gutter,
.row:focus-visible .row__gutter,
.row[aria-expanded="true"] .row__gutter { opacity: 1; }

.row:hover .row__index,
.row:focus-visible .row__index,
.row[aria-expanded="true"] .row__index { color: var(--ink); }

.row:hover .row__blurb,
.row:focus-visible .row__blurb,
.row[aria-expanded="true"] .row__blurb { color: var(--line-hi); }

.row:hover .mark,
.row:focus-visible .mark,
.row[aria-expanded="true"] .mark { border-color: var(--line-hi); }

.row[aria-expanded="true"] .row__index { color: var(--a1); }
.row[aria-expanded="true"][data-cycle="1"] .row__index { color: var(--a2); }
.row[aria-expanded="true"][data-cycle="2"] .row__index { color: var(--a3); }
.row[aria-expanded="true"][data-cycle="3"] .row__index { color: var(--a4); }

.detail {
  overflow: hidden;
  height: 0;
  border-bottom: 1px solid var(--line);
  transition: height 220ms ease-out;
}

.detail__grid {
  display: grid;
  grid-template-columns: 72px 1fr;
}

.detail__rail {
  border-right: 1px solid var(--line);
  padding: 34px 0 0;
  display: flex;
  justify-content: center;
}

.detail__rail i { font-size: 12px; color: var(--a1); }

.detail__inner {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  padding: 34px 40px 40px;
  align-items: start;
}

.detail__prose {
  font-size: 16px;
  line-height: 1.78;
  letter-spacing: 0.02em;
  max-width: 56ch;
  color: var(--ink);
}

.meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  margin-top: 34px;
}

.meta__cell {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.meta__cell:last-child { border-right: 0; }

.meta__k {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--line);
  display: block;
}

.meta__v {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: block;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--line);
  transition: color 120ms ease-out;
}

.repo:hover { color: var(--ink); }
.repo:hover .arrow { color: var(--ink); }

.capture {
  border: 1px solid var(--line);
  height: 220px;
  background-image: repeating-linear-gradient(
    135deg,
    var(--stripe) 0 6px,
    var(--bg) 6px 12px
  );
}

.capture__cap {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--line);
  margin-top: 12px;
  display: block;
}

.detail__back { display: none; }

.contact {
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 56px;
}

.contact__rows { border-top: 1px solid var(--line); }

.contact__row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 26px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.contact__label {
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--line);
  transition: color 120ms ease-out;
}

a.contact__row:hover .contact__label,
a.contact__row:focus-visible .contact__label { color: var(--ink); }

a.contact__row:hover .mark,
a.contact__row:focus-visible .mark { border-color: var(--line-hi); }

a.contact__row:hover .arrow { color: var(--ink); }

.contact__row--static .contact__label { color: var(--line); }

.contact__foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000000;
  display: flex;
  align-items: flex-end;
  transition: opacity 420ms ease-out;
}

.boot[data-out] { opacity: 0; }

.boot__inner { padding: 96px; }

.boot__sigil {
  display: block;
  font-size: 15px;
  color: #5c5952;
  margin-bottom: 20px;
}

.boot__line {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: #f3efe6;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.boot__caret {
  display: inline-block;
  width: 9px;
  height: 22px;
  background: #f3efe6;
  animation: blink 1.05s steps(1) infinite;
}

[data-theme="chroma"] .boot__caret { background: var(--a2); }

@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.seam {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  max-width: 1680px;
  margin-inline: auto;
  height: 1px;
  background: var(--ink);
  z-index: 61;
  opacity: 0;
  pointer-events: none;
}

.seam[data-sweep] { animation: sweep 520ms ease-out both; }

@keyframes sweep {
  0%   { opacity: 1; transform: translateY(0); }
  99%  { opacity: 1; transform: translateY(100vh); transform: translateY(100dvh); }
  100% { opacity: 0; transform: translateY(100vh); transform: translateY(100dvh); }
}

.frame[data-boot] { opacity: 0; }
.frame[data-boot-in] { animation: fade 520ms ease-out both; }

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-hi);
  z-index: 90;
  pointer-events: none;
  display: none;
  transition: border-color 120ms linear, background-color 120ms linear;
}

.cursor[data-on] { display: block; }
.cursor[data-hot] { border-color: var(--ink); }
.cursor[data-press] { background: var(--ink); border-color: var(--ink); }

@media (hover: hover) and (pointer: fine) {
  html[data-cursor] body,
  html[data-cursor] a,
  html[data-cursor] button,
  html[data-cursor] .row { cursor: none; }
}

.tip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.tip__leader {
  width: 1px;
  height: 12px;
  background: var(--line);
  margin-left: 14px;
}

.tip__body {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.18em;
  line-height: 1;
  padding: 9px 12px;
  white-space: nowrap;
}

@media (max-width: 860px) {

  body { overflow: auto; }

  .frame { display: block; height: auto; min-height: 100dvh; }

  .spine { display: none; }

  .header {
    position: sticky;
    top: 0;
    z-index: 40;
    flex: 0 0 56px;
    height: 56px;
    padding: 0 20px;
    background: var(--bg);
  }

  .header__wordmark { font-size: 12px; }

  .header__wordmark::before {
    content: '//';
    color: var(--a1);
    margin-right: 12px;
    letter-spacing: 0.02em;
  }

  .nav { display: none; }
  .menu { display: block; }

  .drawer {
    display: none;
    border-bottom: 1px solid var(--line);
  }

  .drawer[data-open] { display: block; }

  .drawer__item {
    display: block;
    padding: 18px 20px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--line);
  }

  .drawer__item[aria-current="page"] { color: var(--ink); }
  .drawer__item[aria-current="page"] .nav__sigil { color: var(--a1); }

  .drawer__theme {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-top: 1px solid var(--line);
  }

  .main { overflow: visible; padding-bottom: env(safe-area-inset-bottom); }

  .index { grid-template-columns: 1fr; min-height: 0; }
  .index__body { padding: 40px 20px; gap: 56px; }
  .display { font-size: 72px; }
  .framing { font-size: 15px; }
  .index__lede .framing { margin-top: 26px; }

  .index__marks { flex-wrap: wrap; }

  .rail { border-left: 0; border-top: 1px solid var(--line); }
  .rail__block { padding: 22px 20px; }
  .rail__spacer { display: none; }
  .rail__foot { border-top: 0; }

  .ledger__head { padding: 26px 20px 20px; flex-wrap: wrap; gap: 10px; }

  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name  index"
      "blurb blurb"
      "stack stack";
    gap: 14px 16px;
    align-items: baseline;
    padding: 22px 20px 22px 34px;
  }

  .row__gutter { left: 12px; top: 26px; transform: none; }

  .row__index { grid-area: index; justify-self: end; }
  .row__name  { grid-area: name; }
  .row__blurb { grid-area: blurb; }
  .row__stack { grid-area: stack; }

  .row__name { font-size: 20px; }
  .row__stack { justify-content: flex-start; }

  .detail--sheet {
    position: fixed;
    inset: 56px 0 0;
    z-index: 30;
    height: auto;
    background: var(--bg);
    overflow-y: auto;
    border-bottom: 0;
    transition: none;
  }

  .detail--sheet .detail__grid { grid-template-columns: 1fr; }
  .detail--sheet .detail__rail { display: none; }

  .detail--sheet .detail__inner {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 20px 20px calc(56px + env(safe-area-inset-bottom));
  }

  .detail--sheet .detail__side { order: -1; }
  .detail--sheet .capture { height: 180px; }

  .detail--sheet .detail__back {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--line);
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .detail--sheet .meta { grid-template-columns: 1fr; border-left: 0; border-right: 0; }

  .detail--sheet .meta__cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail--sheet .meta__cell:last-child { border-bottom: 0; }
  .detail--sheet .meta__v { margin-top: 0; }

  .contact { padding: 56px 20px 40px; gap: 40px; min-height: 0; }
  .statement { font-size: 38px; }
  .contact__row { grid-template-columns: 30px 1fr auto; gap: 18px; }
  .contact__label { font-size: 13px; }
  .contact__foot { flex-direction: column; gap: 8px; }

  .boot__inner { padding: 20px 20px 56px; }
  .boot__line { font-size: 15px; }
  .boot__caret { height: 16px; width: 7px; }

  .mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    padding: 7px;
    border: 0;
  }

  .mark > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    transition: border-color 120ms ease-out;
  }
  a.mark:hover > span,
  button.mark:hover > span { border-color: var(--line-hi); }
  .row:hover .mark > span,
  .row[aria-expanded="true"] .mark > span { border-color: var(--line-hi); }
  .mark[data-stack] > span { border-color: var(--a4); }

  .cursor { display: none !important; }
}

@media (min-width: 861px) and (max-width: 1180px) {
  .index { grid-template-columns: 1fr 300px; }
  .display { font-size: 104px; }
  .rail__block { padding: 20px 26px 20px 22px; }

  .row { grid-template-columns: 60px 1fr 240px 110px; gap: 16px; padding: 24px 28px; }
  .row__name { font-size: 22px; }
  .ledger__head { padding: 28px 28px 18px; }

  .detail__inner { grid-template-columns: 1fr 300px; gap: 28px; padding: 28px 28px 34px; }
  .capture { height: 190px; }

  .contact { padding: 40px 28px; }
  .statement { font-size: 52px; }
  .header { padding: 0 28px; }
  .index__body { padding: 34px 28px; }
}

@media (max-height: 560px) and (min-width: 861px) {
  .display { font-size: 88px; }
  .statement { font-size: 44px; }
  .boot__inner { padding: 40px 56px; }
}

@media (max-height: 460px) {
  .display { font-size: 56px; }
  .statement { font-size: 32px; }
  .boot__inner { padding: 24px 28px; }
  .boot__line { font-size: 16px; }
  .boot__caret { height: 16px; width: 7px; }
  .index__body { gap: 28px; }
  .index__lede .framing { margin-top: 18px; }
}

@media (max-width: 380px) {
  .display { font-size: 58px; }
  .statement { font-size: 30px; }
  .framing { font-size: 14px; }
  .index__body,
  .rail__block,
  .ledger__head { padding-left: 16px; padding-right: 16px; }
  .row { padding: 20px 16px 20px 30px; }
  .contact { padding: 48px 16px 32px; }
  .detail--sheet .detail__inner,
  .detail--sheet .detail__back { padding-left: 16px; padding-right: 16px; }
  .contact__label { font-size: 12px; }
  .contact__row { gap: 12px; }
  .header { padding: 0 16px; }
  .header__wordmark { font-size: 11px; }
  .header__wordmark::before { margin-right: 8px; }
}

.contact__label,
.meta__v,
.repo,
.rail__now { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .cursor { display: none !important; }
}
