/* ==========================================================================
   DARSHAN NAYAK — Portfolio
   Apple Design System — Precise Token Implementation
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  font-family: "SF Pro Text", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: #1d1d1f;
  background: #fff;
  overflow-x: hidden;
}

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

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

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

::selection {
  background: #1d1d1f;
  color: #fff;
}

/* ---------- Design Tokens (Apple Spec) ---------- */
:root {
  /* Colors */
  --primary: #0066cc;
  --primary-focus: #0071e3;
  --primary-on-dark: #2997ff;
  --ink: #1d1d1f;
  --ink-muted-80: #333333;
  --ink-muted-48: #86868b;
  --on-dark: #ffffff;
  --body-muted: #cccccc;
  --canvas: #ffffff;
  --canvas-parchment: #f5f5f7;
  --surface-tile-1: #161617;
  --surface-tile-2: #1a1a1c;
  --surface-black: #000000;
  --hairline: #e0e0e0;
  --divider-soft: rgba(0, 0, 0, 0.04);

  /* Spacing */
  --sp-xs: 8px;
  --sp-sm: 12px;
  --sp-md: 17px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-xxl: 48px;
  --sp-section: 80px;

  /* Layout */
  --max-w: 980px;
  --max-w-wide: 1120px;
  --nav-h: 44px;

  /* Radius */
  --r-sm: 8px;
  --r-lg: 18px;
  --r-pill: 9999px;

  /* Motion */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --dur: 0.4s;
}

/* ---------- Typography Classes ---------- */
.t-hero {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 56px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.5px;
}

.t-display-lg {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
}

.t-lead {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.196px;
}

.t-lead-airy {
  font-family: "SF Pro Text", system-ui, -apple-system, sans-serif;
  font-size: 21px;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0;
}

.t-tagline {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
}

.t-caption {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: -0.224px;
}

.t-caption-strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.29;
  letter-spacing: -0.224px;
}

.t-fine {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.33;
  letter-spacing: -0.12px;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(22, 22, 23, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: transform var(--dur) var(--ease);
}

.nav--hidden {
  transform: translateY(-100%);
}

.nav__inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 var(--sp-lg);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.374px;
  color: var(--on-dark);
}

.nav__links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav__link {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.2s var(--ease);
}

.nav__link:hover {
  color: var(--on-dark);
}

/* Mobile toggle */
.nav__toggle {
  display: none;
  width: 18px;
  height: 18px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  z-index: 1001;
}

.nav__toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--on-dark);
  transition: all var(--dur) var(--ease);
  transform-origin: center;
}

.nav__toggle.active span:first-child {
  transform: rotate(45deg) translate(2.5px, 2.5px);
}

.nav__toggle.active span:last-child {
  transform: rotate(-45deg) translate(2.5px, -2.5px);
}

/* Mobile overlay */
.nav__mobile {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.97);
  backdrop-filter: blur(20px);
  z-index: 999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--sp-xl);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.nav__mobile.active {
  opacity: 1;
  pointer-events: all;
}

.nav__mobile-link {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--on-dark);
  letter-spacing: -0.28px;
  transition: color 0.2s var(--ease);
}

.nav__mobile-link:hover {
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- Tiles (Full-Bleed Sections) ---------- */
.tile {
  padding: var(--sp-section) var(--sp-lg);
  position: relative;
}

.tile--white {
  background: var(--canvas);
  color: var(--ink);
}

.tile--parchment {
  background: var(--canvas-parchment);
  color: var(--ink);
}

.tile--dark {
  background: var(--surface-tile-1);
  color: var(--on-dark);
}

.tile--dark-2 {
  background: var(--surface-tile-2);
  color: var(--on-dark);
}

.tile--black {
  background: var(--surface-black);
  color: var(--on-dark);
}

.tile__inner {
  max-width: var(--max-w);
  margin: 0 auto;
}

.tile__inner--wide {
  max-width: var(--max-w-wide);
}

/* Section labels */
.tile__label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.224px;
  color: var(--ink-muted-48);
  margin-bottom: var(--sp-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tile--dark .tile__label,
.tile--dark-2 .tile__label,
.tile--black .tile__label {
  color: var(--body-muted);
}

/* Links on dark */
.tile--dark a.text-link,
.tile--dark-2 a.text-link,
.tile--black a.text-link {
  color: var(--primary-on-dark);
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px var(--sp-lg) var(--sp-section);
  background: var(--surface-black);
  color: var(--on-dark);
  position: relative;
  overflow: hidden;
}

/* Subtle background — faint radial glow */
.hero::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 900px;
  height: 900px;
  background: radial-gradient(circle,
      rgba(0, 102, 204, 0.08) 0%,
      rgba(0, 102, 204, 0.03) 35%,
      transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero>* {
  position: relative;
  z-index: 1;
}

.hero__canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__eyebrow {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.224px;
  color: var(--primary-on-dark);
  margin-bottom: var(--sp-md);
}

.hero__title {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.5px;
  color: var(--on-dark);
  max-width: 800px;
  margin-bottom: var(--sp-lg);
}

.hero__description {
  font-size: 21px;
  font-weight: 300;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  max-width: 520px;
  margin-bottom: var(--sp-xxl);
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xl);
  flex-wrap: wrap;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 400;
  color: var(--primary-on-dark);
  letter-spacing: -0.374px;
  transition: gap 0.3s var(--ease);
}

.hero__cta:hover {
  gap: 10px;
}

.hero__cta-arrow {
  font-size: 20px;
  transition: transform 0.3s var(--ease);
}

/* ---------- About ---------- */
.about__content {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 80px;
  align-items: center;
}

.about__photo {
  width: 100%;
  border-radius: var(--r-lg);
}

.about__text {
  max-width: 520px;
}

.about__bio {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink-muted-80);
  margin-bottom: var(--sp-lg);
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-lg);
  margin-top: var(--sp-xxl);
  padding-top: var(--sp-xxl);
  border-top: 1px solid var(--hairline);
}

.stat__number {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 4px;
}

.stat__label {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted-48);
  letter-spacing: -0.224px;
}

/* ---------- Work: Category Tabs ---------- */
.work__tabs {
  display: flex;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-xxl);
  flex-wrap: wrap;
}

.work__tab {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.224px;
  color: var(--ink-muted-48);
  background: var(--canvas-parchment);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.work__tab:hover {
  color: var(--ink);
  border-color: var(--ink-muted-48);
}

.work__tab.active {
  background: var(--ink);
  color: var(--on-dark);
  border-color: var(--ink);
}

/* ---------- Work: Project Grid ---------- */
.work__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-lg);
}

.project {
  background: var(--canvas-parchment);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform 0.3s var(--ease);
}

.project:hover {
  transform: scale(1.01);
}

.project[hidden] {
  display: none;
}

.project__image-wrapper {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #e8e8ed;
}

.project__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.project:hover .project__image {
  transform: scale(1.04);
}

.project__info {
  padding: var(--sp-lg);
}

.project__category {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--ink-muted-48);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.project__title {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
  color: var(--ink);
  margin-bottom: var(--sp-xs);
}

.project__description {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: -0.224px;
  color: var(--ink-muted-48);
  margin-bottom: var(--sp-md);
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project__tag {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--ink-muted-80);
  background: rgba(0, 0, 0, 0.04);
  padding: 4px 10px;
  border-radius: var(--r-pill);
}

/* ---------- Experience Timeline ---------- */
.timeline {
  position: relative;
  padding-left: var(--sp-xl);
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.15);
}

.timeline__item {
  position: relative;
  padding-bottom: var(--sp-xxl);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sp-xl));
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-on-dark);
  transform: translateX(-2.5px);
}

.timeline__period {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--body-muted);
  margin-bottom: 4px;
}

.timeline__role {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.231px;
  color: var(--on-dark);
  margin-bottom: 2px;
}

.timeline__company {
  font-size: 14px;
  font-weight: 400;
  color: var(--body-muted);
  margin-bottom: var(--sp-xs);
}

.timeline__desc {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: -0.224px;
  color: rgba(255, 255, 255, 0.6);
  max-width: 480px;
}

/* ---------- Achievements ---------- */
.achievements__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-lg);
}

.achievement {
  padding: var(--sp-lg);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.achievement__place {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-on-dark);
  letter-spacing: -0.12px;
  margin-bottom: 4px;
}

.achievement__event {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.374px;
  color: var(--on-dark);
  margin-bottom: var(--sp-xs);
}

.achievement__detail {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  color: rgba(255, 255, 255, 0.6);
}

/* Marquee — Sliding Photo Loop */
.marquee {
  margin-top: var(--sp-xxl);
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
}

.marquee__track {
  display: flex;
  gap: var(--sp-sm);
  width: max-content;
  animation: slide 25s linear infinite;
}

.marquee:hover .marquee__track {
  animation-play-state: paused;
}

.marquee__img {
  flex: 0 0 auto;
  width: 280px;
  height: 190px;
  object-fit: cover;
  border-radius: var(--r-sm);
}

@keyframes slide {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - var(--sp-sm) / 2)); }
}

/* ---------- Research ---------- */
.research__grid {
  display: grid;
  gap: 0;
}

.research__item {
  padding: var(--sp-lg) 0;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-lg);
}

.research__item:first-child {
  padding-top: 0;
}

.research__item:last-child {
  border-bottom: none;
}

.research__meta {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--ink-muted-48);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.research__title {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.231px;
  color: var(--ink);
  margin-bottom: var(--sp-xs);
}

.research__desc {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink-muted-48);
  max-width: 600px;
}

.research__text {
  flex: 1;
}

.research__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--primary);
  font-size: 17px;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.research__link span {
  font-size: 18px;
  transition: transform 0.3s var(--ease);
}

.research__link:hover span {
  transform: translateX(4px);
}

/* ---------- Skills ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-xxl);
}

.skills__category-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.224px;
  color: var(--on-dark);
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.skills__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skills__item {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: -0.224px;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- Education ---------- */
.education__grid {
  display: grid;
  gap: 0;
}

.education__item {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--sp-lg);
  padding: var(--sp-md) 0;
  border-bottom: 1px solid var(--hairline);
  align-items: baseline;
}

.education__item:last-child {
  border-bottom: none;
}

.education__years {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted-48);
  letter-spacing: -0.224px;
}

.education__name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.374px;
  color: var(--ink);
  margin-bottom: 2px;
}

.education__program {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-muted-48);
  letter-spacing: -0.224px;
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
}

.contact__title {
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: var(--sp-md);
}

.contact__description {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink-muted-48);
  max-width: 460px;
  margin: 0 auto var(--sp-xxl);
}

.contact__email {
  display: inline-block;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.231px;
  color: var(--primary);
  margin-bottom: var(--sp-xxl);
  transition: opacity 0.2s var(--ease);
}

.contact__email:hover {
  opacity: 0.7;
}

.contact__socials {
  display: flex;
  justify-content: center;
  gap: var(--sp-sm);
}

.contact__social-link {
  font-size: 14px;
  font-weight: 400;
  color: var(--primary);
  letter-spacing: -0.224px;
  padding: 8px 20px;
  border: 1px solid var(--primary);
  border-radius: var(--r-pill);
  transition: all 0.2s var(--ease);
}

.contact__social-link:hover {
  background: var(--primary);
  color: var(--on-dark);
}

/* ---------- Footer ---------- */
.footer {
  padding: var(--sp-lg);
  background: var(--canvas-parchment);
  text-align: center;
}

.footer__text {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--ink-muted-48);
}

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

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

/* ---------- Text Link ---------- */
.text-link {
  color: var(--primary);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.374px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1068px) {
  .hero__title {
    font-size: clamp(32px, 5vw, 40px);
  }

  .about__content {
    grid-template-columns: 280px 1fr;
    gap: var(--sp-xl);
  }

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

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

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

@media (max-width: 834px) {
  .tile {
    padding: var(--sp-xxl) var(--sp-lg);
  }

  .hero {
    padding: 100px var(--sp-lg) 60px;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .nav__links {
    display: none;
  }

  .nav__toggle {
    display: flex;
  }

  .nav__mobile {
    display: flex;
  }

  .about__content {
    grid-template-columns: 1fr;
  }

  .about__photo {
    max-width: 260px;
    margin: 0 auto;
  }

  .about__stats {
    grid-template-columns: repeat(4, 1fr);
  }

  .work__grid {
    grid-template-columns: 1fr;
  }

  .achievements__grid {
    grid-template-columns: 1fr;
  }

  .skills__grid {
    grid-template-columns: 1fr;
    gap: var(--sp-xl);
  }

  .education__item {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 640px) {
  .hero__title {
    font-size: clamp(28px, 8vw, 34px);
  }

  .hero__description {
    font-size: 17px;
  }

  .hero::before {
    width: 500px;
    height: 500px;
  }

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

  .stat__number {
    font-size: 28px;
  }

  .work__tabs {
    gap: var(--sp-xs);
  }

  .work__tab {
    font-size: 12px;
    padding: 6px 14px;
  }

  .project__info {
    padding: var(--sp-md);
  }

  .marquee__img {
    width: 220px;
    height: 150px;
  }

  .research__item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-sm);
  }

  .research__link {
    margin-top: 4px;
  }

  .contact__title {
    font-size: 28px;
  }
}