/*
 * The products are the show: each card carries its product's own colour as a soft glow behind a framed screenshot.
 * Around them the page stays neutral, so the four colours are the only colour on it.
 */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("./fonts/bricolage.woff2") format("woff2-variations"), url("./fonts/bricolage.woff2") format("woff2");
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./fonts/archivo.woff2") format("woff2-variations"), url("./fonts/archivo.woff2") format("woff2");
}

:root {
  --bg: #0e1014;
  --surface: #15181e;
  --raise: #1c2028;
  --ink: #f2f4f8;
  --muted: #a7aebb;
  --faint: #8a92a1;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
  --glow: 46%;

  /* Each product's colour. */
  --duely: #34c38f;
  --roamly: #f59e4b;
  --tailor: #a78bfa;
  --hunter: #4f8dff;
  --molbhav: #22c3d6;

  --display: "Bricolage Grotesque", "Archivo", system-ui, sans-serif;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 24px;
}

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --raise: #eef0f4;
  --ink: #11141a;
  --muted: #535b69;
  --faint: #646c7a;
  --line: rgba(17, 20, 26, 0.08);
  --line-strong: rgba(17, 20, 26, 0.16);
  --shadow: 0 30px 60px -24px rgba(17, 20, 40, 0.22);
  --glow: 32%;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --raise: #eef0f4;
    --ink: #11141a;
    --muted: #535b69;
    --faint: #646c7a;
    --line: rgba(17, 20, 26, 0.08);
    --line-strong: rgba(17, 20, 26, 0.16);
    --shadow: 0 30px 60px -24px rgba(17, 20, 40, 0.22);
    --glow: 32%;
  }
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}
h1, h2, h3 {
  font-family: var(--display);
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 50;
  background: var(--ink);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.wordmark {
  font: 650 17px/1 var(--display);
  letter-spacing: -0.01em;
  text-decoration: none;
  margin-right: auto;
}
.section-nav { display: flex; gap: 2px; }
.section-nav a {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}
.section-nav a:hover { color: var(--ink); }
.section-nav a[aria-current="true"] {
  color: var(--ink);
  background: var(--raise);
}
.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--raise); }
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
/* The icon shows the theme you'd switch to. */
:root[data-theme="light"] .icon-sun,
:root:not([data-theme="light"]) .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun { display: none; }
  :root:not([data-theme]) .icon-moon { display: block; }
}

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

.hero { padding: clamp(56px, 8vw, 104px) 0 clamp(40px, 6vw, 64px); }
h1 {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 5.4rem);
  font-weight: 750;
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.role {
  margin: 22px 0 0;
  font: 500 clamp(1.25rem, 2.4vw, 1.6rem)/1.3 var(--display);
  letter-spacing: -0.01em;
}
.lede {
  margin: 14px 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.08rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 30px 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--raise); }
.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.button.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.button.small { height: 38px; padding: 0 16px; font-size: 14.5px; }
.button[target="_blank"]::after,
.visit::after,
.contact-links a::after {
  content: "↗" / "";
  margin-left: 3px;
  font-size: 0.9em;
  opacity: 0.7;
}

/* ---------- Work ---------- */

.section-head { margin-bottom: 28px; }
.section-head h2,
.split h2,
.contact h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 650;
  line-height: 1.1;
}
.section-head p { margin: 10px 0 0; color: var(--muted); }

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-12 { grid-column: 1 / -1; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  isolation: isolate;
}
/* The product's colour, glowing up from behind its screenshot. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(80% 60% at 70% 100%, color-mix(in srgb, var(--hue) var(--glow), transparent), transparent 72%),
    radial-gradient(45% 40% at 10% 0%, color-mix(in srgb, var(--hue) 10%, transparent), transparent 70%);
  transition: opacity 0.4s ease;
}
.card-copy { padding: 28px 30px 8px; }
.kind {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.kind::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hue);
}
.card h3 {
  margin: 10px 0 8px;
  font-size: clamp(1.7rem, 2.6vw, 2.15rem);
  font-weight: 700;
  line-height: 1.05;
}
.card-copy > p:not(.kind):not(.card-actions) {
  max-width: 46ch;
  color: var(--muted);
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 18px 0 0;
}
.visit {
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--hue) 70%, transparent);
  padding-bottom: 1px;
}
.visit:hover { border-bottom-color: var(--ink); }

/* A browser-ish frame: the bar shows the address the product lives at. */
/* The screenshot takes whatever height the card has left, so cards in a row end level. */
.window {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  margin: 0 30px -18px;
  padding-top: 24px;
  text-decoration: none;
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.window-bar {
  display: block;
  padding: 7px 0;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: var(--raise);
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}
.window picture {
  flex: 1 1 auto;
  display: block;
  min-height: 240px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-top: 0;
  background: #fff;
  box-shadow: var(--shadow);
}
.window img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.card:hover .window { transform: translateY(-8px); }

/* ---------- About and experience ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 24px 48px;
  padding-top: clamp(72px, 10vw, 120px);
}
.prose { max-width: 66ch; }
.prose p { color: var(--muted); font-size: 1.05rem; }

.jobs { display: grid; gap: 16px; }
.job {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.when { margin: 0 0 6px; font-size: 14px; color: var(--faint); }
.job h3 { margin: 0; font-size: 1.3rem; font-weight: 650; }
.job p:not(.when) { margin: 10px 0 0; color: var(--muted); max-width: 68ch; }
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.pills li {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--raise);
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- Contact ---------- */

.contact { padding: clamp(80px, 11vw, 140px) 0 48px; }
.contact-copy { margin: 14px 0 0; max-width: 56ch; color: var(--muted); }
.big-email {
  display: inline-block;
  margin-top: 26px;
  font: 650 clamp(1.5rem, 4.6vw, 3.4rem)/1.1 var(--display);
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(90deg, var(--duely), var(--hunter), var(--tailor), var(--roamly));
  background-size: 100% 3px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 8px;
}
.big-email:hover { color: var(--muted); }
.contact-links {
  display: flex;
  gap: 24px;
  margin: 26px 0 0;
}
.contact-links a { text-decoration: none; color: var(--muted); }
.contact-links a:hover { color: var(--ink); }
.site-footer {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 14px;
}

/* ---------- Case study panel ---------- */

.study {
  width: min(760px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.study::backdrop {
  background: rgba(6, 8, 12, 0.5);
  backdrop-filter: blur(4px);
}
.study[open] { animation: slide-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.study-inner {
  position: relative;
  padding: 0 clamp(20px, 5vw, 44px) 48px;
  isolation: isolate;
}
.study-inner::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 260px;
  z-index: -1;
  background: radial-gradient(80% 100% at 20% 0%, color-mix(in srgb, var(--hue) 22%, transparent), transparent 70%);
}
.study-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-top: 36px;
}
.study-head h2 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 750;
  line-height: 1;
}
.close {
  flex: none;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 500 14.5px/1 var(--sans);
  cursor: pointer;
}
.close:hover { background: var(--raise); }
.study-summary { margin: 22px 0 0; font-size: 1.1rem; }

.tabs {
  display: flex;
  gap: 4px;
  margin: 26px 0 16px;
  padding: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: 999px;
  background: var(--raise);
}
.tabs button {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.panel { min-height: 5em; color: var(--muted); }
.panel[hidden] { display: none; }

.built {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--raise) 55%, transparent);
}
.built summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.built summary::-webkit-details-marker { display: none; }
.built summary::after {
  content: "+";
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}
.built[open] summary::after { content: "−"; }
.study-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 28px 0 0;
}

/* ---------- Architecture diagrams (inside "How it's built") ---------- */

.schematic {
  margin: 0;
  padding: 4px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.schematic-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  grid-auto-rows: minmax(48px, auto);
  column-gap: clamp(24px, 5vw, 44px);
  row-gap: 10px;
}
.wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.wire {
  fill: none;
  stroke: var(--hue);
  stroke-width: 1.4;
  stroke-opacity: 0.55;
  stroke-linejoin: round;
}
.wire-head { fill: var(--hue); fill-opacity: 0.7; }
.wire.is-hot { stroke-opacity: 1; stroke-width: 2; }
.wire-head.is-hot { fill-opacity: 1; }
.schematic[data-drawing] .wire {
  stroke-dasharray: var(--len) var(--len);
  stroke-dashoffset: var(--len);
}
.schematic[data-drawing] .wire-head { opacity: 0; }
.schematic[data-drawn] .wire {
  stroke-dasharray: var(--len) var(--len);
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.3, 0.6, 0.2, 1) var(--delay, 0s), stroke-opacity 0.2s, stroke-width 0.2s;
}
.schematic[data-drawn] .wire-head { opacity: 1; transition: opacity 0.2s ease calc(var(--delay, 0s) + 0.5s); }

.node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font: 600 14px/1.25 var(--sans);
  cursor: pointer;
  overflow-wrap: anywhere;
}
.node small { font-size: 12.5px; font-weight: 400; color: var(--faint); }
.node.is-hub {
  align-items: center;
  text-align: center;
  border-color: color-mix(in srgb, var(--hue) 60%, transparent);
  background: color-mix(in srgb, var(--hue) 12%, var(--surface));
}
.node:hover,
.node.is-active { border-color: var(--hue); box-shadow: 0 0 0 2px color-mix(in srgb, var(--hue) 40%, transparent); }
.node.is-linked { border-color: color-mix(in srgb, var(--hue) 70%, transparent); }
.schematic figcaption {
  min-height: 4.8em;
  color: var(--muted);
  font-size: 15px;
}
.schematic figcaption strong { color: var(--ink); }

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .span-7, .span-5 { grid-column: 1 / -1; }
  .card { min-height: 0; }
  .window picture { flex: none; aspect-ratio: 16 / 10; min-height: 0; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar-inner { gap: 8px; }
  .wordmark { display: none; }
  .section-nav { margin-right: auto; margin-left: -10px; }
  .section-nav a { padding: 8px 9px; font-size: 14.5px; }
  .card-copy { padding: 22px 20px 4px; }
  .window { margin: auto 16px -14px; }
  .job { padding: 20px; }
  .schematic { padding: 4px 12px 14px; }
  .schematic-board { column-gap: 18px; row-gap: 8px; }
  .node { padding: 7px 8px; font-size: 12px; border-radius: 10px; }
  .node small { font-size: 11px; }
  .study { border-left: 0; }
}

@media (max-width: 370px) {
  .section-nav a { padding: 8px 6px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .window, .card::before { transition: none; }
  .card:hover .window { transform: none; }
  .study[open] { animation: none; }
  .schematic[data-drawing] .wire { stroke-dasharray: none; stroke-dashoffset: 0; }
  .schematic[data-drawing] .wire-head { opacity: 1; }
  .schematic[data-drawn] .wire,
  .schematic[data-drawn] .wire-head { transition: none; }
}
