/* ==========================================================================
   Minimal dark redesign — home page, shared nav & footer
   Scoped mostly under `body.home`; nav/footer overrides are shared.
   ========================================================================== */

:root {
    --bg:        #0b0c0e;
    --bg-2:      #131418;
    --bg-3:      #1a1b20;
    --text:      #f4f4f5;
    --muted:     #9a9ba3;
    --muted-2:   #6c6d76;
    --line:      rgba(255, 255, 255, 0.09);
    --line-2:    rgba(255, 255, 255, 0.16);
    --accent:    #7ee0c0;
    --accent-dim: rgba(126, 224, 192, 0.14);
    --maxw:      980px;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ---- base ---- */
body.home {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.6;
}

/* animated curved-surface decoration — fans from a point, flows down (home only) */
.home-decor {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 58%, transparent 96%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 58%, transparent 96%);
}
.home-decor canvas {
    display: block;
    width: 100%;
    height: 100%;
}

body.home a {
    color: var(--text);
    text-decoration: none;
    transition: color .18s ease;
}

body.home ::selection {
    background: var(--accent);
    color: #04110c;
}

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 28px;
}

/* ---- navbar (shared override) ---- */
.navbar.navbar-dark.bg-dark {
    background: rgba(11, 12, 14, 0.72) !important;
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
    padding: 0.9rem 0;
}
.navbar .navbar-brand,
.navbar .navbar-brand.font-weight-bold {
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    font-size: 1rem;
}
.navbar .nav-link {
    color: var(--muted) !important;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    padding: 0.25rem 0 !important;
    margin-left: 1.6rem;
    position: relative;
}
.navbar .nav-link:hover {
    color: var(--text) !important;
}
.navbar-collapse .navbar-nav {
    align-items: center;
}
@media (max-width: 991px) {
    .navbar .nav-link { margin-left: 0; }
}

/* Center-align navbar contents to the same column as the page */
.navbar > .container,
.navbar { padding-left: max(28px, calc((100% - var(--maxw)) / 2));
          padding-right: max(28px, calc((100% - var(--maxw)) / 2)); }

/* ---- hero ---- */
.hero {
    padding: 190px 0 90px;
    border-bottom: 1px solid var(--line);
}
.hero-grid {
    display: grid;
    grid-template-columns: 1fr minmax(230px, 330px);
    gap: 52px;
    align-items: center;
}
.hero-art {
    justify-self: end;
}
.hero-art img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--line);
    filter: grayscale(0.15) contrast(1.05);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    -webkit-mask-image: radial-gradient(circle at center, #000 78%, transparent 100%);
    mask-image: radial-gradient(circle at center, #000 78%, transparent 100%);
}
.hero .eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.hero .eyebrow::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-dim);
}
.hero h1 {
    font-size: clamp(2.6rem, 6vw, 4.4rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.08;
    margin: 0 0 26px;
}
.hero h1 .greeting {
    display: block;
    font-family: var(--font-mono);
    font-size: clamp(0.95rem, 2vw, 1.3rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--muted);
    margin-bottom: 10px;
}
.hero h1 .name {
    font-family: "Courier New", Courier, monospace;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.hero h1 .zh { color: var(--muted-2); font-weight: 200; }
.hero .lede {
    font-size: clamp(1.05rem, 2.2vw, 1.3rem);
    font-weight: 300;
    color: var(--muted);
    max-width: 760px;
    line-height: 1.6;
    margin: 0 0 34px;
}
.hero .lede strong { color: var(--text); font-weight: 500; }
.hero .lede a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); }
.hero .lede a:hover { border-color: var(--accent); }

/* social row */
.social {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.social a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 0.88rem;
    color: var(--muted);
    padding: 9px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.social a:hover {
    color: var(--text);
    border-color: var(--line-2);
    background: var(--bg-2);
}
.social a .icon,
.social a svg { width: 16px; height: 16px; }
.social a .icon svg path { fill: currentColor; }

/* ---- generic section ---- */
.section { padding: 74px 0; border-bottom: 1px solid var(--line); }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 40px;
    gap: 16px;
}
.section-head h2 {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted-2);
    font-family: var(--font-mono);
    font-weight: 500;
    margin: 0;
}
.section-head .see-all {
    font-size: 0.85rem;
    color: var(--muted);
}
.section-head .see-all:hover { color: var(--accent); }

/* ---- selected work list ---- */
.work-item {
    display: block;
    padding: 26px 0;
    border-top: 1px solid var(--line);
    position: relative;
    transition: padding-left .22s ease;
}
.work-item:hover { padding-left: 14px; }
.work-item:hover .work-title { color: var(--accent); }
.work-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.work-title {
    font-size: clamp(1.25rem, 3vw, 1.7rem);
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text);
    transition: color .18s ease;
    margin: 0;
}
.work-date {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--muted-2);
    white-space: nowrap;
}
.work-skills {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.work-skills .chip {
    font-size: 0.76rem;
    color: var(--muted);
    padding: 4px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: var(--font-mono);
    letter-spacing: 0.01em;
}

/* ---- writing list ---- */
.post-row {
    display: flex;
    align-items: baseline;
    gap: 22px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    transition: padding-left .22s ease;
}
.post-row:hover { padding-left: 12px; }
.post-row:hover .post-name { color: var(--accent); }
.post-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted-2);
    white-space: nowrap;
    min-width: 108px;
}
.post-name {
    font-size: 1.02rem;
    color: var(--text);
    font-weight: 400;
    transition: color .18s ease;
}

/* ---- footer (shared) ---- */
.site-footer {
    background: var(--bg);
    color: var(--muted);
    padding: 56px 0 44px;
    font-family: var(--font-sans);
}
.site-footer .foot-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.site-footer .foot-name { color: var(--text); font-weight: 500; }
.site-footer .foot-sub { font-size: 0.85rem; color: var(--muted-2); margin-top: 4px; }
.site-footer .foot-links { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer .foot-links a { color: var(--muted); font-size: 0.88rem; }
.site-footer .foot-links a:hover { color: var(--accent); }

@media (max-width: 860px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .hero-art {
        order: -1;
        justify-self: start;
        max-width: 300px;
    }
}

@media (max-width: 640px) {
    .hero { padding: 150px 0 64px; }
    .section { padding: 56px 0; }
    .post-date { min-width: 92px; }
}

/* ==========================================================================
   Inner pages (body.page) — inherit the home page's dark theme.
   Overrides Bootstrap's light utilities (many use !important).
   ========================================================================== */

body.page {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    line-height: 1.7;
}
body.page ::selection { background: var(--accent); color: #04110c; }

body.page a { color: var(--accent); text-decoration: none; transition: color .18s ease; }
body.page a:hover { color: var(--text); }

/* keep content clear of the fixed nav */
body.page .site-container { padding-top: 96px; }

/* headings */
body.page .content h1,
body.page .content h2,
body.page .content h3,
body.page .content h4,
body.page .content h5,
body.page .content h6 {
    color: var(--text);
    font-weight: 400;
    letter-spacing: -0.01em;
}
body.page .content h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 300; }
body.page .content h2 { font-size: 1.5rem; margin-top: 2em; }
body.page .content h3 { font-size: 1.2rem; color: var(--accent); }
body.page .content h4 { font-size: 1.05rem; }
body.page .content p,
body.page .content li { color: var(--text); }
body.page .content strong,
body.page .content b { color: var(--text); font-weight: 500; }

/* borders used by layouts (Bootstrap .border* use !important) */
body.page .border,
body.page .border-top,
body.page .border-right,
body.page .border-bottom,
body.page .border-left { border-color: var(--line) !important; }

/* list page titles */
body.page .list-title { color: #d6d7dc; letter-spacing: 0.08em; }

/* muted/secondary text — kept light for clear legibility */
body.page .text-secondary,
body.page .text-muted { color: #d6d7dc !important; }

/* cards / sidebar panels (Bootstrap .bg-light|.bg-white use !important) */
body.page .card { background: transparent; border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
body.page .card.bg-light { background: var(--bg-2) !important; border-color: var(--line); }
body.page .card-title,
body.page .card-subtitle { color: var(--text); }
body.page .card-subtitle.text-secondary { color: #d6d7dc !important; }

/* portfolio / post cards (bottom-border list style) */
body.page .card-portfolio,
body.page .card-post { background: transparent; border-color: var(--line) !important; border-radius: 0; }
body.page .card-portfolio .card-title a,
body.page .card-post .card-title a { color: var(--text); }
body.page .card-portfolio .card-title a:hover,
body.page .card-post .card-title a:hover { color: var(--accent); }

/* skill / tag chips (Bootstrap .bg-white + .border use !important) */
body.page .skill,
body.page .tag,
body.page a.skill,
body.page a.tag,
body.page .bg-white {
    background: var(--bg-3) !important;
    border: 1px solid var(--line) !important;
    color: #d6d7dc !important;
    border-radius: 8px !important;
}
body.page a.skill:hover,
body.page a.tag:hover { color: var(--text) !important; border-color: var(--line-2) !important; }

/* buttons */
body.page .btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #04110c;
    font-weight: 500;
}
body.page .btn-primary:hover { background: var(--text); border-color: var(--text); color: var(--bg); }

/* profile avatar */
body.page .profile-image { border: 1px solid var(--line); }

/* images, rules, quotes, code */
body.page .content img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
body.page .content hr { border-top: 1px solid var(--line); }
body.page .content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    color: #d6d7dc;
    margin-left: 0;
}
body.page .content code {
    background: var(--bg-3);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.88em;
}
body.page .content pre {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
    overflow-x: auto;
}
body.page .content pre code { background: transparent; color: var(--text); padding: 0; }

/* tables */
body.page .content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; }
body.page .content th,
body.page .content td { border: 1px solid var(--line); padding: 8px 12px; }
body.page .content th { background: var(--bg-2); color: var(--text); text-align: left; }
body.page .content td { color: var(--text); }

/* svg icons in sidebar */
body.page .icon.grey svg path { fill: var(--muted-2); }
