/* ---------------------------------------------------------------------------
   Inter (variable, latin subsets) — self-hosted, SIL Open Font License 1.1.
   See assets/fonts/OFL.txt.
--------------------------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------------------------------------------------------------------------
   bobmitch.com — tokens
   Light is the base palette; dark overrides follow so the toggle wins in
   both directions regardless of the OS setting.
--------------------------------------------------------------------------- */

:root {
  --bg: #f5f6f7;
  --bg-t0: rgb(245 246 247 / 0);
  --raised: rgb(18 22 30 / 0.028);
  --raised-hover: rgb(18 22 30 / 0.05);
  --line: rgb(18 22 30 / 0.11);
  --line-strong: rgb(18 22 30 / 0.22);
  --text: #15181d;
  --muted: #545a65;
  --faint: #666c74;
  --accent: #2e5c80;
  --accent-soft: rgb(46 92 128 / 0.09);
  --glow: rgb(46 92 128 / 0.10);
  --shadow: 0 1px 2px rgb(18 22 30 / 0.04), 0 8px 24px rgb(18 22 30 / 0.05);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;

  --pad: clamp(1.25rem, 5vw, 3rem);
  --measure: 66rem;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0a0b0e;
    --bg-t0: rgb(10 11 14 / 0);
    --raised: rgb(255 255 255 / 0.032);
    --raised-hover: rgb(255 255 255 / 0.06);
    --line: rgb(255 255 255 / 0.09);
    --line-strong: rgb(255 255 255 / 0.18);
    --text: #e9eaee;
    --muted: #9aa0aa;
    --faint: #7d838d;
    --accent: #7ab8d4;
    --accent-soft: rgb(122 184 212 / 0.12);
    --glow: rgb(122 184 212 / 0.11);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px rgb(0 0 0 / 0.32);
  }
}

:root[data-theme='dark'] {
  --bg: #0a0b0e;
  --bg-t0: rgb(10 11 14 / 0);
  --raised: rgb(255 255 255 / 0.032);
  --raised-hover: rgb(255 255 255 / 0.06);
  --line: rgb(255 255 255 / 0.09);
  --line-strong: rgb(255 255 255 / 0.18);
  --text: #e9eaee;
  --muted: #9aa0aa;
  --faint: #7d838d;
  --accent: #7ab8d4;
  --accent-soft: rgb(122 184 212 / 0.12);
  --glow: rgb(122 184 212 / 0.11);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px rgb(0 0 0 / 0.32);
}

/* --------------------------------------------------------------------- base */

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

html {
  /* Also the standing fallback whenever no renderer is available. */
  background-color: var(--bg);
  background-image: radial-gradient(125% 78% at 50% 0%, var(--glow) 0%, transparent 62%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  position: relative;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }

a { color: inherit; }

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

.skip-link {
  position: fixed;
  top: 0;
  left: var(--pad);
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  /* Slid out of view rather than parked off-canvas, so it never widens the page. */
  transform: translateY(-200%);
  transition: transform 0.18s var(--ease);
}
.skip-link:focus { transform: translateY(0.75rem); }

@media (prefers-reduced-motion: reduce) {
  .skip-link { transition: none; }
}

/* -------------------------------------------------------------- background */

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}
#bg[data-ready='true'] { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #bg { transition: none; }
}

/* Scrolls with the page, so the animation belongs to the hero and everything
   below it sits on calm, solid ground. */
.bg-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--bg-t0) 0,
    var(--bg-t0) 42vh,
    var(--bg) 118vh
  );
}

.bg-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 150vh;
  z-index: -3;
  pointer-events: none;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin-inline: auto;
  padding: 1.1rem var(--pad);
}

.wordmark {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.wordmark::before {
  content: '';
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.06em;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 1.6rem);
  font-size: 0.9rem;
}
.topbar__nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.topbar__nav a:hover { color: var(--text); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--raised);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
    background-color 0.18s var(--ease);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--raised-hover);
}
.theme-toggle .icon { width: 1rem; height: 1rem; }
.icon--sun { display: none; }
:root[data-theme='dark'] .icon--moon { display: none; }
:root[data-theme='dark'] .icon--sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .icon--moon { display: none; }
  :root:not([data-theme='light']) .icon--sun { display: block; }
}

/* --------------------------------------------------------------- structure */

main {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section__label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.section__label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* -------------------------------------------------------------------- hero */

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: min(78vh, 44rem);
  padding: clamp(3rem, 9vh, 6rem) 0 clamp(3.5rem, 10vh, 7rem);
}

.hero__eyebrow {
  margin-bottom: 1.4rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.hero__title {
  max-width: 20ch;
  font-size: clamp(1.9rem, 5.9vw, 4rem);
  font-weight: 300;
  line-height: 1.08;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

.hero__lede {
  max-width: 46ch;
  margin-top: 1.6rem;
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  color: var(--muted);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.66rem 1.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--text);
  background: var(--raised);
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease),
    transform 0.18s var(--ease);
}
.btn:hover { background: var(--raised-hover); transform: translateY(-1px); }

.btn--primary {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
}
.btn--primary:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

/* ------------------------------------------------------------------- about */

.about { padding-bottom: clamp(3rem, 8vh, 5rem); }

.about__text {
  max-width: 58ch;
  font-size: 1.02rem;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- projects */

.projects { padding-bottom: 0; }
.projects .grid + .section__label { margin-top: clamp(3rem, 8vh, 5rem); }

.grid {
  display: grid;
  /* min() caps the track floor at the container, and min-width:0 stops the
     nowrap host label from setting the card's width on narrow screens. */
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: 0.9rem;
}
.grid > li { min-width: 0; }

.card {
  display: flex;
  gap: 1rem;
  height: 100%;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease),
    transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: var(--raised-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card__mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--faint);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.card:hover .card__mark {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.card__mark svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card__mark svg .fill { fill: currentColor; stroke: none; }
.card__mark svg .thick { stroke-width: 2.1; }

.card__body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }

.card__title {
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.012em;
}

.card__desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

.card__host {
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- contact */

.contact { padding: clamp(2.75rem, 7vh, 4.5rem) 0 clamp(1rem, 3vh, 2rem); }

.contact__text {
  max-width: 52ch;
  color: var(--muted);
  text-wrap: pretty;
}
.contact__text a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.18s var(--ease);
}
.contact__text a:hover { text-decoration-color: var(--accent); }

/* ------------------------------------------------------------------ footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  max-width: var(--measure);
  margin: clamp(2rem, 6vh, 4rem) auto 0;
  padding: 1.5rem var(--pad) 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--faint);
}
.footer__mark { font-weight: 600; color: var(--muted); }
.footer__links { display: flex; gap: 1.1rem; }
.footer__links a {
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.footer__links a:hover { color: var(--text); }

/* ------------------------------------------------------------------ reveal */

.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover { transform: none; }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 34rem) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  /* Let the headline find its own breaks once the forced one no longer fits. */
  .wide-only { display: none; }
  .hero { min-height: min(70vh, 34rem); }
  .footer { justify-content: flex-start; }
}

/* ------------------------------------------------- topbar backdrop on scroll */

.topbar::before {
  content: '';
  position: absolute;
  /* Full-bleed behind a centred, max-width bar. */
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.topbar.is-stuck::before { opacity: 1; }
