/* ---------- Base / Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Cascadia Mono", monospace;
  background-color: #0a0a0a;
  color: #e0e0e0;
  scroll-behavior: smooth;
  line-height: 1.6;
  min-height: 100svh; /* mobile-friendly viewport unit */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Background canvas (behind & non-interactive) ---------- */
.content--canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  pointer-events: none; /* do not block clicks */
}

/* Ensure everything else sits above the canvas */
#main-content, header, main, footer { position: relative; z-index: 1; }

/* ---------- Header / Nav ---------- */
header {
  background: #111;
  color: white;
  width: 100%;
  margin: 0;
  padding: .75rem 1rem;
  padding-left: calc(1rem + env(safe-area-inset-left));
  padding-right: calc(1rem + env(safe-area-inset-right));
}

.container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: 0;
  max-width: 1100px;
  margin: 0 auto;
}

nav { position: relative; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid #333;
  border-radius: 8px;
  padding: .4rem .6rem;
  color: #f0f0f0;
  cursor: pointer;
}

.nav-toggle:focus-visible {
  outline: 2px solid #00ffe1;
  outline-offset: 3px;
}

nav ul {
  list-style: none;
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;               /* stays horizontal but wraps */
  align-items: center;
}

nav li {
  display: flex;
  align-items: center;
  background-color: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.55em 0.9em;
  font-size: 14px;
  white-space: nowrap;
  transition: background-color 0.2s ease, transform .05s ease;
}

nav li:hover { background-color: #302c80; }
nav li:active { transform: translateY(1px); }

nav a {
  height: inherit;
  display: flex;
  color: #f0f0f0;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease;
}

nav a:hover,
nav a:focus-visible { color: #00ffe1; outline: none; }

/* ---------- Intro / Hero ---------- */
.intro-section {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 58px); /* full viewport minus header */
  padding: 3rem 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.intro-container {
  display: flex;
  gap: 3.5rem;
  align-items: center;
  justify-content: center;
  max-width: 1060px;
  width: 100%;
}

/* Photo — large, prominent */
.intro-img {
  width: 340px;
  max-width: 42%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top center;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255,255,255,0.06);
  display: block;
  flex-shrink: 0;
  /* entrance animation — starts hidden, plays when intro-ready is added */
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Text */
.intro-text {
  min-width: 220px;
  word-spacing: 0.2rem;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.22s,
              transform 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.22s;
}

/* Triggered from JS after welcome screen exits */
#intro.intro-ready .intro-img,
#intro.intro-ready .intro-text {
  opacity: 1;
  transform: translateY(0);
}

.intro-greeting {
  font-size: 0.95rem;
  color: #00ffe1;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.intro-text h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.1;
}

.intro-bio {
  font-size: 1.1rem;
  color: #bbb;
  line-height: 1.7;
  max-width: 70ch;
}

.intro-verse {
  margin-top: 1.1rem;
  font-size: 0.82rem;
  color: #666;
  font-style: italic;
  letter-spacing: 0.3px;
  line-height: 1.5;
}

/* Scroll indicator */
.scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: #555;
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.scroll-arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid #444;
  border-bottom: 2px solid #444;
  transform: rotate(45deg);
  animation: scroll-bounce 1.6s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: 0.4; }
  50%       { transform: rotate(45deg) translateY(5px); opacity: 1; }
}

/* ---------- Cards grid ---------- */
.stack-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  justify-content: center;
  gap: 2rem;
  padding: 4rem 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.stack-container section {
  position: relative;
  background: #0a0a14;
  width: 100%;
  min-height: 300px;
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0, 255, 255, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: white;
  text-align: left;
  opacity: 0;
  transform: translateY(40px);
  transition: transform 0.5s ease-out, opacity 0.5s ease-out, box-shadow 0.3s ease;
}

.stack-container section:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 28px rgba(0, 255, 255, 0.28);
}

/* Background image layer — zooms independently on hover */
.card-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.45s ease;
  z-index: 0;
}

.stack-container section:hover .card-img {
  transform: scale(1.07);
}

/* Dark gradient overlay — readable text at bottom */
.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(5, 3, 30, 0.92) 0%,
    rgba(5, 3, 30, 0.5) 45%,
    rgba(5, 3, 30, 0.1) 100%
  );
  z-index: 1;
}

/* Text content — sits above image and overlay */
.card-content {
  position: relative;
  z-index: 2;
  padding: 1.4rem 1.25rem;
}

.card-content h2 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
  letter-spacing: 0.5px;
}

.card-content p {
  font-size: 0.88rem;
  color: #bbb;
  line-height: 1.4;
}

.stack-container section.visible { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 0.5s; }
.delay-2 { transition-delay: 1s; }

.on-click-cards { text-decoration: none; }

/* Education card — portrait orientation, spans 2 rows */
.on-click-cards:has(#education) {
  grid-row: span 2;
}

#education {
  aspect-ratio: 2 / 3;
  min-height: unset;
  height: 100%;
}

/* Projects card — portrait orientation, spans 2 rows */
.on-click-cards:has(#projects) {
  grid-row: span 2;
}

#projects {
  min-height: unset;
  height: 100%;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1rem;
  background: #111;
  color: #ccc;
  font-size: 0.9rem;
}

/* ---------- Responsive ---------- */

/* Tablets */
@media (max-width: 1024px) {
  .intro-section { padding: 2rem; }
  .intro-container { gap: 2rem; }
  .intro-img { width: 300px; }
  .stack-container { gap: 2rem 1.25rem; padding: 3rem 1.25rem; }
}

/* Phones */
@media (max-width: 768px) {
  #welcome { margin: 1rem; padding: 1rem; }

  .animated-text {
    font-size: clamp(1.25rem, 6.5vw, 2rem);
    border-right-width: 0.18em; /* gentler cursor on small screens */
    max-width: 32ch;
  }

  .container { flex-wrap: wrap; }

  /* Show toggle on phones; convert menu to popover list */
  .nav-toggle { display: inline-block; }

  nav ul {
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    background: #0f0f11;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: .5rem;
    display: none;              /* hidden by default */
    flex-direction: column;
    min-width: 220px;
    box-shadow: 0 10px 24px rgba(0,0,0,.35);
    z-index: 10;                /* above header */
  }

  nav ul.open { display: flex; }
  nav li { width: 100%; justify-content: flex-start; font-size: 15px; }

  .intro-section { padding: 1.5rem 1.25rem; min-height: calc(100dvh - 58px); }
  .intro-container { flex-direction: column; align-items: center; text-align: center; gap: 2rem; }
  .intro-img { width: 220px; max-width: 65%; aspect-ratio: 3 / 4; }
  .intro-bio { max-width: unset; }
  .scroll-hint { bottom: 1.25rem; }

  /* Cards: single column */
  .stack-container {
    grid-template-columns: 1fr;
    padding: 2rem 1rem;
    gap: 1.25rem;
  }
  .stack-container section { min-height: 90vw; height: auto; aspect-ratio: unset; }
  .card-content { padding: 1.1rem .9rem; }

  /* Reset portrait/spanning cards to normal on mobile */
  .on-click-cards:has(#education),
  .on-click-cards:has(#projects) { grid-row: span 1; }
  #education, #projects { aspect-ratio: unset !important; height: auto !important; min-height: 90vw; }
  #education .card-img, #projects .card-img { background-size: cover !important; }
}

/* Small phones */
@media (max-width: 480px) {
  nav li { font-size: 14px; }
  .intro-section { padding: 1rem; }
  .stack-container { padding: 1.25rem .75rem; }
  .stack-container section { min-height: 85vw; }
  .card-content { padding: 1rem .75rem; }
  .card-content h2 { font-size: 1.15rem; }
}


/* Contact card decorative icon */
.contact-card-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.contact-card-icon svg {
  width: 55%;
  height: 55%;
  filter: drop-shadow(0 0 18px rgba(139,123,240,0.6)) drop-shadow(0 0 40px rgba(139,123,240,0.3));
  opacity: 0.85;
}

#mcmun-box {
  background-size: 120%; /* smaller % zooms out more, e.g., 100% = original fit */
  background-position: center;
  background-repeat: no-repeat;
}

/* Same size + zoomed-out for CIAC, MCMUN, Cornell, NYU (nyumun-box) */
.conference-box#ciac-box,
.conference-box#mcmun-box,
.conference-box#cornell-box,
.conference-box#nyumun-box {
  /* Bigger uniform box */
  min-height: 460px;
  width: 100%;

  /* Zoomed out (shows more of the image) */
  background-size: 90% !important;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #000; /* fills any gaps */
}

/* Tablet */
@media (max-width: 1024px) {
  .conference-box#ciac-box,
  .conference-box#mcmun-box,
  .conference-box#cornell-box,
  .conference-box#nyumun-box {
    min-height: 420px;
    background-size: 88% !important;
  }
}

/* Phones */
@media (max-width: 768px) {
  .conference-box#ciac-box,
  .conference-box#mcmun-box,
  .conference-box#cornell-box,
  .conference-box#nyumun-box {
    min-height: 340px;
    background-size: 85% !important;
  }
}


