:root {
  --bg: #0b0b1e;
  --bg-2: #121233;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --line: rgba(217, 184, 116, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --text: #ece8df;
  --muted: #a3a0b8;
  --gold: #d9b874;
  --gold-2: #b8924a;
  --violet: #4b3fb5;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(75, 63, 181, 0.35), transparent 60%),
    radial-gradient(900px 600px at -10% 40%, rgba(75, 63, 181, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #08081a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }

/* soft bokeh lights echoing the portrait background */
.bokeh { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bokeh span { position: absolute; border-radius: 50%; filter: blur(28px); opacity: .28; animation: drift 22s ease-in-out infinite alternate; }
.bokeh span:nth-child(1) { width: 140px; height: 140px; background: #e29a5b; left: 6%; top: 18%; }
.bokeh span:nth-child(2) { width: 90px; height: 90px; background: #c96a8a; left: 14%; top: 62%; animation-delay: -6s; }
.bokeh span:nth-child(3) { width: 180px; height: 180px; background: #6a5ae0; right: 8%; top: 8%; animation-delay: -12s; }
.bokeh span:nth-child(4) { width: 70px; height: 70px; background: #e0b46a; right: 18%; top: 70%; animation-delay: -3s; }
.bokeh span:nth-child(5) { width: 110px; height: 110px; background: #8a5ac9; left: 48%; top: 88%; animation-delay: -9s; }
@keyframes drift { to { transform: translate3d(30px, -40px, 0) scale(1.15); } }

main, .topbar, .footer { position: relative; z-index: 1; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto; padding: 28px 24px;
}
.mark { font-family: var(--serif); font-size: 34px; font-weight: 600; text-decoration: none; letter-spacing: .02em; color: var(--gold); line-height: 1; }
.mark span { color: var(--text); }
.topbar nav { display: flex; gap: 28px; }
.topbar nav a { text-decoration: none; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); transition: color .2s; }
.topbar nav a:hover { color: var(--gold); }

/* hero: one centred, symmetrical column on every screen size */
.hero {
  max-width: 1120px; margin: 0 auto; padding: 8px 24px 88px;
  display: flex; flex-direction: column; align-items: center; gap: 36px; text-align: center;
}
/* compact portrait: 200×250 */
.portrait { position: relative; width: 200px; aspect-ratio: 4 / 5; }
/* the portrait is a CSS background (no <img> to "Save image as…"), covered by a transparent shield */
.portrait, .portrait * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
.portrait .photo {
  position: absolute; inset: 0;
  background: #1b1840 url('/media/portrait') 50% 30% / cover no-repeat;
  border-radius: 100px 100px 14px 14px;
  box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .8), 0 0 0 1px var(--line);
  pointer-events: none;
}
.portrait .photo-shield { position: absolute; inset: 0; z-index: 2; border-radius: 100px 100px 14px 14px; background: transparent; }
@media print { .portrait { visibility: hidden; } }
.portrait .ring {
  position: absolute; inset: -10px; border-radius: 110px 110px 22px 22px;
  border: 1px solid var(--line);
}
.portrait .ring::after {
  content: ''; position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold); top: 50%; left: -5px; box-shadow: 0 0 16px var(--gold);
}
.eyebrow { margin: 0 0 14px; font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .005em; margin: 0; }
/* the name always stays on one line: font size follows the width of the text column */
.hero-text { container-type: inline-size; min-width: 0; width: 100%; }
h1 { font-size: clamp(30px, 6vw, 68px); line-height: 1.05; white-space: nowrap; }
@supports (font-size: 1cqi) { h1 { font-size: clamp(30px, 13cqi, 68px); } }
/* job titles split into evenly balanced lines instead of leaving one orphan */
.role {
  font-family: var(--serif); font-style: italic; font-size: clamp(19px, 2vw, 23px); line-height: 1.5; color: var(--gold);
  max-width: 720px; margin: 16px auto 0; text-wrap: balance;
}
.role .sep { font-style: normal; color: var(--muted); opacity: .55; margin: 0 .15em; }
.role::after { content: ''; display: block; width: 56px; height: 1px; margin: 26px auto 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.intro { max-width: 600px; color: var(--muted); font-size: 16.5px; font-weight: 300; margin: 22px auto 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.stats {
  display: flex; justify-content: center; gap: 56px; flex-wrap: wrap;
  width: fit-content; max-width: 100%; margin: 48px auto 0; padding: 28px 24px 0; border-top: 1px solid var(--line-soft);
}
.stats dt { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-family: var(--serif); font-size: 24px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font: 500 14px/1 var(--sans); letter-spacing: .04em;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s, box-shadow .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: linear-gradient(135deg, #e8cc8e, var(--gold-2)); color: #17122a; box-shadow: 0 10px 30px -12px rgba(217, 184, 116, .6); }
.btn-gold:hover { box-shadow: 0 14px 34px -10px rgba(217, 184, 116, .75); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-small { padding: 10px 18px; font-size: 13px; }
.btn[hidden] { display: none; }
#reset-order { background: transparent; color: var(--muted); border-color: var(--line-soft); }
#reset-order:hover { color: var(--gold); border-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* projects */
.projects { max-width: 1120px; margin: 0 auto; padding: 0 24px 120px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 36px; flex-wrap: wrap; }
h2 { font-size: clamp(40px, 5vw, 58px); line-height: 1; }
.sort-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hint { margin: 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.hint-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); color: var(--gold); animation: nudge 2.4s ease-in-out infinite; }
.hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .hint-desktop { display: none; } .hint-touch { display: inline; } }
@keyframes nudge { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-3px); } 90% { transform: translateY(3px); } }

.project-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.project {
  --accent: var(--gold);
  position: relative; display: grid; grid-template-columns: 88px 1fr;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  backdrop-filter: blur(6px);
  transition: border-color .25s, box-shadow .25s, background .25s;
  touch-action: pan-y;
  user-select: none; -webkit-user-select: none;
}
.project::before {
  content: ''; position: absolute; left: 0; top: 22px; bottom: 22px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--accent), transparent); opacity: .8;
}
.project:hover { border-color: var(--line); background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025)); }
.project-rank { display: flex; justify-content: center; padding-top: 30px; border-right: 1px solid var(--line-soft); }
.rank-no { font-family: var(--serif); font-size: 34px; color: var(--gold); line-height: 1; transition: transform .3s var(--ease); }
.project-body { padding: 28px 32px 28px; min-width: 0; }
.project-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.project-name { font-size: 34px; line-height: 1.1; }
.project-tagline { margin: 4px 0 0; font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--gold); }
.handle {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px;
  background: transparent; border: 1px solid var(--line-soft); color: var(--muted); cursor: grab;
  transition: color .2s, border-color .2s, background .2s;
  touch-action: none;
}
.handle svg { width: 20px; height: 20px; fill: currentColor; }
.handle:hover, .handle:focus-visible { color: var(--gold); border-color: var(--line); background: rgba(217,184,116,.06); }
.project-desc { margin: 18px 0 14px; color: #cfcbdc; font-weight: 300; font-size: 15.5px; max-width: 780px; user-select: text; -webkit-user-select: text; }
.project-highlights { margin: 0 0 20px; padding: 0; list-style: none; display: grid; gap: 6px; }
.project-highlights li { position: relative; padding-left: 22px; font-size: 14px; color: var(--muted); }
.project-highlights li::before { content: ''; position: absolute; left: 2px; top: .72em; width: 8px; height: 1px; background: var(--gold); }
.project-stack { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.project-stack li { font-size: 12px; letter-spacing: .04em; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-soft); color: #d6d2e4; background: rgba(255,255,255,.03); }
.project-langs { margin: 0 0 22px; max-width: 520px; }
.lang-bar { display: flex; height: 4px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.06); }
.lang-bar span { height: 100%; }
.lang-legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); }
.lang-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.project-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.project-links { display: flex; gap: 10px; flex-wrap: wrap; }
.project-meta { margin: 0; font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }
.project-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); font-style: italic; }
.project-note[hidden], .project-langs[hidden] { display: none; }

/* drag states */
.project.dragging {
  position: fixed; z-index: 50; margin: 0; pointer-events: none;
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(40, 36, 90, .96), rgba(22, 20, 54, .96));
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.85), 0 0 0 1px rgba(217,184,116,.35), 0 0 60px -10px rgba(217,184,116,.25);
  transform: rotate(-.6deg) scale(1.015);
  transition: box-shadow .2s, transform .2s var(--ease);
}
.project.dragging .handle { cursor: grabbing; color: var(--gold); }
.project.dropping { transition: top .28s var(--ease), left .28s var(--ease), transform .28s var(--ease), box-shadow .28s; transform: none; }
.placeholder {
  border: 1px dashed rgba(217,184,116,.5); border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, rgba(217,184,116,.05) 0 12px, transparent 12px 24px);
}
/* while sorting, every card folds down to its title so the list is easy to rearrange */
.project-list.sorting { gap: 12px; }
.project-list.sorting :is(.project-desc, .project-highlights, .project-stack, .project-langs, .project-foot, .project-note) { display: none; }
.project-list.sorting .project-body { padding: 18px 24px; }
.project-list.sorting .project-rank { padding-top: 20px; }
.project-list.sorting .project-name { font-size: 28px; }
.project-list.unfold :is(.project-desc, .project-highlights, .project-stack, .project-langs, .project-foot) { animation: unfold .45s var(--ease) both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }
body.is-dragging { cursor: grabbing; }
body.is-dragging * { cursor: grabbing !important; }
.project.landed { animation: land .6s var(--ease); }
@keyframes land { 0% { box-shadow: 0 0 0 1px var(--gold), 0 0 40px rgba(217,184,116,.4); } 100% { box-shadow: 0 0 0 0 transparent; } }
.project.landed .rank-no { animation: pop .5s var(--ease); }
@keyframes pop { 40% { transform: scale(1.35); } }

/* skeleton */
.skeleton { min-height: 280px; display: block; background: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.07), rgba(255,255,255,.03)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton::before { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); opacity: 0;
  padding: 12px 20px; border-radius: 999px; font-size: 14px;
  background: rgba(22, 20, 54, .95); border: 1px solid var(--line); color: var(--text);
  box-shadow: 0 20px 40px -16px rgba(0,0,0,.8); pointer-events: none;
  transition: opacity .3s, transform .3s var(--ease); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* sparkles on drop */
.spark { position: fixed; z-index: 70; width: 6px; height: 6px; border-radius: 50%; pointer-events: none; background: var(--gold); box-shadow: 0 0 10px var(--gold); }

.footer { max-width: 1120px; margin: 0 auto; padding: 32px 24px 48px; border-top: 1px solid var(--line-soft); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.footer p { margin: 0; }

/* responsive */
@media (max-width: 900px) {
  .hero { gap: 32px; padding-top: 16px; padding-bottom: 64px; }
  .portrait { width: 160px; }
}
@media (max-width: 640px) {
  .topbar { padding: 20px 16px; }
  .topbar nav { gap: 18px; }
  .hero, .projects { padding-left: 16px; padding-right: 16px; }
  .stats { gap: 24px; }
  .stats dd { font-size: 20px; }
  .project { grid-template-columns: 1fr; }
  .project-rank { position: absolute; top: 22px; right: 72px; padding: 0; border: 0; }
  .rank-no { font-size: 26px; opacity: .8; }
  .project-body { padding: 22px 18px; }
  .project-head { padding-right: 0; }
  .project-name { font-size: 28px; padding-right: 48px; }
  .project-links { width: 100%; }
  .project-links .btn { flex: 1; justify-content: center; }
  .footer { padding: 28px 16px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
