/* ============================================================
   Het Shah — portfolio v3
   Concept: the portfolio reads like API reference docs.
   Light reading column, dark live-response console.
   ============================================================ */

:root {
  /* reading side */
  --paper:   #F6F6FA;
  --surface: #FFFFFF;
  --ink:     #15172B;
  --muted:   #545873;
  --faint:   #62667F;
  --rule:    #E2E3EE;
  --violet:  #5546E0;
  --teal:    #08705F;

  /* console side */
  --con-bg:    #141733;
  --con-bar:   #1B1F42;
  --con-line:  #2A2F5C;
  --con-text:  #D7DAF0;
  --con-dim:   #8A90B8;
  --con-key:   #B3A8FF;
  --con-str:   #43D9C3;
  --con-num:   #F2B661;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --side-w: 264px;
  --con-w:  460px;
  --measure: 66ch;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--violet); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { display: block; max-width: 100%; height: auto; }
code { font-family: var(--mono); }
ul, ol { list-style: none; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 4px; }
::selection { background: #DCD8FF; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px;
}
.skip:focus { top: 12px; }

/* ── Shell: sidebar | main | console ── */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr) var(--con-w);
  min-height: 100vh;
}

/* ── Sidebar ── */
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
  padding: 28px 22px;
  border-right: 1px solid var(--rule);
  background: var(--paper);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--con-bg); color: var(--con-str);
  font: 600 15px/1 var(--mono);
}
.brand-name { display: block; font-weight: 600; font-size: 16px; line-height: 1.2; }
.brand-role { display: block; font-size: 13.5px; color: var(--muted); }

.status {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--muted);
  padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #1FA971; box-shadow: 0 0 0 3px #1FA97126; flex: none; }

.menu-btn { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 13px; font-weight: 600; color: var(--faint); margin: 0 0 6px 10px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 7px;
  font: 500 14px/1.3 var(--mono); color: var(--muted); text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a:hover { background: #ECECF4; color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }

.m {
  display: inline-block; min-width: 42px; text-align: center;
  font: 600 12px/1 var(--mono); letter-spacing: .02em;
  padding: 4px 0; border-radius: 4px;
}
.m.get  { color: var(--teal);   background: #E1F4F0; }
.m.post { color: var(--violet); background: #E9E6FF; }

.side-links { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.side-links a { color: var(--muted); text-decoration: none; }
.side-links a:hover { color: var(--ink); text-decoration: underline; }

/* ── Main column ── */
.main { padding: 0 clamp(24px, 4vw, 64px); min-width: 0; }
.sec { padding: 72px 0; border-bottom: 1px solid var(--rule); max-width: 760px; }
.sec > p { max-width: var(--measure); color: var(--muted); }
.sec > p + p { margin-top: 1em; }

.sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.sec-head code { font-size: 14px; color: var(--muted); }
.sec-head h2 {
  flex-basis: 100%;
  font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em;
  margin-top: 6px;
}

/* Hello */
.hello { padding-top: 96px; }
.hello h1 {
  font-size: clamp(48px, 7vw, 84px); line-height: 1; font-weight: 700; letter-spacing: -.035em;
  margin-bottom: 22px;
}
.lede { font-size: clamp(19px, 2vw, 22px); line-height: 1.5; color: var(--ink) !important; max-width: 34ch !important; }
.lede { max-width: 38ch !important; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 44px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 20px; border-radius: 8px;
  font: 600 15px/1 var(--sans); text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: var(--violet); }
.btn-line { border: 1px solid #C9CBDC; color: var(--ink); background: var(--surface); }
.btn-line:hover { border-color: var(--ink); }

.facts { display: grid; gap: 0; max-width: 620px; border-top: 1px solid var(--rule); }
.facts > div { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font: 500 14px/1.6 var(--mono); color: var(--faint); }
.facts dd { font-size: 16px; color: var(--ink); }

/* Experience timeline (a real sequence) */
.timeline { position: relative; }
.job { display: grid; grid-template-columns: 150px 1fr; gap: 24px; padding: 22px 0; position: relative; }
.job + .job { border-top: 1px solid var(--rule); }
.job-when { font: 500 14px/1.7 var(--mono); color: var(--faint); padding-top: 1px; }
.job h3 { font-size: 19px; font-weight: 600; line-height: 1.35; }
.job-org { color: var(--muted); font-size: 15.5px; margin: 2px 0 10px; }
.job ul { display: grid; gap: 6px; max-width: var(--measure); }
.job li { position: relative; padding-left: 18px; color: var(--muted); font-size: 16px; }
.job li::before { content: ''; position: absolute; left: 2px; top: .72em; width: 6px; height: 1.5px; background: #A5A8C2; }
.job-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.job-tags code {
  font-size: 12.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule);
  padding: 3px 8px; border-radius: 5px;
}

/* Projects */
.proj h3 { font-size: 19px; font-weight: 600; margin: 16px 0 6px; line-height: 1.3; }
.proj p { color: var(--muted); font-size: 16px; }
.proj-img { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--rule); background: var(--con-bg); }
.proj-img img { aspect-ratio: 1200 / 627; width: 100%; object-fit: cover; }
a.proj-img img { transition: transform .4s ease; }
a.proj-img:hover img { transform: scale(1.02); }

.proj-lead { padding-bottom: 36px; margin-bottom: 36px; border-bottom: 1px solid var(--rule); }
.proj-lead h3 { font-size: 24px; margin-top: 20px; }
.proj-lead > p { max-width: var(--measure); }
.proj-notes { display: grid; gap: 6px; margin: 14px 0 0; max-width: var(--measure); }
.proj-notes li { position: relative; padding-left: 18px; color: var(--muted); font-size: 15.5px; }
.proj-notes li::before { content: ''; position: absolute; left: 2px; top: .72em; width: 6px; height: 1.5px; background: var(--violet); }

.proj-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: 15px; font-weight: 500; }
.proj-links span { color: var(--faint); }

.proj-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 28px; }
.proj-grid .proj-links { margin-top: 10px; }

/* Skills — a definition table, easy to scan */
.skills { width: 100%; border-collapse: collapse; max-width: 720px; }
.skills th, .skills td { text-align: left; vertical-align: top; padding: 13px 0; border-bottom: 1px solid var(--rule); }
.skills tr:first-child th, .skills tr:first-child td { border-top: 1px solid var(--rule); }
.skills th { width: 170px; font-weight: 600; font-size: 15.5px; padding-right: 16px; }
.skills td { color: var(--muted); font-size: 16px; }

/* Education */
.edu { display: flex; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.edu:first-of-type { border-top: 1px solid var(--rule); }
.edu h3 { font-size: 17.5px; font-weight: 600; line-height: 1.4; }
.edu p { color: var(--muted); font-size: 15.5px; }
.edu-grade { flex: none; text-align: right; color: var(--ink) !important; font-weight: 500; }
.cert { margin-top: 16px !important; font-size: 15.5px; }

/* Contact */
.contact-list { margin: 22px 0 28px; max-width: 560px; border-top: 1px solid var(--rule); }
.contact-list li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.contact-list span { font: 500 14px/1.7 var(--mono); color: var(--faint); }
.contact-list a { font-weight: 500; word-break: break-word; }

.foot { padding: 32px 0 48px; color: var(--faint); font-size: 14px; }

/* ── Console (desktop) ── */
.console {
  position: sticky; top: 0; height: 100vh;
  background: var(--con-bg); color: var(--con-text);
  display: flex; flex-direction: column;
  border-left: 1px solid #0C0E22;
}
.console-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--con-bar); border-bottom: 1px solid var(--con-line);
}
.console-title { font: 500 13px/1 var(--mono); color: var(--con-dim); }
.console-send {
  font: 500 12.5px/1 var(--mono); color: var(--con-text);
  background: transparent; border: 1px solid var(--con-line); border-radius: 6px;
  padding: 7px 10px; cursor: pointer;
}
.console-send:hover { border-color: var(--con-str); color: var(--con-str); }
.console-send:focus-visible { outline-color: var(--con-str); }
.console-body {
  flex: 1; overflow: auto; margin: 0;
  padding: 28px 24px 40px;
  font: 400 13.5px/1.75 var(--mono); white-space: pre; tab-size: 2;
  transition: opacity .18s ease;
}
.console-body.swap { opacity: 0; }

.c-cmd { color: var(--con-text); font-weight: 600; }
.c-url { color: var(--con-key); }
.c-status { color: var(--con-bg); background: var(--con-str); padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.c-key { color: var(--con-key); }
.c-str { color: var(--con-str); }
.c-num, .c-bool { color: var(--con-num); }
.c-dim { color: var(--con-dim); }
.caret { display: inline-block; width: 8px; height: 1.1em; background: var(--con-str); vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Inline responses — shown when the side console is hidden */
.inline-resp { display: none; margin-top: 26px; border-radius: 10px; overflow: hidden; background: var(--con-bg); max-width: 760px; }
.inline-resp summary {
  cursor: pointer; list-style: none;
  padding: 12px 16px; font: 500 13px/1 var(--mono); color: var(--con-dim);
  display: flex; justify-content: space-between; align-items: center;
}
.inline-resp summary::-webkit-details-marker { display: none; }
.inline-resp summary::after { content: '+'; font-size: 16px; color: var(--con-str); }
.inline-resp[open] summary::after { content: '−'; }
.inline-resp pre {
  margin: 0; padding: 4px 16px 18px; color: var(--con-text);
  font: 400 12.5px/1.7 var(--mono); white-space: pre; overflow-x: auto;
}

/* ── Responsive ── */
@media (max-width: 1240px) {
  :root { --con-w: 400px; --side-w: 240px; }
  .console-body { font-size: 12.5px; padding: 24px 18px; }
}
@media (max-width: 1080px) {
  .shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .console { display: none; }
  .inline-resp { display: block; }
}
@media (max-width: 820px) {
  body { font-size: 16px; }
  .shell { display: block; }
  .side {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 18px;
    border-right: 0; border-bottom: 1px solid var(--rule);
    background: rgba(246,246,250,.94); backdrop-filter: blur(10px);
    overflow: visible;
  }
  .brand-mark { width: 34px; height: 34px; font-size: 13px; }
  .status, .side-links { display: none; }
  .menu-btn {
    display: inline-flex; align-items: center; height: 38px; padding: 0 14px;
    font: 500 14px/1 var(--sans); color: var(--ink);
    background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; cursor: pointer;
  }
  .nav { display: none; flex-basis: 100%; padding: 6px 0 4px; }
  .nav.open { display: flex; }
  .nav-group { display: none; }
  .main { padding: 0 18px; }
  .sec { padding: 52px 0; }
  .hello { padding-top: 48px; }
  .sec-head h2 { font-size: 26px; }
  .job { grid-template-columns: 1fr; gap: 4px; }
  .proj-grid { grid-template-columns: 1fr; gap: 36px; }
  .skills th { width: 120px; }
  .edu { flex-direction: column; gap: 4px; }
  .edu-grade { text-align: left; }
}
@media (max-width: 820px) {
  .proj-links a, .contact-list a { display: inline-block; padding: 9px 0; }
  .proj-links { gap: 4px 22px; margin-top: 6px; }
  .contact-list li { align-items: center; padding: 4px 0; }
}
@media (max-width: 560px) {
  .inline-resp pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}
@media (max-width: 420px) {
  .actions .btn { flex: 1 1 100%; }
  .facts > div, .contact-list li { grid-template-columns: 1fr; gap: 0; }
  .skills, .skills tbody, .skills tr, .skills th, .skills td { display: block; width: auto; }
  .skills th { border-bottom: 0; padding-bottom: 0; }
  .skills tr:first-child td { border-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   Motion layer
   Everything below is skipped for prefers-reduced-motion.
   ============================================================ */

/* Cursor spotlight behind the reading column */
.main { position: relative; isolation: isolate; }
.spot {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, -20%), rgba(85,70,224,.075), transparent 70%);
  transition: opacity .3s;
}

/* Name decode */
.decode .ch { display: inline-block; min-width: .2em; }
.decode .ch.scr { color: var(--violet); }

/* Status dot pulse */
.status-dot { animation: pulse 2.4s ease-out infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 #1FA97155; }
  70%  { box-shadow: 0 0 0 8px #1FA97100; }
  100% { box-shadow: 0 0 0 0 #1FA97100; }
}

/* Sliding nav pill */
.nav { position: relative; }
.nav a { position: relative; z-index: 1; }
.nav a.active { background: transparent; box-shadow: none; }
.nav-pill {
  position: absolute; left: 0; right: 0; top: 0; height: 33px; z-index: 0;
  background: var(--surface); border-radius: 7px; box-shadow: inset 0 0 0 1px var(--rule), 0 1px 2px rgba(21,23,43,.04);
  transform: translateY(var(--pill-y, 0)); transition: transform .35s cubic-bezier(.3,.7,.2,1), opacity .2s;
  opacity: 0;
}
.nav-pill.on { opacity: 1; }

/* Request flow diagram */
.flow {
  display: grid; grid-template-columns: auto 1fr auto 1fr auto; align-items: center;
  gap: 0; margin: 0 0 40px; max-width: 640px;
}
.flow figcaption { grid-column: 1 / -1; margin-top: 12px; font-size: 14px; color: var(--faint); }
.flow-node {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--rule); min-width: 132px;
  transition: border-color .25s, box-shadow .25s, transform .25s;
}
.flow-node.hit { border-color: var(--violet); box-shadow: 0 0 0 4px #5546E01A; transform: translateY(-2px); }
.flow-node[data-n="2"].hit { border-color: var(--teal); box-shadow: 0 0 0 4px #0B7F6E1A; }
.flow-k { font: 600 14px/1.2 var(--sans); color: var(--ink); }
.flow-v { font: 400 12.5px/1.3 var(--mono); color: var(--faint); white-space: nowrap; }
.flow-wire { position: relative; height: 2px; margin: 0 8px; background: repeating-linear-gradient(90deg, #C9CBDC 0 6px, transparent 6px 11px); }
.pkt {
  position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  opacity: 0;
}
.pkt-req { background: var(--violet); box-shadow: 0 0 10px #5546E0aa; }
.pkt-res { background: var(--teal);   box-shadow: 0 0 10px #0B7F6Eaa; }
/* One 4s cycle: client→api→db, then db→api→client */
.flow-wire:nth-of-type(2) .pkt-req { animation: go 4s infinite;    animation-delay: 0s; }
.flow-wire:nth-of-type(4) .pkt-req { animation: go 4s infinite;    animation-delay: .7s; }
.flow-wire:nth-of-type(4) .pkt-res { animation: back 4s infinite;  animation-delay: 1.6s; }
.flow-wire:nth-of-type(2) .pkt-res { animation: back 4s infinite;  animation-delay: 2.3s; }
@keyframes go   { 0% { left: 0; opacity: 0; } 3% { opacity: 1; } 15% { left: calc(100% - 10px); opacity: 1; } 18%,100% { left: calc(100% - 10px); opacity: 0; } }
@keyframes back { 0% { left: calc(100% - 10px); opacity: 0; } 3% { opacity: 1; } 15% { left: 0; opacity: 1; } 18%,100% { left: 0; opacity: 0; } }

/* Scroll reveal */
.js-motion .rv { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.js-motion .rv.in { opacity: 1; transform: none; }

/* Timeline: rail that fills as you scroll, dots light up */
.timeline { --tl: 0; }
.timeline::before, .timeline::after {
  content: ''; position: absolute; left: 150px; top: 30px; bottom: 30px; width: 2px; border-radius: 2px;
}
.timeline::before { background: var(--rule); }
.timeline::after  { background: linear-gradient(var(--violet), var(--teal)); transform-origin: top; transform: scaleY(var(--tl)); }
.job { grid-template-columns: 150px 1fr; column-gap: 34px; }
.job::before {
  content: ''; position: absolute; left: 145px; top: 31px; width: 12px; height: 12px; border-radius: 50%; z-index: 1;
  background: var(--paper); border: 2px solid #C9CBDC; transition: border-color .3s, background .3s, box-shadow .3s;
}
.job.lit::before { border-color: var(--violet); background: var(--violet); box-shadow: 0 0 0 4px #5546E022; }
.job:first-child.lit::before { animation: pulse-v 2.4s ease-out infinite; }
@keyframes pulse-v { 0% { box-shadow: 0 0 0 0 #5546E055; } 70% { box-shadow: 0 0 0 9px #5546E000; } 100% { box-shadow: 0 0 0 0 #5546E000; } }

/* Project images: 3D tilt on hover */
.proj-img { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .25s ease, box-shadow .25s; will-change: transform; }
a.proj-img:hover { box-shadow: 0 18px 40px rgba(20,23,51,.18); }
a.proj-img:hover img { transform: scale(1.04); }

/* Buttons: small lift */
.btn { transition: background .15s, border-color .15s, color .15s, transform .15s; }
.btn:hover { transform: translateY(-1px); }

/* Tags pop on hover */
.job-tags code { transition: border-color .15s, color .15s, transform .15s; }
.job-tags code:hover { border-color: var(--violet); color: var(--violet); transform: translateY(-1px); }

/* Console states */
.console-state { display: inline-flex; align-items: center; gap: 8px; }
.console-state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--con-dim); }
.console-state.sending::before { background: var(--con-num); animation: blink .6s steps(1) infinite; }
.console-state.ok::before { background: var(--con-str); }
.console-body .c-status { animation: stamp .45s cubic-bezier(.2,1.6,.4,1); display: inline-block; }
@keyframes stamp { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.console-send:active { transform: scale(.97); }

/* Smaller screens: stack the flow diagram */
@media (max-width: 820px) {
  .timeline::before, .timeline::after { left: 5px; top: 28px; }
  .job { grid-template-columns: 1fr; padding-left: 30px; }
  .job::before { left: 0; top: 27px; }
}
@media (max-width: 560px) {
  .flow { grid-template-columns: 1fr; justify-items: start; }
  .flow-node { width: 100%; }
  .flow-wire { width: 2px; height: 26px; margin: 4px 0 4px 24px; background: repeating-linear-gradient(180deg, #C9CBDC 0 5px, transparent 5px 9px); }
  .pkt { left: 50% !important; margin-left: -5px; margin-top: 0; top: 0; }
  .flow-wire:nth-of-type(2) .pkt-req, .flow-wire:nth-of-type(4) .pkt-req { animation-name: down; }
  .flow-wire:nth-of-type(2) .pkt-res, .flow-wire:nth-of-type(4) .pkt-res { animation-name: up; }
  @keyframes down { 0% { top: 0; opacity: 0; } 3% { opacity: 1; } 15% { top: calc(100% - 10px); opacity: 1; } 18%,100% { opacity: 0; top: calc(100% - 10px); } }
  @keyframes up   { 0% { top: calc(100% - 10px); opacity: 0; } 3% { opacity: 1; } 15% { top: 0; opacity: 1; } 18%,100% { opacity: 0; top: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  .spot { display: none; }
  .pkt { display: none; }
  .proj-img { transform: none !important; }
  .js-motion .rv { opacity: 1; transform: none; }
  .timeline::after { transform: scaleY(1); }
}
