/* ========================================
   Apple-Inspired Design System — chan&chen
   ======================================== */

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---- Design Tokens ---- */
:root {
    --action-blue: #0066cc;
    --focus-blue: #0071e3;
    --near-black: #1d1d1f;
    --pure-white: #ffffff;
    --parchment: #f5f5f7;
    --pure-black: #000000;
    --tile-dark: #272729;
    --muted-80: rgba(0, 0, 0, 0.8);
    --muted-48: rgba(0, 0, 0, 0.48);
    --nav-height: 44px;
}

/* ---- Base ---- */
html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--near-black);
    background: var(--pure-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Global Nav ---- */
.global-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--pure-black);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav-content {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-brand {
    color: var(--pure-white);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-brand:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: 28px;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.65);
    font-size: 12px;
    font-weight: 400;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
    padding: 4px 0;
}

.nav-links a:hover {
    color: var(--pure-white);
}

.nav-links a.active {
    color: var(--pure-white);
    font-weight: 600;
}

/* ---- Main Content Wrapper ---- */
.main-content {
    padding-top: var(--nav-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Photo Album (index) ---- */
.album {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 16px;
    background: var(--pure-white);
    min-height: 0;
}

.photo-frame {
    position: relative;
    width: 100%;
    max-width: 1200px;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    will-change: opacity;
}

.photo-slide.active {
    opacity: 1;
}

/* ---- Photo Controls ---- */
.photo-controls {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 16px 0 12px;
}

.ctrl-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(210, 210, 215, 0.64);
    color: var(--near-black);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:hover {
    background: rgba(210, 210, 215, 0.9);
}

.ctrl-btn:active {
    transform: scale(0.92);
}

.ctrl-btn:focus-visible {
    outline: 2px solid var(--focus-blue);
    outline-offset: 2px;
}

/* ---- Dots ---- */
.photo-dots {
    display: flex;
    gap: 8px;
    padding-bottom: 10px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.dot.active {
    background: var(--near-black);
    transform: scale(1.3);
}

.dot:focus-visible {
    outline: 2px solid var(--focus-blue);
    outline-offset: 2px;
}

/* ---- Sub-pages Layout ---- */
.page-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

.page-section h1 {
    font-size: 40px;
    font-weight: 600;
    letter-spacing: -0.003em;
    line-height: 1.1;
    color: var(--near-black);
    margin-bottom: 12px;
}

.page-section .subtitle {
    font-size: 21px;
    font-weight: 400;
    letter-spacing: 0.011em;
    line-height: 1.19;
    color: var(--muted-80);
    margin-bottom: 40px;
}

/* ===============================
   Anniversary Grid (纪念日)
   =============================== */
.anniversary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 620px;
    width: 100%;
    margin-top: 4px;
}

.anni-card {
    background: var(--parchment);
    border-radius: 18px;
    padding: 32px 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.2s ease;
}

.anni-card:hover {
    transform: translateY(-2px);
}

.anni-card .anni-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.374px;
    color: var(--near-black);
    margin-bottom: 10px;
}

.anni-card .anni-date {
    font-size: 21px;
    font-weight: 400;
    letter-spacing: 0.011em;
    color: var(--action-blue);
}

/* ===============================
   Toggle Group (天/年切换)
   =============================== */
.toggle-group {
    display: inline-flex;
    background: var(--parchment);
    border-radius: 980px;
    padding: 3px;
    margin-bottom: 40px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.toggle-btn {
    padding: 8px 28px;
    border-radius: 980px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 400;
    color: var(--muted-48);
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.toggle-btn.active {
    background: var(--pure-white);
    color: var(--near-black);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.toggle-btn:focus-visible {
    outline: 2px solid var(--focus-blue);
    outline-offset: 2px;
}

/* ===============================
   Counter Row (相爱天数)
   =============================== */
.counter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 740px;
    width: 100%;
}

.counter-card {
    background: var(--parchment);
    border-radius: 18px;
    padding: 36px 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.2s ease;
}

.counter-card:hover {
    transform: translateY(-2px);
}

.counter-card .counter-label {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.374px;
    color: var(--muted-80);
    line-height: 1.47;
    margin-bottom: 12px;
}

.counter-card .counter-num {
    font-size: 72px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--near-black);
    margin-bottom: 8px;
    transition: opacity 0.3s ease;
}

.counter-card .counter-sub {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--muted-48);
}

/* ===============================
   Timeline (大事记)
   =============================== */
.timeline {
    max-width: 600px;
    width: 100%;
    text-align: left;
}

.timeline-item {
    position: relative;
    padding: 20px 0 20px 32px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    scroll-margin-top: calc(var(--nav-height) + 20px);
}

.timeline-item:last-child {
    border-left-color: transparent;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 25px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--near-black);
}

.timeline-link {
    display: block;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.timeline-link:hover {
    transform: translateX(4px);
}

.timeline-link .tl-date {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.224px;
    color: var(--action-blue);
    margin-bottom: 4px;
}

.timeline-link .tl-text {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.374px;
    line-height: 1.47;
    color: var(--near-black);
    transition: color 0.2s ease;
}

.timeline-link:hover .tl-text {
    color: var(--action-blue);
}

.timeline-link .tl-arrow {
    font-size: 14px;
    color: var(--muted-48);
    margin-left: 6px;
    transition: margin-left 0.2s ease;
}

.timeline-link:hover .tl-arrow {
    margin-left: 10px;
    color: var(--action-blue);
}

/* ===============================
   Sidebar Layout for 大事记
   =============================== */
.page-with-sidebar {
    display: flex;
    gap: 48px;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    align-items: flex-start;
    text-align: left;
}

.page-main {
    flex: 1;
    min-width: 0;
}

.month-nav {
    position: sticky;
    top: calc(var(--nav-height) + 40px);
    width: 100px;
    flex-shrink: 0;
    padding-top: 24px;
    padding-left: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.month-nav .mn-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--muted-48);
    text-transform: uppercase;
    margin-bottom: 14px;
}

.month-nav a {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted-48);
    text-decoration: none;
    padding: 5px 0;
    transition: color 0.2s ease;
    line-height: 1.4;
}

.month-nav a:hover {
    color: var(--action-blue);
}

/* ===============================
   Blog Article Pages
   =============================== */
.blog-article {
    flex: 1;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 60px 24px 40px;
}

.blog-article .blog-meta {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.224px;
    color: var(--action-blue);
    margin-bottom: 12px;
}

.blog-article h1 {
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.003em;
    line-height: 1.1;
    color: var(--near-black);
    margin-bottom: 32px;
}

.blog-article .blog-body {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.374px;
    line-height: 1.8;
    color: var(--near-black);
}

.blog-article .blog-body p {
    margin-bottom: 1.2em;
}

.blog-article .back-link {
    display: inline-block;
    margin-top: 40px;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: -0.224px;
    color: var(--action-blue);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.blog-article .back-link:hover {
    opacity: 0.7;
}

/* ---- Footer ---- */
.page-footer {
    background: var(--parchment);
    padding: 24px;
    text-align: center;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: var(--muted-80);
    line-height: 1.5;
}

/* ===============================
   Responsive
   =============================== */
@media (max-width: 834px) {
    .nav-links {
        gap: 16px;
    }

    .page-section h1 {
        font-size: 34px;
    }

    .counter-card .counter-num {
        font-size: 56px;
    }

    .month-nav {
        display: none;
    }

    .page-with-sidebar {
        gap: 0;
    }
}

@media (max-width: 640px) {
    .nav-content {
        padding: 0 16px;
    }

    .nav-links {
        gap: 12px;
    }

    .nav-links a {
        font-size: 11px;
    }

    .album {
        padding: 12px 12px 8px;
    }

    .photo-controls {
        gap: 24px;
    }

    .page-section {
        padding: 48px 16px;
    }

    .page-section h1 {
        font-size: 28px;
    }

    .page-section .subtitle {
        font-size: 18px;
    }

    .anniversary-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .counter-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .counter-card {
        padding: 28px 16px;
    }

    .counter-card .counter-num {
        font-size: 48px;
    }

    .timeline-item {
        padding-left: 24px;
    }

    .blog-article {
        padding: 40px 16px 32px;
    }

    .blog-article h1 {
        font-size: 26px;
    }
}

@media (max-width: 419px) {
    .nav-links a {
        font-size: 10px;
    }

    .nav-links {
        gap: 8px;
    }

    .ctrl-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}
