/* Base — reset, container, header, hero, footer, animations. */
/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-body);
    line-height: 1.6;
    min-height: 100vh;
    transition: none;
}

a {
    color: inherit;
    text-decoration: none;
}

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

i {
    font-style: normal;
}

/* CONTAINER */
.container {
    width: min(var(--container-max), 100% - (var(--container-pad) * 2));
    margin-inline: auto;
}

/* SITE HEADER */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-block: 1rem;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--text-tagline);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.theme-toggle span {
    opacity: 1;
    transition: opacity 0.3s ease;
    padding: 4px 2px;
}

.theme-toggle span.active {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.theme-toggle .separator {
    margin: 0 0.1rem;
}

/* Mobile menu button — hidden on desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--accent);
    padding: 6px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.mobile-menu-btn:hover {
    opacity: 0.6;
}

/* Mobile menu overlay — closed it has no height: no vertical padding, no rule */
.mobile-menu-overlay {
    display: none;
    background: var(--bg-primary);
    border-bottom: 0 solid var(--border-color);
    padding: 0 1.5rem;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
    opacity: 0;
}

.mobile-menu-overlay.open {
    max-height: 300px;
    padding: 1.5rem;
    border-bottom-width: 1px;
    opacity: 1;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.mobile-menu-nav a {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--accent);
    letter-spacing: -0.025em;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-nav a:hover {
    opacity: 0.6;
}

.mobile-menu-nav a.active .nav-label {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mobile-menu-location {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--accent);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.6;
}

.header-location {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--accent);
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 1;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.header-nav a {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-tagline);
    letter-spacing: -0.025em;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.header-nav a:hover {
    opacity: 0.6;
}

.header-nav a .nav-label {
    transition: opacity 0.3s ease;
}

.header-nav a.active .nav-label {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Site-wide Hero */
.hero {
    padding: 3rem 0 0;
    position: relative;
}

.hero-headline {
    font-family: var(--font-display);
    font-size: clamp(3.2rem, 7.5vw, 6rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--text-tagline);
    position: relative;
}

html[lang="zh"] .hero-headline {
    letter-spacing: 0;
}

.hero-line-1 {
    display: block;
}

/* 1px underline after Lydia Leiwang: */
.hero::after {
    content: '';
    display: block;
    width: 100vw;
    height: 1px;
    background: var(--border-color);
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -18px;
}

/* Breathing dot animation */
@keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.breathing-dot {
    animation: breathe 3s ease-in-out infinite;
}

/* PAGE TITLE (portfolio, blog) */
.editorial-hero {
    padding: 3rem 0 0;
    position: relative;
}

.editorial-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7.2vw, 5.4rem);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.025em;
    position: relative;
}

/* Single line at the bottom of the title, as under the index headline */
.editorial-title::after {
    content: '';
    position: absolute;
    bottom: 0.12em;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 1px;
    background: var(--border-color);
}

.editorial-subtitle {
    font-size: 0.9rem;
    color: var(--text-body);
    opacity: 0.6;
    line-height: 1.6;
    max-width: 360px;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .editorial-subtitle {
        margin-top: 1rem;
    }
}

/* SITE FOOTER */
.site-footer {
    background-color: var(--bg-primary);
    padding: 4rem 0 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Plate left, email right, centered on one row */
.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    width: 100%;
    margin-bottom: 40px;
}

/* The old site's plate, small: Koulen caps on a red gradient, the name in gold */
.footer-plate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(to right, #8F1B1B, #B32B26, #8F1B1B);
    box-shadow: inset 0 1px 0 rgba(243, 232, 225, 0.2), inset 0 -1px 0 rgba(243, 232, 225, 0.2), 0 0 0 1px rgba(43, 41, 38, 0.25);
    font-family: 'Koulen', var(--font-body);
    font-size: 20px;
    line-height: 24px;
    letter-spacing: 0.04em;
    color: #F3E8E1;
    white-space: nowrap;
}

.footer-plate-name {
    font-family: 'PingFang TC', 'Noto Sans TC', 'Songti TC', 'Microsoft JhengHei', serif;
    color: #D5C594;
}

.footer-email {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 400;
    color: var(--text-tagline);
    text-decoration: none;
    display: block;
    text-align: right;
    transition: opacity 0.3s ease;
}

.footer-email:hover {
    opacity: 0.7;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.footer-copyright {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--accent);
}

.footer-social {
    display: flex;
    gap: 16px;
}

.footer-social a {
    display: block;
    width: 20px;
    height: 20px;
    color: var(--accent);
    transition: opacity 0.3s ease;
}

.footer-social a:hover {
    opacity: 0.7;
}

.footer-social svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Brand colors from brand.linkedin.com and Simple Icons 16.29.0; X and GitHub fall under the pure-dark ban, so they keep the ink. */
.footer-social a[aria-label="LinkedIn"] { color: #0A66C2; }
.footer-social a[aria-label="Instagram"] { color: #FF0069; }
.footer-social a[aria-label="Xiaohongshu"] { color: #FF2442; }
.footer-social a[aria-label="YouTube"] { color: #FF0000; }

.footer-lines {
    position: relative;
    height: 23px;
}

.footer-lines::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.footer-lines .tick {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--border-color);
}

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll-based reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(var(--reveal-dy));
    transition:
        opacity var(--reveal-dur) var(--reveal-ease),
        transform var(--reveal-dur) var(--reveal-ease);
    will-change: opacity, transform;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* CUSTOM SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 31, 61, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 31, 61, 0.4);
}
