/* ─────────────────────────────────────────────────────────────
   shivam1410.github.io — shared terminal shell
   Themes: matrix (default) · dark · light
   ───────────────────────────────────────────────────────────── */

:root,
:root[data-theme="matrix"] {
  --bg: #000401;
  --panel: #030b05;
  --panel-head: #04120a;
  --border: #0f3f1d;
  --fg: #a8ffa0;
  --muted: #2f9c48;
  --accent: #39ff14;
  --accent-dim: #1f9c3d;
  --key: #7cfc00;
  --string: #b6ff9c;
  --comment: #1f7a30;
  --warn: #adff2f;
  --red: #ff4d4d;
  --shadow: 0 8px 28px rgba(0, 0, 0, .6);
  --hover-overlay: rgba(57, 255, 20, .07);
  --chip-bg: rgba(57, 255, 20, .10);
  --glow: 0 0 2px rgba(57, 255, 20, .30);
  --rain-opacity: .16;
}

:root[data-theme="dark"] {
  --bg: #0a0e12;
  --panel: #10151b;
  --panel-head: #161c24;
  --border: #232a33;
  --fg: #d8dee9;
  --muted: #6b7686;
  --accent: #7ee787;
  --accent-dim: #4c9a5c;
  --key: #9cdcfe;
  --string: #ce9178;
  --comment: #6a9955;
  --warn: #ffcb6b;
  --red: #ff6161;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --hover-overlay: rgba(255, 255, 255, .03);
  --chip-bg: rgba(126, 231, 135, .12);
  --glow: none;
  --rain-opacity: 0;
}

:root[data-theme="light"] {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-head: #eef0f3;
  --border: #d7dbe0;
  --fg: #20262e;
  --muted: #5c6572;
  --accent: #1a7f37;
  --accent-dim: #116329;
  --key: #0550ae;
  --string: #953800;
  --comment: #59873a;
  --warn: #9a6700;
  --red: #cf222e;
  --shadow: 0 8px 24px rgba(20, 25, 35, .08);
  --hover-overlay: rgba(0, 0, 0, .035);
  --chip-bg: rgba(26, 127, 55, .10);
  --glow: none;
  --rain-opacity: 0;
}

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box }
html { scroll-behavior: smooth }
html, body { margin: 0; padding: 0 }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14.5px;
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
  text-shadow: var(--glow);
  transition: background-color .25s ease, color .25s ease;
}

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

/* ── background: digital rain + blueprint grid ─────────────── */
#rain {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  width: 100%;
  height: 100%;
  opacity: var(--rain-opacity);
  transition: opacity .4s ease;
}

#bgfx { position: fixed; inset: 0; z-index: -1; pointer-events: none }

#bgfx::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(57, 255, 20, .04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 20, .04) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 85%);
}

:root[data-theme="dark"] #bgfx::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
}

:root[data-theme="light"] #bgfx::before {
  background-image:
    linear-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, .035) 1px, transparent 1px);
}

#bgfx::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg,
      rgba(57, 255, 20, .022) 0px, rgba(57, 255, 20, .022) 1px,
      transparent 1px, transparent 3px);
  animation: scan 9s linear infinite;
  opacity: .6;
}

:root[data-theme="light"] #bgfx::after {
  background: repeating-linear-gradient(0deg,
      rgba(0, 0, 0, .012) 0px, rgba(0, 0, 0, .012) 1px,
      transparent 1px, transparent 3px);
}

@keyframes scan { 0% { transform: translateY(0) } 100% { transform: translateY(3px) } }
@media (prefers-reduced-motion: reduce) { #bgfx::after { animation: none } }

#progress {
  position: fixed; top: 0; left: 0;
  height: 2px; width: 0%;
  background: var(--accent);
  z-index: 100;
  transition: width .1s linear;
}

.wrap { max-width: 820px; margin: 0 auto; padding: 40px 20px 80px; position: relative; z-index: 1 }

/* ── terminal window chrome ─────────────────────────────────── */
.term {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.term::before {
  content: '';
  position: absolute;
  left: var(--mx, 50%); top: var(--my, 50%);
  width: 420px; height: 420px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  z-index: 0;
}

@media (hover: hover) {
  .term:hover::before { opacity: .07 }
  .term:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 0 0 1px var(--accent-dim) }
}

.term-bar {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--panel-head);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; border: none; padding: 0;
  cursor: pointer;
  transition: filter .12s ease, transform .12s ease;
}
.dot:hover { filter: brightness(1.25); transform: scale(1.15) }
.dot:active { filter: brightness(.85); transform: scale(.95) }
.dot.r { background: #ff5f56 } .dot.y { background: #ffbd2e } .dot.g { background: #27c93f }
@media (prefers-reduced-motion: reduce) { .dot:hover, .dot:active { transform: none } }

body.minimized nav.tabbar, body.minimized main, body.minimized .site-stats { display: none }

.term-title { margin-left: 8px; color: var(--muted); font-size: .78rem }
.last-commit { margin-left: 14px; color: var(--muted); font-size: .72rem; white-space: nowrap }
.last-commit::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 5px; vertical-align: 1px;
}
@media (max-width: 620px) { .last-commit { display: none } }

.term-body { position: relative; z-index: 1; padding: 22px 26px }

.print-btn {
  position: absolute; top: 9px; right: 96px;
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 3px 10px; border-radius: 4px;
  font-family: inherit; font-size: .75rem; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.print-btn:hover { background: var(--accent); color: var(--bg) }

.theme-btn {
  position: absolute; top: 8px; right: 14px;
  height: 24px; padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg); color: var(--accent);
  font-family: inherit; font-size: .7rem;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: border-color .2s ease, color .2s ease;
}
.theme-btn:hover { border-color: var(--accent-dim) }

/* ── header ────────────────────────────────────────────────── */
.name {
  font-family: var(--font-sans);
  font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em;
  margin: 2px 0;
  background: linear-gradient(90deg, var(--fg) 0%, var(--accent) 50%, var(--fg) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 6s ease-in-out infinite;
}
@keyframes sheen { 0%, 100% { background-position: 0% 0 } 50% { background-position: 100% 0 } }
@media (prefers-reduced-motion: reduce) { .name { animation: none } }

#boot { white-space: pre-wrap; min-height: 5.2em }
#boot .comment { color: var(--comment) }
#boot .out { color: var(--fg) }
#boot .warn { color: var(--warn) }

.cursor {
  display: inline-block; width: 8px; height: 1.1em;
  background: var(--accent); vertical-align: text-bottom;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none } }

.contacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px }
.contacts a {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); text-decoration: none;
  border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 4px;
  font-size: .8rem; transition: .15s ease;
}
.contacts a:hover { color: var(--accent); border-color: var(--accent-dim) }
.contacts a::before { content: './'; color: var(--muted) }
.contacts a.cta {
  background: var(--accent); color: var(--bg);
  border-color: var(--accent); font-weight: 600;
}
.contacts a.cta::before { content: none }
.contacts a.cta:hover { filter: brightness(1.12); color: var(--bg) }
.link-icon { color: var(--accent); font-weight: 700; font-size: .82em; line-height: 1 }

/* ── tab bar ───────────────────────────────────────────────── */
.tabbar-wrap { position: sticky; top: 0; z-index: 20; border-radius: 8px 8px 0 0 }
nav.tabbar {
  display: flex; overflow-x: auto;
  background: var(--panel-head);
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  scrollbar-width: none;
}
nav.tabbar::-webkit-scrollbar { display: none }
nav.tabbar a {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: .78rem;
  color: var(--muted); text-decoration: none;
  border-right: 1px solid var(--border);
  border-top: 2px solid transparent;
  transition: .15s ease;
}
nav.tabbar a .ext { color: var(--comment) }
nav.tabbar a:hover { color: var(--fg); background: var(--hover-overlay) }
nav.tabbar a.active { color: var(--fg); background: var(--panel); border-top-color: var(--accent) }
.tabbar-spacer { height: 1px }

/* ── sections ──────────────────────────────────────────────── */
section {
  margin-bottom: 0;
  opacity: 0; transform: translateY(10px);
  transition: opacity .45s ease, transform .45s ease;
  scroll-margin-top: 52px;
}
section.in { opacity: 1; transform: translateY(0) }
section .term { border-radius: 0 0 8px 8px; border-top: none; margin-top: 0; margin-bottom: 26px }
section:first-of-type .term { border-radius: 8px }

p { margin: 0 0 10px }
p:last-child { margin-bottom: 0 }

/* ── git-log style experience ──────────────────────────────── */
.commit { padding: 14px 0; border-bottom: 1px dashed var(--border) }
.commit:first-child { padding-top: 0 }
.commit:last-child { border-bottom: none; padding-bottom: 0 }
.commit-line1 { color: var(--warn) }
.commit-meta { color: var(--muted); font-size: .85rem }
.commit-msg { font-family: var(--font-sans); color: var(--fg); font-weight: 700; font-size: 1.05rem; margin: 8px 0 10px }
.diff { margin: 0; padding-left: 18px }
.diff li {
  font-family: var(--font-sans); font-size: .92rem; line-height: 1.6;
  list-style: none; position: relative;
  padding-left: 6px; margin-bottom: 6px; color: var(--fg);
}
.diff li::before { content: '+'; color: var(--accent); position: absolute; left: -14px }

/* ── code / json / yaml blocks ─────────────────────────────── */
pre.code { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: .86rem }
.k { color: var(--key) } .s { color: var(--string) } .p { color: var(--muted) } .c { color: var(--comment) }
.md-bold { font-weight: 700; color: var(--fg) }
.metric { font-weight: 700; color: var(--accent) }

.proj-link { color: var(--key); text-decoration: none; border-bottom: 1px dotted var(--key) }
.proj-link:hover { color: var(--accent); border-color: var(--accent) }

.chips { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 6px 0 14px }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  background: var(--chip-bg); border: 1px solid var(--accent-dim);
  color: var(--accent); font-size: .78rem; line-height: 1.4;
  transition: background .15s ease, transform .15s ease;
}
.chip:hover { background: var(--accent-dim); color: var(--bg); transform: translateY(-1px) }

.copy-btn {
  margin-left: auto; background: transparent;
  border: 1px solid var(--border); color: var(--muted);
  font-size: .72rem; padding: 2px 9px; border-radius: 4px;
  cursor: pointer; font-family: inherit;
  transition: color .15s ease, border-color .15s ease;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent-dim) }
.copy-btn.copied { color: var(--accent); border-color: var(--accent) }
.link-btn { margin-left: 8px }

.site-stats { display: flex; justify-content: center; margin: 8px 0 28px; opacity: .7 }
.site-stats:hover { opacity: 1 }

#top-btn {
  position: fixed; right: 18px; bottom: 52px;
  width: 38px; height: 38px; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--fg); cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 50; font-family: inherit;
}
#top-btn.show { opacity: 1; pointer-events: auto }
#top-btn:hover { color: var(--accent); border-color: var(--accent-dim) }

/* ── status bar ────────────────────────────────────────────── */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 26px; display: flex; align-items: center; justify-content: space-between;
  background: var(--accent-dim); color: var(--bg);
  font-size: .72rem; padding: 0 12px; z-index: 40;
  font-family: var(--font-mono); text-shadow: none;
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 14px; min-width: 0 }
.sb-item { white-space: nowrap }
.sb-section { overflow: hidden; text-overflow: ellipsis; max-width: 40vw }
.sb-btn { background: transparent; border: none; color: var(--bg); font: inherit; cursor: pointer; padding: 0 2px }
.sb-btn:hover { text-decoration: underline }
.sb-clock { font-variant-numeric: tabular-nums }
@media (max-width: 600px) {
  .statusbar { font-size: .66rem; padding: 0 8px }
  .sb-item:not(.sb-section):not(.sb-btn) { display: none }
}

/* ── command palette / search ──────────────────────────────── */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 11vh; z-index: 200;
}
.cmdk-overlay[hidden] { display: none }

.cmdk {
  width: calc(100% - 32px); max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  overflow: hidden;
  font-family: var(--font-mono);
}
.cmdk-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.cmdk-prompt { color: var(--accent); font-weight: 700 }
.cmdk-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--fg); font: inherit; font-size: .95rem; min-width: 0;
}
.cmdk-input::placeholder { color: var(--muted) }
.cmdk-esc { color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: .7rem }

.cmdk-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto }
.cmdk-group {
  padding: 8px 12px 4px; color: var(--comment);
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
}
.cmdk-list li {
  padding: 8px 12px; border-radius: 6px;
  color: var(--fg); font-size: .85rem; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.cmdk-list li .cmdk-label { min-width: 0 }
.cmdk-list li .cmdk-sub {
  display: block; color: var(--muted); font-size: .74rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-list li .cmdk-hint { color: var(--muted); font-size: .74rem; white-space: nowrap }
.cmdk-list li.active { background: var(--hover-overlay); color: var(--accent) }
.cmdk-list li.active .cmdk-hint { color: var(--accent) }
.cmdk-list mark { background: transparent; color: var(--accent); font-weight: 700 }
.cmdk-empty { padding: 14px 16px; color: var(--muted); font-size: .85rem }
.cmdk-foot {
  display: flex; gap: 14px; padding: 8px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: .7rem;
}
.help-title { flex: 1; color: var(--fg); font-size: .95rem }
.help-list li { cursor: default }
.help-list li .cmdk-hint { color: var(--accent) }

/* ── toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 38px; left: 50%;
  transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--accent);
  color: var(--accent); padding: 8px 16px; border-radius: 6px;
  font-size: .78rem; font-family: var(--font-mono);
  z-index: 300; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  max-width: calc(100% - 32px); text-align: center;
}
.toast[hidden] { display: none }

/* The print-only résumé (built from resume.json by print-resume.js) is
   never shown on screen; print.css reveals it. */
.print-resume { display: none }

/* ── a11y ──────────────────────────────────────────────────── */
::selection { background: var(--accent-dim); color: var(--bg) }
.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;
}
.skip-link {
  position: absolute; left: 8px; top: -48px;
  background: var(--accent); color: var(--bg);
  padding: 8px 16px; border-radius: 4px;
  font-weight: 600; font-size: .85rem; z-index: 1000;
  transition: top .15s ease; text-decoration: none;
}
.skip-link:focus { top: 8px }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px }

@media (max-width: 600px) {
  .term-body { padding: 18px 16px }
  .print-btn { position: static; margin-top: 10px; margin-right: 8px; display: inline-block }
  .theme-btn { position: static; margin-top: 10px; vertical-align: middle }
  .term-bar { flex-wrap: wrap }
  .copy-btn { margin-left: 0 }
}
