/* ===== Design tokens ===== */
:root{
  --bg: #080b10;
  --bg-elev: #0d1117;
  --bg-editor: #0b0f16;
  --bg-card: #10151d;
  --border: #1c2531;
  --border-soft: #161c26;
  --fg: #c9d5e3;
  --fg-dim: #95a2b3;
  --fg-faint: #5c6779;
  --accent: #64ffda;
  --accent-2: #ff79c6;
  --accent-3: #ffb454;
  --accent-4: #82aaff;
  --green: #7ee787;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, 'Fira Code', Menlo, Consolas, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 10px;
  --sidebar-w: 260px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin:0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a{ color: inherit; text-decoration: none; }

/* Skip link (keyboard/screen-reader users) */
.skip-link{
  position: fixed;
  top: -60px; left: 14px;
  z-index: 100;
  background: var(--accent);
  color: #03211a;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  transition: top .15s ease;
}
.skip-link:focus{ top: 14px; }

/* Icon sprite + base icon sizing */
.icon-sprite{ position: absolute; width: 0; height: 0; overflow: hidden; }
.icon{
  width: 14px; height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
  flex-shrink: 0;
}

/* Focus visibility for keyboard navigation */
a:focus-visible,
button:focus-visible,
.contact-btn:focus-visible,
.project-card:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .spotlight{ display: none; }
}

::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-track{ background: var(--bg); }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover{ background: #2a3444; }

/* subtle grid + noise */
.noise-overlay{
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at 20% 0%, black 0%, transparent 70%);
}

.spotlight{
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(600px circle at var(--x,50%) var(--y,20%), rgba(100,255,218,0.06), transparent 40%);
  transition: background 0.05s linear;
}

/* ===== App shell ===== */
.app{
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 3;
}

/* Sidebar */
.sidebar{
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header{
  display:flex; align-items:center; gap:10px;
  padding: 16px 16px;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
}

.dots{ display:inline-flex; gap:6px; }
.dots i{ width:10px; height:10px; border-radius:50%; display:inline-block; }

.file-tree{ padding: 14px 0; flex: 1; overflow-y:auto; }
.folder-label{ padding: 4px 16px 10px; color: var(--fg-dim); font-size: 13px; }
.file-tree ul{ list-style:none; margin:0; padding:0; }
.file-tree li{ margin:0; }
.file-tree .file{
  display:flex; align-items:center; gap:10px;
  padding: 8px 16px 8px 30px;
  color: var(--fg-dim);
  font-size: 13.5px;
  border-left: 2px solid transparent;
  transition: all .15s ease;
}
.file-tree .file:hover{ color: var(--fg); background: rgba(255,255,255,0.02); }
.file-tree .file.active{
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(100,255,218,0.06);
}
.sidebar-footer{
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between;
  font-size: 12px; color: var(--fg-dim);
}
.git-branch{ color: var(--accent-4); }
.status{ display:flex; align-items:center; gap:6px; }
.status-dot{
  width:8px; height:8px; border-radius:50%; background: var(--green);
  box-shadow: 0 0 8px var(--green);
  display:inline-block;
}

/* Mobile menu toggle */
.menu-toggle{
  display:none;
  position: fixed; top: 14px; left: 14px; z-index: 50;
  width: 40px; height: 40px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-direction: column; align-items:center; justify-content:center; gap:4px;
  cursor: pointer;
}
.menu-toggle span{ width: 18px; height: 2px; background: var(--fg); }

/* Back to top */
.back-to-top{
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 45;
  width: 42px; height: 42px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  color: var(--accent);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, border-color .2s ease;
}
.back-to-top.visible{ opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover{ border-color: var(--accent); }
.back-to-top .icon{ width: 18px; height: 18px; }

/* Main column */
.main{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.editor{
  flex: 1;
  background: var(--bg-editor);
}

.pane{
  padding: 70px 6vw;
  max-width: 980px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border-soft);
  position: relative;
}

.pane-title{
  font-size: 22px;
  margin: 0 0 28px;
  display:flex; align-items:baseline; gap:12px;
  color: var(--fg);
}
.pane-num{
  font-size: 13px;
  color: var(--bg-editor);
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}
.pane-sub{ color: var(--fg-dim); font-size: 13px; margin: -18px 0 22px; }

/* ===== HERO ===== */
.hero-pane{ padding-top: 90px; min-height: 92vh; display:flex; flex-direction:column; justify-content:center; }

.hero-grid{
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 40px;
  align-items: center;
}

.terminal-window{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(100,255,218,0.03);
}

/* Hero terminal window state, toggled via the green titlebar dot */
#heroTerminal.maximized{
  position: fixed;
  inset: 6vh 8vw;
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-width: none;
}
#heroTerminal.maximized #typedTerminal{ flex: 1; max-height: none; }

.terminal-backdrop{
  position: fixed; inset: 0;
  background: rgba(3,6,10,0.72);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.terminal-backdrop.visible{ opacity: 1; pointer-events: auto; }

.terminal-titlebar{
  display:flex; align-items:center; gap:14px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.terminal-title{ color: var(--fg-dim); font-size: 12px; margin: 0 auto; }

/* Only the green dot is functional (maximize); red/yellow are decorative, like the other dots on the page */
.dot{
  width: 10px; height: 10px;
  border-radius: 50%;
  border: none; padding: 0;
  cursor: pointer;
  display: inline-block;
}
.dot-red{ background: #ff5f56; }
.dot-yellow{ background: #ffbd2e; }
.dot-green{ background: #27c93f; }
.dot:hover{ filter: brightness(1.2); }
.dot:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

.terminal-body{
  padding: 22px 20px;
  min-height: 260px;
  font-size: 14px;
}
.terminal-body.static{ min-height: auto; }

#typedTerminal{
  max-height: 320px;
  overflow-y: auto;
  transition: max-height .25s ease;
}
/* Hidden from the very first paint (no JS-timing flash) whenever JS is present;
   script.js reveals lines one by one, or all at once if motion is reduced.
   Without JS at all, .js is never added, so the intro stays fully visible/readable. */
.js #typedTerminal > *{ visibility: hidden; }

.tline{ margin-bottom: 4px; white-space: pre-wrap; word-break: break-word;}
.prompt{ color: var(--accent-4); }
.colon{ color: var(--fg-dim); }
.path{ color: var(--accent-2); }
.dollar{ color: var(--fg-dim); margin-right: 2px; }
.cmd{ color: var(--fg); }
.tout{ color: var(--fg-dim); margin: 2px 0 14px 0; }
.tout.accent{ color: var(--green); }
.tout.hint{ color: var(--fg-faint); font-style: italic; }
.tout.error{ color: #ff6b81; }
.tline.final{ margin-top: 4px; }

/* Interactive prompt line */
.terminal-form{ display:flex; align-items:center; gap:4px; }
.terminal-input{
  flex: 1;
  min-width: 60px;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  color: var(--fg);
  font-family: var(--mono);
  font-size: inherit;
  caret-color: var(--accent);
}
.terminal-input::placeholder{ color: var(--fg-faint); }

.avatar-block{ display:flex; flex-direction:column; align-items:center; gap:22px; }
.avatar-frame{
  position: relative;
  width: 220px; height: 220px;
  border-radius: 16px;
  padding: 2px;
  background: var(--border);
}
.avatar-img{
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 12px;
  display:block;
  filter: grayscale(15%) contrast(1.05);
}
.avatar-tag{
  position:absolute; bottom: -14px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.hero-badges{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; }
.badge{
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--fg-dim);
  background: var(--bg-card);
}

.hero-cta{
  display:flex; flex-wrap:wrap; gap:12px;
  margin-top: 40px;
}
.btn{
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  transition: all .15s ease;
}
.btn-primary{
  background: var(--accent);
  color: #03211a;
  font-weight: 600;
  border-color: var(--accent);
}
.btn-primary:hover{ box-shadow: 0 0 20px rgba(100,255,218,0.35); transform: translateY(-1px); }
.btn-ghost{ color: var(--fg-dim); }
.btn-ghost:hover{ color: var(--fg); border-color: var(--fg-dim); }

.scroll-hint{
  margin-top: 46px;
  color: var(--fg-faint);
  font-size: 12px;
  animation: floaty 2s ease-in-out infinite;
}
@keyframes floaty{ 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(6px);} }

/* ===== ABOUT ===== */
.md-card{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 32px;
}
.md-card p{ margin: 0 0 16px; color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.75; }
.md-card p:last-of-type{ margin-bottom: 24px; }
.md-card strong{ color: var(--accent); font-weight: 600; }
.md-card a{ color: var(--accent-4); border-bottom: 1px dotted var(--accent-4); }

.about-meta{ list-style:none; margin:0; padding: 18px 0 0; border-top: 1px dashed var(--border); }
.about-meta li{ display:flex; gap: 16px; padding: 6px 0; font-size: 13.5px; }
.about-meta .k{ color: var(--fg-dim); min-width: 150px; flex-shrink:0; }
.about-meta .v{ color: var(--fg); }

/* ===== EXPERIENCE / git log ===== */
.git-log{ display:flex; flex-direction:column; gap: 22px; }
.commit{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-3);
  border-radius: var(--radius);
  padding: 22px 26px;
  transition: border-color .2s ease, transform .2s ease;
}
.commit:hover{ border-left-color: var(--accent); transform: translateX(2px); }
.commit-head{ display:flex; align-items:center; gap:12px; margin-bottom: 10px; }
.hash{ color: var(--accent-3); font-size: 13px; }
.ref{
  font-size: 11px; color: var(--bg-editor); background: var(--accent);
  padding: 2px 8px; border-radius: 4px; font-weight: 700;
}
.commit-msg{ margin: 0 0 6px; font-size: 16px; color: var(--fg); }
.commit-meta{ color: var(--fg-dim); font-size: 12.5px; margin-bottom: 14px; }
.commit-body{ margin: 0 0 16px; padding-left: 20px; color: var(--fg); }
.commit-body li{ margin-bottom: 5px; font-size: 13.5px; }
.stack-row{ display:flex; flex-wrap:wrap; gap:6px; }
.stack-row span{
  font-size: 11.5px; color: var(--accent-4);
  background: rgba(130,170,255,0.08);
  border: 1px solid rgba(130,170,255,0.18);
  padding: 3px 8px; border-radius: 5px;
}

/* ===== PROJECTS ===== */
.project-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}
.project-card{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display:flex; flex-direction:column; gap:12px;
  transition: all .2s ease;
}
.project-card:hover{
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.project-card-head{ display:flex; align-items:center; gap:10px; }
.folder-ic{ width: 18px; height: 18px; color: var(--accent-4); }
.project-name{ color: var(--fg); font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.project-desc{ color: var(--fg-dim); font-size: 13.5px; font-family: var(--sans); line-height: 1.6; margin:0; flex:1; }
.project-link{ color: var(--accent); font-size: 12.5px; display:flex; align-items:center; gap:5px; }
.project-card-more{ border-style: dashed; }
.ext-icon{ width: 11px; height: 11px; color: var(--fg-dim); vertical-align: -1px; }
a:hover .ext-icon{ color: var(--accent); }

/* ===== ACHIEVEMENTS ===== */
.achievement-card{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 16px;
  position: relative;
}
.achievement-card h3{ margin: 0 0 10px; font-size: 16px; color: var(--fg); }
.achievement-card p{ margin:0; color: var(--fg-dim); font-size: 14px; font-family: var(--sans); line-height: 1.7; }
.achievement-card a{ color: var(--accent-4); border-bottom: 1px dotted var(--accent-4); }
.achievement-card.featured{
  border-color: var(--accent-2);
  background: linear-gradient(180deg, rgba(255,121,198,0.06), var(--bg-card) 40%);
}
.achievement-tag{
  position:absolute; top:-10px; right: 20px;
  background: var(--accent-2); color: #2a0a1c;
  font-size: 10.5px; font-weight:700; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 20px; text-transform: uppercase;
}
.achievement-links{ display:flex; flex-wrap:wrap; gap: 14px; margin-top: 14px; }
.achievement-links a{ font-size: 12.5px; }
.achievement-list{ display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }

/* ===== EDUCATION ===== */
.edu-row h3{ margin: 0 0 4px; color: var(--fg); font-size: 16px; }
.edu-row p{ margin:0; color: var(--fg-dim); font-size: 13.5px; }
.cert-title{ margin: 22px 0 10px; padding-top: 18px; border-top: 1px dashed var(--border); color: var(--fg-dim); font-size: 12.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
.cert-row{ display:flex; flex-wrap:wrap; gap:8px; }

/* ===== CONTACT ===== */
.contact-terminal .terminal-body{ font-size: 13.5px; }
.code-line{ margin-bottom: 6px; }
.cm{ color: var(--fg-faint); }
.var{ color: var(--accent-4); }
.s2{ color: var(--accent-3); }

.contact-actions{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}
.contact-btn{
  background: var(--bg-card);
  padding: 18px 20px;
  display:flex; align-items:center; gap:14px;
  transition: background .15s ease;
}
.contact-btn:hover{ background: var(--bg-elev); }
.contact-ic{ width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.contact-label{ display:flex; align-items:center; gap:5px; color: var(--fg-dim); font-size: 11.5px; margin-bottom: 3px; }
.contact-value{ display:block; color: var(--fg); font-size: 13.5px; }

/* ===== FOOTER ===== */
.statusbar{
  display:flex; gap: 20px;
  padding: 10px 6vw;
  background: var(--accent);
  color: #04211a;
  font-size: 11.5px;
  font-weight: 600;
}
.status-item-right{ margin-left: auto; }

/* reveal animation (progressive enhancement: hidden only once JS opts a pane in) */
.pane.js-reveal{ opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.pane.js-reveal.in-view{ opacity: 1; transform: translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 900px){
  .hero-grid{ grid-template-columns: 1fr; }
  .avatar-block{ order:-1; }
  .avatar-frame{ width: 160px; height: 160px; }
}

@media (max-width: 760px){
  .sidebar{
    position: fixed; left: 0; top:0; z-index: 40;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 20px 0 40px rgba(0,0,0,0.5);
  }
  .sidebar.open{ transform: translateX(0); }
  .sidebar-header{ display: none; }
  .menu-toggle{ display:flex; }
  .menu-toggle.is-hidden{ display:none; }
  .pane{ padding: 56px 6vw; }
  .hero-pane{ padding-top: 90px; }
  .about-meta li{ flex-direction: column; gap: 2px; }
  .about-meta .k{ min-width: 0; }
}
