/* ========================================
   Design Tokens
   ======================================== */
:root {
  --bg: #0b1a3e;
  --bg-hover: rgba(255, 255, 255, 0.08);
  --fg: #ffffff;
  --fg-secondary: rgba(255, 255, 255, 0.85);
  --fg-muted: rgba(255, 255, 255, 0.58);
  --accent: #ffffff;
  --border: rgba(255, 255, 255, 0.14);
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.1);
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-mono);
  color: var(--fg);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;

  /* iPhone midnight-to-sky blue gradient */
  background: linear-gradient(
    180deg,
    #0b1a3e 0%,
    #163d72 25%,
    #2a6cb5 50%,
    #5a9fd4 75%,
    #8dc4e8 100%
  );
  background-attachment: fixed;
}

/* Container */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ========================================
   Fixed Header & Navigation (Transparent Desktop)
   ======================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: transparent !important;
  border-bottom: 1px solid transparent;
  box-shadow: none !important;
  transition: backdrop-filter 0.25s ease, border-color 0.25s ease;
}

/* Desktop: Transparent on scroll with subtle feather blur */
.site-header.scrolled {
  background: transparent !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none !important;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 780px;
  margin: 0 auto;
  padding: 1.35rem 1.5rem;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease;
}

.nav-logo:hover {
  opacity: 0.8;
}

/* Desktop Underlined Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  padding: 0.35rem 0;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #ffffff;
  border-bottom-color: transparent !important;
}

.nav-link.active {
  color: #ffffff;
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.85) !important;
  font-weight: 500;
}

/* ========================================
   Mobile Hamburger Toggle (3-line to X)
   ======================================== */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 102;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-box {
  width: 20px;
  height: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 1px;
  transform-origin: center;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              background-color 0.25s ease;
}

/* Transform 3 lines into precise 'X' */
.nav-toggle.active .line-1 {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.active .line-2 {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle.active .line-3 {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Dropdown & Backdrop Defaults for Desktop */
.mobile-menu {
  display: none;
}

.mobile-backdrop {
  display: none;
}

/* ========================================
   Main Content Layout
   ======================================== */
.main-content {
  position: relative;
  z-index: 1;
}

/* ========================================
   Hero Section (Profile-First & Minimal)
   ======================================== */
.hero-section {
  padding: 8.5rem 0 4.5rem;
  text-align: center;
}

.hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 1.25rem;
}

.hero-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35),
              0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease;
}

.avatar-wrap:hover .hero-avatar {
  transform: scale(1.05);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45),
              0 0 0 1px rgba(255, 255, 255, 0.25);
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6.5vw, 3.8rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.hero-name em {
  font-style: italic;
  opacity: 0.95;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--fg-muted);
  letter-spacing: -0.01em;
  margin-top: 0.4rem;
}

.hero-bio {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--fg-secondary);
  max-width: 520px;
  margin: 1.25rem auto 0;
}

/* Social Row with View-Portfolio Button Styling */
.social-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.8rem;
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
  padding: 0.5rem 0.95rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.social-btn svg {
  flex-shrink: 0;
  color: currentColor;
  fill: currentColor;
}

/* ========================================
   Selected Work Section
   ======================================== */
.work-section {
  padding: 3.5rem 0 4.5rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.8rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.section-counter {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

/* Project Cards / Clean Square Interactive Rows */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px; /* Square shape */
  padding: 1.35rem 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.22s ease, border-color 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, opacity 0.45s ease;
  
  /* Reveal transition */
  opacity: 0;
  transform: translateY(12px);
}

.project-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.project-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

.project-title-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  text-decoration: none;
  color: #ffffff;
}

.project-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #ffffff;
  transition: color 0.18s ease;
}

.project-card:hover .project-title {
  color: #ffffff;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.25);
}

.project-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.project-desc {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--fg-secondary);
  margin-bottom: 0.95rem;
}

.project-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* Square Chips */
.project-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 0.32rem 0.75rem;
  border-radius: 3px; /* Square shape */
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: all 0.18s ease;
  letter-spacing: -0.01em;
}

.project-chip:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

.project-chip.primary {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ========================================
   Contact Section
   ======================================== */
.contact-section {
  padding: 3rem 0 5.5rem;
}

.contact-card {
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px; /* Square shape */
  padding: 3.2rem 1.8rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  
  /* Reveal transition */
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.contact-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.contact-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin-bottom: 0.6rem;
}

.contact-title {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.contact-title em {
  font-style: italic;
  opacity: 0.95;
}

.contact-subtitle {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--fg-secondary);
  line-height: 1.65;
  max-width: 440px;
  margin: 0 auto 1.8rem;
}

.contact-cta-row {
  display: flex;
  justify-content: center;
}

/* Square Contact Button */
.contact-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.7rem;
  border-radius: 4px; /* Square shape */
  background-color: #ffffff;
  color: #0b1a3e;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-cta-btn:hover {
  background-color: rgba(255, 255, 255, 0.94);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.contact-cta-btn svg {
  flex-shrink: 0;
  color: #0b1a3e;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 2.2rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.footer-back-to-top {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.18s ease;
}

.footer-back-to-top:hover {
  color: #ffffff;
}

/* ========================================
   Responsive (Mobile Viewports <= 768px)
   ======================================== */
@media (max-width: 768px) {
  .site-header {
    background: transparent !important;
    border-bottom: 1px solid transparent;
  }

  .site-header.scrolled:not(.menu-open) {
    background: rgba(11, 26, 62, 0.9) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .site-header.menu-open {
    background: rgba(11, 26, 62, 0.96) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  }

  .nav {
    padding: 1.1rem 1.4rem;
  }

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  /* Mobile Dropdown Menu */
  .mobile-menu {
    display: block;
    width: 100%;
    background: rgba(11, 26, 62, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    transition: max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.32s;
  }

  .mobile-menu.open {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-menu-items {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .mobile-menu-item {
    display: block;
    width: 100%;
    padding: 1rem 1.4rem;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: -0.01em;
    background: transparent;
    transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-item:hover,
  .mobile-menu-item:active {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding-left: 1.65rem;
  }

  .mobile-menu-cta-wrap {
    padding: 1.15rem 1.4rem 1.4rem;
    background: transparent;
  }

  .mobile-menu-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.88rem 1.25rem;
    background-color: #ffffff;
    color: #0b1a3e;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px; /* Square shape */
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: background-color 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-cta:hover,
  .mobile-menu-cta:active {
    background-color: rgba(255, 255, 255, 0.92);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  }

  .mobile-menu-cta svg {
    flex-shrink: 0;
    color: #0b1a3e;
  }

  /* Backdrop */
  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Spacing adjustments on mobile */
  .hero-section {
    padding: 7rem 0 3.5rem;
  }

  .hero-avatar {
    width: 80px;
    height: 80px;
  }

  /* Hero Social Row: Icon-only in a single crisp row on mobile */
  .social-row {
    gap: 0.75rem;
    flex-wrap: nowrap;
    justify-content: center;
    margin-top: 1.5rem;
  }

  .social-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }

  .social-btn span {
    display: none;
  }

  .social-btn svg {
    width: 19px;
    height: 19px;
  }

  .work-section {
    padding: 2.5rem 0 3.5rem;
  }

  .project-card {
    padding: 1.15rem 1.2rem;
  }

  .project-heading {
    flex-direction: row;
    align-items: center;
  }

  .contact-section {
    padding: 2rem 0 4rem;
  }

  .contact-card {
    padding: 2.5rem 1.3rem;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.6rem;
    text-align: center;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .project-card, .contact-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
