/* ============================================================
   Left Inverse — studio site
   Concept: the linear-algebra left inverse — a matrix B with B A = I.
   A transformation A embeds your intent into a tangle of steps; its
   left inverse B recovers exactly what went in. The visual language is
   matrices and the identity matrix (a lit diagonal). The page goes
   dark → light → dark.
   Palette: cool ink ↔ cool paper, single ultramarine accent.
   Type: Space Grotesk (display+body) · Space Mono (labels/matrices)
         · Fraunces italic (math variables: B, A, I).
   ============================================================ */

:root {
  --ink:        #0C0D12;
  --ink-2:      #14161f;   /* raised surfaces on dark */
  --paper:      #ECEEF2;   /* light body — cool, not cream */
  --paper-card: #F6F7F9;
  --mist:       #8A909C;   /* muted ink */
  --mist-dk:    #6b7280;
  --accent:     #3B5BFF;   /* ultramarine */
  --accent-soft:#7E93FF;

  --line-dk:  rgba(255,255,255,.12);
  --line-lt:  rgba(12,13,18,.12);

  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, "SFMono-Regular", monospace;
  --serif:"Fraunces", Georgia, serif;

  --pad: clamp(1.25rem, 5vw, 3rem);
  --max: 1180px;
  --sec-y: clamp(5rem, 13vh, 9rem);
  --ease: cubic-bezier(.22,.61,.36,1);
}

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

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

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

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

/* skip link */
.skip {
  position: absolute; left: 50%; top: -100px; transform: translateX(-50%);
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 8px 8px;
  font: 600 .85rem/1 var(--sans); z-index: 100; transition: top .2s var(--ease);
}
.skip:focus { top: 0; }

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

/* ---------- recurring mark: the identity diagonal (1s of I) ---------- */
.km {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
  position: relative; flex: none;
}
.km::before, .km::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 1.5px;
  background: var(--accent); box-shadow: 0 0 7px rgba(59,91,255,.55);
}
.km::before { left: 0; top: 0; }     /* I[0,0] */
.km::after  { right: 0; bottom: 0; } /* I[1,1] */

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: clamp(.9rem,2.4vw,1.4rem) var(--pad);
  color: var(--paper);
  transition: background .4s var(--ease), color .4s var(--ease),
              border-color .4s var(--ease), backdrop-filter .4s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav--solid {
  background: rgba(236,238,242,.82);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  color: var(--ink);
  border-bottom-color: var(--line-lt);
}

.brand { display: inline-flex; align-items: center; gap: .55rem; }
/* identity-matrix mark: brackets adopt text colour, diagonal stays accent */
.brand-mark { width: 27px; height: 27px; flex: none; }
.brand-mark .bk { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.brand-mark .d-on  { fill: var(--accent); }
.brand-mark .d-off { fill: currentColor; opacity: .28; }
.brand-word {
  font-weight: 600; font-size: 1.02rem; letter-spacing: -.01em;
}

.nav-links { display: flex; gap: clamp(1rem, 2.6vw, 2rem); align-items: center; }
.nav-links a {
  font: 500 .92rem/1 var(--sans); position: relative; padding: .2rem 0;
  opacity: .82; transition: opacity .2s var(--ease);
}
.nav-links a:hover { opacity: 1; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--accent); transition: width .25s var(--ease);
}
.nav-links a:hover::after { width: 100%; }

/* ============================================================
   HERO — B A = I, the left inverse
   ============================================================ */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(7rem,16vh,9rem) var(--pad) clamp(4rem,9vh,6rem);
  background-color: var(--ink); color: var(--paper);
  /* faint matrix grid — the space the transformation lives in */
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  overflow: hidden;
}
/* soft accent glow behind the matrix figure */
.hero::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  width: 60vw; height: 60vw; max-width: 700px; max-height: 700px;
  right: -8vw; top: 50%; transform: translateY(-50%);
  background: radial-gradient(circle, rgba(59,91,255,.15), transparent 62%);
}

.hero-inner {
  position: relative; z-index: 2; width: 100%; max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr .95fr; align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.eyebrow {
  font: 400 .78rem/1 var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-soft); display: inline-flex; align-items: center; gap: .45rem;
  margin-bottom: clamp(1.3rem, 3vh, 2.2rem);
}

.hero-title {
  font-weight: 500; letter-spacing: -.028em; line-height: 1.0;
  font-size: clamp(2.4rem, 5.6vw, 5.2rem);
}
.hero-title .l { display: block; }
.hero-title em {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  color: var(--accent-soft); letter-spacing: -.01em;
}

.lede {
  margin-top: clamp(1.3rem, 3vh, 2rem);
  max-width: 46ch; font-size: clamp(1.02rem, 1.4vw, 1.18rem);
  color: rgba(236,238,242,.82); font-weight: 300;
}

/* ---------- the B A = I figure ---------- */
.hero-figure { display: flex; flex-direction: column; align-items: center; gap: clamp(1rem,2.5vh,1.6rem); }
.li-fig {
  --cell: clamp(13px, 2vw, 20px); --cgap: clamp(3px, .5vw, 5px);
  display: flex; align-items: center; justify-content: center;
  gap: clamp(.5rem, 1.6vw, 1.1rem);
}
.mx { display: flex; flex-direction: column; align-items: center; gap: .55rem; }
.op { font: 400 1.3rem/1 var(--mono); color: var(--mist); }
.lab { font: italic 400 1.15rem/1 var(--serif); color: var(--mist); }
.lab-i { color: var(--accent-soft); }

.grid { position: relative; display: grid; gap: var(--cgap); padding: 4px 9px; }
/* matrix brackets */
.grid::before, .grid::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 7px;
  border: 1.6px solid color-mix(in srgb, currentColor 34%, transparent);
}
.grid::before { left: 0;  border-right: none; border-radius: 3px 0 0 3px; }
.grid::after  { right: 0; border-left: none;  border-radius: 0 3px 3px 0; }
.g-b { grid-template-columns: repeat(4, var(--cell)); }
.g-a { grid-template-columns: repeat(2, var(--cell)); }
.g-i { grid-template-columns: repeat(2, var(--cell)); }

.c {
  width: var(--cell); height: var(--cell); border-radius: 3px; transform-origin: center;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.c.v1 { background: color-mix(in srgb, currentColor 13%, transparent); }
.c.v2 { background: color-mix(in srgb, currentColor 24%, transparent); }
.c.v3 { background: color-mix(in srgb, currentColor 42%, transparent); }
.g-i .off { background: color-mix(in srgb, currentColor 12%, transparent); }
.g-i .on  { background: var(--accent); box-shadow: 0 0 14px rgba(59,91,255,.65); }

.li-eq {
  font: 400 .8rem/1.5 var(--mono); color: var(--mist); text-align: center;
  max-width: 40ch; letter-spacing: .01em;
}
.li-eq b  { color: var(--paper); font-weight: 700; }
.li-eq em { font-family: var(--serif); font-style: italic; color: var(--accent-soft); }

.scroll-cue {
  position: absolute; z-index: 2; left: 50%; bottom: clamp(1.4rem,3.5vh,2.4rem);
  transform: translateX(-50%);
  display: inline-flex; flex-direction: column; align-items: center; gap: .5rem;
  font: 400 .68rem/1 var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: var(--mist);
}
.scroll-cue i {
  width: 1px; height: 34px; background: linear-gradient(var(--accent-soft), transparent);
  animation: cue 2.2s var(--ease) infinite;
}
@keyframes cue { 0%{transform:scaleY(.3);opacity:0;transform-origin:top} 40%{opacity:1} 100%{transform:scaleY(1);opacity:0;transform-origin:top} }

/* ============================================================
   STATEMENT (light)
   ============================================================ */
.kicker {
  font: 400 .76rem/1 var(--mono); letter-spacing: .22em; text-transform: uppercase;
  color: var(--mist-dk); display: inline-flex; align-items: center; gap: .35rem;
  margin-bottom: clamp(1.4rem, 3vh, 2rem);
}

.statement {
  max-width: var(--max); margin: 0 auto;
  padding: var(--sec-y) var(--pad);
}
.statement-grid {
  display: grid; grid-template-columns: 1.4fr .6fr;
  gap: clamp(2rem, 5vw, 4rem); align-items: start;
}
.statement-lead {
  font-weight: 400; letter-spacing: -.02em; line-height: 1.08;
  font-size: clamp(1.8rem, 4.6vw, 3.2rem); max-width: 20ch;
}
.statement-sub {
  margin-top: clamp(1.4rem, 3vh, 2rem); max-width: 54ch;
  font-size: clamp(1.02rem, 1.4vw, 1.2rem); font-weight: 300; color: var(--mist-dk);
}

/* the left-inverse definition — gives B A = I its context */
.li-def {
  border: 1px solid var(--line-lt); border-radius: 14px;
  background: var(--paper-card); padding: clamp(1.3rem, 2.4vw, 1.8rem);
}
.li-def-h {
  font: 600 1.05rem/1 var(--sans); letter-spacing: -.01em; color: var(--ink);
  display: flex; align-items: center; gap: .5rem;
}
.li-def-pos {
  margin-top: .55rem; font: 400 .72rem/1 var(--mono);
  letter-spacing: .12em; text-transform: uppercase; color: var(--mist-dk);
}
.li-def-body {
  margin-top: 1rem; font-size: .95rem; font-weight: 300; line-height: 1.6; color: var(--mist-dk);
}
.li-def-body em { font-family: var(--serif); font-style: italic; color: var(--ink); }
.li-def-body b  { font-family: var(--mono); font-weight: 700; font-size: .92em; color: var(--accent); }
.li-def-mx {
  --cell: 15px; --cgap: 4px;
  margin-top: 1.4rem; display: flex; align-items: center; gap: .55rem; color: var(--ink);
}
.li-def .lab-i { color: var(--accent); }

/* ============================================================
   WORK / PORTFOLIO (light)
   ============================================================ */
.work {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--pad) var(--sec-y);
}
.work-head { margin-bottom: clamp(2.4rem, 5vh, 3.6rem); }
.work-head h2 {
  font-weight: 500; letter-spacing: -.025em; line-height: .98;
  font-size: clamp(2.2rem, 6vw, 4rem);
}
.work-head h2 .ital { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); }
.work-intro {
  margin-top: 1.1rem; max-width: 42ch; color: var(--mist-dk);
  font-size: clamp(1rem, 1.3vw, 1.12rem); font-weight: 300;
}

.cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 1.8vw, 1.5rem);
}

.card {
  display: flex; flex-direction: column;
  background: var(--paper-card); color: var(--ink);
  border: 1px solid var(--line-lt); border-radius: 16px;
  padding: clamp(1.4rem, 2.4vw, 2rem);
  min-height: 100%;
  transition: transform .4s var(--ease), background .4s var(--ease),
              color .4s var(--ease), border-color .4s var(--ease), box-shadow .4s var(--ease);
}
/* the "inverse" micro-interaction: card flips to ink on engage */
a.card:hover, a.card:focus-visible {
  transform: translateY(-6px);
  background: var(--ink); color: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 24px 50px -24px rgba(12,13,18,.5);
}

.card-inv {
  font: 400 .76rem/1.4 var(--mono); letter-spacing: .01em;
  color: var(--accent);
  margin-bottom: clamp(1.6rem, 4vw, 2.6rem);
}
a.card:hover .card-inv, a.card:focus-visible .card-inv { color: var(--accent-soft); }

.card-name {
  font-weight: 600; letter-spacing: -.02em; line-height: 1.05;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem;
}
.card-domain {
  margin-top: .35rem; font-size: .95rem; font-weight: 500;
  color: color-mix(in srgb, currentColor 62%, transparent);
}
.card-desc {
  margin-top: 1rem; font-size: .96rem; font-weight: 300; line-height: 1.55;
  color: color-mix(in srgb, currentColor 78%, transparent);
}

.card-foot {
  margin-top: auto; padding-top: 1.6rem;
  display: flex; flex-wrap: wrap; gap: .8rem 1rem;
  align-items: center; justify-content: space-between;
}
.status {
  font: 400 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: color-mix(in srgb, currentColor 60%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 26%, transparent);
  padding: .42rem .6rem; border-radius: 999px; white-space: nowrap;
}
.go {
  font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: .4rem;
}
.go i { transition: transform .25s var(--ease); display: inline-block; }
a.card:hover .go i, a.card:focus-visible .go i { transform: translate(3px,-3px); }
.go--muted { color: var(--mist-dk); font-weight: 500; }

/* the in-development card reads as in-progress, not clickable */
.card--soon {
  border-style: dashed;
  background: transparent;
}

/* ============================================================
   FOOTER — back to dark
   ============================================================ */
.foot {
  background: var(--ink); color: var(--paper);
  padding: var(--sec-y) var(--pad) clamp(2rem,5vh,3rem);
}
.foot > * { max-width: var(--max); margin-inline: auto; }

.foot-top {
  display: flex; flex-wrap: wrap; gap: 1.2rem 2rem;
  align-items: center; justify-content: space-between;
  padding-bottom: clamp(2rem,5vh,3rem); border-bottom: 1px solid var(--line-dk);
}
.foot-grid {
  display: flex; flex-wrap: wrap; gap: 2.5rem 4rem;
  padding: clamp(2rem,5vh,3rem) 0;
}
.foot-col { display: flex; flex-direction: column; gap: .7rem; }
.foot-label {
  font: 400 .72rem/1 var(--mono); letter-spacing: .2em; text-transform: uppercase;
  color: var(--mist); margin-bottom: .3rem;
}
.foot-col a { color: rgba(236,238,242,.84); font-size: .98rem; width: max-content; transition: color .2s var(--ease); }
.foot-col a:hover { color: var(--accent-soft); }
.foot-muted { color: var(--mist); font-size: .98rem; }

.foot-base {
  display: flex; flex-wrap: wrap; gap: .6rem 2rem; justify-content: space-between;
  padding-top: clamp(1.6rem,4vh,2.4rem); border-top: 1px solid var(--line-dk);
  font-size: .85rem; color: var(--mist);
}
.foot-tag { font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; }

/* ============================================================
   REVEAL (JS-driven; default state is visible for no-JS)
   ============================================================ */
.reveal-armed [data-reveal] { opacity: 0; transform: translateY(28px); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .hero { min-height: auto; }
  .hero-inner { grid-template-columns: 1fr; gap: clamp(2.4rem, 6vh, 3.4rem); }
  .hero-figure { align-items: flex-start; }
  .statement-grid { grid-template-columns: 1fr; }
  .li-def { max-width: 30rem; }
  .cards { grid-template-columns: 1fr; }
  .card-foot { padding-top: 1.4rem; }
  .scroll-cue { display: none; }
}
@media (max-width: 560px) {
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: .86rem; }
  .brand-word { font-size: .95rem; }
  .li-fig { --cell: clamp(12px, 3.4vw, 16px); gap: .5rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .scroll-cue i { animation: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal-armed [data-reveal] { opacity: 1 !important; transform: none !important; }
}
