/* Selected homepage refinements, keeping
   the original palette, language controls, portraits and content cards. */
:root { --nav-height: 64px; }
:where(a, button, summary, input, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button, a { -webkit-tap-highlight-color: #526fa61a; }
button { touch-action: manipulation; }

.nav {
    background: #fdfcfcef;
    border-bottom-color: #dde3edb3;
    box-shadow: 0 4px 24px #35456703;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
html[lang] .nav-link { position: relative; padding: 9px 10px; border-radius: 5px; transition: color 180ms ease, background 180ms ease; }
.nav-link::after {
    content: ''; position: absolute; inset: auto 10px 4px; height: 1px;
    background: var(--accent-pink); transform: scaleX(0); transform-origin: left; transition: transform 180ms ease;
}
.nav-link:hover::after, .nav-link:focus-visible::after { transform: scaleX(1); }
.nav-link:not([href="#news"]):hover, .nav-link[href="#news"]:hover { color: var(--text); background: #eef2f780; }
.nav-toggle { width: 40px; height: 40px; border-radius: 8px; }
.nav-toggle:hover { background: var(--accent-blue-soft); }
.nav-toggle-icon { position: relative; display: block; width: 18px; height: 1px; margin: auto; background: currentColor; }
.nav-toggle-icon::before, .nav-toggle-icon::after { content: ''; position: absolute; left: 0; width: 18px; height: 1px; background: currentColor; transition: transform 180ms ease; }
.nav-toggle-icon::before { transform: translateY(-6px); }
.nav-toggle-icon::after { transform: translateY(6px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { transform: rotate(-45deg); }

.hero { padding-block: 76px 46px; }
html[lang] .hero-name { margin-bottom: 15px; }
html[lang] .hero-title { margin-bottom: 20px; }
html[lang] .hero-bio { margin-bottom: 24px; }
html[lang] .hero-links { gap: 10px 22px; }
.hero-link { gap: 8px; }
.hero-link i { color: #7e92b5; }
.hero-link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }

#news, #publications, #projects { padding-block: 34px; }
#news { padding-top: 26px; }
#publications, #projects { border-top: 1px solid var(--border-light); }
html[lang] .section-title { margin-top: 19px; gap: 14px; }
.section-title::after { background: linear-gradient(90deg, #d8c1d0, #d8c1d000); }
#life-portal { padding-top: 36px; }

/* An astronomical plate from the gallery opens the personal side of the site. */
.life-card {
    --plate-ink: #111824;
    --dial-gold: #dfc9a6;
    display: grid;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1px solid #24303b;
    border-radius: 12px;
    background: linear-gradient(125deg, #1b2836, var(--plate-ink) 45%, #242532);
    box-shadow: 0 4px 8px -5px #17223145, 0 16px 36px -22px #17223170;
    text-decoration: none;
    color: #f1f3f7;
}
.life-card::after {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgb(185 197 214 / 16%);
    border-radius: 5px;
    pointer-events: none;
}
.life-card:focus-visible { outline: 3px solid #5476a4; outline-offset: 4px; }
.life-plate {
    position: absolute;
    inset: 0 0 0 40%;
    margin: 0;
    pointer-events: none;
}
.life-plate img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: screen;
    mask-image: linear-gradient(90deg, transparent, #000 33%);
    transition: transform 750ms cubic-bezier(.2,.65,.3,1);
}
.life-plate::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgb(13 20 32 / 85%), transparent 25%);
    mask-image: linear-gradient(90deg, transparent, #000 28%);
}
.life-plate-dial {
    position: absolute;
    top: 51%;
    left: 52%;
    width: min(58%, 236px);
    aspect-ratio: 1;
    translate: -50% -50%;
    border: 1px solid rgb(225 206 170 / 31%);
    border-radius: 50%;
    opacity: .83;
}
.life-plate-dial::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: inherit;
    background: repeating-conic-gradient(from -1deg, var(--dial-gold) 0 .45deg, transparent .6deg 10deg);
    mask-image: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
    transition: rotate 750ms cubic-bezier(.2,.65,.3,1);
}
.life-plate-caption {
    position: absolute;
    z-index: 1;
    right: 26px;
    bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: baseline;
    color: #d6dde8;
    font: italic .875rem/1.3 var(--font-en);
}
.life-plate-id {
    padding-right: 10px;
    border-right: 1px solid #b6bfce55;
    font: normal .6875rem/1 var(--font-mono);
    letter-spacing: .1em;
}
html:lang(zh) .life-plate-caption { font-style: normal; }
html[lang] .life-card-content {
    position: relative;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    width: 58%;
    min-height: 304px;
    padding: 36px clamp(30px, 4.3vw, 58px);
}
html[lang] .life-card-title {
    margin: 0 0 14px;
    color: #fff;
    font-size: clamp(1.625rem, 1.3rem + 1vw, 2rem);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: .01em;
    text-shadow: 0 2px 16px rgb(0 0 0 / 35%);
}
body.lang-en .life-card-title {
    font-family: var(--font-en);
    text-transform: uppercase;
}
html[lang] .life-card-desc {
    max-width: 43ch;
    margin: 0;
    color: #c9d0d6;
    font-size: 1.0625rem;
    line-height: 1.6;
    text-wrap: pretty;
}
.life-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 17px;
    color: rgb(232 237 255 / 88%);
    font-family: var(--font-ui);
    font-size: .7rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.life-card-cta-line {
    position: relative;
    width: 34px;
    height: 1px;
    overflow: hidden;
    background: rgb(221 229 255 / 28%);
    transition: width .55s cubic-bezier(.22, 1, .36, 1);
}
.life-card-cta-line::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, #edf1ff, transparent);
    transform: translateX(-110%);
    transition: transform .7s ease;
}
.life-card-cta-arrow {
    font-size: .92rem;
    transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}
.life-card:is(:hover, :focus-visible) { color: #f1f3f7; }
.life-card:is(:hover, :focus-visible) .life-card-cta-line { width: 48px; }
.life-card:is(:hover, :focus-visible) .life-card-cta-line::after { transform: translateX(110%); }
.life-card:is(:hover, :focus-visible) .life-card-cta-arrow {
    transform: translateX(4px);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .life-card:hover .life-plate img { transform: scale(1.035); }
    .life-card:hover .life-plate-dial::before { rotate: 5deg; }
}
@media (max-width: 640px) {
    .life-plate {
        position: relative;
        inset: auto;
        height: clamp(148px, 40vw, 210px);
    }
    .life-plate img { object-position: center 54%; mask-image: linear-gradient(#000 60%, transparent); }
    .life-plate::after { display: none; }
    .life-plate-dial { width: auto; height: 70%; left: 51%; top: 47%; }
    .life-plate-caption { left: 28px; right: auto; bottom: 0; }
    html[lang] .life-card-content {
        width: 100%;
        min-height: 0;
        padding: 16px 28px 31px;
    }
    html[lang] .life-card-title { max-width: 210px; font-size: 1.75rem; }
    .life-card-cta { margin-top: 18px; }
}
html[lang] .footer { color: #68758a; padding-block: 28px 36px; }

/* The menu is refined independently of the original companion launch button. */
.summon-menu {
    --pet-ink: #52617d; --pet-paper: #faf8fc;
    --pet-cyan: #91b5cc; --pet-violet: #a397cc; --pet-coral: #d49ab6; --pet-gold: #d9c398;
    border: 1px solid #d6ddea; border-radius: 12px;
    background: linear-gradient(135deg, #fdfcfe, #f5f5fa);
    box-shadow: 0 16px 40px #3c4c7024, 0 2px 6px #3c4c7008; padding: 16px; gap: 8px;
}
.summon-menu::before { border-width: 1px; border-color: #d6ddea; background: #fdfcfe; top: -9px; }
.summon-menu-heading { padding: 2px 4px 9px; }
.summon-menu-kicker { color: #7c7894; }
.summon-menu-title { margin-top: 5px; }
.summon-option { border: 1px solid #e2e5ee; border-radius: 7px; padding: 9px; }
.summon-option:hover { transform: none; border-color: #bccbe2; box-shadow: 0 3px 8px #52617d08; }
.pet-summon-btn::before { pointer-events: none; }

@media (max-width: 900px) {
    html[lang] .section-title { margin: 0 0 20px; }
    .section-title::after { max-width: 72px; }
    .hero { padding-block: 54px 36px; }
    #news, #publications, #projects { padding-block: 30px; }
    .nav-inner { gap: 8px; }
    html[lang] .nav-link { padding-inline: 8px; }
}
@media (max-width: 768px) {
    .nav-links.open { background: #fdfcfcf7; padding: 16px 24px 20px; box-shadow: 0 16px 28px #3545670d; gap: 4px; }
    .nav-links.open .nav-link { width: 100%; text-align: center; padding: 10px 18px; min-height: 44px; }
}
@media (max-width: 600px) {
    :root { --nav-height: 60px; }
    .hero { gap: 26px; padding-block: 40px 30px; }
    html[lang] .hero-name { margin-bottom: 14px; }
    html[lang] .hero-title { margin-bottom: 18px; }
    html[lang] .hero-bio { margin-bottom: 22px; }
    html[lang] .hero-links { gap: 10px 18px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
