/* ============================================================
   Harshit Paneri — Portfolio
   "White Himalaya" theme: snow white, glacier blue, mountain
   ridgeline backdrop. Split layout. (decision.md D2, R1, R2)
   ============================================================ */

:root {
    --bg: #f4f8fb;
    --sky: #dcecf7;
    --card: #ffffff;
    --card-border: #dce7f0;
    --card-border-hover: rgba(14, 116, 144, 0.45);
    --text: #3d4f63;
    --text-strong: #1e3448;
    --heading: #0b1f33;
    --accent: #0e7490;
    --accent-dim: #e0f2fe;
    --accent-text: #075985;
    --shadow: 0 6px 24px rgba(30, 64, 110, 0.08);
    --shadow-sm: 0 2px 8px rgba(30, 64, 110, 0.06);
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: linear-gradient(180deg, var(--sky) 0%, var(--bg) 420px);
    color: var(--text);
    line-height: 1.7;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: #fff;
    padding: 8px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Soft sun-on-snow glow following the pointer */
.glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(600px circle at var(--mx, 20%) var(--my, 20%), rgba(125, 190, 230, 0.16), transparent 65%),
        radial-gradient(900px circle at 85% -10%, rgba(255, 255, 255, 0.7), transparent 55%);
    z-index: 1;
}

/* ============ SCROLL SCENES ============
   Fixed full-viewport photo layers. JS crossfades between them as
   different sections scroll into view, with a subtle parallax drift.
   A white veil keeps text readable on every scene. (R4) */
.scenes {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.scene {
    position: absolute;
    inset: -90px 0;
    background-size: cover;
    background-position: center 30%;
    opacity: 0;
    transform: translateY(0) scale(1.06);
    transition: opacity 1.4s ease;
    will-change: opacity, transform;
}

.scene.active { opacity: 1; }

.veil {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(244, 248, 251, 0.55) 0%, rgba(244, 248, 251, 0.25) 45%, rgba(244, 248, 251, 0.15) 100%),
        linear-gradient(180deg, rgba(244, 248, 251, 0.6) 0%, rgba(244, 248, 251, 0.85) 45%, rgba(244, 248, 251, 0.96) 100%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============ MOBILE TOP BAR (hidden on desktop) ============ */
.topbar { display: none; }

/* ============ LAYOUT ============ */
.layout {
    position: relative;
    z-index: 2;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 48px;
    display: grid;
    grid-template-columns: minmax(340px, 42%) 1fr;
    gap: 48px;
}

/* ============ SIDEBAR ============ */
.sidebar { position: relative; }

.sidebar-inner {
    position: sticky;
    top: 0;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 64px 0 56px;
    gap: 44px;
}

.avatar-ring {
    width: 148px; height: 148px;
    border-radius: 50%;
    padding: 5px;
    background: linear-gradient(135deg, #38bdf8, var(--accent));
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.avatar {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 4px solid #ffffff;
}

.identity h1 {
    font-size: clamp(2.3rem, 3.6vw, 3rem);
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.identity h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 12px;
    letter-spacing: -0.01em;
}

.tagline {
    margin-top: 16px;
    max-width: 380px;
    font-size: 1.05rem;
    color: var(--text-strong);
}

.status {
    margin-top: 18px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text);
}

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 6px;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* Prominent social buttons (R2) */
.social-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text-strong);
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.social-btn svg { width: 16px; height: 16px; color: var(--accent); }

.social-btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow);
    color: var(--accent);
}

/* Side nav */
.side-nav ul { list-style: none; }

.side-nav li + li { margin-top: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-link:hover { text-decoration: none; color: var(--heading); }

.nav-index {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--accent);
    opacity: 0.85;
}

.nav-line {
    width: 28px; height: 1.5px;
    background: #94a8bc;
    opacity: 0.55;
    transition: width 0.25s ease, background 0.25s ease, opacity 0.25s ease;
}

.nav-link:hover .nav-line,
.nav-link.active .nav-line {
    width: 56px;
    background: var(--accent);
    opacity: 1;
}

.nav-link.active { color: var(--heading); }

/* ============ CONTENT ============ */
.content { padding: 72px 0 40px; min-width: 0; }

.section { padding-bottom: 88px; }

.section-title {
    display: block;
    font-size: clamp(1.7rem, 2.6vw, 2.1rem);
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 34px;
}

.section-title span {
    display: block;
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.3em;
    margin-bottom: 10px;
}

.section-title::after {
    content: "";
    display: block;
    width: 64px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), rgba(14, 116, 144, 0.25));
    margin-top: 16px;
}

.section-lede {
    margin-bottom: 28px;
    font-size: 1.02rem;
    max-width: 62ch;
}

.section p { max-width: 66ch; }

.section p + p { margin-top: 18px; }

.section p strong { color: var(--text-strong); font-weight: 650; }

.lead {
    font-size: 1.18rem;
    line-height: 1.6;
    color: var(--text-strong);
    font-weight: 450;
}

/* Terminal card — "ice glass" */
.terminal {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 28px;
    background: #f8fbfd;
    box-shadow: var(--shadow-sm);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: #eef4f9;
    border-bottom: 1px solid var(--card-border);
}

.t-dot { width: 11px; height: 11px; border-radius: 50%; }
.t-dot.red { background: #f87171; }
.t-dot.yellow { background: #fbbf24; }
.t-dot.green { background: #34d399; }

.t-title {
    margin-left: 10px;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: #7b8ea1;
}

.terminal-body {
    padding: 18px 20px;
    font-family: var(--mono);
    font-size: 0.84rem;
    line-height: 1.9;
}

.prompt { color: var(--accent); font-weight: 600; }

.t-out { color: var(--text-strong); padding-left: 1.2em; }

.cursor {
    display: inline-block;
    width: 9px; height: 1.1em;
    background: var(--accent);
    vertical-align: text-bottom;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 32px;
}

.stat {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 18px 16px;
    background: var(--card);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat strong {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
    font-family: var(--mono);
    letter-spacing: -0.02em;
}

.stat span { font-size: 0.8rem; }

/* Chips */
.chiplist {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.chiplist li {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--accent-text);
    background: var(--accent-dim);
    border-radius: 999px;
    padding: 4px 12px;
}

/* Cards shared */
.pillar, .case, .project, .cert, .comm {
    border: 1px solid var(--card-border);
    border-radius: 16px;
    background: #ffffff;
    padding: 28px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.pillar:hover, .case:hover, .project:hover, .cert:hover, .comm:hover {
    transform: translateY(-4px);
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow);
}

/* Pillars */
.pillars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.pillar-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: grid;
    place-items: center;
    margin-bottom: 16px;
}

.pillar-icon svg { width: 24px; height: 24px; color: var(--accent); }

.pillar h4, .case h4, .project h4, .cert h4, .comm h4 {
    color: var(--heading);
    font-size: 1.12rem;
    font-weight: 750;
    margin-bottom: 10px;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.pillar p, .case p, .project p, .cert p, .comm p { font-size: 0.94rem; }

/* Experience */
.xp-list { display: flex; flex-direction: column; }

.xp {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 24px;
    padding: 24px;
    border-radius: 14px;
    border: 1px solid transparent;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.xp:hover {
    background: var(--card);
    border-color: var(--card-border);
    box-shadow: var(--shadow-sm);
}

.xp-when {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    padding-top: 4px;
    white-space: nowrap;
}

.xp-body h4 {
    color: var(--heading);
    font-size: 1.18rem;
    font-weight: 750;
    letter-spacing: -0.015em;
    margin-bottom: 2px;
}

.xp-org { color: var(--accent); font-weight: 600; }

.xp-loc {
    font-size: 0.8rem;
    font-family: var(--mono);
    margin-bottom: 12px;
}

.xp-body > ul:not(.chiplist) {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.xp-body > ul:not(.chiplist) li {
    font-size: 0.95rem;
    padding-left: 20px;
    position: relative;
}

.xp-body > ul:not(.chiplist) li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Cases */
.cases {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.case-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.case-head h4 { margin-bottom: 0; }

.case-num {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent);
    border: 1px solid var(--card-border-hover);
    border-radius: 6px;
    padding: 3px 8px;
    letter-spacing: 0.1em;
    flex-shrink: 0;
    background: var(--accent-dim);
}

.case:last-child { grid-column: 1 / -1; }

/* Problem / Built / Result kickers inside case studies */
.k {
    display: block;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 2px;
}

.case p + p { margin-top: 12px; }

.case-outcome {
    margin-top: 12px;
    color: var(--accent-text);
    font-size: 0.94rem;
    font-weight: 600;
    background: rgba(224, 242, 254, 0.55);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 8px 12px;
}

.case-outcome .k { color: var(--accent-text); }

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.project { display: block; color: inherit; }
.project:hover { text-decoration: none; }

.project-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.project-top svg { width: 30px; height: 30px; color: var(--accent); }

.ext {
    color: var(--text);
    font-size: 1.1rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.project:hover .ext { color: var(--accent); transform: translate(3px, -3px); }
.project:hover h4 { color: var(--accent); }

.more-link { margin-top: 24px; }

.more-link a {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Writing */
.posts { display: flex; flex-direction: column; gap: 10px; }

.post {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    align-items: baseline;
    gap: 18px;
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.post:hover {
    text-decoration: none;
    transform: translateX(6px);
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow);
}

.post-date {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--text);
    white-space: nowrap;
}

.post-title {
    color: var(--text-strong);
    font-weight: 650;
    font-size: 1rem;
}

.post:hover .post-title { color: var(--accent); }

.post-arrow { color: var(--text); }
.post:hover .post-arrow { color: var(--accent); }

/* Certs & community */
.certs, .community-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}

.cert, .comm { padding: 20px; }

/* Contact */
.contact-section { padding-bottom: 48px; }

.contact-big {
    font-size: clamp(1.9rem, 3.4vw, 2.6rem);
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.contact-section > p { max-width: 520px; }

.btn-primary {
    display: inline-block;
    margin-top: 26px;
    padding: 14px 34px;
    border: 1px solid var(--accent);
    border-radius: 10px;
    background: var(--accent);
    color: #ffffff;
    font-family: var(--mono);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-primary:hover {
    background: #0c637c;
    text-decoration: none;
    transform: translateY(-2px);
}

.contact-meta {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-family: var(--mono);
    font-size: 0.8rem;
}

/* Footer */
.footer {
    border-top: 1px solid var(--card-border);
    padding: 28px 0 40px;
    font-family: var(--mono);
    font-size: 0.75rem;
}

/* Reveal on scroll */
.section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible { opacity: 1; transform: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .topbar {
        display: flex;
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 50;
        align-items: center;
        justify-content: space-between;
        padding: 12px 20px;
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--card-border);
    }

    .topbar-logo {
        font-family: var(--mono);
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--heading);
    }

    .topbar-logo:hover { text-decoration: none; color: var(--accent); }

    .topbar-social { display: flex; align-items: center; gap: 18px; }

    .topbar-social a { color: var(--text-strong); display: inline-flex; }

    .topbar-social svg { width: 20px; height: 20px; }

    .topbar-social a:hover { color: var(--accent); }

    .layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0 28px;
    }

    .sidebar-inner {
        position: static;
        max-height: none;
        padding: 96px 0 8px;
        gap: 28px;
    }

    .side-nav { display: none; }

    .tagline { max-width: 560px; }

    .content { padding-top: 40px; }

    .section { padding-bottom: 64px; }

    .mountains { opacity: 0.4; }
}

@media (max-width: 640px) {
    .layout { padding: 0 20px; }

    .xp { grid-template-columns: 1fr; gap: 8px; padding: 20px 16px; }

    .post { grid-template-columns: 1fr auto; }

    .post-date { grid-column: 1 / -1; }

    .stats { grid-template-columns: repeat(2, 1fr); }

    .avatar-ring { width: 120px; height: 120px; }
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .section { opacity: 1; transform: none; transition: none; }
    .status-dot, .cursor { animation: none; }
    * { transition-duration: 0.01ms !important; }
}
