/* ==========================================================================
   Parijat Majumdar — Portfolio
   Sections in this file:
   1. Design tokens   2. Base   3. Layout helpers   4. Header & nav
   5. Hero   6. Visual (SVG)   7. Projects   8. Pipeline   9. Skills
   10. About   11. Contact   12. Footer   13. Reveal & motion   14. Responsive
   ========================================================================== */

/* 1. DESIGN TOKENS ------------------------------------------------------- */
:root {
  --bg: #0B0D10;
  --surface: #141820;
  --surface-2: #10141b;
  --text: #F3F4F6;
  --muted: #9CA3AF;
  --accent: #67E8F9;
  --accent-soft: rgba(103, 232, 249, 0.10);
  --accent-line: rgba(103, 232, 249, 0.35);
  --border: #27303D;

  --font-head: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --container: 1180px;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --section-space: clamp(4.5rem, 9vw, 8rem);
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* 2. BASE ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--accent); color: var(--bg);
  padding: 0.6rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

/* 3. LAYOUT HELPERS & TYPE ---------------------------------------------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.small { font-size: 0.78rem; }
.tiny { font-size: 0.68rem; }

.eyebrow {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-mono); font-size: 0.74rem;
  color: var(--accent); letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.eyebrow__line { width: 22px; height: 1px; background: var(--accent); }

.display {
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(3.2rem, 8.5vw, 6rem);
  line-height: 0.98; letter-spacing: -0.035em;
}
.display--md { font-size: clamp(2.6rem, 6vw, 4.2rem); }

.h2 {
  font-family: var(--font-head); font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.12; letter-spacing: -0.025em;
}

.lead {
  font-family: var(--font-head);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  color: var(--muted); line-height: 1.4; max-width: 24ch;
}

.section { padding-block: var(--section-space); border-top: 1px solid var(--border); }
.section--last { padding-bottom: calc(var(--section-space) * 0.9); }

.section__head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 2rem; margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section__aside { max-width: 34ch; color: var(--muted); font-size: 0.95rem; }

.split { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.split__note { margin-top: 1.25rem; max-width: 34ch; font-size: 0.95rem; }

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.85rem 1.35rem; border-radius: var(--radius-sm);
  font-size: 0.92rem; font-weight: 600; border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn--primary { background: var(--accent); color: var(--bg); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px -10px var(--accent); }
.btn--ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted);
  padding: 0.3rem 0.65rem; border: 1px solid var(--border); border-radius: 5px;
  background: rgba(255, 255, 255, 0.015);
}

/* 4. HEADER & NAV -------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(11, 13, 16, 0.92);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }

.logo { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }

.site-nav { display: flex; gap: clamp(1rem, 2.4vw, 2rem); font-size: 0.85rem; color: var(--muted); }
.site-nav a { padding: 0.25rem 0; transition: color 0.2s; position: relative; }
.site-nav a:hover, .site-nav a.is-active { color: var(--accent); }

.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 0; background: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; flex-direction: column; justify-content: center; align-items: center; gap: 5px;
}
.nav-toggle span { width: 18px; height: 1.5px; background: var(--text); transition: transform 0.25s var(--ease), opacity 0.2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* 5. HERO ---------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding-top: clamp(2.5rem, 6vw, 5rem); }

/* Technical grid that drifts very slowly */
.hero__grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.28;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 35%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 70% 35%, #000 20%, transparent 75%);
  animation: grid-drift 24s linear infinite;
}
@keyframes grid-drift { to { background-position: 56px 56px, 56px 56px; } }

.hero__inner {
  position: relative;
  display: grid; grid-template-columns: 1fr 1.08fr;
  gap: clamp(2rem, 5vw, 4rem); align-items: center;
  padding-bottom: clamp(3rem, 6vw, 5rem);
}
.hero__copy .display { margin: 1.25rem 0 1.5rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.hero__domain { margin-top: 1.25rem; font-size: 0.74rem; }

.badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em;
  color: var(--accent); transition: border-color 0.2s, background 0.2s;
}
.badge:hover { border-color: var(--accent); background: rgba(103, 232, 249, 0.16); }

.focus {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  padding: 1.4rem 0 0; font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.focus li:not(:first-child) { text-align: center; }
.focus li:last-child { text-align: right; }
.focus li:nth-child(2) { text-align: center; }
.focus li:nth-child(1) { text-align: left; }
.hero .container:last-child { padding-bottom: 3rem; }

/* 6. VISUAL (SVG) -------------------------------------------------------- */
.vis__frame {
  background: linear-gradient(180deg, #121720, #0e1218);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 0.85rem 1rem 0.75rem;
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.03), 0 30px 80px -40px rgba(103, 232, 249, 0.25);
  overflow: hidden;
}
.vis__head { display: flex; justify-content: space-between; align-items: center; font-size: 0.68rem; letter-spacing: 0.06em; }
.vis__status { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 2.4s ease-in-out infinite; }
.vis__svg { width: 100%; height: auto; margin-block: 0.25rem; }
.vis__label { font-family: var(--font-mono); font-size: 9px; fill: var(--muted); letter-spacing: 0.06em; }
.vis__telemetry {
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem;
  font-size: 0.66rem; color: var(--muted); padding-top: 0.2rem;
}
.vis__telemetry b { color: var(--text); font-weight: 500; }
.vis__note { margin-left: auto; }
.vis__caps { display: flex; justify-content: space-between; margin-top: 0.8rem; font-size: 0.66rem; color: var(--muted); letter-spacing: 0.06em; }

.vis__traj { filter: drop-shadow(0 0 5px rgba(103, 232, 249, 0.55)); }
.vis__goal-ring { transform-box: fill-box; transform-origin: center; animation: ring 2.6s ease-out infinite; }
.vis__scan { animation: scan 6s linear infinite; }
@keyframes scan { 0% { transform: translateY(-20px); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(190px); opacity: 0; } }
@keyframes ring { 0% { transform: scale(0.8); opacity: 0.9; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Draw the trajectory once the visual scrolls into view (only when JS is on) */
.js .vis .vis__traj { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .vis.is-visible .vis__traj { animation: draw 2.2s var(--ease) 0.2s forwards; }
.js .vis .vis__rover { opacity: 0; }
.js .vis.is-visible .vis__rover { opacity: 1; transition: opacity 0.3s 2.4s; }

/* 7. PROJECTS ------------------------------------------------------------ */
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: clamp(1.4rem, 3vw, 2.5rem);
  margin-bottom: 1.75rem;
  transition: border-color 0.3s, transform 0.3s var(--ease);
}
.project:hover { border-color: #34414f; }
.project--feature { border-color: var(--accent-line); background: linear-gradient(180deg, #151b24, var(--surface)); }
.project--feature:hover { border-color: var(--accent); }

.project__grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.project__copy { display: flex; flex-direction: column; align-items: flex-start; gap: 1.1rem; }
.project__copy .eyebrow { margin: 0; }
.project__title { font-family: var(--font-head); font-weight: 600; font-size: clamp(2.2rem, 4.5vw, 3.2rem); letter-spacing: -0.02em; line-height: 1; }
.project__title--md { font-size: clamp(1.9rem, 3.6vw, 2.5rem); }
.project__tagline { font-family: var(--font-head); font-size: 1.3rem; color: var(--text); }
.project__text { color: var(--muted); font-size: 0.95rem; max-width: 46ch; }

.mini-pipe { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.7rem; color: var(--accent); }
.mini-pipe li:not(:last-child)::after { content: "→"; margin-left: 0.4rem; color: var(--muted); }

.link { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; font-weight: 500; color: var(--accent); }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }
.link--off { color: var(--muted); font-weight: 400; }
.link .icon { width: 18px; height: 18px; }

.award {
  display: flex; gap: 0.85rem; align-items: center; width: 100%;
  padding: 0.85rem 1rem; border: 1px solid var(--accent-line); border-radius: var(--radius);
  background: var(--accent-soft);
}
.award__icon { color: var(--accent); flex: none; }
.award__title { font-family: var(--font-head); font-weight: 600; font-size: 0.95rem; }
.award__meta { font-size: 0.78rem; color: var(--muted); line-height: 1.45; }

/* Medical illustrations */
.med { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.med__panel {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.8rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.med__panel figcaption { font-size: 0.66rem; color: var(--muted); }
.med__panel svg { width: 100%; height: auto; }
.med__caption { margin-top: 0.9rem; font-size: 0.66rem; }
.med__roi { animation: blink 3s ease-in-out infinite; }
.med__scan { transform-box: fill-box; transform-origin: center; animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Terminal */
.terminal { background: #0c1016; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.terminal__bar { display: flex; align-items: center; gap: 0.9rem; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--border); font-size: 0.68rem; color: var(--muted); }
.terminal__dots { display: flex; gap: 5px; }
.terminal__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.terminal__dots i:last-child { background: var(--accent); }
.terminal__body { padding: 1rem; font-size: 0.8rem; line-height: 1.8; color: var(--muted); min-height: 130px; white-space: pre-wrap; }
.cursor { display: inline-block; width: 7px; height: 1em; background: var(--accent); vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }

/* 8. PIPELINE ------------------------------------------------------------ */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; position: relative; }
.pipeline__rail { position: relative; height: 14px; margin-bottom: 1.6rem; }
.pipeline__rail::before { /* connecting line to the next node */
  content: ""; position: absolute; left: 6px; right: calc(-1.5rem - 6px); top: 6px; height: 1px;
  background: linear-gradient(90deg, var(--accent-line), var(--border));
}
.pipeline__step:last-child .pipeline__rail::before { right: 0; background: linear-gradient(90deg, var(--accent-line), transparent); }
.pipeline__node {
  position: absolute; left: 0; top: 0; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.pipeline__icon {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 1.4rem;
  color: var(--accent); background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.pipeline__step:hover .pipeline__icon { border-color: var(--accent); transform: translateY(-3px); }
.pipeline__name { font-family: var(--font-mono); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.06em; margin-bottom: 0.6rem; }
.pipeline__text { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; max-width: 30ch; }
.pipeline__note { margin-top: 3rem; }

/* 9. SKILLS -------------------------------------------------------------- */
.skills { display: flex; flex-direction: column; }
.skills__row { padding: 1.5rem 0; border-top: 1px solid var(--border); display: grid; gap: 0.9rem; }
.skills__row:last-child { border-bottom: 1px solid var(--border); }
.skills__title { display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-head); font-weight: 500; font-size: 1.2rem; }
.skills__icon { color: var(--accent); display: grid; }
.skills__icon .icon { width: 20px; height: 20px; }
.skills .chips li { transition: border-color 0.2s, color 0.2s; }
.skills .chips li:hover { border-color: var(--accent-line); color: var(--text); }

/* 10. ABOUT -------------------------------------------------------------- */
.person { display: flex; align-items: center; gap: 0.9rem; margin-top: 2rem; }
.person__avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--accent); font-size: 0.85rem; }
.person__name { font-weight: 500; font-size: 0.95rem; line-height: 1.3; }

.about { display: flex; flex-direction: column; gap: 1.4rem; color: var(--muted); max-width: 62ch; }
.about__lead { font-family: var(--font-head); font-size: clamp(1.3rem, 2.6vw, 1.75rem); line-height: 1.35; color: var(--text); letter-spacing: -0.01em; }

.achievement {
  display: flex; gap: 1.1rem; align-items: flex-start; margin-top: 0.6rem;
  padding: 1.4rem 1.5rem; border-radius: var(--radius);
  border: 1px solid var(--accent-line); background: var(--accent-soft);
}
.achievement__icon { color: var(--accent); margin-top: 0.15rem; }
.achievement__icon .icon { width: 28px; height: 28px; }
.achievement__title { font-family: var(--font-head); font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 500; color: var(--text); margin: 0.2rem 0 0.35rem; line-height: 1.25; }

/* 11. CONTACT ------------------------------------------------------------ */
.contact__cta { margin-top: 1.75rem; }
.contact { display: flex; flex-direction: column; }
.contact__row { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1.15rem 0.25rem; border-bottom: 1px solid var(--border); transition: padding 0.25s var(--ease), background 0.25s; }
.contact li:first-child .contact__row { border-top: 1px solid var(--border); }
a.contact__row:hover { padding-left: 0.9rem; background: var(--accent-soft); }
.contact__icon { color: var(--accent); display: grid; }
.contact__label { display: block; font-family: var(--font-head); font-size: 1.1rem; font-weight: 500; line-height: 1.3; }
.contact__hint { display: block; word-break: break-all; }
.contact__state { font-size: 0.68rem; }
.contact__row--off { opacity: 0.8; }
.contact__foot { padding-top: 1.1rem; }

/* 12. FOOTER ------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding-block: 1.75rem; }
.site-footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: 0.72rem; }

.not-found { min-height: 70vh; display: grid; align-items: center; border-top: 0; }
.not-found .lead { margin: 1.5rem 0 2rem; }

/* 13. REVEAL & MOTION ---------------------------------------------------- */
/* Elements marked data-reveal fade in once, only when JavaScript is available */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js .vis .vis__traj { stroke-dasharray: none; stroke-dashoffset: 0; }
  .js .vis .vis__rover { opacity: 0; }
}

/* 14. RESPONSIVE --------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero__inner { grid-template-columns: 1fr; }
  .lead { max-width: 32ch; }
  .project__grid { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, 1fr); row-gap: 2.5rem; }
  .pipeline__step:nth-child(2) .pipeline__rail::before { background: linear-gradient(90deg, var(--accent-line), transparent); right: 0; }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 0.5rem var(--gutter) 1.25rem;
    background: var(--bg); border-bottom: 1px solid var(--border);
    font-size: 1rem;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s var(--ease), visibility 0.25s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .site-nav a { padding: 0.9rem 0; border-bottom: 1px solid var(--border); }
  .site-header.is-open { border-bottom-color: var(--border); }

  .section__head { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .focus { grid-template-columns: 1fr 1fr; gap: 0.9rem; }
  .focus li, .focus li:nth-child(n) { text-align: left; }
  .vis__note { margin-left: 0; width: 100%; }
  .vis__caps span:nth-child(n+3) { display: none; }
  .med { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: 1fr; }
  .pipeline__rail::before { display: none; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
  .contact__row { grid-template-columns: auto 1fr; }
  .contact__state { grid-column: 2; }
}
