/* ============================================
   Components — Section-Specific Styles
   ============================================ */

/* ---- Navigation ---- */
.nav {
  background-color: var(--color-bg);
  box-shadow: var(--shadow-sm);
  position: fixed;
  width: 100%;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
}

.nav__container {
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--space-gutter);
  padding-block: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav__logo {
  font-size: var(--step-1);
  font-weight: var(--weight-bold);
  color: var(--color-text);
}

.nav__logo-accent {
  color: var(--color-primary);
}

.nav__links {
  display: flex;
  gap: var(--space-xl);
}

.nav__link {
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

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

.nav__cta {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  transition: background-color var(--transition-fast);
}

.nav__cta:hover {
  background-color: var(--color-primary-light);
  color: var(--color-text-inverse);
}

/* ---- Hamburger Button ---- */
.nav__hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
  color: var(--color-text);
  z-index: 60;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

/* ---- Mobile Menu Panel ---- */
.nav__menu {
  display: contents;
}

/* ---- Mobile CTA (hidden on desktop) ---- */
.nav__cta--mobile {
  display: none;
}

/* ---- Mobile: ≤768px ---- */
@media (max-width: 768px) {
  .nav__hamburger {
    display: flex;
  }

  .nav__menu {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: min(300px, 80vw);
    height: 100vh;
    height: 100dvh;
    background-color: var(--color-bg);
    padding: 5rem var(--space-xl) var(--space-xl);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 55;
    overflow-y: auto;
  }

  .nav__menu--open {
    transform: translateX(0);
  }

  .nav__links {
    flex-direction: column;
    gap: var(--space-md);
  }

  .nav__link {
    font-size: var(--step-1);
    padding: var(--space-sm) 0;
  }

  .nav__cta {
    display: none;
  }

  .nav__cta--mobile {
    display: block;
    text-align: center;
    margin-top: var(--space-lg);
    padding: var(--space-md);
  }

  /* Hamburger animation to X */
  .nav__hamburger--open .nav__hamburger-line--top {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .nav__hamburger--open .nav__hamburger-line--middle {
    opacity: 0;
  }
  .nav__hamburger--open .nav__hamburger-line--bottom {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .nav__hamburger-line {
    transition: transform 250ms ease, opacity 250ms ease;
    transform-origin: center;
  }

  /* Prevent body scroll when menu open */
  body.nav-open {
    overflow: hidden;
  }

  @media (prefers-reduced-motion: reduce) {
    .nav__menu {
      transition: none;
    }
    .nav__hamburger-line {
      transition: none;
    }
  }
}

/* ---- Hero Section ---- */
.hero {
  background-color: var(--color-primary-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero__pattern {
  position: absolute;
  inset: 0;
  opacity: var(--hero-pattern-opacity);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero__accent {
  position: absolute;
  top: -10%;
  right: -5%;
  width: var(--hero-accent-size);
  height: var(--hero-accent-size);
  border-radius: 50%;
  background-color: var(--color-accent);
  opacity: 0.08;
  pointer-events: none;
}

.hero__label {
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-md);
}

.hero__title {
  color: var(--color-text-inverse);
  margin-bottom: var(--space-lg);
}

.hero__subtitle {
  color: var(--color-text-light);
  margin-bottom: var(--space-2xl);
  max-width: 42rem;
}

.hero__stats {
  display: flex;
  gap: var(--space-2xl);
  color: var(--color-text-light);
}

.hero__stat-value {
  font-size: var(--step-3);
  font-weight: var(--weight-bold);
  color: var(--color-text-inverse);
}

.hero__stat-label {
  font-size: var(--step--1);
}

/* ---- Mobile Hero Adjustments ---- */
@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding-top: 6rem;
    padding-bottom: var(--space-3xl);
  }

  .hero__title {
    font-size: var(--step-3);
  }

  .hero__subtitle {
    font-size: var(--step-0);
  }

  .hero__accent {
    --hero-accent-size: 150px;
    top: -15%;
    right: -10%;
  }

  .project-card__image {
    height: 8rem;
  }
}

/* ---- About Section ---- */
.about {
  background-color: var(--color-bg);
}

.about__text {
  font-size: var(--step-0);
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.about__card {
  background-color: var(--color-bg-alt);
  padding: var(--space-lg);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.about__card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.about__card-icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: var(--space-xs);
  color: var(--color-primary);
}

.about__card-title {
  font-size: var(--step-0);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-xs);
}

.about__card-desc {
  font-size: var(--step--1);
  color: var(--color-text-muted);
}

/* ---- Projects Section ---- */
.projects {
  background-color: var(--color-bg-alt);
}

.project-card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.project-card__image {
  height: 12rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Subtle dot pattern on project card images */
.project-card__image::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Ccircle cx='10' cy='10' r='1'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.project-card__image--blue {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
}

.project-card__image--green {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

.project-card__body {
  padding: var(--space-xl);
}

.project-card__tag {
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  padding: var(--space-3xs) var(--space-sm);
  border-radius: var(--radius-full);
}

.project-card__tag--language {
  background-color: var(--tag-language-bg);
  color: var(--tag-language-text);
}

.project-card__tag--framework {
  background-color: var(--tag-framework-bg);
  color: var(--tag-framework-text);
}

.project-card__tag--database {
  background-color: var(--tag-database-bg);
  color: var(--tag-database-text);
}

.project-card__tag--tool {
  background-color: var(--tag-tool-bg);
  color: var(--tag-tool-text);
}

.project-card__tag--platform {
  background-color: var(--tag-platform-bg);
  color: var(--tag-platform-text);
}

.project-card__title {
  font-size: var(--step-2);
  margin-bottom: var(--space-sm);
}

.project-card__desc {
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.project-card__features {
  font-size: var(--step--1);
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.project-card__features li {
  margin-bottom: var(--space-2xs);
}

.project-card__link {
  font-weight: var(--weight-semibold);
  transition: color var(--transition-fast);
}

.project-card__link--blue {
  color: var(--color-primary);
}

.project-card__link--green {
  color: var(--color-success);
}

.project-card__link--red {
  color: #dc2626;
}

/* Case study sections within project cards */
.project-card__case-study {
  margin-top: var(--space-md);
}

.case-study__section {
  margin-bottom: var(--space-md);
}

.case-study__section:last-child {
  margin-bottom: 0;
}

.case-study__label {
  font-size: var(--step--1);
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-2xs);
}

/* Outline CTA variant for secondary actions */
.nav__cta--outline {
  background-color: transparent;
  border: 2px solid var(--color-text-inverse);
  color: var(--color-text-inverse);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav__cta--outline:hover {
  background-color: var(--color-text-inverse);
  color: var(--color-primary);
}

.nav__cta--outline svg {
  width: 1rem;
  height: 1rem;
}

/* Resume link in nav */
.nav__link--resume {
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
}

/* ---- Contact Section ---- */
.contact {
  background-color: var(--color-bg);
}

.contact-card {
  padding: var(--space-lg);
  background-color: var(--color-bg-alt);
  border-radius: var(--radius-xl);
  text-align: center;
  transition: background-color var(--transition-fast);
}

.contact-card:hover {
  background-color: #dbeafe;
}

.contact-card__icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: var(--space-md);
  color: var(--color-primary);
}

.contact-card__title {
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-xs);
}

.contact-card__value {
  color: var(--color-text-muted);
}

.contact-card:hover .contact-card__value {
  color: var(--color-primary);
}

.contact__looking-for {
  margin-top: var(--space-2xl);
  padding: var(--space-lg);
  background-color: #dbeafe;
  border-radius: var(--radius-xl);
  color: var(--color-text);
}

/* ---- Scroll Reveal Animations ---- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Staggered children — each child delays 80ms */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 500ms cubic-bezier(0.16, 1, 0.3, 1), transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 240ms; }

/* ---- Scroll Spy Active Nav ---- */
.nav__link.active {
  color: var(--color-primary);
  position: relative;
}

.nav__link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-primary);
  border-radius: 1px;
}

/* ---- Video Thumbnails ---- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

@media (max-width: 480px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

.video-thumbnail {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  background-color: var(--color-bg-dark);
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.video-thumbnail:hover img {
  transform: scale(1.03);
}

.video-thumbnail__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: none;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: transform 200ms ease, background-color 200ms ease;
}

.video-thumbnail__play::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
}

.video-thumbnail:hover .video-thumbnail__play {
  transform: translate(-50%, -50%) scale(1.1);
}

.video-thumbnail__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
}

.video-thumbnail__play:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  border-radius: 50%;
}

/* After iframe loads, hide thumbnail */
.video-thumbnail--playing img,
.video-thumbnail--playing .video-thumbnail__play {
  display: none;
}

.video-thumbnail--playing iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- Enhanced Hover States ---- */
.project-card {
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) {
  .project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
  }
}

@media (hover: none) {
  .project-card:active {
    transform: scale(0.98);
  }
}

.contact-card {
  transition: background-color 200ms ease, transform 200ms ease;
}

@media (hover: hover) {
  .contact-card:hover {
    background-color: #dbeafe;
    transform: translateY(-2px);
  }
}

/* Focus-visible on all interactive elements */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Enhanced link hover — underline animation */
.project-card__link {
  position: relative;
  text-decoration: none;
}

.project-card__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: currentColor;
  transition: width 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card__link:hover::after {
  width: 100%;
}

/* ---- Footer ---- */
.footer {
  background-color: var(--color-bg-dark);
  color: var(--color-text-inverse);
  padding-block: var(--space-3xl);
  padding-bottom: max(var(--space-3xl), env(safe-area-inset-bottom));
}

.footer__logo {
  font-size: var(--step-1);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-md);
}

.footer__logo-accent {
  color: #60a5fa;
}

.footer__text {
  color: #9ca3af;
  margin-bottom: var(--space-lg);
}

.footer__copyright {
  color: #6b7280;
  font-size: var(--step--1);
}
