@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "General Sans";
  src: url("../assets/fonts/general-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Dark is the product default. These are the original dark values. */
  --bg: #121212;
  --text: #fafafa;
  --muted: #ababab;
  --line: #363636;
  --surface: #242424;
  --accent: #0099ff;
  --available: #00ff3c;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --content: 700px;
}

html[data-theme="light"] {
  /* Explicit user choice only. These are the original light values. */
  --bg: #ffffff;
  --text: #0a0a0a;
  --muted: #595959;
  --line: #ababab;
  --surface: #ebebeb;
}

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

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

html[data-theme="light"] {
  color-scheme: light;
}

@view-transition {
  navigation: auto;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

h1,
h2,
h3,
p,
ul,
figure,
dl,
dt,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

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

/* ---------- Fixed plus nav ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 16px 16px 0;
  pointer-events: none;
}

.plus-nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 2px;
  border-radius: 8px;
}

.plus-links {
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.plus-nav.is-open .plus-links {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.plus-links a {
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--text);
  transition: color 0.2s var(--ease);
}

.plus-links a:hover,
.plus-links a.is-active {
  color: var(--muted);
}

.plus-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  z-index: 2;
}

.plus-icon {
  width: 12px;
  height: 12px;
  position: relative;
  display: block;
  transform: rotate(0deg);
  transition: transform 0.35s var(--ease);
}

.plus-nav.is-open .plus-icon {
  transform: rotate(45deg);
}

.plus-icon i {
  position: absolute;
  background: var(--text);
  border-radius: 1px;
}

.plus-icon i:first-child {
  width: 12px;
  height: 1.5px;
  left: 0;
  top: 5.25px;
}

.plus-icon i:last-child {
  width: 1.5px;
  height: 12px;
  left: 5.25px;
  top: 0;
}

/* ---------- Page column ---------- */
.wrap {
  width: min(100%, var(--content));
  margin: 0 auto;
  padding: 0 16px 120px;
}

.hero {
  padding-top: 100px;
  padding-bottom: 40px;
}

.section {
  padding: 60px 0;
  scroll-margin-top: 88px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1,
.profile-name {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.lede,
.body {
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Intro ---------- */
.intro-top {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  width: 100%;
}

.intro-id {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  min-width: 0;
}

.avatar {
  width: 122px;
  height: 122px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.intro-name .role {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
}

.intro-meta {
  display: flex;
  align-items: center;
  gap: 107px;
  flex: 1;
  padding: 0 4px;
  margin-left: auto;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 10px;
  background: var(--available);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--available) 55%, transparent);
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--available) 45%, transparent);
  }
  70% {
    box-shadow: 0 0 0 6px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.intro-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-top: 32px;
}

.text-link {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  cursor: pointer;
}

.text-link .row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  color: var(--text);
}

.text-link svg {
  width: 16px;
  height: 16px;
}

.text-link .line {
  display: block;
  height: 1px;
  width: 100%;
  background: var(--line);
  position: relative;
  overflow: hidden;
}

.text-link .line span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--text);
  transition: width 0.35s var(--ease);
}

.text-link:hover .line span,
.text-link:focus-visible .line span {
  width: 100%;
}

/* ---------- Project grid ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(50px, 1fr));
  gap: 16px;
}

.project-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
}

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface);
  border-radius: 8px 8px 0 0;
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: inset 0.45s var(--ease), width 0.45s var(--ease), height 0.45s var(--ease), transform 0.45s var(--ease);
}

.project-card:hover .thumb img {
  inset: -6px -8px;
  width: calc(100% + 16px);
  height: calc(100% + 12px);
}

.project-card .caption {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 4px 4px;
}

.project-card .caption h3 {
  flex: 1;
}

.arrow {
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  flex-shrink: 0;
  color: var(--text);
}

.project-card .sub {
  font-size: 14px;
  color: var(--muted);
  padding: 0 4px 8px;
}

/* ---------- Typographic stacks ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.job,
.edu,
.skill-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.where,
.when,
.role {
  font-size: 14px;
  color: var(--muted);
}

.job h3,
.edu h3,
.skill-block h3 {
  font-size: 16px;
}

.job ul,
.skill-block ul,
.edu ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job li,
.skill-block li,
.edu li {
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
  padding-left: 16px;
  position: relative;
}

.job li::before,
.skill-block li::before,
.edu li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  position: absolute;
  left: 0;
  top: 0.55em;
}

.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.row-item .sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Project detail ---------- */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 20px;
}

.project-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.visit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
}

.visit svg {
  width: 16px;
  height: 16px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.meta-grid dt {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.meta-grid dd {
  font-size: 14px;
  font-weight: 500;
}

.case {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.case h3 {
  margin-bottom: 8px;
}

.case p,
.case li {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
}

.case ol,
.case ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 18px;
}

.case ul {
  list-style: disc;
}
.case ol {
  list-style: decimal;
}

.takeaways {
  font-size: 14px;
  color: var(--muted);
}
.takeaways strong {
  color: var(--text);
  font-weight: 500;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px 0 48px;
}

.gallery figure {
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
}

.gallery img {
  width: 100%;
  height: auto;
}

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

/* ---------- Appear on scroll ---------- */
.appear {
  opacity: 0;
  transform: translateY(18px);
  will-change: transform, opacity;
}

.appear.in {
  animation: rise 0.8s var(--ease) forwards;
}

.appear.d1 {
  animation-delay: 0.08s;
}
.appear.d2 {
  animation-delay: 0.16s;
}
.appear.d3 {
  animation-delay: 0.24s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: var(--bg);
  font-family: "General Sans", Inter, sans-serif;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 50px;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .appear,
  .appear.in,
  .plus-icon,
  .plus-links,
  .thumb img,
  .dot {
    animation: none !important;
    transition: none !important;
    opacity: 1;
    transform: none;
  }
}

/* ---------- Breakpoints matching Framer ---------- */
@media (max-width: 809.98px) {
  .site-header {
    justify-content: flex-start;
  }

  .plus-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .plus-nav.is-open {
    background: var(--surface);
    padding: 16px 8px;
    width: 220px;
    gap: 20px;
  }

  .plus-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    transform: none;
  }

  .plus-nav.is-open .plus-links {
    display: flex;
  }

  .plus-links-left {
    order: 1;
  }
  .plus-btn {
    order: 0;
  }
  .plus-links-right {
    order: 2;
  }

  .hero {
    padding-top: 88px;
  }

  .intro-top {
    flex-direction: column;
    align-items: center;
    gap: 32px;
    text-align: center;
  }

  .intro-id {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .avatar {
    width: 155px;
    height: 155px;
  }

  .intro-meta {
    margin-left: 0;
    justify-content: center;
    gap: 23px;
    width: 100%;
    flex: none;
  }

  .intro-links {
    align-items: center;
    width: 100%;
  }

  .project-grid,
  .more-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }

  .row-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .meta-grid {
    grid-template-columns: 1fr;
  }
}


/* ---------- Home control: case-study pages ---------- */
.home-fab {
  position: fixed;
  left: 22px;
  top: max(20px, env(safe-area-inset-top));
  z-index: 40;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow:
    0 10px 30px color-mix(in srgb, #000 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--text) 5%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  color: var(--muted);
  text-decoration: none;
  transition:
    border-color 240ms var(--ease),
    background 240ms var(--ease),
    color 240ms var(--ease),
    transform 240ms var(--ease);
}

.home-fab svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-fab:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  color: var(--text);
  transform: translateY(-1px);
}

.home-fab:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 640px) {
  .home-fab {
    left: 16px;
    top: max(16px, env(safe-area-inset-top));
    width: 30px;
    height: 30px;
  }
}

/* ---------- Theme switcher ---------- */
.theme-switcher {
  position: fixed;
  right: 22px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  width: 58px;
  height: 32px;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow:
    0 10px 30px color-mix(in srgb, #000 22%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--text) 5%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  color: var(--muted);
  transition:
    border-color 240ms var(--ease),
    background 240ms var(--ease),
    color 240ms var(--ease),
    transform 240ms var(--ease);
}

.theme-switcher:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  color: var(--text);
  transform: translateY(-1px);
}

.theme-switcher:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

.theme-switcher__icon {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.theme-switcher__icon svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 1.45;
  fill: none;
}

.theme-switcher__thumb {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: 0 3px 10px color-mix(in srgb, #000 18%, transparent);
  transition:
    transform 320ms var(--ease),
    background 240ms var(--ease),
    border-color 240ms var(--ease);
}

html[data-theme="light"] .theme-switcher__thumb {
  transform: translateX(26px);
}

.theme-switcher .theme-switcher__moon {
  color: var(--text);
}

.theme-switcher .theme-switcher__sun {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}

html[data-theme="light"] .theme-switcher .theme-switcher__moon {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}

html[data-theme="light"] .theme-switcher .theme-switcher__sun {
  color: var(--accent);
}

@media (max-width: 640px) {
  .theme-switcher {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 54px;
    height: 30px;
  }

  .theme-switcher__thumb {
    width: 22px;
    height: 22px;
  }

  html[data-theme="light"] .theme-switcher__thumb {
    transform: translateX(24px);
  }
}
