:root {
  --bg: #0B1B33;
  --bg-2: #071226;
  --panel: #10254A;
  --panel-2: #142C57;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #F5F7FB;
  --text-2: #B8C4D9;
  --muted: #7F8FAB;
  --amber: #F5A524;
  --amber-deep: #D98C0F;
  --amber-soft: rgba(245, 165, 36, 0.14);
  --green: #3DD68C;
  --green-soft: rgba(61, 214, 140, 0.14);
  --code-bg: #06101F;
  --code-key: #8CB4FF;
  --code-str: #9AE6B4;
  --code-dim: #6E7D99;
  --sans: "Sora", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 20px 50px -24px rgba(0, 0, 0, 0.7);
  --measure: 62ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 5.5rem; color-scheme: dark; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--amber); text-decoration: none; transition: color .15s; }
a:hover { color: #FFC45E; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--amber); color: var(--bg-2); }
code { font-family: var(--mono); font-size: 0.875em; background: var(--panel); padding: 0.1em 0.4em; border-radius: 6px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }

/* header */
header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(11, 27, 51, 0.72);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; }
.masthead .name { font-weight: 700; font-size: 1.0625rem; color: var(--text); letter-spacing: -0.01em; }
.masthead { position: relative; }
.masthead .right { display: flex; align-items: center; gap: 0.6rem; }
.masthead .cv-top { background: var(--amber); color: var(--bg-2); font-weight: 700; font-size: 0.9375rem; padding: 0.55rem 1rem; border-radius: 999px; }
.masthead .cv-top:hover { background: #FFC45E; color: var(--bg-2); }
.masthead nav { display: none; position: absolute; right: 0; top: calc(100% + 0.5rem); min-width: 15rem; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 0.5rem; z-index: 20; }
.masthead nav.open { display: block; }
.masthead nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; }
.masthead nav a { display: block; color: var(--text-2); font-size: 1rem; padding: 0.7rem 0.9rem; border-radius: 10px; transition: background .15s, color .15s; }
.masthead nav a:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.masthead nav a.cta { display: none; }
.menu-btn { display: flex; width: 2.75rem; height: 2.75rem; border: 1px solid var(--line-strong); background: rgba(255,255,255,0.04); border-radius: 12px; cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* buttons, chips */
.btn { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.8em 1.35em; border-radius: 999px; font-weight: 700; font-size: 1rem; border: 1px solid transparent; transition: transform .15s, background .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--amber); color: var(--bg-2); }
.btn.primary:hover { background: #FFC45E; color: var(--bg-2); transform: translateY(-2px); }
.btn.ghost { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,0.03); }
.btn.ghost:hover { border-color: rgba(255,255,255,0.4); color: var(--text); transform: translateY(-2px); }
.btn .arrow { transition: transform .15s; }
.btn:hover .arrow { transform: translateX(3px); }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip { font-size: 0.8125rem; font-weight: 500; color: var(--text-2); background: rgba(255,255,255,0.06); border: 1px solid var(--line); padding: 0.32em 0.8em; border-radius: 999px; white-space: nowrap; }
.chip.amber { color: var(--amber); background: var(--amber-soft); border-color: transparent; }
.pill { display: inline-flex; align-items: center; gap: 0.55em; font-size: 0.9375rem; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 999px; padding: 0.4em 1em 0.4em 0.75em; }
.pill::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.mono { font-family: var(--mono); }

/* hero */
.hero { position: relative; overflow: hidden; padding: 3rem 0 0; border-bottom: 1px solid var(--line); }
.hero + .wrap .stats { padding-top: 2.5rem; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 55% at 78% 45%, rgba(245,165,36,0.22), transparent 70%),
    radial-gradient(40% 40% at 20% 10%, rgba(96,165,250,0.10), transparent 70%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(22rem, 1.05fr); gap: 2rem 2rem; align-items: end; }
.hero-grid > div:first-child { align-self: center; padding-bottom: 3rem; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4.4rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.035em; margin: 1.25rem 0 1.25rem; max-width: 14ch; }
.hero h1 .accent { color: var(--amber); }
.hero .sub { font-size: 1.1875rem; color: var(--text-2); max-width: 44ch; line-height: 1.55; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero .meta { margin-top: 1.75rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; font-family: var(--mono); font-size: 0.8125rem; color: var(--muted); }
.portrait { position: relative; justify-self: center; width: min(100%, 29rem); aspect-ratio: 546 / 731; margin-bottom: -1px; }
.portrait::before { content: ""; position: absolute; inset: 12% 8% 0 8%; border-radius: 40% 40% 30% 30%; background: linear-gradient(180deg, rgba(245,165,36,0.35), rgba(245,165,36,0.04) 70%); filter: blur(6px); }
.portrait img { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: bottom center; display: block; filter: drop-shadow(0 30px 40px rgba(0,0,0,0.55)); }
.portrait .badge { position: absolute; left: 4%; bottom: 8%; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.6rem 0.85rem; box-shadow: var(--shadow); font-size: 0.8125rem; line-height: 1.35; }
.portrait .badge b { display: block; color: var(--text); font-weight: 700; }
.portrait .badge span { color: var(--text-2); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; padding: 0 0 3.5rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem; box-shadow: var(--shadow); }
.stat .num { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--amber); }
.stat .lbl { margin-top: 0.5rem; color: var(--text-2); font-size: 0.9375rem; line-height: 1.35; }

/* sections */
section.block { padding: 3.75rem 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 800; }
.section-head .hint { color: var(--muted); font-size: 0.9375rem; }

/* experience timeline */
.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ""; position: absolute; left: 0.45rem; top: 0.6rem; bottom: 0.6rem; width: 2px; background: linear-gradient(var(--amber), rgba(245,165,36,0.15)); border-radius: 2px; }
.entry { position: relative; display: grid; grid-template-columns: 10rem minmax(0, 1fr); column-gap: 1.5rem; padding: 0 0 2.25rem; }
.entry:last-child { padding-bottom: 0; }
.entry::before { content: ""; position: absolute; left: -1.75rem; top: 0.45rem; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--bg); border: 3px solid var(--amber); box-shadow: 0 0 0 4px var(--bg); }
.entry .when { font-family: var(--mono); font-size: 0.8125rem; color: var(--amber); padding-top: 0.35rem; }
.entry h3 { font-size: 1.25rem; font-weight: 700; }
.entry .org { color: var(--text-2); font-weight: 500; display: block; margin-top: 0.15rem; font-size: 1rem; letter-spacing: 0; }
.entry p { margin: 0.5rem 0 0; max-width: var(--measure); color: var(--text-2); }
.entry ul { margin: 0.65rem 0 0; padding-left: 1.1rem; max-width: var(--measure); color: var(--text-2); }
.entry li { margin: 0.3rem 0; }
.entry li::marker { color: var(--amber); }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.card { position: relative; display: flex; flex-direction: column; gap: 0.75rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); transition: transform .2s, border-color .2s; }
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.card .kind { font-family: var(--mono); font-size: 0.78rem; color: var(--amber); }
.card h3 { font-size: 1.25rem; font-weight: 700; }
.card h3 a { color: var(--text); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { color: var(--text-2); max-width: var(--measure); }
.card .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 0.5rem; position: relative; z-index: 1; }
.card .foot a { font-size: 0.875rem; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid var(--line); padding: 0.4em 0.9em; border-radius: 999px; }
.card .foot a:hover { border-color: var(--amber); color: var(--amber); }
.card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 1.5rem 2.5rem; background: linear-gradient(135deg, var(--panel-2), var(--panel)); }
.card.featured .body { display: flex; flex-direction: column; gap: 0.75rem; }
.card.featured h3 { font-size: 1.75rem; letter-spacing: -0.025em; }
.card.featured ul { margin: 0.25rem 0 0; padding-left: 1.1rem; color: var(--text-2); }
.card.featured li { margin: 0.3rem 0; }
.card.featured li::marker { color: var(--amber); }
.card.featured .side { background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem 1.25rem; align-self: start; }
.card.featured .side .kind { margin-bottom: 0.6rem; }
.card.featured .side .kv { grid-template-columns: 9rem minmax(0,1fr); gap: 0.5rem 1rem; font-size: 0.9375rem; }
.card.featured .side .kv dt { font-weight: 600; color: var(--text); }
.card.featured .side .kv dd { color: var(--text-2); }
.rulecard { background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; align-self: start; }
.rulecard-head { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.72rem; color: var(--code-dim); }
.rulecard-head .path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rulecard-head .lvl { flex: none; color: var(--amber); }
.rulecard pre { margin: 0; padding: 0.9rem 1rem; font-family: var(--mono); font-size: 0.74rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #D5DCE8; }
.rulecard .k { color: var(--code-key); }
.rulecard .s { color: var(--code-str); }
.rulecard .d { color: var(--code-dim); }
.rulecard .hi { color: var(--amber); }

/* skills */
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.5rem; box-shadow: var(--shadow); }
.panel h3 { font-size: 1.0625rem; font-weight: 700; margin-bottom: 0.9rem; }
.panel .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 1rem; padding: 0.7rem 0; border-top: 1px solid var(--line); align-items: baseline; }
.panel .row:first-of-type { border-top: 0; padding-top: 0; }
.panel .row .sub { display: block; color: var(--text-2); font-size: 0.9rem; }
.panel .row .meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.panel .row a { color: var(--text); text-decoration: underline; text-decoration-color: rgba(255,255,255,0.25); text-underline-offset: 0.18em; }
.panel .row a:hover { color: var(--amber); }
.meter { height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; margin-top: 0.5rem; grid-column: 1 / -1; }
.meter i { display: block; height: 100%; background: var(--amber); border-radius: 999px; }

/* about */
.about { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; max-width: var(--measure); }
.about p { color: var(--text-2); font-size: 1.0625rem; }
.about p strong { color: var(--text); font-weight: 600; }

/* notes */
.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.note { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.5rem; box-shadow: var(--shadow); transition: transform .2s, border-color .2s; }
.note:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.note .when { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.note h3 { margin-top: 0.45rem; font-size: 1.125rem; font-weight: 700; line-height: 1.3; }
.note h3 a { color: var(--text); }
.note h3 a::after { content: ""; position: absolute; inset: 0; }
.note p { margin-top: 0.5rem; color: var(--text-2); font-size: 0.9375rem; }

/* contact */
.contact { background: linear-gradient(135deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem; box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 2rem; align-items: center; }
.contact h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 800; }
.contact .email { display: inline-block; margin-top: 0.75rem; font-size: clamp(1.125rem, 2.4vw, 1.5rem); font-weight: 700; color: var(--amber); }
.contact p { color: var(--text-2); margin-top: 0.75rem; max-width: 46ch; }
.contact .links { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end; }

/* sub-pages (project / blog / 404) */
.doc-head { padding: 3.5rem 0 2.25rem; border-bottom: 1px solid var(--line); }
.doc-head h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; max-width: 22ch; }
.doc-head .meta { margin-top: 0.85rem; font-family: var(--mono); font-size: 0.8125rem; color: var(--amber); }
.doc-head .summary { margin-top: 1rem; max-width: var(--measure); color: var(--text-2); font-size: 1.125rem; }
.record { display: grid; grid-template-columns: 11rem minmax(0, 1fr); column-gap: 2.5rem; padding: 2.25rem 0; border-bottom: 1px solid var(--line); }
.record > .key { font-family: var(--mono); font-size: 0.8125rem; color: var(--amber); padding-top: 0.35rem; }
.record > .val { min-width: 0; }
.val > p { max-width: var(--measure); margin: 0 0 1rem; color: var(--text-2); }
.val > p:last-child { margin-bottom: 0; }
.val ul { padding-left: 1.1rem; max-width: var(--measure); margin: 0; color: var(--text-2); }
.val li { margin: 0.3rem 0; }
.val li::marker { color: var(--amber); }
.val.tags, .tags { font-family: var(--mono); font-size: 0.875rem; color: var(--text-2); line-height: 1.8; word-spacing: 0.3em; }
.kv { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0.6rem 1.5rem; margin: 0; }
.kv dt { font-weight: 600; }
.kv dd { margin: 0; color: var(--text-2); max-width: var(--measure); }
.refs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.refs a { font-size: 0.9375rem; font-weight: 600; color: var(--text); background: rgba(255,255,255,0.06); border: 1px solid var(--line); padding: 0.45em 1em; border-radius: 999px; }
.refs a:hover { border-color: var(--amber); color: var(--amber); }
.prose { max-width: var(--measure); color: var(--text-2); }
.prose p { margin: 0 0 1rem; }
.prose h3 { margin: 2rem 0 0.6rem; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { text-decoration: underline; text-underline-offset: 0.18em; }
.prose ul { padding-left: 1.1rem; margin: 0 0 1rem; }
.backlink { display: inline-block; margin: 2.5rem 0 0; font-weight: 600; }
.note-list .note { margin-bottom: 1rem; }

footer { padding: 2.5rem 0 3rem; color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--line); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; }

/* one load moment */
@media (prefers-reduced-motion: no-preference) {
  .hero .pill, .hero h1, .hero .sub, .hero .actions, .hero .meta { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
  .hero h1 { animation-delay: .08s; }
  .hero .sub { animation-delay: .16s; }
  .hero .actions { animation-delay: .24s; }
  .hero .meta { animation-delay: .3s; }
  .portrait { animation: fade .9s ease both .15s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { width: min(100%, 18rem); order: 1; justify-self: center; }
  .hero-grid > div:first-child { padding-bottom: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards, .panels, .notes { grid-template-columns: 1fr; }
  .card.featured { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
  .contact .links { justify-content: flex-start; }
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  html { scroll-padding-top: 1.5rem; }
  .masthead nav.open { position: static; width: 100%; padding: 0.5rem 0 0.75rem; box-shadow: none; border: 0; background: transparent; min-width: 0; }
  .masthead .cv-top { display: none; }
  .masthead nav a.cta { display: block; }
  .hero { padding: 2.5rem 0 2.5rem; }
  .hero h1 { max-width: none; }
  .entry { grid-template-columns: 1fr; row-gap: 0.2rem; }
  .record { grid-template-columns: 1fr; row-gap: 0.4rem; }
  .kv { grid-template-columns: 1fr; gap: 0.2rem 0; }
  .kv dd { margin-bottom: 0.7rem; }
  .contact { padding: 1.75rem; }
  .stats { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .stat { padding: 1rem 1.1rem; }
  .stat .num { font-size: 1.875rem; }
  section.block { padding: 2.75rem 0; }
}
