/* ================== Base ================== */
:root {
  --bg: #0b0b0b;
  --panel: #141414;
  --panel-2: #1a1a1a;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2f2f2;
  --muted: #8d8d8d;
  --dim: #5c5c5c;
  --radius: 18px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* soft spotlight + grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255,255,255,0.07), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(255,255,255,0.03), transparent 70%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: #fff; color: #000; }

.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }

/* ================== Header ================== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 22px 0;
  transition: background 0.4s var(--ease), padding 0.4s var(--ease);
}
.site-header.scrolled {
  background: rgba(11, 11, 11, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.brand { line-height: 1.25; }
.brand strong { display: block; font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand span { font-size: 11.5px; color: var(--muted); }

.pill-nav {
  position: relative;
  display: flex;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 8px 30px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
}
.pill-nav a {
  position: relative;
  z-index: 1;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.3s;
}
.pill-nav a.active, .pill-nav a:hover { color: #fff; }
.pill-indicator {
  position: absolute;
  top: 5px; bottom: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  transition: left 0.45s var(--ease), width 0.45s var(--ease);
}
/* little glowing tick above the active tab, like the reference */
.pill-indicator::before {
  content: "";
  position: absolute;
  top: -6px; left: 50%;
  width: 18px; height: 2px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 10px 2px rgba(255,255,255,0.6);
}

.header-links { display: flex; justify-content: flex-end; gap: 26px; font-size: 13px; font-weight: 500; }
.header-links a { display: inline-flex; gap: 6px; align-items: center; color: #ddd; transition: color 0.2s; }
.header-links a:hover { color: #fff; }
.arrow { display: inline-block; transition: transform 0.3s var(--ease); }
a:hover .arrow { transform: translate(2px, -2px); }

/* ================== Hero ================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 120px 0 60px;
}
.browser {
  position: relative;
  width: 100%;
  border-radius: 16px;
  background: linear-gradient(180deg, #1c1c1c, #121212 60%, #0e0e0e);
  border: 1px solid var(--line-2);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.6),
    0 40px 120px -20px rgba(0,0,0,0.9),
    0 0 80px -10px rgba(255,255,255,0.08);
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  animation: rise 1.2s var(--ease) 0.15s forwards;
}
/* fade the bottom of the window into the page */
.browser::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 30%;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 14px;
  background: linear-gradient(90deg, #6f6f6f, #b8b8b8 50%, #6f6f6f);
  border-bottom: 1px solid rgba(0,0,0,0.5);
}
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.browser-bar i:nth-child(1) { background: #ff5f57; }
.browser-bar i:nth-child(2) { background: #febc2e; }
.browser-bar i:nth-child(3) { background: #28c840; }
.browser-bar b { margin-left: auto; color: rgba(0,0,0,0.35); font-weight: 300; font-size: 18px; }

.browser-body { position: relative; padding: clamp(40px, 8vw, 90px) clamp(24px, 6vw, 70px) clamp(60px, 9vw, 110px); }

.headline {
  margin: 0;
  font-weight: 500;
  font-size: clamp(40px, 7.4vw, 92px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  filter: drop-shadow(0 0 28px rgba(255,255,255,0.22));
}
.headline .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.headline .line > span {
  display: inline-block;
  transform: translateY(105%);
  animation: lineUp 1.1s var(--ease) forwards;
}
.headline .line:nth-child(1) > span { animation-delay: 0.45s; }
.headline .line:nth-child(2) > span { animation-delay: 0.6s; }
.accent {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  padding-right: 0.08em;
  background: linear-gradient(100deg, #6b6b6b 0%, #f5f5f5 35%, #9a9a9a 55%, #e8e8e8 80%, #777 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  animation: shine 6s linear infinite;
}

.hero-intro {
  margin: clamp(32px, 6vw, 64px) 0 0 auto;
  width: fit-content;
  max-width: 100%;
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.45;
  letter-spacing: -0.01em;
  opacity: 0;
  animation: fadeIn 1s var(--ease) 1s forwards;
}
.hero-intro p { margin: 0; }
.hero-intro .sub { color: var(--muted); }

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 2;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 22px;
  opacity: 0;
  animation: fadeIn 1s 1.4s forwards, bob 2.2s ease-in-out 2s infinite;
}
.scroll-cue:hover { color: #fff; }

/* ================== Sections ================== */
section { padding: 90px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.035em;
}
.section-head h2 em { font-family: var(--serif); font-weight: 400; color: #bdbdbd; }
.section-head span { color: var(--muted); font-size: 13px; }

/* ================== Project cards ================== */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.card {
  --mx: 50%; --my: 50%;
  position: relative;
  display: block;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.5s var(--ease), border-color 0.3s, box-shadow 0.5s var(--ease);
}
.card:first-child { grid-column: 1 / -1; }
.card:first-child .card-media { aspect-ratio: 21 / 9; }
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(400px circle at var(--mx) var(--my), rgba(255,255,255,0.09), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover { transform: translateY(-6px); border-color: var(--line-2); box-shadow: 0 30px 60px -20px rgba(0,0,0,0.8); }
.card:hover::before { opacity: 1; }
.card-media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel-2); }
.card-media img, .card-media .ph { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--ease); }
.card:hover .card-media img, .card:hover .card-media .ph { transform: scale(1.05); }
.card-body { padding: 20px 22px 22px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }
.card-body h3 { margin: 4px 0 6px; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.card-body p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.tag { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.badge3d {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  font-size: 10px;
  color: #ccc;
  letter-spacing: 0.05em;
}
.card-go {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  color: #ddd;
  transition: background 0.3s, color 0.3s, transform 0.4s var(--ease);
}
.card:hover .card-go { background: #fff; color: #000; transform: rotate(-45deg); }

/* image placeholder (shown until a real photo is added) */
.ph {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  min-height: 140px;
  color: var(--dim);
  font-size: 12px;
  text-align: center;
  padding: 16px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 14px),
    linear-gradient(160deg, #1d1d1d, #121212);
}
.ph svg { width: 28px; height: 28px; opacity: 0.6; }
.ph code { font-family: ui-monospace, Consolas, monospace; color: #7a7a7a; font-size: 11px; }

/* ================== Experience ================== */
.timeline { position: relative; }
.job {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}
.job:last-child { border-bottom: 0; }
.job-meta { color: var(--muted); font-size: 13px; }
.job-meta .dates { color: #cfcfcf; font-weight: 500; display: block; margin-bottom: 2px; }
.job h3 { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.job .org { color: var(--muted); font-size: 14px; margin: 2px 0 14px; }
.job ul { margin: 0; padding: 0; list-style: none; }
.job li { position: relative; padding-left: 18px; margin: 8px 0; color: #c4c4c4; font-size: 14.5px; }
.job li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 6px; height: 1px; background: var(--muted); }
.job.collapsed li:nth-child(n+4) { display: none; }
.more-btn {
  margin-top: 10px;
  padding: 7px 14px;
  font: inherit;
  font-size: 12.5px;
  color: #ddd;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s;
}
.more-btn:hover { background: rgba(255,255,255,0.08); }

/* ================== Skills ================== */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.skill-group {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.skill-group h4 { margin: 0 0 14px; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 13px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.chip:hover { background: rgba(255,255,255,0.1); border-color: var(--line-2); transform: translateY(-2px); }

/* ================== Footer / contact ================== */
.contact { text-align: center; padding: 120px 0 60px; }
.contact h2 {
  margin: 0 0 18px;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-shadow: 0 0 40px rgba(255,255,255,0.2);
}
.contact p { color: var(--muted); margin: 0 0 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 99px;
  font-weight: 500;
  font-size: 14px;
  background: #fff;
  color: #000;
  box-shadow: 0 0 40px rgba(255,255,255,0.18);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 60px rgba(255,255,255,0.3); }
.btn.ghost { background: transparent; color: #fff; border: 1px solid var(--line-2); box-shadow: none; }
.btn.ghost:hover { background: rgba(255,255,255,0.06); }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.footer-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 90px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 12.5px;
}
.footer-bar a:hover { color: #fff; }

/* ================== Project page ================== */
.project-hero { padding: 150px 0 40px; }
.back { display: inline-flex; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 30px; transition: color 0.2s; }
.back:hover { color: #fff; }
.project-hero h1 {
  margin: 8px 0 18px;
  font-size: clamp(38px, 6.5vw, 80px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-shadow: 0 0 40px rgba(255,255,255,0.2);
}
.project-hero .lead { max-width: 680px; color: #bdbdbd; font-size: clamp(16px, 1.6vw, 19px); margin: 0; }
.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 46px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts div { padding: 18px 0; }
.facts div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin-bottom: 4px; }
.facts dd { margin: 0; font-size: 14.5px; }
.project-cover { margin: 40px 0 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 16 / 8; background: var(--panel-2); }
.project-cover img, .project-cover .ph { width: 100%; height: 100%; object-fit: cover; }

.story { padding: 70px 0 20px; }
.story-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
}
.story-row h3 { margin: 0; font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.story-row h3 span { color: var(--dim); margin-right: 10px; }
.story-row p { margin: 0; font-size: clamp(17px, 1.8vw, 22px); line-height: 1.5; letter-spacing: -0.015em; color: #e6e6e6; }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.gallery figure { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 3; background: var(--panel-2); }
.gallery img, .gallery .ph { width: 100%; height: 100%; object-fit: cover; }

/* 3D viewer */
.viewer {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-2);
  aspect-ratio: 16 / 9;
  background: radial-gradient(ellipse at 50% 40%, #262626, #0d0d0d 75%);
  box-shadow: 0 0 80px -20px rgba(255,255,255,0.08);
}
.viewer canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; touch-action: none; }
.viewer canvas:active { cursor: grabbing; }
.viewer-hint {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  color: #bbb;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.5s;
}
.viewer-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); font-size: 14px; }
.viewer-msg strong { display: block; color: #ddd; font-weight: 500; margin-bottom: 6px; font-size: 16px; }
.viewer-reset {
  position: absolute;
  top: 14px; right: 14px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  color: #ddd;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--line-2);
  border-radius: 99px;
  cursor: pointer;
}
.viewer-reset:hover { background: rgba(255,255,255,0.1); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 70px 0 0; }
.pager a {
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.3s, transform 0.4s var(--ease);
}
.pager a:hover { border-color: var(--line-2); transform: translateY(-4px); }
.pager a.next { text-align: right; }
.pager small { color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.pager strong { display: block; margin-top: 6px; font-weight: 500; font-size: 18px; letter-spacing: -0.02em; }

/* ================== Info page ================== */
.about { display: grid; grid-template-columns: 1fr 1.4fr; gap: 50px; align-items: start; }
.portrait { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 5; background: var(--panel-2); }
.portrait img, .portrait .ph { width: 100%; height: 100%; object-fit: cover; }
.about-text p { font-size: clamp(17px, 1.7vw, 21px); line-height: 1.55; letter-spacing: -0.015em; color: #dcdcdc; margin: 0 0 20px; }
.about-text p.muted { color: var(--muted); font-size: 15px; }
.edu {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 26px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.edu h3 { margin: 0 0 4px; font-weight: 500; font-size: 20px; letter-spacing: -0.02em; }
.edu p { margin: 0; color: var(--muted); }
.edu .right { text-align: right; color: var(--muted); font-size: 14px; }

/* ================== Scroll reveal ================== */
.reveal { opacity: 0; transform: translateY(36px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* page fade */
.page-fade { animation: fadeIn 0.6s var(--ease); }
body.leaving main, body.leaving footer { opacity: 0; transform: translateY(-10px); transition: opacity 0.35s, transform 0.35s; }

@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes lineUp { to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }
@keyframes shine { to { background-position: -200% 0; } }

/* ================== Responsive ================== */
@media (max-width: 860px) {
  .grid, .gallery, .skills { grid-template-columns: 1fr; }
  .card:first-child .card-media { aspect-ratio: 16 / 10; }
  .job, .story-row, .about { grid-template-columns: 1fr; gap: 10px; }
  .about { gap: 30px; }
  .portrait { max-width: 360px; }
  .facts { grid-template-columns: 1fr; }
  .facts div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .viewer { aspect-ratio: 4 / 3; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .header-inner { grid-template-columns: 1fr auto; }
  .header-links { display: none; }
  .brand span { display: none; }
  .pill-nav a { padding: 7px 14px; }
  .hero { min-height: auto; padding-top: 100px; }
  .browser-body { padding-bottom: 80px; }
  .hero-intro { margin-left: 0; }
  section { padding: 64px 0; }
  .pager { grid-template-columns: 1fr; }
  .card-body { padding: 16px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .headline .line > span, .browser, .hero-intro, .scroll-cue { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
