/* =========================================================
   Theme (brand colour: #008B8B)
   ========================================================= */
:root {
  --brand: #008B8B;
  --bg: #f6f8f8;
  --surface: #ffffff;
  --text: #0d1b1b;
  --muted: #5a6b6b;
  --faint: #8a9999;
  --border: #e1e8e8;
  --accent: #007373;                 /* brand, darker for readable small text */
  --accent-soft: rgba(0, 139, 139, .08);
  --accent-line: rgba(0, 139, 139, .28);
  --spot: rgba(0, 139, 139, .07);
  --live: #0b7a52;
  --shadow: 0 1px 2px rgba(13, 27, 27, .04), 0 4px 16px rgba(13, 27, 27, .05);
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1313;
    --surface: #101c1c;
    --text: #e2eceb;
    --muted: #93a7a6;
    --faint: #647877;
    --border: #1d2c2c;
    --accent: #33bcbc;
    --accent-soft: rgba(51, 188, 188, .10);
    --accent-line: rgba(51, 188, 188, .35);
    --spot: rgba(0, 139, 139, .14);
    --live: #4fd69c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1313;
  --surface: #101c1c;
  --text: #e2eceb;
  --muted: #93a7a6;
  --faint: #647877;
  --border: #1d2c2c;
  --accent: #33bcbc;
  --accent-soft: rgba(51, 188, 188, .10);
  --accent-line: rgba(51, 188, 188, .35);
  --spot: rgba(0, 139, 139, .14);
  --live: #4fd69c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (min-width: 1024px) { html { scroll-padding-top: 72px; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
ul, ol, dl, dd { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--brand); color: #fff; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* Soft spotlight that follows the cursor (desktop only, set by JS) */
.spotlight {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(600px circle at var(--x, -999px) var(--y, -999px), var(--spot), transparent 40%);
}

/* =========================================================
   Layout
   ========================================================= */
.layout {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto; padding: 0 16px;
}
@media (min-width: 640px) { .layout { padding: 0 32px; } }
@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: 5fr 7fr; gap: 64px; padding: 0 48px; }
}

/* ---------- Mobile top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transform: translateY(-100%); transition: transform .25s ease;
}
.topbar.show { transform: none; }
.topbar-name { font-weight: 700; color: var(--text); white-space: nowrap; }
.topbar-nav {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin-left: auto; mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  padding: 0 8px;
}
.topbar-nav::-webkit-scrollbar { display: none; }
.topbar-nav a { flex: none; font-size: 14px; font-weight: 500; color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.topbar-nav a.active { color: var(--accent); background: var(--accent-soft); }
.topbar-nav a:hover { text-decoration: none; color: var(--text); }
@media (min-width: 640px) { .topbar { padding: 0 32px; } }
@media (min-width: 1024px) { .topbar { display: none; } }
/* keep layout from jumping: topbar overlays content on mobile */
@media (max-width: 1023px) { .topbar { position: fixed; left: 0; right: 0; } }

/* ---------- Profile (left) ---------- */
.profile { padding: 56px 0 24px; }
@media (min-width: 1024px) {
  .profile {
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 88px 0 48px;
  }
}

.avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.avatar {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover; object-position: 50% 18%;
  border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--brand), var(--shadow);
}
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
}
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 2.2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

.name { font-size: clamp(38px, 6vw, 50px); font-weight: 800; letter-spacing: -.03em; }
.title { margin: 6px 0 14px; font-size: 19px; font-weight: 600; color: var(--accent); }
.tagline { margin: 0; color: var(--muted); max-width: 38ch; }

.side-nav { display: none; }
@media (min-width: 1024px) {
  .side-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 48px; }
  .side-nav a {
    display: inline-flex; align-items: center; gap: 14px; width: max-content;
    padding: 8px 0; font: 600 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
    color: var(--faint); transition: color .2s;
  }
  .side-nav .line { width: 32px; height: 1px; background: currentColor; transition: width .25s ease, background .25s; }
  .side-nav a:hover, .side-nav a.active { color: var(--text); text-decoration: none; }
  .side-nav a:hover .line, .side-nav a.active .line { width: 64px; }
  .side-nav a.active .line { background: var(--brand); }
}

.profile-bottom { margin-top: 28px; }
.meta { list-style: none; display: grid; gap: 6px; margin-bottom: 18px; font-size: 14px; color: var(--muted); }
.meta li { display: flex; align-items: center; gap: 10px; }
.meta svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.icons { display: flex; gap: 8px; }
.icon {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s;
}
.icon:hover { color: var(--brand); border-color: var(--accent-line); transform: translateY(-2px); text-decoration: none; }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon svg.fill { fill: currentColor; stroke: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

/* ---------- Content (right) ---------- */
.content { padding: 8px 0 40px; min-width: 0; }
@media (min-width: 1024px) { .content { padding: 88px 0 48px; } }

.block { padding: 40px 0; }
.block:first-child { padding-top: 0; }
@media (min-width: 1024px) { .block { padding: 0 0 96px; } }

.block-title {
  display: flex; align-items: center; gap: 12px;
  font: 600 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text);
  margin-bottom: 24px;
}
.block-title span { color: var(--brand); }
.block-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.prose p { margin: 0 0 16px; color: var(--muted); }
.prose strong { color: var(--text); font-weight: 600; }

.facts {
  display: grid; grid-template-columns: repeat(2, 1fr); margin-top: 28px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden;
}
@media (min-width: 640px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts div { padding: 16px 18px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; }
.facts dt { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.facts dd { font-weight: 700; font-size: 16px; margin-top: 4px; }

/* ---------- Rows (experience + education) ---------- */
.rows { list-style: none; display: grid; gap: 8px; }
.row {
  display: grid; gap: 6px; padding: 20px; margin: 0 -20px;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: background .25s, border-color .25s, box-shadow .25s, opacity .25s;
}
@media (min-width: 640px) { .row { grid-template-columns: 150px 1fr; gap: 24px; } }
.row-side { display: flex; flex-direction: column; gap: 2px; padding-top: 3px; }
.row-side time { font: 500 12px/1.5 var(--mono); color: var(--faint); letter-spacing: .02em; }
.dur { font: 500 11px/1.4 var(--mono); color: var(--accent); }
.row-main h3 { font-size: 17px; font-weight: 700; }
.row-main .at { color: var(--accent); font-weight: 600; }
.row-sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.row-text { margin: 8px 0 0; font-size: 15px; color: var(--muted); }
.points { margin-top: 10px; padding-left: 18px; color: var(--muted); font-size: 15px; }
.points li { margin-bottom: 4px; }
.points li::marker { color: var(--brand); }
.row .tags { margin-top: 14px; }

@media (hover: hover) and (min-width: 1024px) {
  .row:hover { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
  .rows:hover .row:not(:hover) { opacity: .55; }
}

/* ---------- Tags ---------- */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li, .tag-sample {
  font: 500 12px/1 var(--mono); padding: 6px 10px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft); border: 1px solid transparent;
}
.tags li.basic, .tag-sample { background: transparent; border: 1px dashed var(--accent-line); color: var(--muted); }

/* ---------- Projects ---------- */
.filters { display: flex; gap: 6px; margin: -6px 0 20px; flex-wrap: wrap; }
.filter {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: all .2s;
}
.filter span { font: 500 11px/1 var(--mono); color: var(--faint); }
.filter:hover { border-color: var(--accent-line); color: var(--text); }
.filter.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.filter.on span { color: rgba(255, 255, 255, .75); }

.projects { list-style: none; display: grid; gap: 8px; }
.project {
  display: grid; gap: 16px; padding: 20px; margin: 0 -20px;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: background .25s, border-color .25s, box-shadow .25s, opacity .25s;
}
.project.hidden { display: none; }
@media (min-width: 640px) { .project { grid-template-columns: 200px 1fr; gap: 24px; } }
@media (hover: hover) and (min-width: 1024px) {
  .project:hover { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
  .projects:hover .project:not(:hover) { opacity: .55; }
}

.thumb {
  position: relative; display: block; width: 100%; padding: 0; cursor: zoom-in;
  aspect-ratio: 16 / 10; overflow: hidden; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .5s ease; }
.project:hover .thumb img { transform: scale(1.05); }
.thumb::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .25s;
}
.project:hover .thumb::after { box-shadow: inset 0 0 0 2px var(--accent-line); }
.shots {
  position: absolute; left: 8px; bottom: 8px;
  font: 500 11px/1 var(--mono); color: #fff; background: rgba(5, 25, 25, .78);
  padding: 5px 8px; border-radius: 6px;
}
.p-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.p-head h3 { font-size: 17px; font-weight: 700; }
.p-head h3 a { color: var(--text); }
.p-head h3 a:hover { color: var(--accent); text-decoration: none; }
.arrow { display: inline-block; font-size: 14px; color: var(--accent); transition: transform .2s; }
.p-head h3 a:hover .arrow { transform: translate(3px, -3px); }
.state { flex: none; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.state.live { color: var(--live); display: inline-flex; align-items: center; gap: 6px; }
.state.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-body p { margin: 0 0 12px; font-size: 15px; color: var(--muted); }
.p-body p strong { color: var(--text); font-weight: 600; }

/* ---------- Skills ---------- */
.skills { display: grid; }
.skills > div {
  display: grid; gap: 10px; padding: 16px 0; border-bottom: 1px solid var(--border);
}
.skills > div:first-child { padding-top: 0; }
@media (min-width: 640px) { .skills > div { grid-template-columns: 150px 1fr; gap: 24px; align-items: baseline; } }
.skills dt { font: 600 12px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text); }
.note { margin: 14px 0 0; font-size: 13px; color: var(--faint); }

/* ---------- Contact ---------- */
.contact-card {
  position: relative; overflow: hidden;
  padding: 28px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow);
}
.contact-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 30%, transparent));
}
.contact-lead { margin: 0 0 20px; font-size: clamp(19px, 2.6vw, 23px); font-weight: 700; letter-spacing: -.01em; line-height: 1.4; max-width: 32ch; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  font-weight: 600; font-size: 15px; color: var(--text);
  border: 1px solid var(--border); background: var(--bg);
  transition: border-color .2s, transform .2s, background .2s;
}
.btn:hover { border-color: var(--accent-line); transform: translateY(-1px); text-decoration: none; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--faint);
}
.foot p { margin: 0; }
.foot a { color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* Intro entrance */
.js .profile-top > * { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.js .profile-top > :nth-child(2) { animation-delay: .06s; }
.js .profile-top > :nth-child(3) { animation-delay: .12s; }
.js .profile-top > :nth-child(4) { animation-delay: .18s; }
.js .profile-top > :nth-child(5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* =========================================================
   Lightbox
   ========================================================= */
.lightbox {
  width: min(1080px, 100vw - 24px); max-height: calc(100dvh - 24px);
  padding: 0; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text); overflow: hidden;
}
.lightbox[open] { display: flex; flex-direction: column; animation: zoom .25s ease; }
@keyframes zoom { from { opacity: 0; transform: scale(.97); } }
.lightbox::backdrop { background: rgba(3, 14, 14, .7); backdrop-filter: blur(3px); }
.lb-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--border); }
.lb-head h3 { font-size: 16px; font-weight: 700; }
#lbCount { font: 500 12px/1 var(--mono); color: var(--faint); margin-right: auto; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; background: var(--bg); overflow: auto; }
.lb-stage img { max-width: 100%; max-height: calc(100dvh - 190px); object-fit: contain; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.lb-nav:hover { border-color: var(--brand); color: var(--brand); }
.lb-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lb-nav.prev { left: 10px; }
.lb-nav.next { right: 10px; }
.lb-nav[hidden] { display: none; }
.lb-caption { margin: 0; padding: 14px 20px 16px; font-size: 15px; color: var(--muted); }

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