@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/instrument-serif-latin-ext-400-normal.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;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/instrument-serif-latin-400-normal.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: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/instrument-serif-latin-ext-400-italic.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;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/instrument-serif-latin-400-italic.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: 100 900;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  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;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  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;
}

:root {
  color-scheme: light dark;
  --bg: light-dark(#F7F6F3, #15140F);
  --surface: light-dark(#FFFFFF, #1C1B17);
  --surface-2: light-dark(#EFEDE7, #23221D);
  --border: light-dark(#E4E2DC, #302E27);
  --border-strong: light-dark(#CFCCC3, #47443A);
  --text: light-dark(#111111, #F2F1EC);
  --text-muted: light-dark(#5E5D59, #A09E95);
  --accent: light-dark(#9A3412, #E8A07A);
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
  --section: clamp(var(--size-10), 10vw, var(--size-11));
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.sprite { position: absolute; }
.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 0.2em; transition: text-decoration-color 160ms var(--ease-in-out-3); }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: var(--pad); top: -4rem; z-index: 20; padding: 0.6rem 1rem; background: var(--text); color: var(--bg); border-radius: 4px; }
.skip:focus { top: 0.75rem; }

.container { width: 100%; max-width: calc(1120px + 2 * var(--pad)); margin-inline: auto; padding-inline: var(--pad); }
.label { font: 500 0.75rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.nav { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color 160ms var(--ease-in-out-3); }
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav .container { display: flex; align-items: center; justify-content: space-between; min-height: 4rem; }
.wordmark { font: 400 1.5rem/1 var(--serif); text-decoration: none; }
.nav ul { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2rem); font-size: 0.9375rem; }
.nav li a { text-decoration: none; padding-block: 0.75rem; }
.nav li a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
@media (max-width: 479px) { .nav li.opt { display: none; } }

.theme-toggle { position: relative; width: 44px; height: 24px; padding: 0; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.theme-toggle::before { content: ""; position: absolute; inset: -10px -2px; }
.theme-toggle .thumb { position: absolute; top: 2px; left: 2px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--text); color: var(--bg); transition: transform 160ms var(--ease-in-out-3); }
.theme-toggle .icon { width: 12px; height: 12px; grid-area: 1 / 1; }
.theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .thumb { transform: translateX(20px); }
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
:root[data-theme="dark"] .theme-toggle .thumb { transform: translateX(20px); }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

.hero { padding-block: clamp(var(--size-8), 9vw, var(--size-10)) var(--section); }
.hero .label { margin-bottom: var(--size-5); }
.hero h1 { font: 400 clamp(2.75rem, 7vw, 5.5rem)/1.02 var(--serif); letter-spacing: -0.02em; max-width: 14ch; text-wrap: balance; }
.hero h1 em { font-style: italic; }
.lead { margin-top: var(--size-8); max-width: 65ch; font-size: 1.0625rem; color: var(--text-muted); }
.hero-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: var(--size-5); }
.hero-meta .icon { width: 1rem; height: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--size-8); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px; padding: 0 1.25rem; border: 1px solid var(--border-strong); border-radius: 4px; font-weight: 500; font-size: 0.9375rem; text-decoration: none; transition: transform 160ms var(--ease-in-out-3), border-color 160ms var(--ease-in-out-3); }
.btn:hover { border-color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }

.section { padding-block: var(--section); border-top: 1px solid var(--border); }
.section-head { display: grid; gap: var(--size-3); margin-bottom: var(--size-8); max-width: 65ch; }
h2 { font: 400 clamp(2rem, 4vw, 3rem)/1.1 var(--serif); letter-spacing: -0.01em; }
.section-head p { color: var(--text-muted); }

.filters { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-bottom: var(--size-8); padding-bottom: var(--size-3); border-bottom: 1px solid var(--border); }
.filters button { min-height: 44px; padding: 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font: 500 0.9375rem var(--sans); cursor: pointer; transition: color 160ms var(--ease-in-out-3), border-color 160ms var(--ease-in-out-3); }
.filters button:hover { color: var(--text); }
.filters button[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }

.projects { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 760px) { .projects { grid-template-columns: repeat(2, 1fr); } }
.project { display: flex; min-width: 0; }
.card { display: flex; flex-direction: column; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; text-decoration: none; transition: border-color 160ms var(--ease-in-out-3); }
.card:hover { border-color: var(--border-strong); }
.shot { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ease-out-4); }
.card:hover .shot img { transform: scale(1.02); }
.card-body { display: flex; flex: 1; flex-direction: column; gap: 0.75rem; padding: var(--size-5); }
.card-meta { display: flex; justify-content: space-between; gap: 1rem; }
h3 { font: 600 1.125rem/1.3 var(--sans); }
.card p { color: var(--text-muted); font-size: 0.9375rem; }
.card .stack { margin-top: auto; padding-top: 0.25rem; font: 500 0.75rem/1.4 var(--mono); color: var(--text-muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); font-size: 0.9375rem; font-weight: 500; }
.card-foot .path { font: 500 0.75rem/1.4 var(--mono); color: var(--text-muted); overflow-wrap: anywhere; }
.card-foot .go { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 0.2em; }
.card:hover .go { text-decoration-color: var(--accent); }

.group + .group { margin-top: var(--size-8); }
.group-title { margin-bottom: var(--size-3); padding-bottom: var(--size-2); border-bottom: 1px solid var(--border); }
.minis { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .minis { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .minis { grid-template-columns: repeat(3, 1fr); } }
.mini { display: flex; min-width: 0; }
.mini .card-body { gap: 0.5rem; padding: var(--size-4); }
h4 { font: 600 1rem/1.3 var(--sans); }
.mini .card-foot { margin-top: auto; }
.repo-list { border-top: 1px solid var(--border-strong); }
.repo-list a { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr auto auto; align-items: center; gap: 0.5rem 1.5rem; padding-block: var(--size-4); border-bottom: 1px solid var(--border); text-decoration: none; }
.repo-list .name { font: 500 0.9375rem/1.4 var(--mono); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 0.2em; transition: text-decoration-color 160ms var(--ease-in-out-3); }
.repo-list a:hover .name { text-decoration-color: var(--accent); }
.repo-list .desc { color: var(--text-muted); font-size: 0.9375rem; }
.repo-list .icon { width: 1.25rem; height: 1.25rem; }
@media (max-width: 639px) { .repo-list a { grid-template-columns: 1fr auto; } .repo-list .desc { grid-column: 1 / -1; grid-row: 2; } .repo-list .lang { grid-row: 1; grid-column: 2; } .repo-list .icon { display: none; } }

.about-grid { display: grid; gap: var(--size-8); }
@media (min-width: 760px) { .about-grid { grid-template-columns: 7fr 5fr; gap: var(--size-10); } }
.prose { display: grid; gap: var(--size-3); max-width: 65ch; }
.stack-list { align-self: start; border-top: 1px solid var(--border-strong); }
.stack-list div { display: grid; gap: 0.25rem; padding-block: var(--size-3); border-bottom: 1px solid var(--border); }

.contact-list { border-top: 1px solid var(--border-strong); }
.contact-list a, .contact-list .row { display: grid; grid-template-columns: 6rem 1fr auto; align-items: center; gap: 1rem; padding-block: var(--size-5); border-bottom: 1px solid var(--border); text-decoration: none; }
.contact-list .value { font-size: 1.0625rem; overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 0.2em; transition: text-decoration-color 160ms var(--ease-in-out-3); }
.contact-list .row .value { text-decoration: none; }
.contact-list a:hover .value { text-decoration-color: var(--accent); }
.contact-list .icon { width: 1.25rem; height: 1.25rem; }

.footer { border-top: 1px solid var(--border); padding-block: var(--size-8); }
.footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }
.footer p, .footer a { font: 500 0.75rem/1.4 var(--mono); color: var(--text-muted); }
.footer .small { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; }

@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .about, .contact { animation: fade-up linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; animation-duration: 1ms; }
  }
}

/* Wire-glass background (js/bg-loader.js -> js/bg/fushift-bg.min.js). Sits under all content,
   paints the same --bg colour where empty, so it fades in without a flash. */
.bg-canvas { position: fixed; inset: 0; z-index: -1; display: block; width: 100%; height: 100vh; height: 100lvh; pointer-events: none; opacity: 0; transition: opacity 900ms var(--ease-out-3); }
.bg-canvas.is-ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .bg-canvas { transition: none; } }
