/* ==========================================================================
   Neil — portfolio
   One stylesheet, no build step. Sections follow the order of the page.
   ========================================================================== */

/* --- Fonts (self-hosted, variable) --------------------------------------- */

@font-face {
  font-family: "Geist";
  src: url("../assets/fonts/geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../assets/fonts/geist-mono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens -------------------------------------------------------------- */

:root {
  --accent: #2540f2;
  --ink: #0b1026;
  --paper: #f4f5f8;
  --white: #ffffff;
  --line: #d9dde8;
  --muted: #555b72;
  --navy: #0b1026;
  --panel: #121836;
  --on-accent-soft: rgb(255 255 255 / 0.84);
  --on-accent-line: rgb(255 255 255 / 0.32);
  --on-navy-soft: #c9cfe6;
  --on-navy-muted: #a9b0cc;
  --on-navy-line: rgb(255 255 255 / 0.14);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 5.5vw, 5rem);
  --gap: 1.5rem;
  --section: clamp(4.5rem, 10vw, 9rem);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

/* --- Base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, dl, dd, figure, fieldset, pre {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 3px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
}

.wrap {
  width: 100%;
  max-width: calc(80rem + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- Shared pieces ------------------------------------------------------- */

.wordmark {
  font-size: 1.625rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.04em;
}

.title {
  font-size: clamp(2.5rem, 5.2vw, 4.75rem);
  font-weight: 560;
  line-height: 1;
  letter-spacing: -0.045em;
}

.label {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.5;
}

.kind {
  color: var(--muted);
  font-size: 0.9375rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.375rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 550;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.pill--solid {
  min-height: 3.25rem;
  padding-inline: 1.75rem;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
}

.pill--solid:hover {
  background: var(--ink);
  color: var(--white);
}

.pill--outline {
  border: 1px solid rgb(255 255 255 / 0.6);
}

.pill--outline:hover {
  border-color: var(--white);
  background: var(--white);
  color: var(--ink);
}

.underlined {
  display: inline-block;
  padding-block: 0.625rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.32em;
  transition: opacity 0.2s;
}

.underlined:hover {
  opacity: 0.72;
}

.visit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  align-self: flex-start;
  padding-block: 0.625rem;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 500;
}

.visit svg {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  transition: transform 0.25s var(--ease);
}

.visit:hover svg {
  transform: translate(2px, -2px);
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
  padding-bottom: clamp(7rem, 15vw, 13.75rem);
  background: var(--accent);
  color: var(--white);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.5rem;
}

.nav__brand {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
  padding-block: 0.5rem;
}

.nav__role {
  color: var(--on-accent-soft);
  font-size: 0.875rem;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.6vw, 2.25rem);
  font-size: 0.9375rem;
  font-weight: 500;
}

.nav__links a:not(.pill) {
  display: block;
  padding-block: 0.625rem;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 0.5rem) / 0 1px no-repeat;
  transition: background-size 0.25s var(--ease);
}

.nav__links a:not(.pill):hover {
  background-size: 100% 1px;
}

@media (max-width: 52em) {
  .nav__wide,
  .nav__role {
    display: none;
  }
}

.hero__title {
  max-width: 11.5em;
  margin-top: clamp(2.5rem, 6vw, 5.25rem);
  font-size: clamp(2.875rem, 8.3vw, 7.5rem);
  font-weight: 560;
  line-height: 0.96;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2.5rem 5rem;
  margin-top: clamp(2rem, 5vw, 4.25rem);
}

.hero__intro {
  max-width: 36rem;
  font-size: clamp(1.125rem, 0.5vw + 1rem, 1.3125rem);
  line-height: 1.5;
}

.hero__side {
  font-size: 0.9375rem;
}

.hero__status {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 500;
}

.dot {
  flex: none;
  width: 0.5625rem;
  height: 0.5625rem;
  border-radius: 50%;
  background: #8df5b4;
}

.hero__clients {
  margin-top: 0.375rem;
  color: var(--on-accent-soft);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  margin-top: 1.375rem;
  font-size: 1rem;
}

.hero__strip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: clamp(3.5rem, 7vw, 6rem);
  padding-top: 1.375rem;
  border-top: 1px solid var(--on-accent-line);
}

.hero__strip h2 {
  font-size: clamp(1.375rem, 1vw + 1.1rem, 1.875rem);
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.hero__strip p {
  color: var(--on-accent-soft);
  font-size: 0.9375rem;
}

/* One load sequence: the headline settles, then the rest follows. */
@media (prefers-reduced-motion: no-preference) {
  .hero__title,
  .hero__row,
  .hero__strip,
  .lead__shot {
    animation: settle 0.9s var(--ease) both;
  }

  .hero__row {
    animation-delay: 0.1s;
  }

  .hero__strip,
  .lead__shot {
    animation-delay: 0.2s;
  }

  @keyframes settle {
    from {
      opacity: 0;
      transform: translateY(0.875rem);
    }
  }
}

/* --- Selected work ------------------------------------------------------- */

.work {
  padding-bottom: var(--section);
}

/* The lead project overlaps the bottom of the hero. */
.lead__shot {
  display: block;
  position: relative;
  margin-top: calc(-1 * clamp(4.5rem, 12vw, 11.25rem));
  overflow: hidden;
  border-radius: 10px;
  background: #101010;
  box-shadow: 0 2.5rem 5.5rem -2.5rem rgb(11 16 38 / 0.55);
}

.lead__shot img,
.card__shot img {
  width: 100%;
  transition: transform 0.9s var(--ease);
}

.lead__shot:hover img,
.card__shot:hover img {
  transform: scale(1.015);
}

.lead__body {
  display: grid;
  gap: 0.75rem var(--gap);
  margin-top: 1.75rem;
}

.lead__title {
  font-size: clamp(2rem, 3.6vw, 3.375rem);
  font-weight: 560;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.lead__text {
  max-width: 34rem;
  color: var(--muted);
}

@media (min-width: 60em) {
  .lead__body {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
    margin-top: 2.25rem;
  }

  .lead__title {
    grid-column: span 5;
  }

  .lead__text {
    grid-column: span 4;
    margin-top: 0.375rem;
  }

  .lead__meta {
    grid-column: span 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-top: 0.375rem;
    text-align: right;
  }

  .lead__meta .visit {
    align-self: flex-end;
  }
}

.grid {
  display: grid;
  gap: clamp(3.5rem, 8vw, 6.5rem) 6rem;
  margin-top: clamp(4rem, 9vw, 8rem);
}

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

.card__shot {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: var(--white);
}

/* Light screenshots need an edge against the pale page. */
.card__shot--framed {
  outline: 1px solid var(--line);
  outline-offset: -1px;
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.card__title {
  font-size: clamp(1.75rem, 2.6vw, 2.375rem);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.card__text {
  max-width: 31rem;
  margin-top: 0.875rem;
  color: var(--muted);
}

.card .visit {
  margin-top: 0.5rem;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: start;
  padding: clamp(1.75rem, 3.4vw, 2.75rem);
  border-radius: 10px;
  background: var(--accent);
  color: var(--white);
}

.tile__title {
  font-size: clamp(1.875rem, 3vw, 2.625rem);
  font-weight: 560;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.tile__text {
  max-width: 24rem;
  margin-block: 0.875rem 1.5rem;
  color: var(--on-accent-soft);
}

@media (min-width: 56em) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  /* The left-hand column sits lower, so the two columns read as staggered. */
  .grid > :nth-child(odd) {
    margin-top: clamp(4rem, 9vw, 9rem);
  }

  .tile {
    align-self: end;
  }
}

/* Image reveal. Only runs when JavaScript has opted in and motion is allowed.
   The class lands on the card, because a fully clipped element never reports
   itself as visible to an IntersectionObserver. */
@media (prefers-reduced-motion: no-preference) {
  .js .card__shot {
    clip-path: inset(0 0 100% 0 round 8px);
    transition: clip-path 1s var(--ease);
  }

  .js .card__shot img {
    transform: scale(1.06);
  }

  .js .is-in .card__shot {
    clip-path: inset(0 round 8px);
  }

  .js .is-in .card__shot img {
    transform: none;
  }

  .js .is-in .card__shot:hover img {
    transform: scale(1.015);
  }
}

/* --- Services ------------------------------------------------------------ */

.services {
  padding-block: var(--section);
  background: var(--white);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem 5rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head p {
  max-width: 29rem;
  margin-bottom: 0.375rem;
  color: var(--muted);
}

.rows__item {
  display: grid;
  gap: 0.75rem var(--gap);
  padding-block: clamp(1.5rem, 3vw, 2.375rem);
  border-top: 1px solid var(--line);
}

.rows__item:first-child {
  border-top-color: var(--ink);
}

.rows dt {
  font-size: clamp(1.5rem, 2.4vw, 2.125rem);
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.rows dd {
  max-width: 39rem;
  font-size: clamp(1.0625rem, 0.4vw + 1rem, 1.1875rem);
  line-height: 1.5;
}

.tools {
  display: grid;
  gap: 0.25rem var(--gap);
  padding-top: 1.625rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

.tools span:first-child {
  color: var(--muted);
}

@media (min-width: 60em) {
  .rows__item,
  .tools {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .rows dt,
  .tools span:first-child {
    grid-column: span 5;
  }

  .rows dd,
  .tools span:last-child {
    grid-column: span 7;
  }

  .rows dd {
    margin-top: 0.25rem;
  }
}

/* --- About --------------------------------------------------------------- */

.about {
  display: grid;
  gap: 1.25rem var(--gap);
  padding-block: var(--section);
}

.about__photo {
  width: 100%;
  max-width: 25rem;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 10px;
}

.about__lead {
  max-width: 17em;
  font-size: clamp(2rem, 4.1vw, 3.625rem);
  font-weight: 540;
  line-height: 1.06;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.about__body {
  display: grid;
  gap: 1.125rem;
  max-width: 39rem;
  margin-top: clamp(1.75rem, 3.4vw, 2.75rem);
  font-size: clamp(1.0625rem, 0.4vw + 1rem, 1.1875rem);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(1.25rem, 4vw, 3rem);
  max-width: 39rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  font-size: 0.9375rem;
}

.facts > div {
  padding-block: 1rem;
  border-top: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  font-weight: 500;
}

@media (min-width: 60em) {
  .about {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .about .label {
    grid-column: 1 / span 4;
    padding-top: 0.75rem;
  }

  .about__photo {
    grid-column: 1 / span 4;
    grid-row: 2;
  }

  .about__main {
    grid-column: 5 / -1;
    grid-row: 1 / span 2;
  }
}

/* --- Smart contracts ----------------------------------------------------- */

.contracts {
  padding-block: var(--section);
  background: var(--navy);
  color: var(--white);
}

.contracts__grid {
  display: grid;
  gap: 3.5rem 6rem;
}

.contracts__text {
  max-width: 29rem;
  margin-top: 2rem;
  color: var(--on-navy-soft);
  font-size: clamp(1.0625rem, 0.4vw + 1rem, 1.1875rem);
}

.stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2rem;
  max-width: 29rem;
  margin-block: 2.75rem 1.5rem;
}

.stack li {
  padding-block: 0.75rem;
  border-top: 1px solid var(--on-navy-line);
}

@media (min-width: 64em) {
  .contracts__grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }
}

.code {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--on-navy-line);
  border-radius: 12px;
  background: var(--panel);
}

.code__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 1rem 1.375rem;
  border-bottom: 1px solid var(--on-navy-line);
  color: var(--on-navy-muted);
  font-size: 0.875rem;
}

.code__file {
  color: var(--white);
  font-family: var(--mono);
}

.code__picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 1.375rem;
  border-bottom: 1px solid var(--on-navy-line);
}

.code__picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.code__picker label {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border: 1px solid rgb(255 255 255 / 0.32);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.code__picker label:hover {
  border-color: var(--white);
}

.code__picker input:checked + label {
  border-color: var(--white);
  background: var(--white);
  color: var(--ink);
}

.code__picker input:focus-visible + label {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

.code__pre {
  overflow-x: auto;
  padding-block: 1.125rem;
  color: #e2e6f8;
  font-family: var(--mono);
  font-size: 0.84375rem;
  line-height: 1.5rem;
  tab-size: 4;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  counter-reset: line;
}

/* Each line is a block, so the newlines between them in the HTML are dropped. */
.code__pre code {
  display: block;
  width: max-content;
  min-width: 100%;
  font: inherit;
  white-space: normal;
}

.ln {
  display: block;
  min-height: 1.5rem;
  padding-right: 1.5rem;
  white-space: pre;
  box-shadow: inset 3px 0 0 transparent;
  transition: background-color 0.25s, box-shadow 0.25s;
}

.ln::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 3.25rem;
  padding-right: 1rem;
  color: #8089ae;
  text-align: right;
  user-select: none;
}

.code__pre .k {
  color: #a9b6ff;
}

.code__pre .c {
  color: #8f98bd;
}

.code__notes {
  min-height: 5.75rem;
  padding: 1.125rem 1.375rem 0;
  border-top: 1px solid var(--on-navy-line);
}

.code__notes p {
  max-width: 38rem;
}

.code__notes code {
  font-family: var(--mono);
  font-size: 0.875em;
  font-variant-ligatures: none;
}

.code figcaption {
  padding: 0.625rem 1.375rem 1.25rem;
  color: var(--on-navy-muted);
  font-size: 0.84375rem;
}

/* The picker is plain CSS: radio inputs plus :has(). No JavaScript involved. */
@supports selector(:has(*)) {
  .code__notes p {
    display: none;
  }

  .code:has(#c-reentrancy:checked) [data-n="reentrancy"],
  .code:has(#c-events:checked) [data-n="events"],
  .code:has(#c-payable:checked) [data-n="payable"],
  .code:has(#c-access:checked) [data-n="access"],
  .code:has(#c-inherit:checked) [data-n="inherit"] {
    display: block;
  }

  .code:has(#c-reentrancy:checked) [data-c~="reentrancy"],
  .code:has(#c-events:checked) [data-c~="events"],
  .code:has(#c-payable:checked) [data-c~="payable"],
  .code:has(#c-access:checked) [data-c~="access"],
  .code:has(#c-inherit:checked) [data-c~="inherit"] {
    background: rgb(120 140 255 / 0.24);
    box-shadow: inset 3px 0 0 #8e9dff;
  }
}

@supports not selector(:has(*)) {
  .code__picker {
    display: none;
  }

  .code__notes p + p {
    margin-top: 0.75rem;
  }
}

/* --- Contact and footer -------------------------------------------------- */

.contact {
  padding-block: var(--section) 2.75rem;
  background: var(--accent);
  color: var(--white);
}

.contact__title {
  max-width: 9em;
  font-size: clamp(3rem, 9.2vw, 8.25rem);
  font-weight: 560;
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.contact__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2.5rem 5rem;
  margin-top: clamp(2.5rem, 5.5vw, 4.5rem);
}

.contact__text {
  color: var(--on-accent-soft);
}

.contact__email {
  display: inline-block;
  margin-top: 0.5rem;
  padding-bottom: 0.2em;
  font-size: clamp(1.5rem, 4.3vw, 3.625rem);
  font-weight: 540;
  line-height: 1.1;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 2px no-repeat;
  transition: opacity 0.2s;
}

.contact__email:hover {
  opacity: 0.78;
}

.contact__links {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0 3.5rem;
  font-weight: 500;
}

.contact__links a {
  display: inline-block;
  padding-block: 0.625rem;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 0.5rem) / 0 1px no-repeat;
  transition: background-size 0.25s var(--ease);
}

.contact__links a:hover {
  background-size: 100% 1px;
}

.contact__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: clamp(4rem, 9vw, 7.5rem);
  padding-top: 1.375rem;
  border-top: 1px solid var(--on-accent-line);
  color: var(--on-accent-soft);
  font-size: 0.875rem;
}

.contact__foot .wordmark {
  color: var(--white);
  font-size: 1.375rem;
}

/* --- 404 ----------------------------------------------------------------- */

.notfound {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 1.75rem;
  min-height: 100vh;
  background: var(--accent);
  color: var(--white);
}

/* --- Print --------------------------------------------------------------- */

@media print {
  .skip-link,
  .code__picker {
    display: none;
  }
}
