/* Homepage-only presentation layer.
   Uses existing IDs and utility classes so the shared component system stays intact. */

:root {
    --home-ink: #182015;
    --home-muted: #64705e;
    --home-line: rgba(74, 94, 58, 0.14);
    --home-surface: rgba(255, 255, 255, 0.78);
    --home-shadow: 0 24px 70px rgba(49, 61, 42, 0.09);
}

#landing-page-content {
    background:
        radial-gradient(circle at 12% 8%, rgba(101, 121, 84, 0.11), transparent 27rem),
        radial-gradient(circle at 88% 16%, rgba(8, 145, 178, 0.07), transparent 25rem),
        #f8f9f6;
}

/* 在路由程式完成初始化前就隱藏首頁，避免工具頁出現內容閃現或重疊。 */
html.app-route-active #landing-page-content {
    display: none !important;
}

html.app-route-active #app-shell-content {
    display: flex !important;
}

#landing-page-content main {
    color: var(--home-ink);
}

#site-navbar-injected {
    background: rgba(248, 249, 246, 0.76);
    border-bottom: 1px solid transparent;
    box-shadow: none;
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
}

#site-navbar-injected.scrolled {
    background: rgba(248, 249, 246, 0.9);
    border-bottom-color: var(--home-line);
    box-shadow: 0 10px 32px rgba(49, 61, 42, 0.06);
}

#home-hero {
    min-height: min(720px, calc(100svh - var(--navbar-height)));
    display: flex;
    align-items: center;
    padding-block: clamp(6rem, 12vw, 10rem);
}

#home-hero h1 {
    color: var(--home-ink);
    font-size: clamp(3rem, 6.5vw, 5.75rem);
    line-height: 1;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

#home-hero p {
    color: var(--home-muted);
    max-inline-size: 35rem;
    font-size: clamp(1rem, 0.96rem + 0.25vw, 1.16rem);
    line-height: 1.85;
}

#entry a:active,
#labs a:active {
    transform: scale(0.985);
    transition-duration: 90ms;
}

#hero-physics-visual {
    position: relative;
    min-height: 31rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 2.25rem;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(238, 243, 234, 0.67)),
        rgba(255, 255, 255, 0.72);
    box-shadow: var(--home-shadow);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    backdrop-filter: blur(24px) saturate(150%);
}

#hero-physics-visual::before,
#hero-physics-visual::after {
    content: "";
    position: absolute;
    border-radius: 999px;
}

#hero-physics-visual::before {
    width: 21rem;
    height: 21rem;
    inset: 50% auto auto 50%;
    border: 1px solid rgba(101, 121, 84, 0.18);
    box-shadow:
        0 0 0 3.3rem rgba(101, 121, 84, 0.035),
        0 0 0 6.6rem rgba(101, 121, 84, 0.025);
    transform: translate(-50%, -50%);
}

#hero-physics-visual::after {
    width: 8rem;
    height: 8rem;
    top: 10%;
    right: 8%;
    background: rgba(245, 158, 11, 0.13);
    filter: blur(2px);
}

#hero-formula {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: 14rem;
    padding: 1.35rem;
    border: 1px solid rgba(101, 121, 84, 0.15);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 20px 45px rgba(49, 61, 42, 0.12);
    transform: translate(-50%, -50%);
}

#hero-formula strong {
    display: block;
    color: #526645;
    font-family: "Geist Mono", ui-monospace, monospace;
    font-size: clamp(1.65rem, 3vw, 2.2rem);
    letter-spacing: -0.04em;
}

#hero-formula span {
    display: block;
    margin-top: 0.65rem;
    color: var(--home-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

#hero-axis {
    position: absolute;
    z-index: 1;
    inset: 50% auto auto 50%;
    width: 72%;
    height: 72%;
    transform: translate(-50%, -50%);
}

#hero-axis::before,
#hero-axis::after {
    content: "";
    position: absolute;
    background: rgba(82, 102, 69, 0.18);
}

#hero-axis::before {
    width: 100%;
    height: 1px;
    top: 50%;
}

#hero-axis::after {
    width: 1px;
    height: 100%;
    left: 50%;
}

#hero-particle-one,
#hero-particle-two,
#hero-particle-three {
    position: absolute;
    z-index: 3;
    width: 0.8rem;
    height: 0.8rem;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(49, 61, 42, 0.18);
}

#hero-particle-one {
    top: 20%;
    left: 22%;
    background: #657954;
}

#hero-particle-two {
    top: 25%;
    right: 24%;
    background: #0891b2;
}

#hero-particle-three {
    right: 18%;
    bottom: 20%;
    background: #f59e0b;
}

#entry {
    position: relative;
    padding-block: clamp(4.5rem, 8vw, 7rem);
}

#entry > div > div:last-child > a {
    border-color: var(--home-line);
    background: var(--home-surface);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

#entry > div > div:last-child > a:hover {
    border-color: rgba(101, 121, 84, 0.32);
    box-shadow: 0 24px 48px rgba(49, 61, 42, 0.1);
    transform: translateY(-4px);
}

#entry > div > div:last-child > a[aria-current="true"] {
    border-color: rgba(101, 121, 84, 0.42);
    box-shadow:
        0 0 0 3px rgba(101, 121, 84, 0.08),
        0 18px 38px rgba(49, 61, 42, 0.08);
}

#labs {
    display: none;
    scroll-margin-top: calc(var(--navbar-height) + 1rem);
    background: rgba(255, 255, 255, 0.7);
    border-top: 1px solid var(--home-line);
}

#labs > div {
    max-width: 76rem;
}

#labs [id^="cat-"] {
    scroll-margin-top: calc(var(--navbar-height) + 1.5rem);
}

#labs [id^="cat-"] > div:first-child {
    margin-bottom: 1.5rem;
}

#labs [id^="cat-"] > div:first-child > div {
    width: 0.28rem;
    height: 1.75rem;
}

#labs [id^="cat-"] h2 {
    letter-spacing: -0.025em;
}

#labs [id^="cat-"] h2 span {
    display: block;
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#student-section > div > div:last-child > a,
#teacher-section > div > div:last-child > a,
#simulation-section > div > div:last-child > a {
    min-height: 12.5rem;
    border-radius: 1.4rem;
    border-color: var(--home-line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

#student-section > div > div:last-child > a:hover,
#teacher-section > div > div:last-child > a:hover,
#simulation-section > div > div:last-child > a:hover {
    border-color: rgba(101, 121, 84, 0.35);
    box-shadow: 0 16px 32px rgba(49, 61, 42, 0.08);
    transform: translateY(-3px);
}

#student-section > div > div:last-child > a h3,
#teacher-section > div > div:last-child > a h3,
#simulation-section > div > div:last-child > a h3 {
    color: var(--home-ink);
    font-size: 1.08rem;
    line-height: 1.35;
    letter-spacing: -0.018em;
}

#student-section > div > div:last-child > a p,
#teacher-section > div > div:last-child > a p,
#simulation-section > div > div:last-child > a p {
    color: var(--home-muted);
    line-height: 1.7;
}

#student-section,
#teacher-section,
#simulation-section {
    display: none;
}

#landing-page-content :focus-visible {
    outline: 3px solid rgba(8, 145, 178, 0.42);
    outline-offset: 4px;
}

@media (max-width: 1023px) {
    #home-hero {
        min-height: auto;
    }
}

@media (max-width: 767px) {
    #home-hero {
        min-height: min(620px, calc(100svh - var(--navbar-height)));
        padding-block: 5rem;
    }

    #home-hero h1 {
        font-size: clamp(2.8rem, 15vw, 4.4rem);
        line-height: 1.02;
    }

    #entry {
        padding-block: 3.5rem;
    }

    #labs {
        padding-block: 3.5rem;
    }

    #student-section > div > div:last-child > a,
    #teacher-section > div > div:last-child > a,
    #simulation-section > div > div:last-child > a {
        min-height: auto;
        padding: 1.25rem;
        border-radius: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    #landing-page-content *,
    #landing-page-content *::before,
    #landing-page-content *::after {
        animation: none !important;
        scroll-behavior: auto !important;
        transition-duration: 1ms !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    #site-navbar-injected,
    #hero-physics-visual,
    #entry > div > div:last-child > a {
        background: #f8f9f6;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

@media (prefers-contrast: more) {
    #site-navbar-injected,
    #hero-physics-visual,
    #entry > div > div:last-child > a,
    #labs a {
        border-color: #526645;
    }
}
