/* ==========================================================================
   Personal site — plain CSS, no framework.
   Dark, monospace, minimal. Everything sizes off the variables below.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --bg: #000000;
    --card-bg: #181818;
    --card-border: #4e4e4e;
    --panel-bg: #222222;
    --text: #ededed;        /* body copy on dark */
    --text-strong: #ffffff; /* card titles, links */
    --muted: #666666;       /* section subtitles */
    --muted-2: #999999;     /* small meta lines */
    --hover: #b4b0b0;

    --font: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
    --font-logo: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --nav-h: 80px;
    --edge: 10px;     /* page side margin */
    --indent: 70px;        /* content indent inside a section (140px from 1200px up) */
    --about-indent: 70px;  /* About keeps its indent even on phones */
    --about-top: 40px;     /* heading -> About text (70px from 1200px up) */
    --gap: 20px;           /* vertical rhythm */
    --section: 70px;       /* space between sections (140px from 1200px up) */
}

@media (min-width: 1200px) {
    :root {
        --indent: 140px;
        --about-indent: 140px;
        --about-top: 70px;
        --section: 140px;
    }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--muted);
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 20px);
}

body {
    margin: 0;
    background: var(--bg);
}

h3,
h4 {
    margin: 0 0 var(--gap);
    font-weight: 400;
    line-height: 1.4;
    color: var(--text);
}

h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; color: var(--text-strong); }

p {
    margin: 0 0 var(--gap);
}

* + p,
* + h3,
* + h4 {
    margin-top: var(--gap);
}

a {
    color: var(--text-strong);
    text-decoration: none;
}

/* Animated underline used on nav + card links */
.link-line {
    position: relative;
    color: var(--text-strong);
    transition: color 300ms;
}

.link-line::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 100%;
    border-bottom: 1px solid var(--text-strong);
    transition: right 0.3s ease-out;
}

.link-line:hover::before,
.link-line:focus-visible::before {
    right: 0;
}

/* Placeholder card links ("coming soon") aren't clickable, so no hover underline */
span.card-link .link-line::before {
    display: none;
}

:focus-visible {
    outline: 1px dashed var(--muted-2);
    outline-offset: 3px;
}

/* ---------- Navbar ---------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--nav-h);
    margin: 0 var(--edge);
    background: var(--bg);
}

.logo {
    display: flex;
    align-items: center;
    min-height: var(--nav-h);
    padding: 0 15px;
    font-family: var(--font-logo);
    font-size: 1.5rem;
    color: var(--text);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Hidden while the big ARMAN in the hero is on screen. */
.logo.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.nav-links {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links a {
    display: flex;
    align-items: center;
    min-height: var(--nav-h);
    padding: 0 15px;
    font-size: 0.875rem;
}

/* the underline sits under the text, not the full-height box */
.nav-links a span {
    position: relative;
}

.nav-links a span::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 100%;
    border-bottom: 1px solid var(--text-strong);
    transition: right 0.3s ease-out;
}

.nav-links a:hover span::before,
.nav-links a:focus-visible span::before {
    right: 0;
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: var(--nav-h);
    padding: 0 15px;
    border: 0;
    background: none;
    color: var(--text-strong);
    cursor: pointer;
}

/* ---------- Mobile off-canvas menu ---------- */
.offcanvas {
    position: fixed;
    inset: 0;
    z-index: 100;
    visibility: hidden;
    transition: visibility 0s linear 0.3s;
}

.offcanvas::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.offcanvas-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 270px;
    padding: 20px;
    background: var(--panel-bg);
    color: var(--text);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease-out;
}

.offcanvas.is-open {
    visibility: visible;
    transition-delay: 0s;
}

.offcanvas.is-open::before { opacity: 1; }
.offcanvas.is-open .offcanvas-bar { transform: none; }

.offcanvas-close {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px;
    border: 0;
    background: none;
    color: var(--muted-2);
    cursor: pointer;
}

.offcanvas-close:hover { color: var(--text-strong); }

.offcanvas-nav {
    margin: auto 0;
    padding: 0;
    list-style: none;
    text-align: center;
}

.offcanvas-nav a {
    display: block;
    padding: 5px 0;
    font-size: 1.5rem;
    color: var(--text-strong);
}

.offcanvas-nav a:hover { color: var(--hover); }

body.menu-open { overflow: hidden; }

/* ---------- Hero (particle name) ---------- */
/* The hero fills the first screen and the name sits in its exact middle
   (the bottom padding balances the navbar so it centers on the whole screen). */
.hero {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: calc(100svh - var(--nav-h));
    margin: 0 var(--edge);
    padding-bottom: var(--nav-h);
}

.hero-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* .hero-stage reserves the name's space; the canvas inside is drawn larger
   (sized in JS) so pushed particles can drift past the name without clipping. */
.hero-stage {
    position: relative;
    width: 90%;
    aspect-ratio: 2090 / 1000;
}

#hero-canvas {
    position: absolute;
    display: block;
    pointer-events: none;
}

/* Visually hidden, still read by screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Moderate gap between the hero and About */
.spacer {
    height: 24px;
}

@media (min-width: 500px) {
    .spacer {
        height: auto;
        padding-top: 120px;
    }
}

/* ---------- Sections ---------- */
.section {
    margin: var(--section) var(--edge);
    padding-bottom: 24px;
}

.section > h3,
.section > .subtitle {
    margin-left: var(--indent);
}

.section-body {
    margin: 0 var(--indent);
}

.subtitle {
    color: var(--muted);
}

#about {
    margin-top: 0;
    padding-bottom: 0;
}

#about h3 {
    margin-left: var(--about-indent);
    font-weight: 700;
}

#about .about-text {
    margin: var(--about-top) var(--about-indent) 0;
    padding-bottom: 68px; /* paragraph margin + two line breaks, like the reference */
    color: var(--text);
}

#about .about-text p {
    margin: 0;
}

#about .about-text p + p {
    margin-top: 24px;
}

/* "Current:" / "Past:" labels in Experience */
.group-label {
    margin: 0 0 var(--gap) var(--indent);
    color: var(--muted);
}

.card + .group-label {
    margin-top: var(--gap);
}

/* ---------- Cards ---------- */
.card {
    display: flow-root;
    margin: 0 0 var(--gap);
    padding: 30px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.card h4 {
    color: var(--text-strong);
}

.card .meta {
    margin-top: calc(var(--gap) * -0.5);
    font-size: 0.875rem;
    color: var(--muted-2);
}

.card-link {
    display: inline;
    line-height: 1.5;
}

.card-link svg {
    vertical-align: middle;
}

.card-link svg {
    flex: none;
}

/* Certifications: one card each, issuer logo beside the name */
.cert-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.org-logo {
    flex: none;
    width: 48px;
    height: 48px;
    padding: 6px;
    background: #ffffff;
    border-radius: 8px;
    object-fit: contain;
}

.cert-body {
    min-width: 0;
}

.cert-body > :first-child { margin-top: 0; }
.cert-body > :last-child { margin-bottom: 0; }

.cert-body h4 {
    margin-bottom: var(--gap);
}

/* inline "underlined link + sentence" rows in More */
.inline-link {
    color: var(--text-strong);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.1s ease-in-out;
}

.inline-link:hover {
    color: var(--hover);
}

/* ---------- Photo slider ---------- */
.slider {
    position: relative;
    margin-top: var(--gap);
}

.slider-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.slider-track::-webkit-scrollbar { display: none; }

.slide {
    position: relative;
    margin: 0;
    scroll-snap-align: start;
}

.slide img,
.photo-placeholder {
    display: block;
    width: 100%;
    height: auto; /* override the img height attribute so every slide stays square */
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #262626;
    color: var(--muted-2);
    font-size: 0.875rem;
    box-shadow: inset 0 0 0 1px #333;
}

.slide figcaption {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: max-content;
    max-width: 100%;
    margin: 0 0 20px;
    padding: 0 10px;
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
    color: #ffffff;
    text-shadow:
        -1px -1px 0 #000,
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000;
}

.slider-btn {
    position: absolute;
    top: 50%;
    z-index: 2;
    padding: 5px 10px;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.1s ease-in-out, color 0.1s ease-in-out;
}

.slider-btn:hover { color: #ffffff; }
.slider-btn.prev { left: 15px; }
.slider-btn.next { right: 15px; }

.slider:hover .slider-btn,
.slider:focus-within .slider-btn {
    opacity: 1;
}

@media (hover: none) {
    .slider-btn { opacity: 1; }
}

@media (min-width: 960px) {
    .slider-track { grid-auto-columns: calc(100% / 3); }
}

/* ---------- Contact ---------- */
.contact-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.contact-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.contact-list li + li {
    margin-top: 12px;
}

.contact-list .label {
    min-width: 7ch;
    color: var(--muted-2);
}

/* Last section: a modest gap at the very bottom instead of a full section gap */
#contact {
    margin-bottom: 60px;
}

/* ---------- Responsive ---------- */
@media (min-width: 1200px) {
    .card { padding: 40px; }
}

/* Tablet & down: swap the link row for a hamburger */
@media (max-width: 959px) {
    .nav-links { display: none; }
    .menu-toggle { display: flex; }
}

/* Phones: section content goes full width (About keeps its indent, like the reference) */
@media (max-width: 500px) {
    :root {
        --indent: 0px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .slider-track { scroll-behavior: auto; }
}

/* Meta's image has extra built-in whitespace, so give it less padding */
/* logos with their own coloured background or a transparent crest: no white tile */
.org-logo--bare {
    padding: 0;
    background: none;
}

/* small wordmark replacing the source name in a meta line (e.g. SSRN) */
.meta-logo {
    display: inline-block;
    height: 1.65em;
    width: auto;
    vertical-align: middle;
    border-radius: 3px;
}

/* small logo badge inside a card title (e.g. YC next to AfterQuery) */
.inline-logo {
    display: inline-block;
    width: 0.95em;
    height: 0.95em;
    margin-left: 0;
    border-radius: 3px;
    vertical-align: -0.1em;
}


.contact-list li {
    align-items: center;
}

/* Section headings drawn as particles (see script 1b). The canvas carries
   PAD (10px) of breathing room, so pull it back to line up with the text. */
.particle-heading {
    display: flow-root; /* keep the canvas's negative margins inside the heading */
    line-height: 0;
}

.heading-canvas {
    display: block;
    margin: -10px 0 -10px -10px;
    touch-action: pan-y;
}

/* ---------- Certifications: ledger (one card, one row per item) ---------- */
.cert-ledger {
    padding: 0;
    overflow: hidden;
}

.cert-row.cert-row--head {
    padding-top: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.8125rem;
    color: var(--muted-2);
}

.cert-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1.6fr) minmax(0, 0.6fr) 152px 20px;
    align-items: center;
    gap: 18px;
    padding: 14px 30px;
    color: var(--text);
    text-decoration: none;
    border-top: 1px solid #262626;
    transition: background 0.15s ease;
}

.cert-row:first-child,
.cert-row--head + .cert-row { border-top: 0; }

a.cert-row:hover,
a.cert-row:focus-visible {
    background: #202020;
    outline: none;
}

.cert-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}

.cert-logo--tile {
    padding: 4px;
    background: #ffffff;
}

.cert-title {
    color: var(--text-strong);
}

.cert-issuer {
    font-size: 0.875rem;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cert-date {
    font-size: 0.8125rem;
    color: var(--muted-2);
    text-align: right;
}

.cert-icon {
    width: 20px;
    height: 20px;
    color: var(--muted-2);
    transition: color 0.15s ease;
}

a.cert-row:hover .cert-icon,
a.cert-row:focus-visible .cert-icon {
    color: var(--text-strong);
}

.cert-badge {
    display: inline-block;
    white-space: nowrap;
    margin-left: 8px;
    padding: 1px 7px;
    font-size: 0.6875rem;
    color: var(--muted-2);
    border: 1px solid #3a3a3a;
    border-radius: 99px;
    vertical-align: middle;
}

@media (max-width: 700px) {
    .cert-row--head > :nth-child(n+3) { display: none; }
    .cert-row--head > :nth-child(2)::after { content: " / Institution"; }
    .cert-row {
        grid-template-columns: 32px minmax(0, 1fr) 20px;
        row-gap: 2px;
        padding: 14px 20px;
    }
    .cert-title { white-space: normal; }
    .cert-issuer { grid-column: 2; grid-row: 2; }
    .cert-date { display: none; }
    .cert-logo { grid-row: 1 / 3; }
    .cert-icon { grid-column: 3; grid-row: 1 / 3; }
}
