/* ==========================================================
   Rajesh Chowdhury — Portfolio
   Clean professional theme with automatic dark mode
   ========================================================== */

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #16191D;
  --ink-2: #2E343B;
  --muted: #5B636E;
  --line: #E6E4DE;
  --accent: #0E6B4F;
  --accent-hover: #0A5740;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4F1EB;
  --tag-bg: #F1F0EB;
  --shadow: 0 1px 2px rgba(22, 25, 29, .04), 0 8px 24px rgba(22, 25, 29, .05);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --container: 1080px;
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1214;
    --surface: #161A1E;
    --ink: #ECEEF0;
    --ink-2: #CDD2D7;
    --muted: #98A1AB;
    --line: #262C32;
    --accent: #3CC28F;
    --accent-hover: #5AD3A4;
    --accent-ink: #07130E;
    --accent-soft: rgba(60, 194, 143, .12);
    --tag-bg: #1D2227;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

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

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.mono { font-family: var(--mono); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  transition: color .15s ease, background-color .15s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--tag-bg); }
.nav-links a.active { color: var(--ink); }
.nav-links a.nav-cta {
  margin-left: 8px;
  color: var(--accent-ink);
  background: var(--accent);
}
.nav-links a.nav-cta:hover { background: var(--accent-hover); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
}
.nav-toggle span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s ease, top .2s ease;
}
.nav-toggle span:first-child { top: 15px; }
.nav-toggle span:last-child { top: 23px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.btn-ghost:hover { border-color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  padding-top: 112px;
  padding-bottom: 88px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.pass-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

.hero h1 {
  margin-top: 28px;
  font-size: clamp(2.4rem, 6.4vw, 4.4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.lead {
  margin-top: 24px;
  max-width: 640px;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 28px;
  font-size: 15px;
}
.hero-links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color .15s ease, border-color .15s ease;
  overflow-wrap: anywhere;
}
.hero-links a:hover { color: var(--accent); border-color: var(--accent); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 72px 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.stat dt {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.stat dd {
  margin: 6px 0 0;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---------- Sections ---------- */
.section {
  padding-top: 96px;
  padding-bottom: 8px;
}

.section-head { margin-bottom: 40px; }
.section-kicker {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 12px;
}
.section h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.subhead {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 48px 0 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 48px;
  align-items: start;
}
.prose p + p { margin-top: 18px; }
.prose p { color: var(--ink-2); }

.about-card { padding: 28px; }
.about-card h3 { font-size: 16px; margin-bottom: 16px; }
.facts li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.5;
}
.facts li span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 2px;
}

/* ---------- Experience timeline ---------- */
.timeline { border-top: 1px solid var(--line); }

.role {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.role-dates {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}
.role-place {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

.role-body h3 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.role-body h3 .at { color: var(--muted); font-weight: 500; }
.role-body > p { margin-top: 10px; color: var(--ink-2); }

.bullets { margin-top: 16px; }
.bullets li {
  position: relative;
  padding-left: 24px;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 16px;
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .55em;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}
.bullets strong { color: var(--ink); font-weight: 600; }

.role-compact .role-body > p { font-size: 16px; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.tags li {
  font-size: 13px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--tag-bg);
  color: var(--ink-2);
  border: 1px solid var(--line);
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.skill-card { padding: 24px; }
.skill-card h3 { font-size: 16px; font-weight: 600; }
.skill-card .tags { margin-top: 14px; }

/* ---------- Work ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.work-card {
  padding: 28px;
  transition: transform .2s ease, border-color .2s ease;
}
.work-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.work-type {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.work-card h3 { margin-top: 10px; font-size: 1.3rem; }
.work-card p:last-child { margin-top: 10px; color: var(--muted); font-size: 16px; }

.repo-list { border-top: 1px solid var(--line); }
.repo-list a {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background-color .15s ease;
}
.repo-list a:hover { background: var(--surface); }
.repo-list a:hover .repo-name { color: var(--accent); }
.repo-name { font-family: var(--mono); font-size: 15px; font-weight: 500; transition: color .15s ease; }
.repo-desc { color: var(--muted); font-size: 15px; }
.repo-lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lang-dot.java { background: #B07219; }

/* ---------- Learning ---------- */
.learning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.learning-grid .subhead { margin-top: 0; }
.cert-list { border-top: 1px solid var(--line); }
.cert-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.cert-name { font-weight: 600; font-size: 16px; }
.cert-org { font-size: 14px; color: var(--muted); }

/* ---------- Contact ---------- */
#contact { padding-bottom: 96px; }
.contact-card {
  text-align: center;
  padding: clamp(40px, 7vw, 72px) clamp(20px, 5vw, 64px);
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.contact-card h2 { margin-top: 4px; }
.contact-card > p:not(.section-kicker) {
  max-width: 520px;
  margin: 16px auto 0;
  color: var(--muted);
}
.contact-card .hero-actions { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 28px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.footer-status { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; }

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
.js .reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .role { grid-template-columns: 1fr; gap: 10px; }
  .role-meta { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
  .role-place { margin-top: 0; }
  .role-place::before { content: "· "; }
  .repo-list a { grid-template-columns: 1fr auto; }
  .repo-desc { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 760px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }

  .nav-toggle { display: block; }
  .nav-links {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 16px; }
  .nav-links a.nav-cta { margin: 8px 0 0; text-align: center; }

  .hero { padding-top: 64px; padding-bottom: 56px; }
  .stats { grid-template-columns: 1fr 1fr; margin-top: 48px; }
  .stat:last-child { grid-column: 1 / -1; }

  .section { padding-top: 72px; }
  .section-head { margin-bottom: 28px; }

  .skills-grid, .work-grid, .learning-grid { grid-template-columns: 1fr; }
  .learning-grid { gap: 40px; }

  .facts li { grid-template-columns: 84px 1fr; }
  .btn { flex: 1 1 auto; }
}
