/* Sagar Gupta — Portfolio
   Visual direction: cool stone + ink + single sharp accent (no purple / cream / glass) */

:root {
  --bg: #eef1f4;
  --bg-alt: #e4e9ee;
  --surface: #f7f8fa;
  --ink: #12151a;
  --ink-soft: #3a424d;
  --muted: #5c6673;
  --line: #c8d0d9;
  --accent: #0f6e56;
  --accent-ink: #0a4f3d;
  --header-h: 64px;
  --max: 1180px;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --text: 1.125rem; /* 18px */
  --text-card: 1.0625rem; /* 17px */
  --heading: clamp(2.75rem, 4vw, 3.25rem); /* ~44–52px */
  --card-title: 1.3125rem; /* 21px */
  --card-pad: 1.875rem; /* 30px */
  --section-y: 4rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

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

img {
  max-width: 100%;
  display: block;
}

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

ul {
  list-style: none;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(238, 241, 244, 0.88);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(247, 248, 250, 0.94);
}

.nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-menu a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: var(--ink);
}

.nav-cta {
  color: var(--accent-ink) !important;
  font-weight: 600 !important;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* Hero */
.hero {
  position: relative;
  min-height: auto;
  display: flex;
  align-items: flex-start;
  overflow: visible;
  border-bottom: 1px solid var(--line);
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(238, 241, 244, 0.2) 0%, rgba(238, 241, 244, 0.92) 58%, var(--bg) 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 47px,
      rgba(18, 21, 26, 0.045) 47px,
      rgba(18, 21, 26, 0.045) 48px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 47px,
      rgba(18, 21, 26, 0.045) 47px,
      rgba(18, 21, 26, 0.045) 48px
    ),
    linear-gradient(135deg, #d9e2ea 0%, #eef1f4 42%, #dfe8e4 100%);
  transform: scale(1.02);
  animation: heroDrift 18s var(--ease) infinite alternate;
  pointer-events: none;
}

.hero-bg::after {
  content: "";
  position: absolute;
  right: -8%;
  top: 10%;
  width: min(52vw, 560px);
  height: min(52vw, 560px);
  border: 1px solid rgba(15, 110, 86, 0.28);
  border-radius: 50%;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.75rem 3.25rem;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  padding: 0.2em 0.02em 0.15em;
  overflow: visible;
  display: block;
  /* opacity-only fade — transform clips Syne glyph tops in Chrome */
  animation: fadeIn 0.7s var(--ease) both;
}

.hero-role {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.7s var(--ease) 0.06s both;
}

#hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.4vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.28;
  max-width: 18ch;
  margin-bottom: 1.15rem;
  animation: fadeIn 0.7s var(--ease) 0.12s both;
}

.hero-support {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 42rem;
  margin-bottom: 1.75rem;
  animation: fadeIn 0.7s var(--ease) 0.18s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  animation: fadeIn 0.7s var(--ease) 0.24s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes heroDrift {
  from {
    transform: scale(1.02) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.05) translate3d(-1.2%, -0.8%, 0);
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.35rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--ink);
  color: #f5f7f9;
}

.btn-primary:hover {
  background: #000;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  min-height: 42px;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  align-self: flex-start;
}

.btn-ghost:hover,
.btn-ghost[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Sections */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--section-y) 1.75rem;
}

.section-alt {
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-alt > .section-head,
.section-alt > .capability-grid,
.section-alt > .approach-list,
.section-alt > .stack-grid {
  max-width: var(--max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.75rem;
  padding-right: 1.75rem;
}

.section-head {
  margin-bottom: 1.75rem;
  max-width: 46rem;
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 0.6rem;
}

.section-head h2,
.about-layout h2,
.contact-inner h2 {
  font-family: var(--font-display);
  font-size: var(--heading);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

/* AI projects */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: var(--card-pad);
  display: grid;
  gap: 0.75rem;
  transition: border-color 0.25s ease;
}

.project-card:hover {
  border-color: #9eabb8;
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: var(--card-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.project-purpose {
  color: var(--ink-soft);
  font-size: var(--text-card);
  line-height: 1.6;
}

.project-built {
  color: var(--muted);
  font-size: var(--text-card);
  line-height: 1.6;
}

.project-built span {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-right: 0.55rem;
}

.project-tech {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding-top: 0.65rem;
  margin-top: 0.15rem;
  border-top: 1px solid var(--line);
}

.project-detail {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-top: 0.15rem;
}

.project-detail[hidden] {
  display: none !important;
}

.project-detail.is-open {
  display: block;
}

.project-detail ul {
  display: grid;
  gap: 0.55rem;
}

.project-detail li {
  position: relative;
  padding-left: 1rem;
  color: var(--ink-soft);
  font-size: var(--text-card);
  line-height: 1.6;
}

.project-detail li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Capabilities */
.capability-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem 1.5rem;
}

.capability {
  border-top: 2px solid var(--ink);
  padding: 1.1rem 0.1rem 0.25rem;
}

.capability h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.capability p {
  font-size: var(--text-card);
  line-height: 1.55;
  color: var(--muted);
}

/* Production work */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.work-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: var(--card-pad);
}

.work-item h3 {
  font-family: var(--font-display);
  font-size: var(--card-title);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.2rem;
}

.work-tag {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-ink);
  margin-bottom: 0.55rem;
}

.work-item p:last-child {
  color: var(--ink-soft);
  font-size: var(--text-card);
  line-height: 1.6;
}

/* Approach */
.approach-list {
  list-style: none;
  display: grid;
  gap: 0;
  counter-reset: step;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
}

.approach-list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 4.5rem 10rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 1.15rem 1.75rem;
  border-bottom: 1px solid var(--line);
}

.approach-list li:last-child {
  border-bottom: none;
}

.approach-list li::before {
  content: "0" counter(step);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-ink);
}

.approach-list strong {
  font-family: var(--font-display);
  font-size: 1.1875rem;
}

.approach-list span {
  color: var(--muted);
  font-size: var(--text-card);
  line-height: 1.55;
}

/* Experience */
.experience-list {
  display: grid;
  gap: 1.35rem;
}

.experience-item {
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}

.experience-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.experience-item h3 {
  font-family: var(--font-display);
  font-size: var(--card-title);
  margin-bottom: 0.4rem;
}

.experience-item p {
  color: var(--ink-soft);
  max-width: 58rem;
  font-size: var(--text-card);
  line-height: 1.65;
}

/* Stack */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 2.25rem;
}

.stack-grid h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.stack-grid p {
  color: var(--muted);
  font-size: var(--text-card);
  line-height: 1.55;
}

/* About */
.about-layout {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 2.5rem;
  align-items: start;
}

.about-copy {
  display: grid;
  gap: 0.85rem;
  color: var(--ink-soft);
  font-size: var(--text);
  line-height: 1.65;
}

/* Contact */
.contact-section {
  max-width: none;
  background: var(--ink);
  color: #e8edf2;
  border-top: none;
  padding: 4.25rem 1.75rem;
}

.contact-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.contact-inner h2 {
  color: #f5f7f9;
  max-width: 16ch;
  margin-bottom: 0.85rem;
}

.contact-inner > p {
  color: #b7c0ca;
  max-width: 38rem;
  margin-bottom: 1.5rem;
  font-size: var(--text);
  line-height: 1.65;
}

.contact-section .btn-primary {
  background: #f5f7f9;
  color: var(--ink);
}

.contact-section .btn-primary:hover {
  background: #fff;
}

.contact-email {
  margin-top: 1.25rem;
  font-size: 0.95rem;
}

.contact-email a {
  color: #9fb0a8;
  border-bottom: 1px solid transparent;
}

.contact-email a:hover {
  color: #d7e4de;
  border-bottom-color: currentColor;
}

/* Footer */
.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--ink);
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 980px) {
  .capability-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .approach-list li {
    grid-template-columns: 3.5rem 1fr;
  }

  .approach-list li span {
    grid-column: 2;
  }

  .stack-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-menu {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.5rem 1.25rem;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
  }

  .nav-menu.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-menu li {
    width: 100%;
  }

  .nav-menu a {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-menu li:last-child a {
    border-bottom: none;
  }

  .hero-inner {
    padding: 1.35rem 1.5rem 2.5rem;
  }

  .work-grid,
  .capability-grid,
  .stack-grid {
    grid-template-columns: 1fr;
  }

  .section,
  .contact-section {
    padding-top: 3.25rem;
    padding-bottom: 3.25rem;
  }

  .section-head {
    margin-bottom: 1.35rem;
  }

  .project-card,
  .work-item {
    padding: 1.5rem;
  }

  #hero-title {
    max-width: none;
  }
}

@media (min-width: 1440px) {
  :root {
    --max: 1200px;
    --heading: 3.25rem;
  }
}

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

  .hero-bg,
  .reveal,
  .hero-name,
  .hero-role,
  #hero-title,
  .hero-support,
  .hero-actions {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
