/* =========================================================
   Formal CV — Stylesheet
   Monochrome: deep black, charcoal, ivory.
   Typography: classical serif for display, sans for utility.
   ========================================================= */

:root {
    --bg: #0a0a0a;
    --bg-elev: #111111;
    --bg-alt: #0d0d0d;
    --bg-soft: #131313;
    --line: #1c1c1c;
    --line-strong: #2a2a2a;
    --line-faint: #161616;
    --text: #f1ede4;            /* warm ivory */
    --text-mute: #8e8a82;
    --text-soft: #c8c4ba;
    --accent: #f1ede4;           /* same as text — formal monochrome */
    --rule: #242424;
    --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --max: 1120px;
    --pad: clamp(1.25rem, 4vw, 2.5rem);
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-weight: 300;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Top Navigation ---------- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topnav-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.1rem var(--pad);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: 0.22em;
    font-size: 1.05rem;
    color: var(--text);
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 2.25rem;
}
.nav-links a {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-mute);
    transition: color 0.2s ease;
    font-weight: 400;
}
.nav-links a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero {
    border-bottom: 1px solid var(--line);
    padding: clamp(4.5rem, 12vh, 8rem) var(--pad) clamp(4rem, 10vh, 6.5rem);
    background: var(--bg);
}
.hero-inner {
    max-width: var(--max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
.profile-frame {
    width: clamp(140px, 18vw, 200px);
    height: clamp(140px, 18vw, 200px);
    border: 1px solid var(--line-strong);
    padding: 8px;
    background: var(--bg-soft);
    flex-shrink: 0;
}
.profile-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.05);
}
.hero-text { min-width: 0; }
.eyebrow {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.36em;
    color: var(--text-mute);
    margin-bottom: 1.25rem;
}
.display {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.75rem, 7vw, 5.25rem);
    line-height: 1.05;
    letter-spacing: -0.005em;
    margin-bottom: 1rem;
}
.subtitle {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.5vw, 1.3rem);
    color: var(--text-soft);
    max-width: 640px;
    margin-bottom: 1.75rem;
}
.hero-meta {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-mute);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.dot { color: var(--line-strong); }

@media (max-width: 640px) {
    .hero-inner { grid-template-columns: 1fr; gap: 2rem; }
    .profile-frame { width: 120px; height: 120px; }
}

/* ---------- Sections ---------- */
.section {
    padding: clamp(4rem, 9vh, 6.5rem) var(--pad);
    border-bottom: 1px solid var(--line);
}
.section-alt { background: var(--bg-alt); }
.section-inner { max-width: var(--max); margin: 0 auto; }

.section-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    letter-spacing: 0.005em;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
}
.section-title .num {
    font-family: var(--sans);
    font-size: 0.74rem;
    font-weight: 400;
    letter-spacing: 0.34em;
    color: var(--text-mute);
}
.section-lead {
    color: var(--text-mute);
    max-width: 680px;
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
    font-style: italic;
    font-family: var(--serif);
    font-size: 1.1rem;
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}
.lead {
    font-family: var(--serif);
    font-size: clamp(1.15rem, 1.7vw, 1.4rem);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-soft);
}
.info-list { display: grid; gap: 0; }
.info-list > div {
    border-top: 1px solid var(--line);
    padding: 0.95rem 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.info-list > div:last-child { border-bottom: 1px solid var(--line); }
.info-list dt {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--text-mute);
}
.info-list dd { font-size: 0.92rem; color: var(--text); font-family: var(--serif); font-size: 1.05rem; }

@media (max-width: 720px) {
    .about-grid { grid-template-columns: 1fr; }
}

/* ---------- Timeline (Education) ---------- */
.timeline {
    list-style: none;
    display: grid;
    gap: 0;
}
.timeline > li {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2.5rem;
    padding: 1.75rem 0;
    border-top: 1px solid var(--line);
}
.timeline > li:last-child { border-bottom: 1px solid var(--line); }
.timeline-period {
    font-size: 0.78rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-mute);
    padding-top: 0.4rem;
}
.timeline-body h3 {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.timeline-body p { color: var(--text-mute); font-size: 0.95rem; }

@media (max-width: 720px) {
    .timeline > li { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* ---------- Projects — Row Bars ---------- */
.projects-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--rule);
}
.project-row {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: clamp(1.25rem, 3vw, 2.5rem);
    align-items: center;
    padding: 1.5rem 0.5rem;
    border-bottom: 1px solid var(--rule);
    background: transparent;
    transition: background 0.3s ease, padding 0.3s ease;
    position: relative;
}
.project-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--text);
    transform: scaleY(0);
    transition: transform 0.35s ease;
    transform-origin: top;
}
.project-row:hover {
    background: var(--bg-soft);
    padding-left: 1.25rem;
}
.project-row:hover::before { transform: scaleY(1); }
.project-row:hover .row-cta { color: var(--text); transform: translateX(4px); }
.project-row:hover .row-thumb { border-color: var(--line-strong); }
.project-row:hover .row-thumb img { filter: grayscale(0%); }

.row-thumb {
    width: 200px;
    height: 125px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: var(--bg-soft);
    transition: border-color 0.3s ease;
}
.row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(40%);
    transition: filter 0.4s ease;
}

.row-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.row-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.7rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.row-meta .row-tag {
    color: var(--text);
    border-left: 1px solid var(--line-strong);
    padding-left: 0.85rem;
}
.row-title {
    font-family: var(--serif);
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    font-weight: 500;
    line-height: 1.25;
    color: var(--text);
}
.row-desc {
    font-size: 0.92rem;
    color: var(--text-mute);
    line-height: 1.55;
    max-width: 60ch;
}

.row-cta {
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--text-mute);
    transition: color 0.3s ease, transform 0.3s ease;
    padding-left: 1rem;
    flex-shrink: 0;
    letter-spacing: 0.05em;
}

@media (max-width: 820px) {
    .project-row {
        grid-template-columns: 140px 1fr;
        gap: 1.25rem;
        padding: 1.25rem 0.25rem;
    }
    .row-thumb { width: 140px; height: 88px; }
    .row-cta {
        grid-column: 1 / -1;
        text-align: right;
        padding-left: 0;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .project-row { grid-template-columns: 1fr; }
    .row-thumb { width: 100%; height: 160px; }
}

/* ---------- Skills ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0;
    border-top: 1px solid var(--line);
}
.skill-block {
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 1.5rem 1.5rem 1.5rem 0;
}
.skill-block:nth-child(even) { padding-left: 1.5rem; padding-right: 0; }
.skill-block:last-child { border-right: none; }
@media (min-width: 768px) {
    .skill-block { padding: 1.75rem 1.75rem; }
    .skill-block:first-child { padding-left: 0; }
    .skill-block:last-child { padding-right: 0; }
}
.skill-block h4 {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: var(--text);
    letter-spacing: 0.01em;
}
.skill-block p { color: var(--text-mute); font-size: 0.92rem; }

/* ---------- Contact ---------- */
.contact-inner { max-width: 720px; }
.contact-lead {
    color: var(--text-mute);
    margin-bottom: 2rem;
    max-width: 520px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
}
.contact-list { list-style: none; display: grid; gap: 0; }
.contact-list li {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1.5rem;
    padding: 1.1rem 0;
    border-top: 1px solid var(--line);
    align-items: baseline;
}
.contact-list li:last-child { border-bottom: 1px solid var(--line); }
.contact-list span {
    font-size: 0.74rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.contact-list a {
    color: var(--text);
    transition: color 0.2s ease;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    width: fit-content;
    font-family: var(--serif);
    font-size: 1.1rem;
}
.contact-list a:hover { border-bottom-color: var(--text); }

/* ---------- Footer ---------- */
.footer {
    padding: 2rem var(--pad);
    background: var(--bg);
    border-top: 1px solid var(--line);
}
.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-mute);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.back-top { transition: color 0.2s ease; }
.back-top:hover { color: var(--text); }

/* ---------- Project Detail Pages ---------- */
.project-page main { max-width: 820px; margin: 0 auto; padding: 0 var(--pad); }
.project-hero {
    padding: clamp(4rem, 12vh, 7rem) var(--pad) clamp(2.5rem, 6vh, 4rem);
    border-bottom: 1px solid var(--line);
}
.project-hero-inner { max-width: 820px; margin: 0 auto; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 2rem;
    transition: color 0.2s ease;
}
.back-link:hover { color: var(--text); }
.project-tag {
    display: inline-block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    color: var(--text);
    border-top: 1px solid var(--text);
    border-bottom: 1px solid var(--text);
    padding: 0.4rem 0;
    margin-bottom: 1.5rem;
}
.project-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    line-height: 1.1;
    margin-bottom: 1rem;
}
.project-summary {
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.1rem, 1.6vw, 1.3rem);
    color: var(--text-soft);
    margin-bottom: 1.5rem;
}
.project-meta-row {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
    color: var(--text-soft);
    font-family: var(--serif);
}
.project-meta-row strong {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-mute);
    font-weight: 400;
    font-family: var(--sans);
    margin-bottom: 0.4rem;
}
.code-link {
    color: var(--text);
    border-bottom: 1px solid var(--line-strong);
    padding-bottom: 2px;
    transition: border-color 0.2s ease;
    font-family: "Courier New", monospace;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}
.code-link:hover { border-bottom-color: var(--text); }
.code-link::before {
    content: "↗ ";
    color: var(--text-mute);
}

.project-body { padding: clamp(3rem, 6vh, 4.5rem) var(--pad) 4rem; }
.project-body-inner { max-width: 820px; margin: 0 auto; }
.project-body h2 {
    font-family: var(--serif);
    font-size: 1.75rem;
    font-weight: 500;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--line);
}
.project-body h2:first-child { margin-top: 0; }
.project-body p {
    color: var(--text-soft);
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.75;
}
.project-body ul {
    margin: 0 0 1.5rem 1.25rem;
    color: var(--text-soft);
}
.project-body ul li { margin-bottom: 0.5rem; }
.project-body code {
    background: #181818;
    padding: 0.15rem 0.45rem;
    font-size: 0.88rem;
    color: var(--text);
    border: 1px solid var(--line);
    font-family: "Courier New", monospace;
}

/* ---------- Figures inside project pages ---------- */
.figure {
    margin: 2rem 0;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    padding: 0.75rem;
}
.figure img { width: 100%; height: auto; display: block; }
.figure figcaption {
    padding: 0.85rem 0.25rem 0.25rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--text-mute);
    border-top: 1px solid var(--line);
    margin-top: 0.75rem;
    text-align: center;
}
.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}
.figure-grid .figure { margin: 0; }
.sample-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 2rem 0;
    padding: 0.75rem;
    border: 1px solid var(--line);
    background: var(--bg-soft);
}
.sample-strip img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--line-faint);
}
.sample-strip figcaption {
    padding-top: 0.5rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-mute);
    text-align: center;
    border-top: 1px solid var(--line);
    margin-top: 0.25rem;
}

.project-footer {
    border-top: 1px solid var(--line);
    padding: 3rem var(--pad);
    text-align: center;
}
.project-footer a {
    color: var(--text-mute);
    font-size: 0.8rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}
.project-footer a:hover { color: var(--text); }
