/* ============================================================
   Prafful Mishra - personal site
   Editorial-engineering aesthetic · pipeline motif
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
    --bg:        #f6f5f1;
    --bg-soft:   #ffffff;
    --surface:   #ffffff;
    --surface-2: #f0efe9;
    --ink:       #16130f;
    --ink-soft:  #57534e;
    --ink-faint: #8a857d;
    --line:      rgba(22, 19, 15, 0.10);
    --line-2:    rgba(22, 19, 15, 0.16);
    --accent:    #e8482b;
    --accent-2:  #d63d22;
    --accent-soft: rgba(232, 72, 43, 0.12);
    --dot:       rgba(22, 19, 15, 0.05);
    --shadow:    0 1px 2px rgba(22,19,15,.04), 0 12px 32px -12px rgba(22,19,15,.16);
    --shadow-sm: 0 1px 2px rgba(22,19,15,.05), 0 6px 18px -10px rgba(22,19,15,.14);

    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-body:    "Inter", system-ui, sans-serif;
    --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

    --container: 1120px;
    --radius:    16px;
    --radius-sm: 10px;
}

[data-theme="dark"] {
    --bg:        #0c0c0e;
    --bg-soft:   #131316;
    --surface:   #16161a;
    --surface-2: #1d1d22;
    --ink:       #ece9e2;
    --ink-soft:  #a8a29a;
    --ink-faint: #6f6a63;
    --line:      rgba(236, 233, 226, 0.12);
    --line-2:    rgba(236, 233, 226, 0.20);
    --accent:    #ff6a45;
    --accent-2:  #ff8364;
    --accent-soft: rgba(255, 106, 69, 0.16);
    --dot:       rgba(236, 233, 226, 0.05);
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 18px 40px -18px rgba(0,0,0,.7);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px -12px rgba(0,0,0,.6);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background .4s ease, color .4s ease;
    /* faint blueprint dot grid */
    background-image: radial-gradient(var(--dot) 1px, transparent 1px);
    background-size: 26px 26px;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

::selection { background: var(--accent); color: #fff; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }

.eyebrow, .section__num, .nav__mark, .panel__handle, .panel__loc, .panel__status,
.pipeline, .tl__date, .stat__label, .post__date, .book__kicker, .stack__label,
.footer__note, .footer__copy, .panel__log {
    font-family: var(--font-mono);
}

.accent { color: var(--accent); }

/* ---------- Skip link ---------- */
.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 200;
    background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Progress bar ---------- */
.progress-bar {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: var(--accent); z-index: 120;
    transition: width .1s linear;
}

/* ---------- Nav ---------- */
.nav {
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    border-bottom: 1px solid transparent;
    transition: border-color .3s ease, background .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.nav__brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 600; }
.nav__mark {
    display: grid; place-items: center; width: 34px; height: 34px;
    background: var(--accent); color: #fff; border-radius: 9px;
    font-size: 13px; font-weight: 500; letter-spacing: .02em;
}
.nav__name { letter-spacing: -.01em; }

.nav__menu { display: flex; gap: 28px; }
.nav__link {
    position: relative; color: var(--ink-soft); font-size: 15px; font-weight: 500;
    transition: color .2s ease;
}
.nav__link::after {
    content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
    background: var(--accent); transition: width .25s ease;
}
.nav__link:hover, .nav__link.is-active { color: var(--ink); }
.nav__link.is-active::after { width: 100%; }

.nav__actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
    display: grid; place-items: center; width: 38px; height: 38px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    color: var(--ink); cursor: pointer; transition: border-color .2s, transform .2s, background .3s;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav__burger { display: none; flex-direction: column; gap: 5px; width: 38px; height: 38px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; padding: 0; align-items: center; justify-content: center; }
.nav__burger span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .25s; }
.nav__burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-display); font-weight: 500; font-size: 15px;
    padding: 13px 22px; border-radius: 999px; cursor: pointer;
    border: 1px solid transparent; transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
    white-space: nowrap;
}
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-2); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 72px 0 96px; overflow: hidden; }
.hero::before {
    content: ""; position: absolute; top: -160px; right: -120px; width: 520px; height: 520px;
    background: radial-gradient(circle, var(--accent-soft), transparent 70%);
    filter: blur(20px); z-index: -1; pointer-events: none;
    animation: drift 16s ease-in-out infinite alternate;
}
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }

.eyebrow {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-soft); margin-bottom: 22px;
}
.eyebrow__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-soft); animation: pulse 2.4s infinite; }

.hero__title { font-size: clamp(2.4rem, 5.2vw, 4rem); font-weight: 700; letter-spacing: -.03em; }
.hero__lede { margin-top: 24px; font-size: 1.12rem; color: var(--ink-soft); max-width: 40ch; }
.hero__lede strong { color: var(--ink); font-weight: 600; }

.hero__chips-label { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); margin-top: 28px; }
.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hero__chips li {
    font-family: var(--font-mono); font-size: 12.5px; padding: 6px 12px;
    border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-soft);
    transition: border-color .2s, color .2s;
}
.hero__chips li:hover { border-color: var(--accent); color: var(--accent); }
.hero__chips .chip--fun { color: var(--accent); border-color: var(--accent-soft); border-style: dashed; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

.hero__socials { display: flex; gap: 8px; margin-top: 28px; }
.hero__socials a {
    display: grid; place-items: center; width: 42px; height: 42px;
    border: 1px solid var(--line); border-radius: 12px; color: var(--ink-soft);
    background: var(--surface); transition: transform .2s, color .2s, border-color .2s;
}
.hero__socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }

/* ---------- Hero panel (deploy card) ---------- */
.hero__panel { perspective: 1200px; }
.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow);
}
.panel__top { display: flex; align-items: center; gap: 12px; }
.panel__avatar { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.panel__id { display: flex; flex-direction: column; line-height: 1.3; margin-right: auto; }
.panel__handle { font-size: 13px; font-weight: 500; color: var(--ink); }
.panel__loc { font-size: 11px; color: var(--ink-faint); }
.panel__status {
    display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
    color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px;
}
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }

/* Animated pipeline visualization (canvas) */
.viz { margin-top: 22px; }
.viz__canvas {
    display: block; width: 100%; height: 240px;
    border-radius: var(--radius-sm);
    background:
        radial-gradient(120% 120% at 0% 0%, var(--accent-soft), transparent 45%),
        var(--surface-2);
    border: 1px solid var(--line);
    cursor: crosshair;
}
.viz__caption {
    display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
    margin-top: 12px;
}
.viz__legend {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
}
.vdot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.vdot--data  { background: #38bdf8; color: #38bdf8; }
.vdot--feat  { background: #a78bfa; color: #a78bfa; }
.vdot--train { background: var(--accent); color: var(--accent); }
.vdot--serve { background: #34d399; color: #34d399; }

/* ---------- Sections ---------- */
.section { padding: 92px 0; }
.section--alt { background: var(--bg-soft); border-block: 1px solid var(--line); }
.section__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 40px; }
.section__num { font-size: 14px; color: var(--accent); font-weight: 500; }
.section__title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.section__sub { color: var(--ink-soft); margin: -24px 0 40px; max-width: 52ch; }

/* ---------- About ---------- */
.about__grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 56px; align-items: start; }
.about__body p { margin-bottom: 18px; color: var(--ink-soft); }
.about__body strong { color: var(--ink); font-weight: 600; }

.pubs { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.pubs__title { font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 16px; }
.pubs__list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pubs__list li:last-child { border-bottom: none; }
.pubs__name { display: block; font-weight: 600; color: var(--ink); }
.pubs__meta { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

.about__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; position: sticky; top: 100px; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 20px; transition: transform .2s, border-color .2s;
}
.stat:hover { transform: translateY(-3px); border-color: var(--accent); }
.stat__num { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--accent); letter-spacing: -.02em; }
.stat__label { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; line-height: 1.4; }

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.tl { display: grid; grid-template-columns: 28px 1fr; gap: 20px; }
.tl__rail { position: relative; display: flex; justify-content: center; }
.tl__rail::before { content: ""; position: absolute; top: 6px; bottom: -24px; width: 2px; background: var(--line); }
.tl:last-child .tl__rail::before { display: none; }
.tl__node { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); margin-top: 6px; z-index: 1; }
.tl__card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px 26px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
    transition: transform .25s ease, border-color .25s ease;
}
.tl__card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.tl__meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-bottom: 10px; }
.tl__date { font-size: 12px; color: var(--accent); }
.tl__org { font-size: 13px; color: var(--ink-faint); }
.tl__role { font-size: 1.25rem; margin-bottom: 6px; }
.tl__lead { color: var(--ink-soft); margin-bottom: 12px; }
.tl__points li { position: relative; padding-left: 20px; color: var(--ink-soft); margin-bottom: 7px; font-size: .96rem; }
.tl__points li::before { content: ""; position: absolute; left: 4px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ---------- Book ---------- */
.book {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 280px 1fr; gap: 56px; align-items: center;
    background:
        radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 55%),
        var(--surface);
    border: 1px solid var(--accent); border-radius: var(--radius);
    padding: 48px; box-shadow: var(--shadow), 0 0 0 6px var(--accent-soft);
}
.book::before {
    content: ""; position: absolute; top: -120px; left: -80px; width: 320px; height: 320px;
    background: radial-gradient(circle, var(--accent-soft), transparent 70%);
    filter: blur(10px); pointer-events: none;
}
.book > * { position: relative; }

.book__badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft);
    padding: 6px 12px; border-radius: 999px; margin-bottom: 16px;
}
.book__badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
.book__cover {
    position: relative; aspect-ratio: 3/4; border-radius: 4px;
    overflow: hidden; background: var(--surface-2);
    border: 3px solid var(--accent);
    box-shadow: 0 24px 48px -18px rgba(0,0,0,.5);
    transition: transform .35s ease, box-shadow .35s ease;
}
.book__cover:hover { transform: rotate(-2deg) translateY(-4px); box-shadow: 0 32px 60px -20px rgba(0,0,0,.55); }
.book__cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.book__title { font-size: 1.6rem; margin-bottom: 10px; }
.book__meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); margin-bottom: 18px; }
.book__desc { color: var(--ink-soft); margin-bottom: 26px; max-width: 52ch; }

/* ---------- Stack ---------- */
.stack__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.stack__group {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; transition: border-color .2s;
}
.stack__group:hover { border-color: var(--line-2); }
.stack__label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
    font-size: 13.5px; padding: 7px 13px; border-radius: 8px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
    transition: transform .15s, color .2s, border-color .2s;
}
.tags li:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ---------- Open source ---------- */
.oss__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.oss {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow-sm);
    transition: transform .25s ease, border-color .25s ease;
}
.oss:hover { transform: translateY(-5px); border-color: var(--accent); }
.oss__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; margin-bottom: 16px;
    font-family: var(--font-mono); font-size: 12px; color: var(--accent);
    background: var(--accent-soft); border-radius: 10px;
}
.oss__name { font-size: 1.12rem; margin-bottom: 8px; }
.oss__desc { color: var(--ink-soft); font-size: .92rem; flex: 1; }
.oss__more { color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: 16px; }

/* ---------- Writing ---------- */
.writing__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.post {
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; box-shadow: var(--shadow-sm);
    transition: transform .25s ease, border-color .25s ease;
}
.post:hover { transform: translateY(-5px); border-color: var(--accent); }
.post__date { font-size: 12px; color: var(--ink-faint); }
.post__title { font-size: 1.2rem; margin: 10px 0; }
.post__excerpt { color: var(--ink-soft); font-size: .95rem; flex: 1; }
.post__more { color: var(--accent); font-weight: 600; font-size: .92rem; margin-top: 18px; }
.writing__cta { margin-top: 36px; text-align: center; }

/* ---------- Contact ---------- */
.contact { text-align: center; }
.contact .section__head { justify-content: center; }
.contact__body { display: flex; flex-direction: column; align-items: center; }
.contact__pitch { color: var(--ink-soft); max-width: 50ch; margin-bottom: 28px; }
.contact__email {
    font-family: var(--font-display); font-weight: 600;
    font-size: clamp(1.5rem, 4vw, 2.6rem); letter-spacing: -.02em;
    background: linear-gradient(120deg, var(--ink), var(--accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    transition: opacity .2s; word-break: break-word;
}
.contact__email:hover { opacity: .8; }
.contact__links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 34px; }
.contact__chip {
    padding: 10px 20px; border: 1px solid var(--line-2); border-radius: 999px;
    font-weight: 500; font-size: 14px; color: var(--ink-soft);
    transition: transform .2s, color .2s, border-color .2s;
}
.contact__chip:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 28px 0; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer__copy, .footer__note { font-size: 12.5px; color: var(--ink-faint); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 var(--accent-soft); }
    70%  { box-shadow: 0 0 0 10px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes drift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-60px, 40px) scale(1.15); }
}

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
    .hero__grid { grid-template-columns: 1fr; gap: 44px; }
    .hero__panel { max-width: 440px; }
    .about__grid { grid-template-columns: 1fr; gap: 36px; }
    .about__stats { position: static; }
    .book { grid-template-columns: 200px 1fr; gap: 36px; padding: 32px; }
    .writing__grid { grid-template-columns: repeat(2, 1fr); }
    .oss__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .nav__menu {
        position: fixed; inset: 68px 0 auto 0; flex-direction: column; gap: 0;
        background: var(--bg-soft); border-bottom: 1px solid var(--line);
        padding: 8px 24px 20px; transform: translateY(-120%); transition: transform .3s ease;
        box-shadow: var(--shadow);
    }
    .nav__menu.is-open { transform: translateY(0); }
    .nav__link { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
    .nav__link:last-child { border-bottom: none; }
    .nav__link::after { display: none; }
    .nav__burger { display: flex; }
    .nav__name { display: none; }

    .section { padding: 68px 0; }
    .section__head { margin-bottom: 32px; }
    .stack__grid { grid-template-columns: 1fr; }
    .writing__grid { grid-template-columns: 1fr; }
    .oss__grid { grid-template-columns: 1fr; }
    .book { grid-template-columns: 1fr; gap: 28px; text-align: left; }
    .book__cover { max-width: 200px; margin: 0 auto; }
    .about__stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
    .container { padding: 0 18px; }
    .hero { padding: 48px 0 72px; }
    .about__stats { grid-template-columns: 1fr; }
}
