/* Xiao Liu — personal site. Monochrome editorial design with section color accents (see CLAUDE.md). */
:root {
    --black: #111;
    --white: #fff;
    --gray: #555;
    --muted: #888;
    --rule: #e0e0e0;
    --light-gray: #f7f7f7;
    --deep-blue: #005594;
    --sky-blue: #4398D3;
    --orange: #EE8D3D;
    --red: #C5362F;
    --header-h: 64px;
    --page-padding: 4vw;
    --max-width: 1200px;
    --content-width: 860px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--white);
    color: var(--black);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

/* Section color accents: a short colored tick before small uppercase labels */
.accent-blogs { --accent: var(--sky-blue); }
.accent-presentations { --accent: var(--orange); }
.accent-apps { --accent: var(--deep-blue); }

.label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.label::before {
    content: '';
    width: 4px;
    height: 14px;
    background: var(--accent, var(--black));
}

/* ============================================================
   HEADER — white and sticky; transparent over the home hero
   ============================================================ */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 var(--page-padding);
    background: var(--white);
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 200;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
}
header.overlay {
    background: transparent;
    border-bottom-color: transparent;
    color: var(--white);
}

.brand { font-weight: 600; white-space: nowrap; }

header nav { display: flex; gap: 4px; }
header nav a { padding: 4px 10px; font-size: 15px; transition: opacity 0.15s; }
header nav a:hover { text-decoration: none; opacity: 0.6; }
header nav a.active { text-decoration: underline; text-underline-offset: 4px; }

/* Phone menu button: three bars that turn into an X when open */
.menu {
    display: none;
    position: relative;
    z-index: 2;
    flex-direction: column;
    gap: 5px;
    padding: 6px 4px;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
}
.menu span { display: block; width: 22px; height: 2px; background: currentColor; transition: transform 0.2s, opacity 0.2s; }
header.open .menu { color: var(--black); }
header.open .menu span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
header.open .menu span:nth-child(2) { opacity: 0; }
header.open .menu span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

main {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 5vw var(--page-padding) 6vw;
}

footer {
    border-top: 1px solid var(--rule);
    padding: 2.5rem var(--page-padding);
    text-align: center;
}
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; margin-bottom: 0.6rem; }
.footer-nav a { padding: 0 0.5rem; font-size: 0.9rem; }
.footer-nav .sep { color: var(--gray); font-size: 0.9rem; }
.footer-copy { font-size: 0.82rem; color: var(--gray); }

/* ============================================================
   HOME — dark hero + grid of section cells
   ============================================================ */
.hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 80vh;
    margin-top: calc(-1 * var(--header-h));
    padding: calc(var(--header-h) + 4vw) var(--page-padding) 6vw;
    /* Dark scrim, heaviest at the bottom where the text sits, over NASA's Earth limb photo */
    background:
        linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.3) 55%, rgba(0, 0, 0, 0.15) 100%),
        url('img/hero-earth.jpg') center 30% / cover no-repeat,
        var(--black);
    color: var(--white);
}
.hero-credit {
    position: absolute;
    right: var(--page-padding);
    bottom: 1rem;
    font-size: 0.72rem;
    opacity: 0.6;
}
.hero-inner { width: 100%; max-width: calc(var(--max-width) - 2 * var(--page-padding)); margin: 0 auto; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 4.4rem); margin-bottom: 1.25rem; animation: fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) both; }
.hero p { max-width: 600px; font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.55; opacity: 0.85; animation: fade-up 1s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(24px); }
}
@media (prefers-reduced-motion: reduce) {
    .hero h1, .hero p { animation: none; }
}

.section-heading { margin-bottom: 2rem; font-size: clamp(1.6rem, 3vw, 2.4rem); }

/* Ask Xiao: a question box with suggested questions; the answer appears below */
.ask { --accent: var(--deep-blue); max-width: var(--content-width); margin: 0 auto 4.5vw; }
.ask .label { color: var(--gray); }
.ask .section-heading { margin: 0.6rem 0 0.45rem; }
.ask-intro { color: var(--gray); }
.ask-form { display: flex; margin-top: 1.2rem; border: 1px solid #aaa; }
.ask-form:focus-within { border-color: var(--black); }
.ask-form textarea {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--black);
    background: transparent;
    border: none;
    resize: vertical;
}
.ask-form textarea:focus { outline: none; }
.ask-form button {
    align-self: flex-end;
    margin: 7px;
    padding: 0.52rem 1rem;
    font: inherit;
    font-size: 0.85rem;
    color: var(--white);
    background: var(--black);
    border: 1px solid var(--black);
    cursor: pointer;
}
.ask-form button:hover { color: var(--black); background: var(--white); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.suggestions button {
    padding: 6px 10px;
    font: inherit;
    font-size: 0.78rem;
    color: var(--gray);
    background: transparent;
    border: 1px solid #ccc;
    cursor: pointer;
}
.suggestions button:hover { color: var(--black); border-color: var(--black); }
.answer { margin-top: 1.25rem; padding: 1rem 1.2rem; border: 1px solid var(--rule); border-left: 3px solid var(--deep-blue); }
.answer p { margin-top: 0.45rem; line-height: 1.65; }
.answer a { text-decoration: underline; text-underline-offset: 3px; }
.ask-note { margin-top: 12px; font-size: 0.72rem; color: var(--muted); }

/* Currently: text on the left, photo on the right */
.now {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 5vw;
    align-items: start;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
    scroll-margin-top: var(--header-h);
}
.now .section-heading { margin-bottom: 1.25rem; }
.now p { margin-bottom: 1rem; font-size: 0.98rem; line-height: 1.7; }
.now p a { text-decoration: underline; text-underline-offset: 3px; }
.now .actions { margin-top: 1.5rem; }
.now-photo img { display: block; width: 100%; }
.now-photo .img-placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; }
.now .caption { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--gray); }

/* Explore: a compact strip linking to each section */
.latest-heading { margin-bottom: 1rem; font-size: 1.25rem; }
.doors {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 4.5vw;
    border-top: 1px solid var(--rule);
}
.door {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.5rem;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.door:first-child { padding-left: 0; }
.door:last-child { border-right: none; padding-right: 0; }
.door-count { margin-left: auto; font-weight: 600; color: var(--muted); }
.door-latest { display: block; margin-top: 0.6rem; font-size: 1.02rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.door-date { margin-top: 0.2rem; font-size: 0.82rem; color: var(--gray); }
.door-empty { margin-top: 0.6rem; color: var(--muted); }
.door-all { margin-top: auto; padding-top: 0.6rem; font-size: 0.85rem; font-weight: 500; }

/* ============================================================
   SECTION PAGES — title + rows divided by rules
   ============================================================ */
.page-title { max-width: var(--content-width); margin-bottom: 2.5rem; }
.page-title h1 { margin-top: 0.75rem; font-size: clamp(2.2rem, 4.5vw, 3.6rem); }
.page-title p { margin-top: 1rem; font-size: 1.05rem; color: var(--gray); }
.page-title p a { text-decoration: underline; text-underline-offset: 3px; }
.page-title .label { color: var(--gray); }

.rows { max-width: var(--content-width); border-top: 1px solid var(--rule); }
.row { padding: 2.25rem 0; border-bottom: 1px solid var(--rule); }
.meta { font-size: 0.88rem; color: var(--gray); }
.row h2 { margin-top: 0.35rem; font-size: clamp(1.3rem, 2.2vw, 1.6rem); letter-spacing: -0.01em; line-height: 1.2; }
.row p { margin-top: 0.6rem; line-height: 1.7; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.25rem; }
.empty { padding: 2rem 0; color: var(--muted); }

/* Outlined buttons that fill black on hover */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--black);
    background: transparent;
    border: 1px solid var(--black);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--black); color: var(--white); text-decoration: none; }
.btn-quiet { border-color: #ccc; color: var(--gray); }
.btn-quiet:hover { border-color: var(--black); }
.btn-static, .btn-static:hover { cursor: default; color: var(--muted); background: transparent; border-color: #ccc; }

/* ============================================================
   BLOG POST — one readable column
   ============================================================ */
.post { max-width: var(--content-width); font-size: 17px; line-height: 1.75; }
.back { display: inline-block; margin-bottom: 2rem; font-size: 0.9rem; color: var(--gray); }
.post > h1 { margin: 0.5rem 0 2.5rem; font-size: clamp(2rem, 4vw, 3rem); }
.post h2 { margin: 3rem 0 1rem; font-size: 1.6rem; }
.post h3 { margin: 2rem 0 0.5rem; font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; }
.post p, .post ul, .post ol, .post blockquote, .post pre, .post .table-wrap { margin: 0 0 1.25rem; }
.post ul, .post ol { padding-left: 1.6rem; }
.post li { margin: 0.3rem 0; }
.post li > ul, .post li > ol, .post li > pre { margin: 0.5rem 0; }
.post a { text-decoration: underline; text-underline-offset: 3px; }
.post a:hover { opacity: 0.6; }
.post code {
    font-family: 'Cascadia Code', Consolas, 'SF Mono', monospace;
    font-size: 0.86em;
    padding: 1px 5px;
    background: var(--light-gray);
    border: 1px solid #eee;
}
.post pre { padding: 1rem 1.25rem; background: var(--black); overflow-x: auto; line-height: 1.55; }
.post pre code { padding: 0; background: none; border: none; color: #f2f2f2; font-size: 14px; }
.post blockquote { padding: 0.25rem 0 0.25rem 1.1rem; border-left: 3px solid var(--black); }
.post blockquote p { margin: 0; }
.post .table-wrap { overflow-x: auto; }
.post table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.post th, .post td { padding: 0.7rem 0.75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.post th { font-weight: 600; border-bottom-color: var(--black); }
.post img { max-width: 100%; }
.img-placeholder {
    display: block;
    padding: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    border: 1.5px dashed #ccc;
}

/* ============================================================
   LIKES, COPY LINK AND COMMENTS — filled in by social.js
   ============================================================ */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.post-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: -1.25rem 0 2.5rem; }
.like {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--black);
    background: transparent;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: border-color 0.15s;
}
.like:hover:not(:disabled) { border-color: var(--black); }
.like:disabled { cursor: default; color: var(--muted); }
.like .heart { color: #888; font-size: 1rem; line-height: 1; transition: color 0.15s, transform 0.15s; }
.like.liked .heart { color: var(--red); }
.like.liked:active .heart { transform: scale(1.25); }
.like .like-count:empty { display: none; }

.comments { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
.comments .comments-heading { margin: 0 0 1.25rem; font-size: 1.4rem; }
.comments p { margin: 0; }
.comments ol { margin: 0; padding: 0; list-style: none; }

.c-form { display: grid; gap: 0.6rem; }
.c-form input, .c-form textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--black);
    border: 1px solid #ccc;
    border-radius: 0;
}
.c-form textarea { resize: vertical; min-height: 5.5rem; line-height: 1.55; }
.c-form input:focus, .c-form textarea:focus { outline: none; border-color: var(--black); }
.c-form input { max-width: 320px; }
.c-form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.c-counter { margin-right: auto; font-size: 0.8rem; color: var(--muted); }
.comments .c-error { font-size: 0.85rem; color: var(--red); }
.c-form-row .btn { padding: 0.5rem 1.2rem; }

.comment-list { margin-top: 2rem !important; }
.comment { padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.c-replies { margin-left: 1.5rem !important; }
.c-replies .comment { padding: 1rem 0 0.25rem; border-top: none; }
.c-reply-slot .c-form { margin: 1rem 0 0 1.5rem; }
.c-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; font-size: 0.92rem; }
.c-head strong { min-width: 0; overflow-wrap: anywhere; }
.c-badge { padding: 1px 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--white); background: var(--black); }
.c-meta { font-size: 0.82rem; color: var(--muted); }
.comments .c-body { margin-top: 0.35rem; font-size: 1rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-actions { display: flex; gap: 1.1rem; margin-top: 0.5rem; }
.c-actions button { padding: 0; font: inherit; font-size: 0.82rem; color: var(--gray); background: none; border: none; cursor: pointer; }
.c-actions button:hover { color: var(--black); }
.c-vote { display: inline-flex; gap: 5px; filter: grayscale(1) brightness(0.6); }
.c-vote.voted { filter: none; opacity: 1; font-weight: 600; color: var(--black) !important; }
.c-actions .c-delete { color: var(--red); }
.c-empty { padding: 1.5rem 0; color: var(--muted); border-top: 1px solid var(--rule); }

/* ============================================================
   PHONES
   ============================================================ */
@media (max-width: 768px) {
    .menu { display: flex; }
    header nav {
        display: none;
        position: fixed;
        inset: 0;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        background: var(--white);
        color: var(--black);
    }
    header.open nav { display: flex; }
    header nav a { font-size: 1.3rem; }

    .now { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
    .now-photo .img-placeholder { aspect-ratio: 16 / 9; }
    .doors { grid-template-columns: 1fr; }
    .door, .door:first-child, .door:last-child { padding: 1rem 0; border-right: none; }
    main { padding: 2.5rem var(--page-padding) 3.5rem; }
    .hero { min-height: 60vh; }
}
