/* ============================================
   NIMIT BHANDARI — TERMINAL PORTFOLIO
   Old-school CRT terminal + modern animations
   ============================================ */

:root {
    --bg: #050505;
    --bg-term: #0a0a0a;
    --green: #00ff41;
    --green-dim: #00aa00;
    --green-muted: #0d3b0d;
    --amber: #ffb000;
    --blue: #00aaff;
    --red: #ff4444;
    --text: #e0e0e0;
    --text-dim: #888;
    --text-muted: #444;
    --border: #1a1a1a;
    --font: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --radius: 10px;
    --transition: 0.3s ease;
}

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

html { scroll-behavior: smooth; font-size: 15px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--green);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--green);
    color: var(--bg);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--green-dim); border-radius: 4px; }

/* Screen Reader Only */
.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;
}

/* ============================================
   CRT EFFECTS
   ============================================ */
.scanlines {
    position: fixed; inset: 0; z-index: 9998;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        rgba(0,0,0,0.12) 0px,
        rgba(0,0,0,0.12) 1px,
        transparent 1px,
        transparent 2px
    );
    opacity: 0.6;
}

.vignette {
    position: fixed; inset: 0; z-index: 9997;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
}

/* ============================================
   BOOT SEQUENCE
   ============================================ */
.boot {
    position: fixed; inset: 0; z-index: 10000;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.boot.done {
    opacity: 0; visibility: hidden; pointer-events: none;
}

.boot-log {
    max-width: 640px; width: 100%;
    font-size: 0.85rem; line-height: 1.8;
}

.boot-line {
    display: block;
    opacity: 0;
    animation: boot-fade 0.15s ease forwards;
}

.boot-line.ok { color: var(--green); }
.boot-line.info { color: var(--blue); }
.boot-line.warn { color: var(--amber); }

@keyframes boot-fade {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   TERMINAL WINDOW
   ============================================ */
.terminal {
    max-width: 960px; margin: 2rem auto;
    background: var(--bg-term);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 0 40px rgba(0,255,65,0.04), 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative; z-index: 1;
    animation: terminal-boot 0.8s ease 2.8s both;
}

@keyframes terminal-boot {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.titlebar {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: linear-gradient(to bottom, #1a1a1a, #111);
    border-bottom: 1px solid var(--border);
}

.titlebar-dots {
    display: flex; gap: 6px;
}

.titlebar-dots span {
    width: 12px; height: 12px; border-radius: 50%;
    display: block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.titlebar-title {
    font-size: 0.8rem; color: var(--text-dim);
    flex: 1; text-align: center;
}

.titlebar-empty { width: 42px; }

.terminal-body {
    padding: 1.5rem 1.5rem 0;
    min-height: 70vh;
    position: relative;
}

/* ============================================
   NAV
   ============================================ */
.term-nav {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin-bottom: 2rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.term-nav .prompt {
    color: var(--green-dim);
    margin-right: 0.5rem;
}

.cmd-link {
    color: var(--green); text-decoration: none;
    font-size: 0.85rem; padding: 0.2rem 0.4rem;
    border-radius: 4px; transition: all var(--transition);
}

.cmd-link:hover {
    background: rgba(0,255,65,0.08);
    color: var(--green);
    text-shadow: 0 0 10px rgba(0,255,65,0.4);
}

.cmd-link .cmd {
    color: var(--amber);
}

/* ============================================
   TERMINAL ELEMENTS
   ============================================ */
.term-section {
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(12px);
    animation: section-reveal 0.5s ease forwards;
}

.term-section:nth-child(2) { animation-delay: 3.0s; }
.term-section:nth-child(3) { animation-delay: 3.1s; }
.term-section:nth-child(4) { animation-delay: 3.2s; }
.term-section:nth-child(5) { animation-delay: 3.3s; }
.term-section:nth-child(6) { animation-delay: 3.4s; }
.term-section:nth-child(7) { animation-delay: 3.5s; }
.term-section:nth-child(8) { animation-delay: 3.6s; }

@keyframes section-reveal {
    to { opacity: 1; transform: translateY(0); }
}

.term-line {
    display: flex; align-items: center; gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.prompt {
    color: var(--green-dim);
    font-weight: 500;
    white-space: nowrap;
}

.cmd {
    color: var(--text);
    font-weight: 500;
}

.cursor {
    display: inline-block;
    width: 9px; height: 1.1em;
    background: var(--green);
    vertical-align: text-bottom;
    margin-left: 1px;
}

.cursor.blink {
    animation: blink 1s step-end infinite;
}

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

.term-output {
    padding-left: 0.5rem;
    border-left: 2px solid var(--green-muted);
    margin-left: 0.25rem;
    margin-bottom: 1rem;
}

.term-p {
    margin-bottom: 0.5rem;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.7;
}

.term-p strong {
    color: var(--green);
    font-weight: 600;
}

.dim { color: var(--text-dim); }

.link {
    color: var(--blue);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all var(--transition);
}

.link:hover {
    border-bottom-color: var(--blue);
    text-shadow: 0 0 8px rgba(0,170,255,0.3);
}

/* ASCII Art */
.hero-top {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1rem 0 1.5rem;
}

.ascii-art {
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: pre;
    overflow-x: auto;
    flex: 1;
    min-width: 280px;
}

.ascii-art .dim { color: var(--green-dim); }

.hero-img img {
    width: 160px;
    height: 160px;
}

/* Image */
.term-img {
    margin: 1.5rem 0;
    display: inline-block;
}

.term-img img {
    width: 220px; height: 220px; object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    filter: grayscale(0.3) contrast(1.1);
    transition: all var(--transition);
}

.term-img:hover img {
    filter: grayscale(0) contrast(1);
    border-color: var(--green-dim);
    box-shadow: 0 0 20px rgba(0,255,65,0.08);
}

.term-img-caption {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* ============================================
   LS TABLE (Experience)
   ============================================ */
.ls-table {
    font-size: 0.85rem;
    overflow-x: auto;
}

.ls-header, .ls-row {
    display: grid;
    grid-template-columns: 120px 100px 1fr 200px;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.ls-header {
    color: var(--text-muted);
    font-weight: 600;
    border-bottom-color: var(--green-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.ls-row {
    color: var(--text-dim);
    transition: all var(--transition);
}

.ls-row:hover {
    color: var(--green);
    background: rgba(0,255,65,0.03);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin: 0 -0.5rem;
    border-radius: 4px;
}

.ls-row .perm { color: var(--amber); font-size: 0.8rem; }
.ls-row .date { color: var(--text-muted); font-size: 0.8rem; }
.ls-row .role { color: var(--text); font-weight: 500; }
.ls-row .company { color: var(--text-dim); }

/* ============================================
   NEOFETCH (Skills)
   ============================================ */
.neofetch {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    font-size: 0.85rem;
}

.neofetch-logo {
    white-space: pre;
    line-height: 1.4;
    font-size: 0.8rem;
}

.logo-green { color: var(--green); }
.logo-dim { color: var(--text-dim); }

.neofetch-info {
    display: flex; flex-direction: column; gap: 0.6rem;
    justify-content: center;
}

.bar-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    align-items: center;
}

.bar-label {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.bar {
    height: 8px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-dim), var(--green));
    border-radius: 2px;
    animation: bar-grow 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: left;
    transform: scaleX(0);
}

@keyframes bar-grow {
    to { transform: scaleX(1); }
}

/* ============================================
   GIT LOG (Projects)
   ============================================ */
.git-log {
    display: flex; flex-direction: column; gap: 0.75rem;
}

.git-commit {
    display: flex; flex-wrap: wrap;
    gap: 0.75rem; align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    transition: all var(--transition);
}

.git-commit:hover {
    background: rgba(0,255,65,0.03);
    padding-left: 0.5rem; padding-right: 0.5rem;
    margin: 0 -0.5rem; border-radius: 4px;
}

.git-hash {
    color: var(--amber);
    font-size: 0.8rem;
    font-family: var(--font);
}

.git-msg {
    color: var(--text);
    font-size: 0.9rem;
}

.git-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: auto;
}

/* ============================================
   JSON CODE (Education)
   ============================================ */
.json-code {
    font-family: var(--font);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-dim);
    overflow-x: auto;
}

.json-code .key { color: var(--amber); }
.json-code .str { color: var(--green); }
.json-code .num { color: var(--blue); }

/* ============================================
   STATUS BAR
   ============================================ */
.statusbar {
    display: flex; align-items: center;
    padding: 0.5rem 1rem;
    background: #111;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin: 2rem -1.5rem 0;
}

.status-left {
    color: var(--green);
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    background: rgba(0,255,65,0.08);
    border-radius: 3px;
}

.status-center {
    flex: 1; text-align: center;
}

.status-right {
    color: var(--text-muted);
}

/* ============================================
   GLITCH HOVER EFFECT
   ============================================ */
.link:hover,
.git-commit:hover .git-msg,
.ls-row:hover .role {
    animation: glitch 0.3s ease;
}

@keyframes glitch {
    0% { text-shadow: 2px 0 var(--red), -2px 0 var(--blue); }
    25% { text-shadow: -2px 0 var(--red), 2px 0 var(--blue); }
    50% { text-shadow: 2px 0 var(--blue), -2px 0 var(--red); }
    75% { text-shadow: -1px 0 var(--blue), 1px 0 var(--red); }
    100% { text-shadow: none; }
}

/* ============================================
   EXPANDABLE EXPERIENCE DETAILS
   ============================================ */
.ls-row {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.ls-row::after {
    content: '+';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--green-dim);
    font-size: 0.9rem;
    transition: all var(--transition);
    opacity: 0;
}

.ls-row:hover::after,
.ls-row:focus::after {
    opacity: 1;
}

.ls-row.open::after {
    content: '−';
    opacity: 1;
    color: var(--green);
}

.exp-detail {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.35s ease,
                margin 0.4s ease,
                padding 0.4s ease;
    margin: 0 0;
    padding: 0 0.5rem;
    border-left: 2px solid var(--green-muted);
    margin-left: 0.25rem;
}

.exp-detail.open {
    max-height: 800px;
    opacity: 1;
    margin-bottom: 1.25rem;
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
}

.exp-cmd-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
}

.exp-cmd-line .cmd {
    min-height: 1.2em;
}

.exp-content {
    padding-left: 0.5rem;
}

.exp-content .term-p {
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

.exp-list {
    list-style: none;
    margin-top: 0.5rem;
    padding-left: 0;
}

.exp-list li {
    position: relative;
    padding-left: 1.2rem;
    margin-bottom: 0.4rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.exp-detail.open .exp-list li {
    opacity: 1;
    transform: translateX(0);
}

/* stagger the bullet reveals */
.exp-detail.open .exp-list li:nth-child(1) { transition-delay: 0.15s; }
.exp-detail.open .exp-list li:nth-child(2) { transition-delay: 0.28s; }
.exp-detail.open .exp-list li:nth-child(3) { transition-delay: 0.41s; }
.exp-detail.open .exp-list li:nth-child(4) { transition-delay: 0.54s; }
.exp-detail.open .exp-list li:nth-child(5) { transition-delay: 0.67s; }
.exp-detail.open .exp-list li:nth-child(6) { transition-delay: 0.80s; }

.exp-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--green);
    font-size: 0.75rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .terminal { margin: 0.5rem; border-radius: 8px; }
    .terminal-body { padding: 1rem 1rem 0; }
    .ascii-art { font-size: 0.6rem; }
    .neofetch { grid-template-columns: 1fr; gap: 1rem; }
    .neofetch-logo { font-size: 0.7rem; }
    .ls-header, .ls-row {
        grid-template-columns: 80px 80px 1fr;
    }
    .ls-header span:nth-child(4),
    .ls-row span:nth-child(4) { display: none; }
    .statusbar { margin: 2rem -1rem 0; padding: 0.5rem; font-size: 0.65rem; }
    .term-nav { gap: 0.3rem; }
    .cmd-link { font-size: 0.75rem; padding: 0.15rem 0.3rem; }
}

@media (max-width: 480px) {
    .ascii-art { display: none; }
    .term-img img { width: 160px; height: 160px; }
    .git-meta { margin-left: 0; width: 100%; }
    .bar-row { grid-template-columns: 80px 1fr; }
}
