:root {
  color-scheme: dark;
  --bg-primary: #0b1120;
  --bg-surface: #121b31;
  --bg-elevated: #192642;
  --accent-royal: #2563eb;
  --accent-ice: #67e8f9;
  --accent-gold: #d4b475;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-subtle: rgba(212, 180, 117, .22);
  --border-gold: rgba(212, 180, 117, .55);
  --reading-text: #cbd5e1;
  --serif: "Cinzel", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --display: "Cinzel", "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --header: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 24px); }
body { margin: 0; background: var(--bg-primary); color: var(--text-primary); font: 1rem/1.75 var(--sans); }
body:has(dialog[open]) { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
figure, blockquote, h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent-ice); outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { width: min(100% - 112px, 1232px); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: 12px; left: 12px; z-index: 30; padding: 8px 12px; background: var(--bg-elevated); }

.topbar { position: fixed; z-index: 5; inset: 0 0 auto; height: var(--header); border-bottom: 1px solid transparent; transition: background 250ms var(--ease), border-color 250ms var(--ease); }
.topbar.scrolled { background: #0b1120ed; border-color: var(--border-subtle); }
.topbar.scrolled::before { content: ""; position: absolute; z-index: -1; inset: 0; backdrop-filter: blur(12px); pointer-events: none; }
.nav-inner, .identity, .desktop-nav { display: flex; align-items: center; }
.nav-inner { height: 100%; justify-content: space-between; }
.identity { gap: 10px; }
.header-controls { display: flex; align-items: center; gap: 8px; }
.seal, .menu-toggle { display: grid; place-items: center; border: 0; background: transparent; width: 44px; height: 44px; padding: 0; }
.seal:hover { filter: brightness(1.35); }
.wordmark { display: flex; align-items: center; gap: 12px; color: #f6e7c7; font: 700 1.03rem/1 var(--display); letter-spacing: .18em; }
.wordmark span { color: var(--text-secondary); font: .875rem var(--sans); letter-spacing: .09em; padding-left: 12px; border-left: 1px solid var(--border-subtle); white-space: nowrap; }
.desktop-nav { margin-inline-start: auto; gap: clamp(18px, 3vw, 42px); }
.desktop-nav a { display: grid; place-items: center; min-height: 44px; color: var(--text-secondary); font-size: .9rem; }
.desktop-nav a:hover, .desktop-nav a[aria-current] { color: var(--accent-gold); }
.menu-toggle { display: none; }

.hero { position: relative; display: grid; align-items: center; isolation: isolate; min-height: 100svh; padding: calc(var(--header) + 30px) 0 90px; overflow: clip; background: radial-gradient(ellipse at 77% 40%, #1b3564 0%, #111d36 28%, transparent 62%), linear-gradient(155deg, #0a1121, #0d172b 60%, #0b1120); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 12% 20%, #e3bd7d88 0 1px, transparent 2px), radial-gradient(circle at 46% 19%, #80a5e599 0 1px, transparent 2px), radial-gradient(circle at 90% 30%, #e3bd7d88 0 1px, transparent 2px), radial-gradient(circle at 64% 19%, #e3bd7d66 0 1px, transparent 2px); pointer-events: none; }
.hero-grid { position: absolute; z-index: -1; inset: 48% -30% -30%; background-image: linear-gradient(#789ad425 1px, transparent 1px), linear-gradient(90deg, #789ad425 1px, transparent 1px); background-size: 68px 68px; transform: perspective(390px) rotateX(59deg); transform-origin: 50% 0; mask-image: linear-gradient(transparent, black 26%, #0008 75%, transparent); }
.hero-inner { display: grid; grid-template-columns: 55fr 45fr; align-items: center; }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { display: flex; align-items: center; gap: .57rem; color: var(--accent-gold); font: 600 .8rem/1.5 var(--sans); letter-spacing: .17em; }
.eyebrow i { display: inline-block; flex: 0 0 7px; height: 7px; background: var(--accent-gold); transform: rotate(45deg); }
.hero h1 { margin: 25px 0 24px; font: 700 clamp(2.5rem, 4.4vw, 4.2rem)/1.23 var(--serif); letter-spacing: .035em; }
.hero h1 em { color: #e8d1a2; font-style: normal; }
.hero-intro { max-width: 33rem; color: var(--reading-text); }
.hero-inscription { display: flex; align-items: center; gap: .65rem; margin-top: 13px; color: #dfc999; font-size: .875rem; letter-spacing: .12em; }
.hero-inscription::before { content: ""; width: 22px; border-top: 1px solid var(--border-gold); }
.hero-inscription span { color: var(--accent-gold); }
.hero-actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.hero-actions { margin-top: 24px; gap: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--border-subtle); border-radius: 3px; color: var(--text-primary); background: #101a2b; font-size: .875rem; transition: background 250ms var(--ease), border-color 250ms var(--ease); }
.button:hover { background: var(--bg-elevated); border-color: var(--accent-gold); }
.button.primary { background: linear-gradient(180deg, var(--accent-royal), #1d4ed8); border-color: var(--border-gold); box-shadow: inset 0 1px #67e8f959; color: #fff; padding-inline: 20px; }
.button.primary:hover { background: linear-gradient(180deg, #255dd5, #173fae); border-color: var(--accent-gold); }
.button.quiet { background: #101a2b77; }
.stage { position: relative; min-width: 0; height: min(640px, 72svh); }
.arch { position: absolute; inset: 5% 10% 9%; border: 1px solid #d4b475a6; border-radius: 50% 50% 2px 2px / 38% 38% 2px 2px; background: repeating-linear-gradient(90deg, transparent 0 19%, #d4b4751c 19% 19.25%, transparent 19.25% 20%), radial-gradient(ellipse at center, #335a9370, #12234277 74%); }
.arch::before, .arch::after { content: ""; position: absolute; pointer-events: none; }
.arch::before { inset: 8px; border: 1px solid #d4b47559; border-radius: inherit; }
.arch::after { left: 50%; top: -5px; width: 9px; height: 9px; border: 1px solid var(--accent-gold); background: #17233d; transform: translateX(-50%) rotate(45deg); }
.orbit { position: absolute; inset: 18% 3% 16%; border: 1px solid #7096c337; border-radius: 50%; transform: rotate(-24deg); }
.orbit::after { content: ""; position: absolute; inset: 10px; border: 1px solid #7096c320; border-radius: 50%; }
.stage-name { position: absolute; bottom: 8%; inset-inline: 0; text-align: center; color: #c7d9ff3c; font: 700 clamp(2.2rem, 6.4vw, 6rem)/1 var(--display); letter-spacing: .04em; }
.hero-art { position: absolute; left: 50%; top: -4%; translate: -50% 0; display: block; width: 130%; max-width: none; height: 110%; object-fit: contain; object-position: center 20%; mask-image: linear-gradient(#000 58%, #000a 76%, transparent 96%); filter: drop-shadow(0 10px 26px #060e29bb); animation: hover-art 9s ease-in-out infinite; }
.hero-art.is-fallback { width: 70%; height: 72%; }
@keyframes hover-art { 50% { transform: translateY(-7px); } }
.scroll-cue { position: absolute; bottom: 15px; left: 50%; transform: translateX(-50%); color: #d1b987; font: .75rem var(--display); letter-spacing: .3em; display: grid; justify-items: center; gap: 8px; padding: 8px; min-height: 44px; }
.scroll-cue span { height: 22px; border-left: 1px solid var(--accent-gold); }

.section { padding-block: 104px; scroll-margin-top: -15px; }
.section-heading { margin-bottom: 38px; }
.section-heading h2 { font: 700 clamp(2rem, 3.4vw, 3rem)/1.25 var(--serif); margin: 11px 0 12px; letter-spacing: .055em; }
.section-heading p, .project-card p { color: var(--text-secondary); max-width: 68ch; }
.reveal.animate-in { animation: in 420ms var(--ease) both; }
@keyframes in { from { opacity: .5; transform: translateY(12px); } }
.chronicle-layout { display: grid; grid-template-columns: 34fr 66fr; gap: 30px; align-items: start; }
.archive-trim { position: relative; }
.archive-trim::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; z-index: 1; background: linear-gradient(90deg, transparent, var(--border-gold), transparent); pointer-events: none; }
.quotation { position: relative; display: grid; gap: 22px; justify-items: center; text-align: center; border: 1px solid var(--border-subtle); padding: 38px 24px; background: radial-gradient(ellipse at 50% 0, #192d5144, transparent 90%), var(--bg-surface); }
.quotation::after { content: ""; position: absolute; inset: 7px; border: 1px solid #d4b4751c; pointer-events: none; }
.quotation blockquote { font: 700 clamp(1.06rem, 1.65vw, 1.42rem)/1.7 var(--serif); color: #ebd8b3; text-wrap: balance; }
.quotation a { color: #cfb681; display: inline-flex; align-items: center; min-height: 44px; gap: 8px; font-size: .875rem; }
.quotation a::before { content: "✦"; }
.quotation a:hover { color: #f4dbab; }
.chapters { border-top: 1px solid var(--border-subtle); }
.chapter { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-top: 0; }
.chapter > button { display: grid; grid-template-columns: 2.6rem 1fr auto; align-items: center; text-align: left; width: 100%; min-height: 63px; gap: 12px; border: 0; border-left: 2px solid transparent; background: transparent; padding: 12px 22px; }
.chapter > button:hover, .chapter > button[aria-expanded=true] { background: var(--bg-elevated); }
.chapter > button[aria-expanded=true] { border-left-color: var(--accent-gold); }
.chapter > button[aria-expanded=true] .number { color: var(--accent-gold); }
.number { font: 500 .9rem var(--display); font-variant-numeric: tabular-nums; color: var(--text-secondary); letter-spacing: .1em; }
.chapter-icon { color: var(--accent-gold); }
.chapter-panel { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 330ms var(--ease), opacity 240ms var(--ease); }
.chapter-panel[aria-hidden=false] { grid-template-rows: 1fr; opacity: 1; }
.chapter-panel-inner { min-height: 0; overflow: hidden; }
.chapter-body { padding: 16px 28px 22px; color: var(--reading-text); max-width: 68ch; font-size: .9375rem; line-height: 1.8; }
.archive { background: #10192c; border-block: 1px solid var(--border-subtle); }
.gallery, .projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.gallery-card, .project-card, .gambit { border: 1px solid var(--border-subtle); border-radius: 3px; background: var(--bg-surface); }
.gallery-card { transition: border-color 250ms var(--ease); }
.gallery-card:hover, .gallery-card:focus-within { border-color: var(--border-gold); }
.image-button { display: block; width: 100%; border: 0; background: var(--bg-elevated); padding: 0; overflow: hidden; }
.image-button img { width: 100%; height: 100%; object-fit: cover; transition: transform 350ms var(--ease); }
.image-button:hover img { transform: scale(1.045); }
.gallery-card .image-button { position: relative; aspect-ratio: 16 / 10; }
.gallery-card .image-button::after { content: ""; position: absolute; inset: 7px; border: 1px solid #d4b47585; box-shadow: 0 0 0 7px #080d1822, inset 0 -28px 34px -26px #080d18d9; pointer-events: none; }
.gallery-card .portrait-frame img { object-position: center 15%; scale: 1.2; transform-origin: center 17%; }
.image-action { position: absolute; z-index: 1; right: 13px; bottom: 13px; display: flex; align-items: center; gap: 7px; padding: 5px 9px; background: #0b1120ed; color: #f3dfb8; border: 1px solid var(--border-gold); font-size: .8125rem; }
.expand-glyph { width: 11px; height: 11px; background: linear-gradient(#e9cb91,#e9cb91) left top / 5px 1px, linear-gradient(#e9cb91,#e9cb91) left top / 1px 5px, linear-gradient(#e9cb91,#e9cb91) right bottom / 5px 1px, linear-gradient(#e9cb91,#e9cb91) right bottom / 1px 5px; background-repeat: no-repeat; }
.card-copy { padding: 22px; }
.card-copy h3, .project-card h3, .gambit h3, .project-dialog h3 { margin: 8px 0 9px; font: 700 1.5rem/1.36 var(--serif); letter-spacing: .03em; }
.card-copy > p:not(.eyebrow), .gambit-copy > p:not(.eyebrow) { color: var(--text-secondary); }
.credit { display: inline-block; padding-block: 12px; color: #e2c799; font-size: .875rem; }
.gambit { display: grid; grid-template-columns: 1fr 1fr; }
.gambit-image { aspect-ratio: 16/10; align-self: stretch; }
.gambit-image img { object-fit: contain; }
.gambit-image img.refresh { animation: in 360ms var(--ease) both; }
.gambit-copy { display: grid; align-content: center; padding: clamp(20px, 4vw, 46px); min-width: 0; }
.gambit-copy .button-row { margin-top: 22px; }
.status { min-height: 1.5em; margin-top: 8px; font-size: .875rem; }
#projects { padding-top: 0; }
.projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-card { padding: 26px; }
.project-mark { color: var(--accent-gold); font-size: 1.7rem; line-height: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
.tag { padding: 3px 8px; background: #193052; color: #c9d6f0; font-size: .8125rem; }
.footer { border-top: 1px solid var(--border-subtle); background: #0a101d; }
.footer-inner { display: grid; gap: 8px; padding-block: 34px 66px; color: var(--text-secondary); font-size: .875rem; }
.footer-brand { display: flex; align-items: center; gap: 10px; color: var(--accent-gold); letter-spacing: .13em; font: 700 1rem var(--display); }
.footer-brand span { font: .875rem var(--sans); }
.footer-motto { color: #e8d1a2; font-family: var(--serif); letter-spacing: .1em; }

.merit { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
.merit-toggle { display: flex; align-items: center; gap: 8px; min-width: 44px; min-height: 44px; background: #0f1a2eee; border: 1px solid #d4b47562; padding: 0 12px; border-radius: 3px; font-size: .875rem; color: #e4d1af; font-variant-numeric: tabular-nums; }
.merit-toggle:hover, .merit-toggle[aria-expanded=true] { border-color: var(--accent-gold); background: var(--bg-elevated); }
.merit-icon { color: var(--accent-gold); font-size: 1.25rem; line-height: 1; }
.merit-chevron { width: 7px; height: 7px; border-top: 1px solid currentColor; border-left: 1px solid currentColor; rotate: 45deg; margin: 3px 1px 0 2px; }
.merit-toggle[aria-expanded=true] .merit-chevron { rotate: 225deg; margin-top: -3px; }
.merit-progress { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 9px; margin-bottom: 10px; color: #e4d1af; }
.merit-pips { display: flex; gap: 9px; padding-inline: 2px; }
.merit-pips i { display: block; width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid #d4b47569; }
.merit-pips i.lit { background: var(--accent-gold); border-color: var(--accent-gold); box-shadow: 0 0 7px #67e8f95c; }
.merit-panel { position: absolute; right: 0; bottom: calc(100% + 10px); width: min(310px, calc(100vw - 32px)); border: 1px solid var(--border-subtle); padding: 18px; background: var(--bg-elevated); }
.merit-panel p { margin-bottom: 12px; }
.merit-toggle.promoted { animation: coronation 900ms var(--ease); }
@keyframes coronation { 45% { box-shadow: 0 0 32px #d4b475aa; } }
.gilded .hero-grid { background-image: linear-gradient(#eac57267 1px, transparent 1px), linear-gradient(90deg, #eac57267 1px, transparent 1px); }
#gold-board[aria-pressed=true] { border-color: var(--accent-gold); color: var(--accent-gold); }
dialog { color: var(--text-primary); border: 1px solid var(--border-subtle); background: var(--bg-surface); }
dialog::backdrop { background: #040914de; }
.mobile-menu { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 24px; border: 0; background: var(--bg-primary); }
.mobile-menu nav { width: min(100%, 28rem); margin: 18svh auto 0; display: grid; gap: 8px; }
.mobile-menu nav a { display: flex; align-items: center; min-height: 54px; padding-inline: 18px; border: 1px solid var(--border-subtle); background: var(--bg-surface); }
.close-menu { float: right; }
.close-menu, .lightbox button { min-width: 44px; min-height: 44px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); font-size: 1.4rem; }
.lightbox { width: min(960px, 100% - 28px); max-height: calc(100% - 24px); padding: 12px; overflow: auto; }
.lightbox-top, .lightbox-bottom { display: flex; align-items: center; justify-content: space-between; padding: 4px; gap: 8px; }
.lightbox-top > div { display: flex; gap: 6px; }
.lightbox-bottom { text-align: center; }
.lightbox-bottom a { color: var(--accent-gold); font-size: .875rem; }
.art-view { height: min(64svh, 580px); overflow: auto; display: grid; place-items: safe center; background: #080d18; margin: 8px 4px; }
.art-view img { display: block; min-width: 100%; min-height: 100%; max-width: none; object-fit: contain; }
.project-dialog { width: min(550px, 100% - 28px); padding: 26px; }
.project-dialog form { display: flex; justify-content: flex-end; }

@media (max-width: 1100px) {
  .shell { width: calc(100% - 72px); }
}
@media (max-width: 768px) {
  .shell { width: calc(100% - 36px); }
  .topbar.scrolled::before { backdrop-filter: none; }
  .desktop-nav { display: none; }
  .menu-toggle { display: grid; border: 1px solid var(--border-subtle); }
  .hero { align-items: center; padding: calc(var(--header) + 10px) 0 68px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hero-copy { grid-row: 2; text-align: center; }
  .hero-copy .eyebrow, .hero-inscription { justify-content: center; }
  .hero-copy .eyebrow { letter-spacing: .1em; }
  .hero h1 { margin: 14px 0; font-size: clamp(1.75rem, 6.3vw, 3.2rem); }
  .hero-intro { margin-inline: auto; }
  .hero-intro { font-size: .9375rem; text-wrap: balance; }
  .hero-inscription { margin-top: 8px; }
  .hero-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 17px auto 0; gap: 8px; max-width: 28rem; }
  .hero-actions .primary { grid-column: 1 / -1; min-height: 46px; }
  .hero-actions .button { padding-inline: 12px; white-space: nowrap; }
  .desktop-break { display: none; }
  .stage { height: min(37svh, 345px); width: min(100%, 460px); margin-inline: auto; overflow: clip; }
  .arch { inset: 5% 15% 7%; }
  .hero-art { width: 108%; top: 0; animation: none; }
  .stage-name { font-size: clamp(2.3rem, 11vw, 4.8rem); }
  .merit { position: static; }
  .merit-toggle { gap: 5px; padding-inline: 7px; }
  #merit-label, .merit-chevron { display: none; }
  .merit-panel { top: calc(100% + 8px); bottom: auto; right: max(18px, env(safe-area-inset-right)); }
  .art-view:not(.zoomed) { touch-action: pan-y; }
  .section { padding-block: 64px; }
  .section-heading { margin-bottom: 24px; }
  .chronicle-layout, .gallery, .projects, .gambit { grid-template-columns: minmax(0, 1fr); }
  .quotation { padding: 26px 20px; gap: 15px; }
  .chapter > button { grid-template-columns: 1.85rem 1fr auto; padding-inline: 14px; gap: 6px; }
  #projects { padding-top: 0; }
}
@media (max-width: 420px) {
  .identity { gap: 5px; }
  .wordmark { gap: 6px; font-size: .9rem; letter-spacing: .12em; }
  .wordmark span { padding-left: 6px; font-size: .8rem; }
}
@media (max-width: 360px) {
  .wordmark span { display: none; }
  .hero-actions .button { padding-inline: 6px; }
}
@media (max-width: 768px) and (max-height: 680px) {
  .stage { height: 30svh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
