/* Akhil Theerthala — Portfolio. Dark editorial. Newsreader serif + Geist sans. */

:root {
    /* Dark palette */
    --bg: #0c0c0d;
    --bg-1: #131315;
    --bg-2: #18181b;
    --bg-elev: #1f1f23;
    --rule: #232327;
    --rule-2: #2e2e34;
    --rule-3: #44444c;

    --ink: #f1ede6;
    --ink-2: #d4cfc6;
    --muted: #8e8a82;
    --dim: #5e5b55;
    --faint: #3a3833;

    --accent: #d4a86a;

    --headline-font: "Newsreader", "Instrument Serif", Georgia, serif;
    --body-font:
        "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --label-font: "Geist", -apple-system, sans-serif;
    --mono-font: "JetBrains Mono", ui-monospace, monospace;

    --maxw: 1180px;
    --gap: 1.5rem;
    --pad: 70px;

    --t: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-density="compact"] {
    --pad: 64px;
    --gap: 1rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--body-font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s var(--t);
}
button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}
img {
    max-width: 100%;
    display: block;
}
ul {
    list-style: none;
}
::selection {
    background: var(--accent);
    color: var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: radial-gradient(
        rgba(255, 255, 255, 0.02) 1px,
        transparent 1px
    );
    background-size: 3px 3px;
    opacity: 0.7;
}

[data-grid="on"] body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background:
        linear-gradient(
                to right,
                rgba(212, 168, 106, 0.06) 1px,
                transparent 1px
            )
            0 0 / 8.333% 100%,
        linear-gradient(
                to bottom,
                rgba(212, 168, 106, 0.04) 1px,
                transparent 1px
            )
            0 0 / 100% 24px;
}

.serif {
    font-family: var(--headline-font);
    font-weight: 400;
    letter-spacing: -0.005em;
}
.serif-italic {
    font-family: var(--headline-font);
    font-style: italic;
    font-weight: 400;
}
.mono {
    font-family: var(--label-font);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.dim {
    color: var(--dim);
}

/* ───── Nav (hidden — rail handles nav) ───── */
.nav {
    display: none;
}
.nav-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}
.nav-logo {
    font-family: var(--headline-font);
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: -0.005em;
    color: var(--ink);
}
.nav-links {
    display: flex;
    gap: 1.85rem;
    font-family: var(--body-font);
    font-size: 0.875rem;
}
.nav-links a {
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 450;
    padding: 0.4rem 0;
}
.nav-links a:hover {
    color: var(--ink);
}
.nav-links a.active {
    color: var(--ink);
}
.nav-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.25s var(--t);
}
.nav-cta-dim {
    font-family: var(--label-font);
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.01em;
}

/* ───── Left rail (section status) ───── */
.rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 200px;
    z-index: 50;
    padding: 3rem 1.25rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: auto;
}
.rail-inner {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    height: 100%;
}
.rail-logo {
    font-size: 1.05rem;
    letter-spacing: -0.005em;
    color: var(--ink);
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule);
    font-family: var(--headline-font);
    font-weight: 400;
}
.rail-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}
.rail-item {
    display: inline-flex;
    align-items: center;
    gap: 0.95rem;
    padding: 0.3rem 0;
    font-family: var(--label-font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: color 0.25s var(--t);
}
.rail-tick {
    display: inline-block;
    height: 1px;
    width: 10px;
    background: var(--rule-3);
    transition:
        width 0.4s var(--t),
        background 0.25s var(--t);
}
.rail-item:hover {
    color: var(--ink-2);
}
.rail-item:hover .rail-tick {
    background: var(--muted);
    width: 18px;
}
.rail-item.active {
    color: var(--ink);
}
.rail-foot {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--label-font);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-transform: none;
}
.rail-foot:hover {
    color: var(--accent);
}

@media (max-width: 1100px) {
    .rail {
        position: static;
        width: auto;
        flex-direction: row;
        padding: 1.5rem 2rem;
        border-bottom: 1px solid var(--rule);
    }
    .rail-inner {
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        flex-wrap: wrap;
    }
    .rail-logo {
        padding: 0;
        border: none;
    }
    .rail-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
        flex: 1;
    }
    .rail-foot {
        margin: 0;
        padding: 0;
        border: none;
    }
    .rail-item {
        padding: 0;
    }
}

/* ───── Hero ───── */
main {
    padding-left: 0;
}
@media (max-width: 1100px) {
    main {
        padding-left: 0;
    }
}

.hero {
    max-width: 980px;
    margin: 0 auto;
    padding: 100px 3rem 70px;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.9s var(--t),
        transform 0.9s var(--t);
}
.hero.in {
    opacity: 1;
    transform: none;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(240px, 0.88fr);
    gap: 3rem;
    align-items: start;
}
.hero-left {
    min-width: 0;
}
.hero-title {
    font-family: var(--headline-font);
    font-size: clamp(2.75rem, 5.2vw, 4.5rem);
    line-height: 1;
    letter-spacing: -0.025em;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--ink);
}
.hero-role {
    color: var(--accent);
    margin-bottom: 0.8rem;
}
.hero-agenda {
    max-width: 660px;
    color: var(--ink);
    font-family: var(--headline-font);
    font-size: clamp(1.45rem, 2.6vw, 2.1rem);
    line-height: 1.25;
    letter-spacing: -0.015em;
    margin-bottom: 1.5rem;
}
.hero-title em {
    color: var(--ink);
    font-weight: 400;
}
.hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.78rem 1.3rem;
    border-radius: 999px;
    font-family: var(--body-font);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--rule-2);
    background: var(--bg-1);
    color: var(--ink);
    transition: all 0.25s var(--t);
}
.btn .arrow {
    transition: transform 0.25s var(--t);
}
.btn:hover {
    border-color: var(--rule-3);
    transform: translateY(-1px);
    background: var(--bg-2);
}
.btn:hover .arrow {
    transform: translate(3px, 0);
}
.btn-primary {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}
.btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}
.btn-ghost {
    background: transparent;
}

.hero-right {
    display: flex;
    justify-content: flex-end;
    padding-top: 1.15rem;
}

.portrait-wrap {
    width: min(100%, 348px);
    aspect-ratio: 4 / 5;
    background: var(--bg-1);
    border: 1px solid var(--rule);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 28px 72px -36px rgba(0, 0, 0, 0.8);
    transform: translateX(12px);
}
.portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 60% 12%;
    transform: scale(1.08);
    transform-origin: center top;
}

.hero-notes {
    margin-top: 3rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.note-card {
    padding: 1.35rem 1.4rem;
    border: 1px solid var(--rule);
    border-radius: 16px;
    background: linear-gradient(180deg, var(--bg-1), var(--bg));
}
.note-kicker {
    margin-bottom: 0.55rem;
    font-family: var(--headline-font);
    font-size: 1.1rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.note-text {
    color: var(--ink-2);
    font-family: var(--body-font);
    font-size: 0.97rem;
    line-height: 1.7;
}

/* ───── Section ───── */
.section {
    max-width: 980px;
    margin: 0 auto;
    padding: var(--pad) 3rem;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.9s var(--t),
        transform 0.9s var(--t);
}
.section.in {
    opacity: 1;
    transform: none;
}

/* About */
.about-section {
    padding-top: var(--pad);
}
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    gap: 3rem;
    align-items: start;
}
.about-body {
    max-width: 700px;
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--ink-2);
}
.about-kicker {
    margin-bottom: 1.1rem;
}
.about-body p {
    margin-bottom: 1.4rem;
}
.about-side {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.about-panel {
    border: 1px solid var(--rule);
    background: linear-gradient(180deg, var(--bg-1), var(--bg));
    padding: 1.75rem;
}
.about-panel-title {
    cursor: pointer;
    list-style: none;
    font-family: var(--headline-font);
    font-size: 1.6rem;
    line-height: 1.15;
    color: var(--ink);
}
.about-panel-title::-webkit-details-marker {
    display: none;
}
.about-panel-title::after {
    content: "+";
    float: right;
    color: var(--accent);
    font-family: var(--label-font);
    font-size: 1rem;
    line-height: 1.6;
}
.about-panel[open] .about-panel-title {
    margin-bottom: 1.25rem;
}
.about-panel[open] .about-panel-title::after {
    content: "−";
}
.about-focus-list {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}
.about-focus-item {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 0.9rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--rule);
}
.about-focus-item:first-child {
    padding-top: 0;
    border-top: none;
}
.about-focus-num {
    padding-top: 0.15rem;
}
.about-focus-item h4 {
    font-family: var(--headline-font);
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--ink);
    margin-bottom: 0.35rem;
}
.about-focus-item p {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
}
.profile-links {
    margin-top: 0;
}
.profile-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}
.profile-link {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.65rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid var(--rule-2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.015);
    transition:
        border-color 0.25s var(--t),
        background 0.25s var(--t),
        transform 0.25s var(--t);
}
.profile-link:hover {
    border-color: var(--accent);
    background: var(--bg-1);
    transform: translateY(-1px);
}
.profile-link-label {
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 500;
}
.profile-link-handle {
    grid-column: 1;
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    line-height: 1.35;
}
.profile-link-arrow {
    grid-row: 1 / span 2;
    grid-column: 2;
    color: var(--muted);
    font-size: 0.82rem;
}
.profile-link:hover .profile-link-arrow {
    color: var(--accent);
}

.sec-head {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 0.8rem 2rem;
    align-items: baseline;
    margin-bottom: 2rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--rule);
}
.sec-label {
    color: var(--accent);
    padding-top: 0.5rem;
    font-family: var(--label-font);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.sec-title {
    font-family: var(--headline-font);
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.025em;
    font-weight: 400;
    grid-column: 2;
    color: var(--ink);
}
.sec-sub {
    grid-column: 2;
    margin-top: 0.1rem;
    color: var(--muted);
    font-family: var(--body-font);
    font-size: 1rem;
    max-width: 580px;
    line-height: 1.55;
}

/* ───── Publications ───── */
.pubs {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.pub-group {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 3rem;
    padding: 3rem 0;
    border-top: 1px solid var(--rule);
}
.pub-group:first-child {
    padding-top: 0;
    border-top: none;
}
.pub-group:last-child {
    border-bottom: 1px solid var(--rule);
}
.pub-group-side {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.pub-group-main {
    display: flex;
    flex-direction: column;
}
.pub {
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity 0.7s var(--t),
        transform 0.7s var(--t);
}
.pub + .pub {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--rule);
}
.pub.in {
    opacity: 1;
    transform: none;
}
.pub-year {
    font-family: var(--headline-font);
    font-size: 3.25rem;
    color: var(--accent);
    line-height: 1;
    font-style: italic;
}
.pub-venue {
    font-family: var(--label-font);
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 500;
    max-width: 240px;
    line-height: 1.5;
    margin-bottom: 1rem;
}
.pub-title {
    font-family: var(--headline-font);
    font-size: 1.95rem;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: -0.015em;
    margin-bottom: 0.85rem;
    color: var(--ink);
}
.pub-authors {
    font-family: var(--body-font);
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1.4rem;
    text-transform: none;
    letter-spacing: 0;
}
.pub-abstract {
    color: var(--ink-2);
    font-size: 1.0625rem;
    line-height: 1.65;
    margin-bottom: 1.75rem;
    max-width: 640px;
}
.pub-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.tag-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.tag {
    display: inline-flex;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--rule-2);
    border-radius: 999px;
    font-family: var(--label-font);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    color: var(--muted);
}
.link-arrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--label-font);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
}
.link-arrow:hover .arrow {
    transform: translateX(3px);
}
.link-arrow .arrow {
    transition: transform 0.25s var(--t);
}

/* ───── Projects ───── */
.projects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
}
.project {
    background: var(--bg);
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 340px;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.6s var(--t),
        transform 0.6s var(--t),
        background 0.25s var(--t);
}
.project.in {
    opacity: 1;
    transform: none;
}
.project:hover {
    background: var(--bg-1);
}
.project-head {
    display: flex;
    justify-content: space-between;
}
.project-kicker,
.project-year {
    font-family: var(--label-font);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
    color: var(--muted);
}
.project-title {
    font-family: var(--headline-font);
    font-size: 1.65rem;
    line-height: 1.15;
    font-weight: 400;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.project-desc {
    color: var(--ink-2);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}
.project-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
}
.project-stat {
    min-width: 0;
    background: var(--bg-1);
    padding: 0.9rem;
}
.project-stat-value {
    display: block;
    color: var(--ink);
    font-size: 1.35rem;
    line-height: 1.05;
    letter-spacing: -0.015em;
}
.project-stat-label {
    display: block;
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.62rem;
    line-height: 1.35;
}
.project-foot {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}
.project-metric {
    font-family: var(--headline-font);
    font-size: 1.35rem;
    font-style: italic;
}
.project-arrow {
    color: var(--muted);
    font-size: 1rem;
    transition: transform 0.25s var(--t);
}
.project:hover .project-arrow {
    transform: translateX(4px);
    color: var(--ink);
}

/* ───── CV ───── */
.cv-groups {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}
.cv-group-title {
    font-family: var(--headline-font);
    font-size: 1.7rem;
    font-weight: 400;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin-bottom: 1.25rem;
}
.cv {
    position: relative;
}
.cv-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 3rem;
    padding: 2.5rem 0 2.5rem 2rem;
    position: relative;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.6s var(--t),
        transform 0.6s var(--t);
}
.cv-row + .cv-row {
    border-top: 1px solid var(--rule);
}
.cv-row.in {
    opacity: 1;
    transform: none;
}
.cv-row:last-child {
    border-bottom: 1px solid var(--rule);
}
.cv-marker {
    position: absolute;
    left: 0;
    top: 2.95rem;
    width: 9px;
    height: 9px;
    background: var(--accent);
    border-radius: 50%;
}
.cv-date {
    font-family: var(--label-font);
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
}
.cv-title {
    font-family: var(--headline-font);
    font-size: 1.65rem;
    font-weight: 400;
    letter-spacing: -0.015em;
    margin-bottom: 0.25rem;
    color: var(--ink);
}
.cv-org {
    font-family: var(--body-font);
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 0.85rem;
}
.cv-desc {
    color: var(--ink-2);
    font-size: 0.95rem;
    line-height: 1.65;
    max-width: 620px;
}

.cv-desc-list {
    color: var(--ink-2);
    font-size: 0.95rem;
    line-height: 1.65;
    max-width: 620px;
    padding-left: 1.1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.cv-desc-list li {
    position: relative;
    padding-left: 1rem;
}
.cv-desc-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.cv--compact .cv-row {
    padding: 1rem 0;
}

.cv--compact .cv-row + .cv-row {
    border-top: none;
}

.cv--compact .cv-row:last-child {
    border-bottom: none;
}

.cv--compact .cv-title {
    font-size: 1.2rem;
}

.cv--compact .cv-date {
    font-family: var(--headline-font);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: -0.015em;
    text-transform: none;
    color: var(--accent);
    line-height: 1.15;
    font-style: italic;
}

.cv--compact .cv-marker {
    display: none;
}

.cv--compact .cv-org {
    margin-bottom: 0;
}

/* ───── Writings ───── */
.featured {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 4rem;
}
.feat {
    border: 1px solid var(--rule);
    padding: 1.85rem;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.6s var(--t),
        transform 0.6s var(--t),
        border-color 0.25s var(--t),
        background 0.25s var(--t);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-1);
}
.feat.in {
    opacity: 1;
    transform: none;
}
.feat:hover {
    border-color: var(--rule-3);
    background: var(--bg-2);
}
.feat-head {
    display: flex;
    justify-content: space-between;
    font-family: var(--label-font);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
    color: var(--muted);
}
.feat-title {
    font-family: var(--headline-font);
    font-size: 1.45rem;
    line-height: 1.2;
    font-weight: 400;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.feat-excerpt {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}
.feat-link {
    font-family: var(--label-font);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 500;
}

.writings-tools {
    margin-bottom: 2.5rem;
}
.filter-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--rule-2);
    border-radius: 999px;
    font-family: var(--label-font);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    color: var(--muted);
    transition: all 0.2s var(--t);
}
.chip:hover {
    color: var(--ink);
    border-color: var(--rule-3);
}
.chip.active {
    color: var(--ink);
    border-color: var(--ink);
    background: var(--bg-1);
}

.archive {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.year-block {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 2rem;
    padding: 1.75rem 0;
    border-top: 1px solid var(--rule);
}
.year-label {
    font-family: var(--headline-font);
    font-size: 1.65rem;
    color: var(--dim);
    line-height: 1.1;
    position: sticky;
    top: 110px;
    font-style: italic;
}
.year-list {
    display: flex;
    flex-direction: column;
}
.item {
    display: grid;
    grid-template-columns: 40px 1fr 120px 100px 24px;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    transition: all 0.2s var(--t);
    width: 100%;
}
.item:last-child {
    border-bottom: none;
}
.item:hover {
    padding-left: 0.85rem;
}
.item-num {
    font-family: var(--label-font);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--dim);
}
.item-title {
    font-family: var(--body-font);
    font-size: 1rem;
    font-weight: 450;
    color: var(--ink-2);
    line-height: 1.4;
    transition: color 0.2s var(--t);
}
.item:hover .item-title {
    color: var(--ink);
}
.item-cat,
.item-date {
    font-family: var(--label-font);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 500;
    color: var(--muted);
    text-align: right;
}
.item-arrow {
    color: var(--dim);
    transition:
        transform 0.2s var(--t),
        color 0.2s var(--t);
}
.item:hover .item-arrow {
    color: var(--accent);
    transform: translateX(4px);
}

.item-wrap {
    border-bottom: 1px solid var(--rule);
}
.item-wrap .item {
    border-bottom: none;
}
.item-wrap.open .item {
    background: var(--bg-1);
    padding-left: 0.85rem;
}
.item-wrap.open .item .item-title {
    color: var(--ink);
}
.item-expand {
    padding: 0.5rem 1.5rem 2.5rem 2.5rem;
    background: var(--bg-1);
    animation: expandIn 0.35s var(--t);
}
@keyframes expandIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.item-expand-meta {
    margin-bottom: 1rem;
    color: var(--accent);
}
.item-expand-excerpt {
    font-family: var(--headline-font);
    font-size: 1.35rem;
    line-height: 1.4;
    color: var(--ink);
    font-style: italic;
    margin-bottom: 2rem;
    max-width: 640px;
}
.item-expand-body {
    max-width: 680px;
    font-size: 1rem;
    line-height: 1.75;
}
.item-expand-body img {
    max-width: 100%;
}

.pub-links {
    display: flex;
    gap: 1.5rem;
}

/* ───── Now ───── */
.now-section {
    background: linear-gradient(
        to bottom,
        transparent,
        var(--bg-1) 30%,
        transparent
    );
}
.now-grid {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 4rem;
    align-items: start;
}
.now-list {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 640px;
}
.now-list li {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    font-family: var(--body-font);
    font-size: 1.05rem;
    color: var(--ink-2);
    line-height: 1.6;
}
.now-bullet {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transform: translateY(8px);
}
.now-aside {
    font-family: var(--label-font);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
    color: var(--dim);
    text-align: right;
}

/* ───── Footer ───── */
.footer {
    max-width: 980px;
    margin: 0 auto;
    padding: 100px 3rem 3rem;
    border-top: 1px solid var(--rule);
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.9s var(--t),
        transform 0.9s var(--t);
}
.footer.in {
    opacity: 1;
    transform: none;
}
@media (max-width: 1100px) {
    .footer {
        margin-left: auto;
    }
}

.footer-head {
    max-width: 720px;
    margin-bottom: 4rem;
}
.footer-eyebrow {
    font-family: var(--label-font);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--accent);
}
.footer-title {
    font-family: var(--headline-font);
    font-size: clamp(2.5rem, 4.5vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-weight: 400;
    margin-bottom: 1.75rem;
    color: var(--ink);
}
.footer-sub {
    color: var(--muted);
    font-size: 1.0625rem;
    line-height: 1.65;
    max-width: 580px;
    margin-bottom: 2rem;
}
.collab-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    max-width: 720px;
    margin: 0 0 2rem;
    color: var(--ink-2);
}
.collab-list li {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    font-size: 0.95rem;
    line-height: 1.5;
}
.collab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    transform: translateY(-1px);
}
.footer-mail {
    font-family: var(--headline-font);
    font-size: 1.85rem;
    font-style: italic;
    display: inline-flex;
    align-items: baseline;
    gap: 0.75rem;
    color: var(--ink);
    border-bottom: 1px solid var(--rule-2);
    padding-bottom: 0.25rem;
}
.footer-mail:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.footer-mail .arrow {
    font-size: 1.4rem;
    transition: transform 0.25s var(--t);
}
.footer-mail:hover .arrow {
    transform: translate(4px, 0);
}

.footer-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 4rem;
}
.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border: 1px solid var(--rule-2);
    border-radius: 999px;
    font-family: var(--body-font);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--bg-1);
    transition: all 0.25s var(--t);
}
.social-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}
.social-handle {
    font-family: var(--label-font);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: none;
}
.social-arrow {
    font-size: 0.85rem;
    color: var(--muted);
    transition: transform 0.25s var(--t);
}
.social-btn:hover .social-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
    flex-wrap: wrap;
    gap: 1rem;
    font-family: var(--label-font);
    font-size: 0.78rem;
    color: var(--muted);
}
.footer-bottom a:hover {
    color: var(--accent);
}

/* ───── Reader ───── */
.reader-page {
    min-height: 100vh;
    position: relative;
    z-index: 3;
}
.article-rail .rail-item {
    text-transform: none;
    letter-spacing: 0.01em;
    font-size: 0.82rem;
    align-items: flex-start;
    line-height: 1.45;
    gap: 0.8rem;
}
.article-rail .rail-list {
    gap: 0.65rem;
}
.article-rail .rail-tick {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.62rem;
}
.article-rail .rail-text {
    white-space: normal;
}
.article-rail .toc-level-1 {
    color: var(--ink);
}
.article-rail .toc-level-3 {
    padding-left: 1.15rem;
    font-size: 0.76rem;
    color: var(--dim);
}
.article-rail .toc-level-3 .rail-tick {
    width: 6px;
}
.reader-topbar-page {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(14px);
    background: rgba(19, 19, 21, 0.88);
}
.reader-page-main {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}
.reader-page .reader-article {
    max-width: 760px;
    padding: 3rem 0 6rem;
}

.reader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    animation: fadeIn 0.3s var(--t);
}
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.reader-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1001;
    background: var(--rule);
}
.reader-progress-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.1s linear;
}

.reader-panel {
    background: var(--bg);
    width: 100%;
    max-width: 880px;
    max-height: 96vh;
    margin-top: 2vh;
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--rule);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.45s var(--t);
    box-shadow: 0 -20px 80px rgba(0, 0, 0, 0.6);
}
@keyframes slideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

.reader-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--rule);
    flex-shrink: 0;
    background: var(--bg-1);
}
.reader-close {
    font-family: var(--label-font);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    transition: all 0.2s var(--t);
}
.reader-close:hover {
    color: var(--ink);
    background: var(--bg-2);
}
.reader-meta-top {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    color: var(--muted);
    font-family: var(--label-font);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 500;
}
.reader-dot {
    color: var(--faint);
}

.reader-scroll {
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
}
.reader-article {
    max-width: 680px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
}
.reader-eyebrow {
    color: var(--accent);
    font-family: var(--label-font);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 500;
    margin-bottom: 1.5rem;
}
.reader-title {
    font-family: var(--headline-font);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--ink);
}
.reader-byline {
    font-family: var(--body-font);
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}
.reader-divider {
    height: 2px;
    width: 60px;
    background: var(--accent);
    margin-bottom: 3rem;
}
.reader-loading,
.reader-error {
    color: var(--muted);
    font-size: 0.95rem;
    padding: 2rem 0;
}
.reader-error p {
    margin-bottom: 1rem;
}
.reader-link {
    color: var(--accent);
    border-bottom: 1px solid currentColor;
}
.reader-link:hover {
    opacity: 0.8;
}

.reader-body {
    font-family: var(--body-font);
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--ink-2);
}
.reader-body h1,
.reader-body h2,
.reader-body h3 {
    font-family: var(--headline-font);
    color: var(--ink);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.reader-body h1 {
    font-size: 2.15rem;
    margin: 3rem 0 1rem;
}
.reader-body h2 {
    font-size: 1.75rem;
    margin: 2.5rem 0 1rem;
}
.reader-body h3 {
    font-size: 1.35rem;
    margin: 2rem 0 0.85rem;
}
.reader-body p {
    margin-bottom: 1.4rem;
}
.reader-body a {
    color: var(--accent);
    border-bottom: 1px solid rgba(212, 168, 106, 0.4);
}
.reader-body a:hover {
    border-bottom-color: var(--accent);
}
.reader-body strong {
    color: var(--ink);
    font-weight: 600;
}
.reader-body em {
    font-style: italic;
    color: var(--ink);
}
.reader-body ul,
.reader-body ol {
    margin: 0 0 1.4rem 1.5rem;
}
.reader-body li {
    margin-bottom: 0.5rem;
}
.reader-body code {
    font-family: var(--mono-font);
    font-size: 0.85em;
    background: var(--bg-1);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    color: var(--accent);
    border: 1px solid var(--rule);
}
.reader-body pre {
    background: var(--bg-1);
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid var(--rule);
    overflow-x: auto;
    margin: 2rem 0;
    font-size: 0.85rem;
}
.reader-body pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--ink-2);
}
.reader-body blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1.5rem;
    margin: 2rem 0;
    color: var(--ink);
    font-style: italic;
    font-family: var(--headline-font);
    font-size: 1.3rem;
    line-height: 1.5;
}
.reader-body img {
    border-radius: 6px;
    margin: 2rem 0;
    border: 1px solid var(--rule);
}
.reader-body hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 3rem 0;
}

.reader-footer {
    margin-top: 4rem;
}
.reader-footer-text {
    color: var(--muted);
    font-size: 0.95rem;
    margin-top: 2rem;
}

/* ───── Responsive ───── */
@media (max-width: 980px) {
    .hero-grid,
    .about-grid,
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    .article-rail .rail-item {
        font-size: 0.78rem;
    }
    .article-rail .toc-level-3 {
        padding-left: 0.85rem;
    }
    .reader-page-main {
        padding: 0 1.25rem 3.5rem;
    }
    .reader-page .reader-article {
        padding: 2.5rem 0 4.5rem;
    }
    .hero-right {
        justify-content: flex-start;
        padding-top: 0.5rem;
    }
    .portrait-wrap {
        width: min(100%, 300px);
        transform: translateX(6px);
    }
    .hero-notes {
        grid-template-columns: 1fr;
    }
    .projects {
        grid-template-columns: 1fr;
    }
    .featured {
        grid-template-columns: 1fr;
    }
    .pub-group {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .cv-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .now-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .nav-links {
        display: none;
    }
    .item {
        grid-template-columns: 32px 1fr 24px;
    }
    .item-cat,
    .item-date {
        display: none;
    }
    .year-block {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .year-label {
        position: static;
        font-size: 1.45rem;
    }
    .sec-head {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .sec-title,
    .sec-sub {
        grid-column: 1;
    }
}

@media (max-width: 720px) {
    :root {
        --pad: 46px;
    }
    body {
        font-size: 15px;
        line-height: 1.6;
    }
    [data-grid="on"] body::after {
        opacity: 0.35;
    }
    .rail {
        padding: 1rem 1.15rem 0.9rem;
        background: rgba(12, 12, 13, 0.92);
        backdrop-filter: blur(14px);
        position: sticky;
        top: 0;
        z-index: 60;
    }
    .rail-inner {
        width: 100%;
        gap: 0.85rem;
    }
    .rail-logo {
        width: 100%;
        font-size: 1rem;
    }
    .rail-list {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 0.45rem;
        padding-bottom: 0.15rem;
        scrollbar-width: none;
    }
    .rail-list::-webkit-scrollbar {
        display: none;
    }
    .rail-item {
        white-space: nowrap;
        border: 1px solid var(--rule);
        border-radius: 999px;
        padding: 0.35rem 0.7rem;
        font-size: 0.68rem;
        background: var(--bg-1);
    }
    .rail-tick,
    .rail-foot {
        display: none;
    }
    .hero {
        padding: 52px 1.15rem 38px;
    }
    .section {
        padding: var(--pad) 1.15rem;
    }
    .footer {
        padding: 60px 1.15rem 2rem;
    }
    .hero-title {
        font-size: clamp(2.35rem, 15vw, 3.25rem);
    }
    .hero-right {
        display: none;
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .sec-title {
        font-size: clamp(2rem, 11vw, 2.8rem);
    }
    .project,
    .feat {
        padding: 1.35rem;
        min-height: auto;
    }
    .about-panel {
        padding: 1.35rem;
    }
    .profile-link-grid {
        grid-template-columns: 1fr;
    }
    .project-stats {
        grid-template-columns: 1fr;
    }
    .pub-group {
        padding: 2rem 0;
    }
    .pub-year {
        font-size: 2.25rem;
    }
    .pub-title,
    .project-title,
    .cv-title {
        font-size: 1.45rem;
    }
    .pub-foot,
    .project-head,
    .feat-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }
    .cv-row {
        padding: 2rem 0 2rem 1.1rem;
    }
    .cv-marker {
        top: 2.4rem;
    }
    .cv-desc-list {
        padding-left: 0;
        font-size: 0.9rem;
    }
    .item {
        grid-template-columns: 1fr 24px;
        gap: 0.75rem;
        padding: 0.9rem 0;
    }
    .item-num {
        display: none;
    }
    .footer-head {
        margin-bottom: 2.5rem;
    }
    .collab-list {
        grid-template-columns: 1fr;
    }
    .footer-mail {
        font-size: 1.25rem;
        word-break: break-word;
    }
    .social-btn {
        width: 100%;
        justify-content: space-between;
        border-radius: 16px;
    }
    .social-handle {
        display: none;
    }
    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
    }
}
