:root {
  --bg: #070b14; --bg-2: #0c1426; --ink: #eef2f9; --muted: #8e9db8; --body: #c6d0e0;
  --line: rgba(142,157,184,.2); --steel: #4682B4; --ice: #9cc6f5; --ok: #6ee7b7;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.7,.2,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-in: cubic-bezier(.7,0,.84,0);
  --ease-spring: cubic-bezier(.34,1.45,.5,1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--sans); font-size: 17px; line-height: 1.65; color: var(--ink);
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(70,130,180,.22), transparent 55%),
    radial-gradient(circle at 1px 1px, rgba(142,157,184,.13) 1px, transparent 0) 0 0 / 26px 26px,
    var(--bg);
  background-attachment: fixed;
  padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  overflow-x: hidden;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 4px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--steel); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 16px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: 680px; margin: 0 auto; }

/* Top bar */
.bar { position: relative; z-index: 40; padding-top: max(18px, env(safe-area-inset-top, 0px)); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.mark { font-family: var(--display); font-weight: 600; font-size: 24px; text-decoration: none; letter-spacing: -.01em; transition: opacity .6s ease, filter .6s ease; }
.mark i { font-style: normal; color: var(--steel); }
.nav { display: flex; gap: 22px; }
.nav a { position: relative; min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; color: var(--muted); text-decoration: none; transition: color .25s ease; }
.nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 2px; background: var(--steel); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }

/* Desktop: the dropdown wrapper is transparent, links sit inline as before */
.dropdown { display: flex; }
.dropdown-toggle { display: none; }
.dropdown-menu { display: flex; gap: 22px; }

/* Phone: links collapse into a dropdown (FlyonUI-style: toggle + menu + dropdown-open state) */
@media (max-width: 640px) {
  .dropdown { position: relative; }
  .dropdown-toggle {
    display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
    border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03);
    color: var(--ink); font: inherit; font-size: 15px; cursor: pointer;
    transition: border-color .25s ease, background .25s ease;
  }
  .dropdown-toggle:hover, .dropdown.dropdown-open .dropdown-toggle { border-color: var(--steel); background: rgba(70,130,180,.12); }
  .dropdown-toggle:active { transform: scale(.96); }
  .dropdown-chev { width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .5s var(--ease-spring), border-color .3s ease; }
  .dropdown.dropdown-open .dropdown-chev { transform: translateY(2px) rotate(-135deg); border-color: var(--ice); }
  .dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 30;
    display: flex; flex-direction: column; gap: 2px; min-width: 210px; padding: 6px;
    background: rgba(12,20,38,.94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 24px 48px -18px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.04);
    clip-path: inset(0 0 100% 0 round 16px); transform-origin: top right;
    visibility: hidden; pointer-events: none;
    transition: clip-path .2s var(--ease-in), visibility 0s linear .2s;
  }
  .dropdown.dropdown-open .dropdown-menu {
    clip-path: inset(0 0 0 0 round 16px); visibility: visible; pointer-events: auto;
    transition: clip-path .32s var(--ease-out), visibility 0s;
  }
  .dropdown-menu a:nth-child(1) { --i: 0; }
  .dropdown-menu a:nth-child(2) { --i: 1; }
  .dropdown-menu a:nth-child(3) { --i: 2; }
  .dropdown-menu a:nth-child(4) { --i: 3; }
  .dropdown.dropdown-open .dropdown-menu a {
    opacity: 1; transform: none;
    transition: opacity .3s var(--ease-out) calc(var(--i) * 35ms + 60ms), transform .36s var(--ease-out) calc(var(--i) * 35ms + 60ms), background .2s ease, color .2s ease;
  }
  .dropdown-menu a {
    min-height: 44px; padding: 0 14px; display: flex; align-items: center; border-radius: 10px; font-size: 16px;
    opacity: 0; transform: translateX(-10px);
    transition: opacity .18s ease, transform .2s ease, background .2s ease, color .2s ease;
  }
  .dropdown-menu a::after { display: none; }
  .dropdown-menu a:hover, .dropdown-menu a[aria-current="page"] { background: rgba(70,130,180,.14); }
  .dropdown-menu a[aria-current="page"] { color: var(--ice); }
}

/* Page changes: header and footer stay put, content fades/slides/blurs with a soft overlap */
@view-transition { navigation: auto; }
.bar { view-transition-name: bar; }
.foot { view-transition-name: foot; }
main { view-transition-name: content; }
::view-transition-group(root) { animation-duration: .3s; }
::view-transition-group(content) { animation-timing-function: var(--ease); }
::view-transition-old(content) { animation: vt-out .18s cubic-bezier(.4,0,1,1) both; }
::view-transition-new(content) { animation: vt-in .36s var(--ease) .03s both; }
::view-transition-old(bar), ::view-transition-old(foot) { animation: none; }
::view-transition-new(bar), ::view-transition-new(foot) { animation: none; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(.985); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px) scale(.985); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }

/* Nav underline glides to the new active link instead of popping */
.nav a[aria-current="page"]::after { view-transition-name: nav-underline; }
::view-transition-group(nav-underline) { animation-duration: .3s; animation-timing-function: var(--ease); }

/* Browsers without view transitions get a simple entrance instead */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@supports not (view-transition-name: none) {
  main > * { animation: rise .6s var(--ease) both; }
  main > *:nth-child(2) { animation-delay: .08s; } main > *:nth-child(3) { animation-delay: .16s; } main > *:nth-child(4) { animation-delay: .24s; } main > *:nth-child(5) { animation-delay: .32s; }
}

main { flex: 1; padding-top: clamp(36px, 8vh, 80px); padding-bottom: 56px; }

/* Home */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .22em; transition: opacity .6s ease, filter .6s ease; font-family: var(--display); font-weight: 600; font-size: clamp(44px, 13vw, 92px); line-height: 1.1; letter-spacing: -.035em; margin: 0 0 28px; }
.avatar { transform-origin: 50% 100%; transition: opacity .6s ease, filter .6s ease; will-change: transform; width: 1.5em; aspect-ratio: 150 / 151; flex: none; display: block; margin-inline: -.05em; background: url(/profile.png) center / contain no-repeat; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; pointer-events: auto; cursor: help; }
body { -webkit-touch-callout: none; }
.lede { font-family: var(--display); font-size: clamp(22px, 5vw, 28px); line-height: 1.35; margin: 0 0 18px; max-width: 24em; text-wrap: balance; }
.bio { color: var(--body); margin: 0; max-width: 34em; }
.actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1px solid var(--steel); background: transparent; color: var(--ink);
  text-decoration: none; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background .3s ease, color .3s ease, border-color .3s ease, transform .3s var(--ease), box-shadow .3s ease;
}
.btn svg { transition: transform .3s var(--ease); }
/* Sheen sweep across buttons on hover */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%); transform: translateX(-120%); transition: transform .5s var(--ease-out); }
.btn:hover::before { transform: translateX(120%); }
.btn:hover { background: var(--steel); border-color: var(--steel); color: #fff; transform: translateY(-2px); box-shadow: 0 10px 24px -12px rgba(70,130,180,.65); }
.btn:hover svg { transform: translateX(3px); }
.btn.ext:hover svg { transform: translate(2px, -2px); }
.btn.solid { background: var(--steel); color: #fff; }
.btn.solid:hover { background: #5b97c8; border-color: #5b97c8; }


/* Scroll progress and small touches */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--steel); transform: scaleX(0); transform-origin: left; z-index: 20; pointer-events: none; box-shadow: 0 0 12px rgba(70,130,180,.7); }
::selection { background: rgba(70,130,180,.45); color: #fff; }
a, button { -webkit-tap-highlight-color: transparent; }
p { text-wrap: pretty; }
.btn:active { transform: scale(.97); }
.btn.off { border-style: dashed; border-color: var(--line); color: var(--muted); font-family: var(--mono); font-size: 14px; cursor: not-allowed; pointer-events: none; }

/* Projects */
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); margin: 0 0 10px; }
h1.page { font-family: var(--display); font-weight: 600; font-size: clamp(40px, 10vw, 60px); line-height: 1; letter-spacing: -.025em; margin: 0 0 36px; }
.entry { padding: 28px 0; border-top: 1px solid var(--line); }
.entry:last-of-type { border-bottom: 1px solid var(--line); }
.entry { position: relative; transition: background .35s ease; }
.entry::before { content: ""; position: absolute; left: -14px; top: 28px; bottom: 28px; width: 2px; background: var(--steel); transform: scaleY(0); transform-origin: top; transition: transform .45s var(--ease); }
.entry:hover::before { transform: scaleY(1); }
.entry h2 { transition: color .3s ease, transform .4s var(--ease); }
.entry:hover h2 { color: var(--ice); transform: translateX(4px); }
.entry h2 { font-family: var(--display); font-weight: 600; font-size: 32px; line-height: 1.1; letter-spacing: -.02em; margin: 0 0 8px; }
.meta { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.meta .on { color: var(--ok); }
.meta .on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 8px; vertical-align: 1px; }
.entry p { margin: 0 0 12px; color: var(--body); max-width: 34em; }
.entry .feat { font-size: 15px; color: var(--muted); margin: 0; }
.entry .btn { margin-top: 8px; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.entry-actions .btn { margin-top: 0; }

.notfound { padding-top: 8px; }
.notfound .code { font-family: var(--display); font-weight: 600; font-size: clamp(96px, 28vw, 168px); line-height: .85; letter-spacing: -.04em; color: var(--steel); margin: 0 0 20px; }
.notfound h1 { font-family: var(--display); font-weight: 600; font-size: 32px; margin: 0 0 8px; }
.notfound p { color: var(--body); margin: 0 0 24px; }

/* Donators */
.donators-intro { margin: 0 0 28px; }
.raise { margin: 0 0 32px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.02); }
.raise-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.raise-label { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.raise-amt { font-family: var(--display); font-weight: 600; font-size: clamp(26px, 6vw, 34px); color: var(--ice); letter-spacing: -.02em; }
.raise-bar { height: 8px; border-radius: 999px; background: rgba(142,157,184,.14); overflow: hidden; }
.raise-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--steel), var(--ice)); transition: width .8s var(--ease) .05s; }
.donors { list-style: none; margin: 0; padding: 0; }
.donor { display: flex; align-items: center; gap: 14px; padding: 18px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: 10px; transition: background .3s ease; }
.donor:hover { background: rgba(255,255,255,.035); }
.donor-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donor:last-child { border-bottom: 1px solid var(--line); }
.donor-name { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -.01em; }
.donor-amt { margin-left: auto; font-family: var(--mono); font-size: 14px; color: var(--ok); white-space: nowrap; }
.raise-goal { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.raise-pct { font-family: var(--mono); font-size: 13px; color: var(--ice); letter-spacing: .04em; }

/* Credits */
.credits-intro { margin: 0 0 28px; }
.credits-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.credit-card {
  display: flex; align-items: flex-start; gap: 18px; padding: 22px 24px;
  border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.02);
  transition: background .35s ease, border-color .35s ease, transform .4s var(--ease);
}
.credit-card:hover { background: rgba(255,255,255,.045); border-color: rgba(70,130,180,.5); transform: translateX(4px); box-shadow: 0 10px 30px -18px rgba(70,130,180,.6); }
.credit-role { line-height: 1.5; }
.credit-rank { font-family: var(--mono); font-size: 13px; color: var(--steel); letter-spacing: .06em; padding-top: 6px; padding-right: 16px; margin-right: 16px; border-right: 1px solid var(--line); flex: none; align-self: stretch; transition: color .3s ease, border-color .3s ease; }
.credit-card:hover .credit-rank { border-color: rgba(70,130,180,.5); }
.credit-card:hover .credit-rank { color: var(--ice); }
.credit-body h2 { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: -.015em; margin: 0 0 6px; transition: color .3s ease; }
.credit-card:hover .credit-body h2 { color: var(--ice); }
.credit-role { margin: 0; color: var(--body); font-size: 15px; max-width: 34em; }

/* Footer */
.foot { padding: 0 0 max(24px, env(safe-area-inset-bottom, 0px)); }
.foot .wrap { border-top: 1px solid var(--line); padding-top: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; font-size: 14px; color: var(--muted); }
.foot p { margin: 0; }
/* Language switcher: sliding glossy thumb with a shine sweep */
.lang { --hi: rgba(255,255,255,.7); position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-family: var(--mono); font-size: 13px; isolation: isolate; }
.lang button { position: relative; z-index: 1; min-width: 46px; min-height: 36px; padding: 0 6px; background: none; border: 0; border-radius: 999px; color: var(--muted); cursor: pointer; font: inherit; font-weight: 500; letter-spacing: .04em; transition: color .35s ease; }
.lang button:hover { color: var(--ink); }
.lang button[aria-pressed="true"] { color: #fff; }
.lang button:focus-visible { outline-offset: 2px; }
.thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 2); border-radius: 999px; overflow: hidden; background: linear-gradient(180deg, #5b97c8, #3b6c98); box-shadow: inset 0 0 0 1px rgba(156,198,245,.4), inset 0 1px 0 rgba(255,255,255,.25), 0 6px 18px -6px rgba(70,130,180,.8); transition: transform .6s cubic-bezier(.34,1.3,.5,1); }
.lang[data-active="vi"] .thumb { transform: translateX(100%); }
.lang.still .thumb { transition: none; }
.thumb::before, .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 32%, var(--hi) 50%, transparent 68%); transform: translateX(-130%); }
.thumb::before { animation: idle-shine 6.5s ease-in-out 2.5s infinite; opacity: .55; }
.lang.flash .thumb::after { animation: thumb-shine .8s var(--ease) both; }
.lang:hover .thumb::after { animation: thumb-shine .8s var(--ease) both; }
@keyframes thumb-shine { from { transform: translateX(-130%); } to { transform: translateX(130%); } }
@keyframes idle-shine { 0%, 70% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }

/* Text swap: elements animate via JS; a light band sweeps through the new text */
span[data-i] { display: inline-block; }
[data-i].shine {
  --hi: #d6ebff;
  color: transparent;
  background-image: linear-gradient(105deg, var(--c) 0%, var(--c) 40%, var(--hi) 50%, var(--c) 60%, var(--c) 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text;
  animation: text-shine 1.1s cubic-bezier(.45,.05,.25,1) var(--sd, 0ms) both;
}
@keyframes text-shine { to { background-position: 0% 0; } }
/* Scroll reveal: blur-rise using the independent `translate` property, so hover transforms still work.
   --d is set per item in app.js so lists cascade in. */
.reveal {
  opacity: 0; translate: 0 14px; filter: blur(4px);
  transition:
    opacity .45s var(--ease-out) var(--d, 0ms),
    translate .5s var(--ease-out) var(--d, 0ms),
    filter .45s var(--ease-out) var(--d, 0ms),
    background .35s ease, border-color .35s ease, color .3s ease, transform .4s var(--ease-out);
}
.reveal.in { opacity: 1; translate: none; filter: none; }
main { will-change: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .reveal { opacity: 1; translate: none; filter: none; }
}

/* Guards */
html.guard body { display: none !important; }
html.shot .avatar,
html.shot .mark,
html.shot .hero { opacity: 0; filter: blur(14px); }
.avatar { -webkit-user-drag: none; }
@media print { .avatar { display: none !important; } body { visibility: hidden; } }
