/* ============================
   Design Tokens
   ============================ */
:root {
    /* Primary palette — spring greens + soft blossom accents */
    --color-brand-1: #52b788;       /* Mint leaf green — primary brand */
    --color-brand-2: #40916c;       /* Richer emerald — gradient end */
    --color-brand-3: #f0c987;       /* Soft daffodil yellow — accent */
    --color-hero-start: #7dd87d;    /* Fresh spring leaf */
    --color-hero-end: #44a08d;      /* Sage teal */

    /* Neutrals (tinted with green, never pure gray) */
    --color-bg: #f4f8f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f0f5f1;
    --color-border: rgba(20, 45, 35, 0.06);
    --color-border-strong: rgba(20, 45, 35, 0.1);
    --color-text: #1a2e25;
    --color-text-muted: #4d665a;
    --color-text-subtle: #889b91;

    /* Shadows (layered, green-tinted) */
    --shadow-sm: 0 1px 2px rgba(20, 45, 35, 0.04),
                 0 2px 8px rgba(20, 45, 35, 0.04);
    --shadow-md: 0 4px 12px rgba(20, 45, 35, 0.06),
                 0 12px 32px rgba(20, 45, 35, 0.06);
    --shadow-lg: 0 8px 20px rgba(20, 45, 35, 0.08),
                 0 28px 60px rgba(20, 45, 35, 0.10);
    --shadow-brand: 0 6px 20px rgba(82, 183, 136, 0.35);
    --shadow-brand-lg: 0 10px 32px rgba(82, 183, 136, 0.45);

    /* Easing — pick deliberate curves, never bare `ease` */
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);     /* Even, refined */
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);    /* A touch snappier */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);      /* Decisive, confident */
    --ease-in-quart: cubic-bezier(0.5, 0, 0.75, 0);      /* For exits */
    --ease-standard: cubic-bezier(0.65, 0, 0.35, 1);     /* Toggles */

    /* Duration — the 100/300/500 rule */
    --d-instant: 120ms;     /* Button press, toggle flip */
    --d-state: 220ms;       /* Hover, menu open */
    --d-layout: 400ms;      /* Accordion, modal */
    --d-entrance: 600ms;    /* Page load, hero reveal */
    --d-exit: 160ms;        /* Exit = ~75% of entrance */
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
        sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--d-state) var(--ease-out-quart);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

/* Global focus-visible — every interactive element gets a ring */
:focus-visible {
    outline: 2px solid var(--color-brand-1);
    outline-offset: 3px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-brand-1);
    outline-offset: 2px;
}

/* ============================
   Page Loader
   ============================ */
.page-loader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--color-hero-start) 0%, var(--color-hero-end) 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--d-layout) var(--ease-in-quart),
                visibility var(--d-layout) var(--ease-in-quart);
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-ring {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================
   Scroll Progress
   ============================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-brand-1), var(--color-brand-2), var(--color-brand-3));
    z-index: 999;
    width: 0%;
    transition: width 80ms linear;
}

/* ============================
   Layout Container
   ============================ */
.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================
   Header / Nav
   ============================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    border-bottom: 1px solid var(--color-border);
    transition: box-shadow var(--d-state) var(--ease-out-quart),
                background var(--d-state) var(--ease-out-quart);
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    transition: transform var(--d-state) var(--ease-out-quart);
}

.logo:hover {
    transform: scale(1.04);
}

.logo-icon {
    font-size: 24px;
    display: inline-block;
    animation: wiggle 4s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    30% { transform: rotate(-10deg); }
    70% { transform: rotate(10deg); }
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    font-size: 15px;
    color: var(--color-text-muted);
    font-weight: 500;
    position: relative;
    padding: 6px 2px;
}

.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--color-brand-1), var(--color-brand-2));
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--d-state) var(--ease-out-quint);
}

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

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
}

.nav-links a.active {
    color: var(--color-brand-1);
}

/* Mobile menu toggle — hamburger → X */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: background var(--d-state) var(--ease-out-quart);
}

.menu-toggle:hover {
    background: rgba(20, 45, 35, 0.05);
}

.menu-toggle:active {
    background: rgba(20, 45, 35, 0.08);
    transform: scale(0.96);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 300ms var(--ease-out-quart);
    position: relative;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}
.menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================
   Hero
   ============================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-hero-start) 0%, var(--color-hero-end) 100%);
    background-size: 200% 200%;
    animation: gradientShift 18s ease-in-out infinite;
    color: #fff;
    padding: 100px 0 60px;
    position: relative;
    overflow: hidden;
    counter-reset: section-num 0;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Decorative floating blobs */
.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    animation: float 14s ease-in-out infinite;
    pointer-events: none;
}
.hero::before {
    width: 340px; height: 340px;
    top: 8%; left: -80px;
    animation-delay: 0s;
}
.hero::after {
    width: 220px; height: 220px;
    bottom: 18%; right: -50px;
    animation-delay: -7s;
}

.bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    animation: rise linear infinite;
}

@keyframes rise {
    0%   { transform: translateY(0) rotate(0); opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateY(-110vh) rotate(720deg); opacity: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-40px) scale(1.06); }
}

.hero-content {
    text-align: center;
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Avatar */
.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    font-size: 56px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    animation: avatarBreath 4.5s ease-in-out infinite;
    position: relative;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5);
    transition: transform var(--d-state) var(--ease-out-quart);
}

.avatar::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.28);
    animation: spin 22s linear infinite;
}
.avatar::after {
    content: "";
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: rgba(255, 255, 255, 0.2);
    animation: spin 12s linear infinite reverse;
}

@keyframes avatarBreath {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.45);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 0 0 16px rgba(255, 255, 255, 0);
    }
}

/* Title & subtitle */
.hero-title {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.highlight {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 14px;
    border-radius: 10px;
    display: inline-block;
}

.hero-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 36px;
    min-height: 1.4em;
}

/* Typing cursor */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: rgba(255, 255, 255, 0.85);
    margin-left: 3px;
    vertical-align: -2px;
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    0%, 50%   { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Hero entrance choreography — each child staggers */
.hero-content > * {
    opacity: 0;
    animation: enter-up var(--d-entrance) var(--ease-out-quart) forwards;
}
.hero-content > .avatar  { animation-delay: 80ms; }
.hero-content > .hero-title  { animation-delay: 200ms; }
.hero-content > .hero-subtitle { animation-delay: 360ms; }
.hero-content > .hero-buttons  { animation-delay: 520ms; }

@keyframes enter-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: none; }
}

/* ============================
   Buttons
   ============================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform var(--d-instant) var(--ease-out-quint),
                box-shadow var(--d-state) var(--ease-out-quart),
                background var(--d-state) var(--ease-out-quart),
                color var(--d-state) var(--ease-out-quart);
    position: relative;
    user-select: none;
}

.btn-primary {
    background: #fff;
    color: var(--color-brand-1);
    box-shadow: 0 4px 16px rgba(20, 45, 35, 0.15);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(20, 45, 35, 0.22);
}
.btn-primary:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 8px rgba(20, 45, 35, 0.15);
}

.btn-outline {
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}
.btn-outline:active {
    transform: translateY(0) scale(0.97);
    background: rgba(255, 255, 255, 0.25);
}

/* ============================
   Sections — shared
   ============================ */
.section {
    padding: 100px 0;
    position: relative;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 56px;
    color: var(--color-text);
    position: relative;
    letter-spacing: -0.3px;
}

/* Decorative section number */
.section-title::before {
    content: "0" counter(section-num);
    counter-increment: section-num;
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-brand-1);
    opacity: 0.7;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}

.section-title::after {
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-brand-1), var(--color-brand-2));
    margin: 12px auto 0;
    border-radius: 2px;
    transition: width var(--d-state) var(--ease-out-quint);
}

.section:hover .section-title::after {
    width: 72px;
}

/* ============================
   Reveal animations — FAIL-SAFE
   ============================ */
/* Only hide when JS is confirmed alive. Without JS → visible by default. */
.has-js .reveal,
.has-js .reveal-left,
.has-js .reveal-right {
    opacity: 0;
}
.has-js .reveal {
    transform: translateY(36px);
    transition: opacity var(--d-entrance) var(--ease-out-quart),
                transform var(--d-entrance) var(--ease-out-quart);
}
.has-js .reveal-left {
    transform: translateX(-48px);
    transition: opacity var(--d-entrance) var(--ease-out-quart),
                transform var(--d-entrance) var(--ease-out-quart);
}
.has-js .reveal-right {
    transform: translateX(48px);
    transition: opacity var(--d-entrance) var(--ease-out-quart),
                transform var(--d-entrance) var(--ease-out-quart);
}

.reveal.visible,
.reveal-left.visible,
.reveal-right.visible {
    opacity: 1;
    transform: none;
}

/* ============================
   About
   ============================ */
.about {
    background: var(--color-surface);
}

.about-content {
    max-width: 720px;
    margin: 0 auto;
}

.about-text p {
    font-size: 16px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    line-height: 1.9;
}

.about-text strong {
    color: var(--color-brand-1);
    font-weight: 600;
}

.info-list {
    margin-top: 32px;
    display: grid;
    gap: 12px;
}

.info-item {
    display: flex;
    padding: 14px 20px;
    background: var(--color-surface-alt);
    border-radius: 12px;
    border-left: 3px solid var(--color-brand-1);
    transition: transform var(--d-state) var(--ease-out-quart),
                background var(--d-state) var(--ease-out-quart),
                box-shadow var(--d-state) var(--ease-out-quart);
    position: relative;
    overflow: hidden;
}

.info-item::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(82, 183, 136, 0.08), transparent);
    opacity: 0;
    transition: opacity var(--d-state) var(--ease-out-quart);
}

.info-item:hover {
    background: #e5f2ea;
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}
.info-item:hover::before { opacity: 1; }

.info-label {
    width: 60px;
    color: var(--color-text-subtle);
    font-size: 14px;
}
.info-value {
    color: var(--color-text);
    font-weight: 500;
}

/* ============================
   Hobbies
   ============================ */
.hobbies {
    background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-surface-alt) 100%);
}

.hobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.hobby-card {
    background: var(--color-surface);
    padding: 32px 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 320ms var(--ease-out-quint),
                box-shadow 320ms var(--ease-out-quart);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.hobby-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(82, 183, 136, 0.06), rgba(240, 201, 135, 0.08));
    opacity: 0;
    transition: opacity var(--d-state) var(--ease-out-quart);
}

.hobby-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}
.hobby-card:hover::before { opacity: 1; }

.hobby-icon {
    font-size: 44px;
    margin-bottom: 16px;
    position: relative;
    display: inline-block;
    transition: transform 320ms var(--ease-out-quint);
}
.hobby-card:hover .hobby-icon {
    transform: scale(1.12) rotate(-4deg);
}

.hobby-card h3 {
    font-size: 17px;
    color: var(--color-text);
    margin-bottom: 8px;
    font-weight: 600;
    position: relative;
}
.hobby-card p {
    font-size: 14px;
    color: var(--color-text-subtle);
    line-height: 1.65;
    position: relative;
}

/* ============================
   Contact
   ============================ */
.contact {
    background: var(--color-surface);
}

.contact-tip {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 36px;
    font-size: 15px;
}

.contact-list {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    background: var(--color-surface-alt);
    border-radius: 12px;
    min-width: 220px;
    transition: transform var(--d-state) var(--ease-out-quint),
                background var(--d-state) var(--ease-out-quart),
                box-shadow var(--d-state) var(--ease-out-quart);
    position: relative;
    border: 1px solid transparent;
}

.contact-item:hover {
    background: #e5f2ea;
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(82, 183, 136, 0.3);
}

.contact-item:active {
    transform: translateY(-1px) scale(0.98);
}

.contact-icon {
    font-size: 28px;
    transition: transform 320ms var(--ease-out-quint);
}
.contact-item:hover .contact-icon {
    animation: iconPop 500ms var(--ease-out-quint);
}

@keyframes iconPop {
    0%, 100% { transform: translateY(0) scale(1); }
    40%      { transform: translateY(-6px) scale(1.15); }
}

.contact-label {
    font-size: 12px;
    color: var(--color-text-subtle);
}
.contact-value {
    font-size: 15px;
    color: var(--color-text);
    font-weight: 500;
}

/* ============================
   Footer
   ============================ */
.footer {
    background: linear-gradient(135deg, #1e3a2c 0%, #152a20 100%);
    color: #9bb8a8;
    padding: 44px 0;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.copyright {
    font-size: 14px;
    letter-spacing: 0.5px;
}

.icp a {
    font-size: 13px;
    color: #9bb8a8;
    transition: color var(--d-state) var(--ease-out-quart);
}
.icp a:hover { color: #fff; }

/* ============================
   Back-to-top button
   ============================ */
.back-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand-1), var(--color-brand-2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-brand);
    border: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.9);
    transition: opacity var(--d-state) var(--ease-out-quart),
                transform var(--d-state) var(--ease-out-quint),
                visibility var(--d-state) var(--ease-out-quart),
                box-shadow var(--d-state) var(--ease-out-quart);
    z-index: 998;
    font-size: 20px;
}

.back-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.back-top:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: var(--shadow-brand-lg);
}
.back-top:active {
    transform: translateY(0) scale(0.95);
}

/* ============================
   Responsive
   ============================ */
@media (max-width: 768px) {
    .nav-links {
        display: flex;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(16px) saturate(1.6);
        -webkit-backdrop-filter: blur(16px) saturate(1.6);
        flex-direction: column;
        padding: 20px 24px;
        gap: 18px;
        border-bottom: 1px solid var(--color-border);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: transform var(--d-state) var(--ease-out-quint),
                    opacity var(--d-state) var(--ease-out-quart),
                    visibility var(--d-state) var(--ease-out-quart);
    }
    .nav-links.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .menu-toggle { display: flex; }

    .hero { padding: 100px 0 50px; }
    .hero-title { font-size: 30px; letter-spacing: -0.5px; }
    .hero-subtitle { font-size: 16px; }
    .avatar { width: 96px; height: 96px; font-size: 44px; }

    .section { padding: 72px 0; }
    .section-title { font-size: 24px; margin-bottom: 40px; }

    .hobby-grid { grid-template-columns: 1fr; }

    .contact-list {
        flex-direction: column;
        align-items: stretch;
    }
    .contact-item { justify-content: center; }

    .back-top {
        bottom: 24px; right: 24px;
        width: 44px; height: 44px;
        font-size: 18px;
    }
}

/* ============================
   Reduced motion
   ============================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .has-js .reveal,
    .has-js .reveal-left,
    .has-js .reveal-right {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}
