/*
 * Portfolio overrides: typography, hero, skills, project cards, contact
 * Loaded after main.css
 */

/* ---- Typography ---- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

body, input, select, textarea {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---- Hero / Intro ---- */
#intro {
  min-height: 100vh;
  display: flex;
  align-items: center;
}

#intro .inner {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
  max-width: 56em;
}

#intro .hero-content {
  flex: 1;
  min-width: 280px;
}

#intro .hero-tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.5em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#intro h1 {
  font-size: clamp(2.25em, 5vw, 3.25em);
  margin-bottom: 0.4em;
  line-height: 1.2;
}

#intro .personalpic {
  width: 20em;
  max-width: 100%;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
  object-fit: cover;
  flex-shrink: 0;
}

#intro p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.15em;
  line-height: 1.7;
}

/* ---- Skills section ---- */
#skills .inner {
  max-width: 56em;
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6em 1em;
  justify-content: center;
  margin-top: 1.5em;
}

.skill-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45em 1em;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.skill-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

/* ---- Projects: cards and links ---- */
.spotlights > section {
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.spotlights > section:hover {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.spotlights > section > .content .inner {
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.spotlights > section .project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-bottom: 0.75em;
}

.spotlights > section .project-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7em;
  padding: 0.25em 0.6em;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
}

.project-links {
  margin-top: 1em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5em 1em;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-link:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  transform: translateY(-2px);
  border-bottom-style: solid;
}

.btn-link.primary {
  background: rgba(255, 255, 255, 0.95);
  border-color: transparent;
  color: #312450;
}

.btn-link.primary:hover {
  background: #fff;
  color: #312450;
}

/* ---- Work experience ---- */
.features section {
  transition: background 0.2s ease;
}

.features section:hover {
  background: rgba(255, 255, 255, 0.03);
}

.features .icon.solid.major {
  transition: transform 0.25s ease;
}

.features section:hover .icon.solid.major {
  transform: scale(1.08);
}

/* ---- Contact ---- */
#three .contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25em;
  margin-top: 1.5em;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5em 1.25em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.contact-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.contact-card .icon-wrap {
  width: 2.5em;
  height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75em;
  color: rgba(255, 255, 255, 0.9);
}

.contact-card h3 {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 0.35em 0;
}

.contact-card a,
.contact-card span {
  color: #fff;
  font-weight: 500;
  word-break: break-word;
  border-bottom: none;
}

.contact-card a:hover {
  border-bottom: none;
  color: rgba(255, 255, 255, 0.95);
}

.contact-card.resume .btn-link {
  margin-top: 0.25em;
}

/* ---- Section headings ---- */
.wrapper .inner > h2 {
  font-size: clamp(1.75em, 3vw, 2.25em);
  margin-bottom: 0.25em;
}

#one .inner > h2 {
  margin-bottom: 0.5em;
}

/* ---- Footer ---- */
#footer .inner {
  padding: 1.5em 2em;
}

#footer .menu {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.45);
}

#footer .menu a {
  border-bottom: none;
  color: rgba(255, 255, 255, 0.6);
}

#footer .menu a:hover {
  color: #fff;
}

/* ---- Focus and accessibility ---- */
a:focus-visible,
.btn-link:focus-visible,
.skill-pill:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .nav-toggle-bar,
  .skill-pill,
  .btn-link,
  .contact-card,
  .spotlights > section > .content .inner,
  .features .icon.solid.major {
    transition: none;
  }
}

/* ---- Responsive: base (all viewports) ---- */
html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

/* Scroll margin so anchor links don't sit under fixed nav (desktop sidebar / tablet bar) */
#intro,
#skills,
#one,
#two,
#three {
  scroll-margin-top: 4rem;
}

@media screen and (min-width: 981px) {
  #intro,
  #skills,
  #one,
  #two,
  #three {
    scroll-margin-top: 0; /* sidebar is on the side, not top */
  }
}

/* Images never overflow */
img {
  max-width: 100%;
  height: auto;
}

/* ---- Mobile menu toggle button ---- */
#nav-toggle {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10001;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(49, 36, 80, 0.95);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}

#nav-toggle:hover,
#nav-toggle:focus {
  background: rgba(94, 66, 166, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
  outline: none;
}

#nav-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.nav-toggle-inner {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 1.25rem;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.nav-open #nav-toggle .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.nav-open #nav-toggle .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

body.nav-open #nav-toggle .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Responsive: large (tablet landscape / small laptop, max 1280px) ---- */
@media screen and (max-width: 1280px) {
  #intro .personalpic {
    display: block;
    margin: 0 auto 1.5em;
  }

  #intro .inner {
    flex-direction: column;
    text-align: center;
  }

  #intro .hero-content {
    order: 2;
  }

  #intro .hero-tagline {
    text-align: center;
  }

  #intro .personalpic {
    width: min(20em, 85vw);
  }
}

/* ---- Responsive: medium (tablet portrait, max 980px) ---- */
@media screen and (max-width: 980px) {
  .wrapper .inner {
    padding-left: 2em;
    padding-right: 2em;
  }

  #skills .inner {
    padding-left: 2em;
    padding-right: 2em;
  }

  .contact-cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

/* ---- Responsive: small (large phone / small tablet, max 736px) ---- */
@media screen and (max-width: 736px) {
  /* Show mobile toggle; sidebar is hidden by main.css */
  #nav-toggle {
    display: flex;
  }

  /* Leave room for the menu button so content isn’t covered */
  #wrapper {
    padding-top: 3.5rem;
  }

  /* When nav is open, show sidebar as full-screen overlay */
  body.nav-open #sidebar {
    display: block !important;
    width: 100%;
    height: 100%;
    height: 100dvh;
    top: 0;
    left: 0;
    overflow-y: auto;
    background: rgba(49, 36, 80, 0.98);
    text-align: center;
    padding: 4rem 2rem 2rem;
    box-sizing: border-box;
  }

  body.nav-open #sidebar .inner {
    justify-content: center;
    min-height: auto;
  }

  body.nav-open #sidebar nav ul {
    flex-direction: column;
    gap: 0;
  }

  body.nav-open #sidebar nav a {
    padding: 1em;
    font-size: 1em;
  }

  /* Scroll margin for anchor links when there's no fixed bar */
  #intro,
  #skills,
  #one,
  #two,
  #three {
    scroll-margin-top: 1rem;
  }

  #intro .inner {
    padding: 2rem 1.5rem;
    gap: 1.5rem;
  }

  #intro .personalpic {
    width: min(16em, 75vw);
  }

  #intro h1 {
    font-size: 1.85em;
  }

  #intro p {
    font-size: 1em;
  }

  .skills-grid {
    justify-content: flex-start;
    gap: 0.5em 0.75em;
    margin-top: 1.25em;
  }

  .skill-pill {
    padding: 0.5em 0.85em;
    font-size: 0.8em;
  }

  #skills .inner {
    padding: 2rem 1.5rem;
  }

  .project-links {
    flex-direction: column;
  }

  .btn-link {
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.6em 1em;
  }

  .contact-cards {
    grid-template-columns: 1fr;
    gap: 1em;
    margin-top: 1.25em;
  }

  .contact-card {
    padding: 1.25em 1em;
  }

  .wrapper .inner > h2 {
    font-size: 1.6em;
  }
}

/* ---- Responsive: xsmall (phone, max 480px) ---- */
@media screen and (max-width: 480px) {
  #nav-toggle {
    top: 0.5rem;
    left: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
  }

  .wrapper .inner {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  #intro .inner {
    padding: 1.5rem 1.25rem;
  }

  #intro .personalpic {
    width: min(14em, 80vw);
  }

  #intro h1 {
    font-size: 1.65em;
  }

  #skills .inner {
    padding: 1.5rem 1.25rem;
  }

  .skills-grid {
    gap: 0.4em 0.6em;
  }

  .skill-pill {
    font-size: 0.75em;
    padding: 0.4em 0.7em;
  }

  /* Project spotlights: ensure content padding is comfortable */
  .spotlights > section > .content {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

  .spotlights > section .project-tag {
    font-size: 0.65em;
  }

  .contact-cards {
    gap: 0.75em;
  }

  #footer .inner {
    padding: 1.25rem 1rem;
  }

  #footer .menu {
    font-size: 0.8em;
    text-align: center;
  }
}

/* ---- Safe area (notches / home indicator) ---- */
@supports (padding: max(0px)) {
  #nav-toggle {
    top: max(0.75rem, env(safe-area-inset-top));
    left: max(0.75rem, env(safe-area-inset-left));
  }

  @media screen and (max-width: 480px) {
    #nav-toggle {
      top: max(0.5rem, env(safe-area-inset-top));
      left: max(0.5rem, env(safe-area-inset-left));
    }
  }

  #footer .inner {
    padding-bottom: max(1.5em, env(safe-area-inset-bottom));
  }
}
