/* Nicholas Patten — v2 "raster". One serif for display, one mono for everything else. */
@font-face { font-family: "Instrument Serif"; src: url("/assets/fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  --bg: #0f0f0d; --fg: #ecebe4; --muted: #8a8980; --rule: #2a2a26; --accent: #ff5a1f; --plate: #141411;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad: clamp(20px, 4vw, 56px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f3f1ea; --fg: #151513; --muted: #6d6b63; --rule: #d9d6cb; --accent: #e2470e; --plate: #ebe8df; color-scheme: light; }
}
:root[data-theme="light"] { --bg: #f3f1ea; --fg: #151513; --muted: #6d6b63; --rule: #d9d6cb; --accent: #e2470e; --plate: #ebe8df; color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 15px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
.mono { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: #fff; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--fg); color: var(--bg); padding: 8px 12px; }
.skip:focus { top: 12px; }

/* bar */
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--pad); font-size: 12px; letter-spacing: .02em;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.mark { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; font-size: 15px; letter-spacing: .03em; color: var(--fg); }
.mark__orb { flex: 0 0 auto; display: block; width: 22px; height: 22px; color: var(--accent); overflow: visible; }
.bar__meta { display: flex; align-items: center; gap: 18px; color: var(--muted); }
.clock time { color: var(--fg); font-variant-numeric: tabular-nums; }

.modes { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; }
.modes button {
  font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 4px 10px; border-radius: 999px; transition: color .2s var(--ease), background-color .2s var(--ease);
}
.modes button:hover { color: var(--fg); }
.modes button[aria-checked="true"] { background: var(--fg); color: var(--bg); }

.theme { width: 28px; height: 28px; display: grid; place-items: center; background: none; border: 1px solid var(--rule); border-radius: 50%; cursor: pointer; color: var(--fg); }
.theme__icon { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px currentColor; transition: transform .5s var(--ease); }
:root[data-theme="light"] .theme__icon { transform: rotate(180deg); }

/* tick rail (desktop only) */
.rail { display: none; }
@media (min-width: 1100px) and (hover: hover) {
  .rail { display: block; position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 15; }
  .rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; justify-items: end; }
  .rail a { position: relative; display: block; width: 26px; height: 10px; }
  .rail a::after { content: ""; position: absolute; right: 0; top: 50%; width: 8px; height: 1px; background: var(--muted); transition: width .25s var(--ease), background-color .25s; }
  .rail__major a::after { width: 16px; }
  .rail a:hover::after, .rail a:focus-visible::after { width: 24px; background: var(--fg); }
  .rail a[aria-current="true"]::after { width: 24px; height: 2px; background: var(--accent); }
  .rail span {
    position: absolute; right: 32px; top: 50%; transform: translate(6px, -50%); white-space: nowrap;
    font-size: 11px; color: var(--fg); background: var(--bg); padding: 2px 6px; border: 1px solid var(--rule);
    opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: translate(0, -50%); }
}

/* hero */
.hero { position: relative; min-height: min(88vh, 820px); display: flex; align-items: flex-end; padding: 0 var(--pad) clamp(40px, 7vh, 80px); overflow: hidden; border-bottom: 1px solid var(--rule); }
.field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero__inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: end; width: 100%; }
.eyebrow { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); }
.prompt { color: var(--accent); }
.hero__title { margin: 0; font: 400 clamp(46px, 7.4vw, 112px)/.95 var(--serif); letter-spacing: -.02em; max-width: 13em; text-wrap: balance; }
.hero__title em { color: var(--accent); }
.caret { display: inline-block; width: .08em; height: .8em; margin-left: .08em; background: var(--accent); vertical-align: -.04em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__sub { grid-column: 1; margin: 0; max-width: 46ch; color: var(--muted); }
.hero__aside { grid-column: 2; grid-row: 2 / span 2; list-style: none; margin: 0; padding: 0; font-size: 12px; min-width: 230px; }
.hero__aside li { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border-top: 1px solid var(--rule); }
.hero__aside span { color: var(--muted); }
.hero__aside b { font-weight: 400; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #3ecf6e; margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 0 rgba(62,207,110,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgba(62,207,110,0); } 100% { box-shadow: 0 0 0 0 rgba(62,207,110,0); } }
.br-lg { display: none; }
@media (min-width: 1024px) { .br-lg { display: inline; } }

/* sections */
.work, .systems, .method, .contact { padding: clamp(56px, 9vw, 120px) var(--pad); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: clamp(28px, 4vw, 56px); }
.label { margin: 0; font-size: 12px; font-weight: 400; letter-spacing: .02em; }
.label--muted { color: var(--muted); }

/* projects */
.projects { list-style: none; margin: 0; padding: 0; }
.proj { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); padding: clamp(28px, 4vw, 48px) 0; border-top: 1px solid var(--rule); scroll-margin-top: 70px; }
.proj__meta { display: flex; flex-direction: column; gap: 14px; align-self: start; position: sticky; top: 90px; }
.proj__num { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; margin: 0; font-size: 12px; color: var(--muted); }
.proj__num span:first-child { color: var(--accent); }
.proj__num .proj__url { margin-left: auto; }
.proj__name { margin: 0; font: 400 clamp(36px, 4.4vw, 64px)/1 var(--serif); letter-spacing: -.015em; }
.proj__line { margin: 0; font-size: 15px; }
.proj__blurb { margin: 0; color: var(--muted); max-width: 52ch; }
.proj__url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  font-size: 13px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  text-decoration: none;
  transition: border-color .2s, color .2s;
}
.proj__url-icon {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.proj__url:hover { color: var(--accent); border-color: var(--accent); }
.proj__shot { color: inherit; text-decoration: none; cursor: pointer; }
.proj__shot .plate__poke,
.proj__shot .plate__raster { pointer-events: none; }

.proj__film {
  grid-column: 1 / -1;
  margin-top: clamp(16px, 2.5vw, 24px);
  min-width: 0;
}
.proj .sys-pack__film,
.proj__film.sys-pack__film {
  display: flex;
  margin-inline: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-snap-type: none;
  scroll-padding: 0;
  scroll-padding-inline: 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pinch-zoom;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
  -ms-overflow-style: none;
}

.proj .sys-pack__film::-webkit-scrollbar {
  -webkit-appearance: none;
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}

.proj .sys-pack__film::-webkit-scrollbar-thumb,
.proj .sys-pack__film::-webkit-scrollbar-track {
  background: transparent;
}
.proj .sys-pack__film .plate,
.proj__film.sys-pack__film .plate {
  flex: 0 0 min(78vw, 520px);
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
:root[data-layout="raster"] .proj__film .proj__shot {
  display: contents;
}
:root[data-layout="raster"] .proj__film > .proj__shot > .plate {
  flex: 0 0 min(78vw, 520px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.proj__film .proj__shot .plate {
  margin: 0;
}

.plate { margin: 0; }
.plate__frame { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--plate); border: 1px solid var(--rule); border-radius: 4px; }
.plate__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.plate__raster { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.js .plate__raster { display: block; }
.plate__poke { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; margin: 0; background: none; border: 0; cursor: none; display: none; touch-action: pan-y; }
.js .plate__poke { display: block; }
.plate__poke:focus-visible { outline-offset: -3px; }
.plate__cap { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.plate__state::before { content: "■ "; color: var(--muted); }
.plate.is-dev .plate__state::before, .plate.is-look .plate__state::before { color: var(--accent); }
.plate--sys .plate__frame { aspect-ratio: 16 / 9; }

/* systems / workflows */
.systems { border-top: 1px solid var(--rule); scroll-margin-top: 70px; }
.systems__lede { margin: -12px 0 clamp(32px, 5vw, 56px); max-width: 58ch; color: var(--muted); font-size: 15px; line-height: 1.55; }
.systems__list { list-style: none; margin: 0; padding: 0; }
.sys-pack {
  padding: clamp(28px, 4vw, 44px) 0; border-top: 1px solid var(--rule); scroll-margin-top: 70px;
}
.sys-pack__head { display: flex; flex-direction: column; gap: 10px; max-width: 52ch; margin-bottom: clamp(16px, 2vw, 22px); }
.sys-pack__num { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 11px; color: var(--muted); }
.sys-pack__num span:first-child { color: var(--accent); flex-shrink: 0; }
.sys-pack__tag { text-align: right; }
.sys-pack__name { margin: 0; font: 400 clamp(28px, 3.2vw, 44px)/1.05 var(--serif); letter-spacing: -.015em; }
.sys-pack__line { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.sys-pack__link { align-self: flex-start; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 2px; transition: color .2s, border-color .2s; }
.sys-pack__link:hover { color: var(--accent); border-color: var(--accent); }
.sys-pack__scroll { margin: 0 0 10px; font-size: 11px; color: var(--muted); text-align: right; }
.sys-pack__film {
  display: flex; gap: clamp(12px, 2vw, 18px);
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior: contain;
  scroll-snap-type: none; scroll-padding-inline: var(--pad);
  margin-inline: calc(-1 * var(--pad)); padding: 4px var(--pad) 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scrollbar-color: transparent transparent;
  -ms-overflow-style: none;
}
.sys-pack__film::-webkit-scrollbar {
  -webkit-appearance: none;
  display: none;
  width: 0;
  height: 0;
  background: transparent;
}
.sys-pack__film::-webkit-scrollbar-thumb,
.sys-pack__film::-webkit-scrollbar-track {
  background: transparent;
}
.sys-pack__film .plate { flex: 0 0 min(82vw, 560px); scroll-snap-align: start; margin: 0; min-width: 0; }
.sys-pack__film .plate__poke { touch-action: pan-x pan-y; }
.sys-pack--solo .sys-pack__film { overflow: visible; margin-inline: 0; padding-inline: 0; }
.sys-pack--solo .sys-pack__film .plate { flex: 1 1 auto; width: 100%; max-width: none; }
.plate__label { color: var(--fg); }
.plate__cap .plate__label { margin-right: auto; }
.plate__cap .plate__state { margin-left: auto; }

/* method */
.method__lede { margin: 0 0 clamp(32px, 5vw, 64px); font: 400 clamp(30px, 3.6vw, 52px)/1.08 var(--serif); max-width: 32ch; letter-spacing: -.01em; text-wrap: balance; }
.steps { list-style: none; margin: 0; padding: 0; }
:root:not([data-layout="allo"]) .steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 clamp(20px, 3vw, 40px);
}
.step { border-top: 1px solid var(--rule); padding-top: 18px; }
.step__k { font-size: 12px; color: var(--accent); }
.step__t { margin: 10px 0 8px; font: 400 26px/1.1 var(--serif); }
.step p { margin: 0; color: var(--muted); }

/* contact */
.contact { border-top: 1px solid var(--rule); }
.contact__big { margin: 0 0 clamp(28px, 4vw, 48px); font: 400 clamp(44px, 7vw, 104px)/.98 var(--serif); letter-spacing: -.02em; }
.contact__big em { color: var(--accent); }
.contact__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(16px, 3vw, 28px);
}
.contact__row .contact__big { margin: 0; }
.social {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}
.social__item { display: flex; margin: 0; padding: 0; }
.social__link {
  display: grid;
  place-items: center;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 40px;
  height: 40px;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--fg); text-decoration: none;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.social__link:hover { color: var(--accent); border-color: var(--accent); }
.social__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.social__icon { display: block; width: 18px; height: 18px; object-fit: contain; }
.social__link--linkedin {
  position: relative;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.social__link--linkedin .social__icon--linkedin {
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  margin: auto;
  grid-area: unset;
}
.social__icon--linkedin-dark { display: block; }
.social__icon--linkedin-light { display: none; }
:root[data-theme="light"] .social__icon--linkedin-dark { display: none; }
:root[data-theme="light"] .social__icon--linkedin-light { display: block; }
:root[data-theme="dark"] .social__icon--linkedin-dark { display: block; }
:root[data-theme="dark"] .social__icon--linkedin-light { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .social__icon--linkedin-dark { display: none; }
  :root:not([data-theme="dark"]) .social__icon--linkedin-light { display: block; }
}
.contact__mail { margin: 22px 0 0; font-size: 13px; color: var(--muted); }
.contact__mail a { border-bottom: 1px solid var(--rule); }
.foot { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding: 22px var(--pad) 28px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--rule); }

/* reveal on scroll */
:root:not([data-layout="allo"]) .js .proj,
:root:not([data-layout="allo"]) .js .step {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
:root:not([data-layout="allo"]) .js .proj.in,
:root:not([data-layout="allo"]) .js .step.in {
  opacity: 1;
  transform: none;
}

@media (max-width: 1023px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__aside { grid-column: 1; grid-row: auto; min-width: 0; }
  .proj { grid-template-columns: 1fr; }
  .proj__meta { position: static; }
  :root:not([data-layout="allo"]) .steps { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 640px) {
  .bar { padding-block: 10px; }
  .clock { display: none; }
  .mark { font-size: 13px; }
  .mark__orb { width: 20px; height: 20px; }
  .modes button { padding: 4px 7px; }
  .hero { min-height: auto; padding-top: 72px; }
  .hero__title { font-size: clamp(40px, 11.5vw, 56px); }
  .plate__poke { cursor: pointer; }
}
@media (hover: none) { .plate__poke { cursor: pointer; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .js .proj, .js .step { opacity: 1; transform: none; }
}

/* 404 */
.hero__cta { margin: 24px 0 0; font-size: 13px; }
.link-arrow { border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
.link-arrow:hover { color: var(--accent); border-color: var(--accent); }
.hero--404 { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 18px; }
