/* 通用基础：元素、图标、导航、页脚与浮层 */
/* 2. 基础元素 ------------------------------------------------------------ */
* { box-sizing: border-box }

html { scroll-behavior: smooth }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s, color .3s;
}

body.modal-open { overflow: hidden }

button, a { font: inherit }
a { text-decoration: none; color: inherit }
button { color: inherit; border: 0; background: none }
img { max-width: 100%; display: block }
::selection { background: var(--pink); color: #fff }

:focus-visible {
    outline: 2px solid var(--pink);
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: fixed;
    left: 50%;
    top: 10px;
    z-index: 60;
    padding: 10px 18px;
    border-radius: 12px;
    background: var(--ink);
    color: var(--paper);
    font-size: 12px;
    transform: translate(-50%, -200%);
    transition: transform .2s;
}

.skip-link:focus { transform: translate(-50%, 0) }

/* 3. 图标 ---------------------------------------------------------------- */
.icon {
    width: 1em;
    height: 1em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -.15em;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* 4. 导航 ---------------------------------------------------------------- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    height: 74px;
    transition: background-color .3s, box-shadow .3s, backdrop-filter .3s;
}

.site-nav.is-scrolled {
    background: var(--nav-bg);
    box-shadow: 0 1px 0 var(--line);
    backdrop-filter: blur(14px);
}

.nav-inner {
    height: 100%;
    max-width: 1180px;
    margin: auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: Georgia, serif;
    font-weight: 700;
    font-style: italic;
}

.logo > span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 13px;
    background: linear-gradient(135deg, #ef9cac, #cf718c);
    color: #fff;
    font: 700 12px Arial;
    letter-spacing: -1px;
    box-shadow: 0 8px 20px rgba(187, 82, 110, .22);
}

.site-nav nav {
    display: flex;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--card-ring);
    border-radius: 99px;
    background: var(--nav-bg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.site-nav nav a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 99px;
    font-size: 12px;
    color: var(--muted);
    transition: background-color .2s, color .2s;
}

.site-nav nav a .icon { font-size: 15px }

.site-nav nav a.active,
.site-nav nav a:hover {
    background: var(--surface);
    color: var(--pink-dark);
    box-shadow: var(--shadow-sm);
}

.nav-actions { display: flex; align-items: center; gap: 8px }

.theme-toggle,
.admin-link {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 13px;
    border-radius: 99px;
    background: var(--nav-bg);
    border: 1px solid var(--card-ring);
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: color .2s, border-color .2s;
}

.theme-toggle { width: 36px; padding: 0; justify-content: center }
.theme-toggle .icon, .admin-link .icon { font-size: 16px }
.theme-toggle:hover, .admin-link:hover { color: var(--pink-dark); border-color: var(--line-strong) }

/* 配色按钮上的图标跟着“选择”走，而不是跟着最终配色走：
   跟随系统 → 半阴半阳，手动选了才显示太阳或月亮。没有 JS 时停在跟随系统 */
.icon-sun, .icon-moon { display: none }
:root[data-theme-mode="light"] .icon-auto, :root[data-theme-mode="dark"] .icon-auto { display: none }
:root[data-theme-mode="light"] .icon-sun { display: block }
:root[data-theme-mode="dark"] .icon-moon { display: block }

/* 9. 页脚与浮层 ---------------------------------------------------------- */
.site-footer {
    min-height: 190px;
    padding: 40px max(24px, calc((100vw - 1120px)/2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: var(--footer-bg);
    color: var(--footer-ink);
}

.site-footer p { display: inline-flex; align-items: center; gap: 7px; font: italic 13px Georgia; color: #c4bdc5 }
.footer-heart { color: var(--pink); fill: currentColor; stroke-width: 1.5 }
.site-footer > span { font: 8px Arial; letter-spacing: .2em; color: #867f88 }
.site-footer .logo > span { box-shadow: none }

.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 25;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--surface);
    color: var(--pink-dark);
    font-size: 19px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform .2s;
}

.to-top[hidden] { display: none }
.to-top:hover { transform: translateY(-3px) }

.feature-modal, .lightbox {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--scrim);
    backdrop-filter: blur(9px);
}

.feature-modal[hidden], .lightbox[hidden] { display: none }

.modal-card {
    width: min(420px, 100%);
    background: var(--paper);
    border-radius: 28px;
    text-align: center;
    padding: 42px 38px 36px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.modal-close { position: absolute; right: 17px; top: 14px; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 0 }
.modal-close:hover { color: var(--pink-dark) }

.modal-heart {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    background: var(--pink-soft);
    color: var(--pink-dark);
    border-radius: 19px;
    margin: auto;
    font-size: 26px;
}

.modal-card > p { font: 700 8px Arial; letter-spacing: .25em; color: var(--pink-dark); margin: 21px 0 8px }
.modal-card h2 { font: 400 29px var(--serif); margin: 0 0 13px }
.modal-card > span:not(.modal-heart) { font-size: 12px; line-height: 1.8; color: var(--muted) }

.modal-okay {
    display: block;
    width: 100%;
    margin-top: 25px;
    border-radius: 14px;
    padding: 13px;
    background: var(--ink);
    color: var(--paper);
    cursor: pointer;
}

.lightbox { cursor: zoom-out }
.lightbox img { max-width: min(1100px, 94vw); max-height: 88vh; border-radius: 16px; box-shadow: var(--shadow-lg) }

.lightbox-close {
    position: absolute;
    right: 22px;
    top: 22px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.will-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .5s ease var(--reveal-delay, 0ms), transform .5s ease var(--reveal-delay, 0ms);
}

.will-reveal.is-visible { opacity: 1; transform: none }

@media (max-width: 800px) {
    .nav-inner { padding: 0 14px; gap: 8px }
    .logo { font-size: 14px }
    .site-nav nav a { padding: 9px 12px }
    .site-nav nav a span, .admin-link span { display: none }
    .admin-link { width: 36px; padding: 0; justify-content: center }
    .section-title { display: block }
    .section-title > span, .section-more { display: block; margin-top: 15px }
    .site-footer { display: block; text-align: center }
    .site-footer .logo { justify-content: center }
    .site-footer p { margin: 22px 0; justify-content: center }
    .to-top { right: 14px; bottom: 14px }
}

@media (max-width: 520px) {
    .modal-card { padding: 38px 24px 28px }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto }
    .celebration-particle { display: none }
    .celebration-banner { animation: none; opacity: 1; transform: translate(-50%, 0) }
    .will-reveal { opacity: 1; transform: none }
    * { transition: none !important }
}
