:root {
  --bg: #f3f0e8;
  --surface: #fbf9f4;
  --ink: #17150f;
  --muted: #6b665b;
  --line: #dcd6c8;
  --accent: #ff4f1a;
  --accent-ink: #c2360a;
  --on-solid: #fbf9f4;
  --shadow: 0 1px 2px rgb(23 21 15 / 6%), 0 12px 32px -12px rgb(23 21 15 / 22%);
  --radius: 18px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0d0b;
    --surface: #171613;
    --ink: #f2eee5;
    --muted: #9a9486;
    --line: #2b2924;
    --accent: #ff6a3d;
    --accent-ink: #ff8a63;
    --on-solid: #0e0d0b;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 16px 40px -16px rgb(0 0 0 / 70%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0d0b;
  --surface: #171613;
  --ink: #f2eee5;
  --muted: #9a9486;
  --line: #2b2924;
  --accent: #ff6a3d;
  --accent-ink: #ff8a63;
  --on-solid: #0e0d0b;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 16px 40px -16px rgb(0 0 0 / 70%);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

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

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }

.mark {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.02em; text-decoration: none;
}
.mark-soft { color: var(--muted); font-weight: 500; }
.mark-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 8px 12px; border-radius: 999px;
  font-size: 15px; font-weight: 500; text-decoration: none; color: var(--muted);
  transition: color .15s, background-color .15s;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }

.theme-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; margin-left: 6px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform .2s;
}
.theme-btn:hover { transform: rotate(-18deg); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-btn .i-moon { display: none; fill: currentColor; stroke: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: block; }
}

/* ---------- Hero ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  min-height: min(760px, calc(100svh - 70px));
  padding: clamp(40px, 8vw, 96px) 0 clamp(48px, 8vw, 104px);
}

.hello {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 28px;
  padding: 5px 14px 5px 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.hello a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
.hello a:hover { text-decoration-color: var(--accent); }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }

h1 {
  margin: 0;
  font-size: clamp(56px, 10.5vw, 132px);
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  line-height: 0.9;
  letter-spacing: -0.045em;
}
.accent { color: var(--accent); }

.lede {
  max-width: 34ch;
  margin: 28px 0 0;
  font-size: clamp(19px, 2vw, 23px);
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 36px; }

.icon-links { display: flex; gap: 6px; }
.icon-links a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; color: var(--muted);
  transition: color .15s, background-color .15s, transform .15s;
}
.icon-links a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); transform: translateY(-2px); }
.icon-links svg { width: 21px; height: 21px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
  background: var(--surface);
  transition: border-color .15s, background-color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn-solid { background: var(--ink); border-color: var(--ink); color: var(--on-solid); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: #17150f; }

/* Deck of covers */
.deck {
  position: relative;
  aspect-ratio: 5 / 4;
  width: 100%;
}
.deck-card {
  --r: calc(var(--i) * 4.5deg - 5deg);
  --x: calc(var(--i) * 4.5%);
  --y: calc(var(--i) * -3.5%);
  position: absolute;
  left: 2%; top: 26%;
  width: 78%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  outline: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
  z-index: calc(10 - var(--i));
}
.deck-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.deck:hover .deck-card {
  --r: calc(var(--i) * 7deg - 8deg);
  --x: calc(var(--i) * 6.5%);
  --y: calc(var(--i) * -6%);
}
.deck .deck-card:hover { z-index: 20; box-shadow: 0 30px 60px -20px rgb(0 0 0 / 45%); }
.deck .deck-card:hover { transform: translate(var(--x), calc(var(--y) - 6%)) rotate(calc(var(--r) * .4)) scale(1.04); }

/* ---------- Sections ---------- */
.section-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px;
  padding-bottom: 20px; margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}
.section-meta { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--muted); }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); font-family: var(--mono); font-size: 12px; text-align: center; color: var(--ink);
}

.work { padding-top: 24px; }

/* ---------- Projects ---------- */
.project {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s, border-color .3s;
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); }
.project.flash { animation: flash 1s ease; }
@keyframes flash { 30% { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); } }

.shot { display: block; overflow: hidden; background: #111; }
.shot img {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.project:hover .shot img { transform: scale(1.035); }

.project-body { display: flex; flex-direction: column; flex: 1; padding: 22px 24px 24px; }

.project-num {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 8px;
  font-family: var(--mono); font-size: 13px; color: var(--accent-ink);
}
.project-num span {
  padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--muted); font-size: 12px;
}

h3 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
h3 a { text-decoration: none; }
h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; text-decoration-color: var(--accent); }

.project-desc { margin: 10px 0 0; color: var(--muted); text-wrap: pretty; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tags li {
  padding: 3px 10px;
  border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}

.project-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: auto; padding-top: 22px;
}
.stats { display: flex; gap: 14px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.stat { display: inline-flex; align-items: center; gap: 5px; }
.stat svg { width: 15px; height: 15px; }
.stat b { color: var(--ink); font-weight: 500; }
.links { display: flex; gap: 8px; }
.grid .links { margin-left: auto; }

.project-featured {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  margin-bottom: 20px;
}
.project-featured .shot { height: 100%; }
.project-featured .shot img { height: 100%; }
.project-featured .project-body { padding: clamp(24px, 3vw, 40px); justify-content: center; }
.project-featured h3 { font-size: clamp(32px, 3.4vw, 44px); }
.project-featured .project-desc { font-size: 18px; }
.project-featured .project-foot { margin-top: 0; padding-top: 28px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

.more { margin: 28px 0 0; color: var(--muted); }
.more a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--accent); }

/* ---------- Elsewhere ---------- */
.elsewhere { padding: clamp(80px, 12vw, 144px) 0 clamp(56px, 8vw, 96px); }

.socials li { border-bottom: 1px solid var(--line); }
.socials a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 32px;
  align-items: center; gap: 16px;
  padding: 22px 4px;
  text-decoration: none;
  transition: padding .25s cubic-bezier(.2, .8, .2, 1), color .2s;
}
.s-icon { width: 26px; height: 26px; color: var(--muted); transition: color .2s; }
.s-name { font-size: clamp(26px, 4vw, 40px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.s-handle { font-family: var(--mono); font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-arrow { font-size: 24px; color: var(--muted); text-align: right; transition: transform .25s, color .2s; }
.socials a:hover { padding-left: 16px; }
.socials a:hover .s-icon, .socials a:hover .s-arrow { color: var(--accent); }
.socials a:hover .s-arrow { transform: translate(3px, -3px); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--max); margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 28px var(--gutter) 40px;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.footer p { margin: 0; }
.footer a { color: var(--ink); text-underline-offset: 3px; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .deck { max-width: 560px; aspect-ratio: 16 / 11; }
  .project-featured { grid-template-columns: 1fr; }
  .project-featured .shot img { height: auto; }
  .kbd-hint { display: none; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .nav a { padding: 8px 9px; }
  .mark-soft { display: none; }
  .project-body { padding: 18px 18px 20px; }
  .socials a { grid-template-columns: 26px minmax(0, 1fr) 24px; gap: 12px; padding: 18px 0; }
  .s-icon { width: 22px; height: 22px; }
  .s-handle { grid-column: 2; grid-row: 2; margin-top: -8px; }
  .s-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .socials a:hover { padding-left: 0; }
}

@media (hover: none) {
  .kbd-hint { display: none; }
}

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