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

:root {
  --black:   #0f0f0f;
  --dark:    #1c1c1c;
  --mid:     #444444;
  --accent:  #2a2a2a;
  --bg:      #f9f9f9;
  --bg-alt:  #f2f2f2;
  --white:   #ffffff;
  --text:    #222222;
  --muted:   #888888;
  --border:  #e0e0e0;
  --radius:  4px;
  --shadow:  0 1px 3px rgba(0,0,0,.06);
  --transition: .25s ease;
}

html { scroll-behavior: smooth; scroll-padding-top: 96px; font-family: 'Poppins', sans-serif; }

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
}

a { color: var(--dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Nav
   ============================================================ */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3.5rem;
  height: 96px;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
#navbar.scrolled { box-shadow: 0 2px 16px rgba(0,0,0,.08); }

.nav-brand {
  font-family: 'Poppins', sans-serif;
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--black);
  white-space: nowrap;
  letter-spacing: -.01em;
  cursor: pointer;
}
.nav-brand:hover { text-decoration: none; opacity: .7; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}
.nav-links a {
  font-size: .78rem;
  font-weight: 300;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mid);
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--black); text-decoration: none; }

.nav-dropdown {
  position: relative;
  padding-bottom: 1.4rem;
  margin-bottom: -1.4rem;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
  min-width: 260px;
  padding: .5rem 0;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
  z-index: 200;
}
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu li a {
  display: block;
  padding: .65rem 1.4rem;
  font-size: .75rem;
  font-weight: 300;
  letter-spacing: .04em;
  text-transform: none;
  white-space: nowrap;
  color: var(--mid);
}
.dropdown-menu li a:hover { background: var(--bg-alt); color: var(--black); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px; height: 1.5px;
  background: var(--black);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}

/* ============================================================
   Hero
   ============================================================ */
#hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 230px 2rem 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('background.png') center/cover no-repeat;
  filter: brightness(.85);
  z-index: 0;
}

.hero-stack {
  position: relative;
  z-index: 1;
  max-width: 940px;
  width: 100%;
}

.hero-card {
  display: flex;
  background: var(--white);
  border-radius: 0;
  overflow: hidden;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
}

.hero-bar {
  height: 72px;
  max-width: 940px;
  width: 100%;
  margin: -80px auto 4.5rem;
  background: #b3b3b3;
}

.hero-photo {
  width: 42%;
  flex-shrink: 0;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-info {
  flex: 1;
  padding: 3.6rem 2.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ececec;
}
.hero-info h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.9rem;
  font-weight: 300;
  color: var(--black);
  margin-bottom: .4rem;
  letter-spacing: -.01em;
}
.hero-subtitle {
  font-size: .82rem;
  font-weight: 400;
  color: var(--mid);
  margin-bottom: 1.8rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hero-details { display: flex; flex-direction: column; gap: .9rem; }
.detail-row { display: flex; flex-direction: column; gap: .1rem; }
.detail-label {
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-value { font-size: .86rem; color: var(--text); font-weight: 300; }
.detail-value a { color: var(--dark); }

/* ============================================================
   Section Common
   ============================================================ */
.section { padding: 100px 1.5rem; }
.section-alt { background: var(--bg-alt); }
.section-white { background: #ffffff; }

.intro-section { padding: 80px 1.5rem 120px; background: var(--bg-alt); }
.intro-container { text-align: center; max-width: 580px; }
.intro-heading {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--black);
  margin-bottom: 1.25rem;
  letter-spacing: -.01em;
}
.intro-text {
  font-size: 1.05rem;
  color: var(--mid);
  line-height: 1.8;
  max-width: 470px;
  margin: 0 auto;
}
.intro-cta {
  display: inline-block;
  margin-top: 2rem;
  padding: .8rem 1.8rem;
  background: var(--black);
  color: var(--white);
  font-size: .8rem;
  font-weight: 400;
  letter-spacing: .04em;
}
.intro-cta:hover { background: var(--dark); text-decoration: none; }

.container { max-width: 1000px; margin: 0 auto; }

.section-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 3.5rem;
  position: relative;
  display: block;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .3em;
}

/* ============================================================
   Timeline
   ============================================================ */
.timeline { position: relative; padding-left: 0; }

.timeline::before {
  content: '';
  position: absolute;
  left: calc(300px + 20px);
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  display: grid;
  grid-template-columns: 300px 40px 1fr;
  gap: 0;
  margin-bottom: 3.5rem;
  align-items: start;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s ease, transform .5s ease;
}
.timeline-item.visible { opacity: 1; transform: none; }

/* ============================================================
   Generic reveal-on-scroll (applied via JS site-wide)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.visible { opacity: 1; transform: none; }

.timeline-left {
  padding-right: 24px;
  text-align: right;
  padding-top: 2px;
}
.timeline-date {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--black);
  margin-bottom: .5rem;
}
.timeline-title {
  display: block;
  font-weight: 400;
  font-size: .82rem;
  letter-spacing: .1em;
  color: var(--mid);
  margin-bottom: .15rem;
}
.timeline-company {
  display: block;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--black);
  font-weight: 600;
  margin-bottom: .6rem;
}

.timeline-dot {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 4px;
}
.timeline-dot::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--black);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #aaaaaa;
  flex-shrink: 0;
}

.section-alt .timeline-dot::before {
  box-shadow: 0 0 0 3px var(--bg-alt), 0 0 0 5px #aaaaaa;
}

.timeline-right {
  padding-left: 24px;
  padding-top: 0;
}
.timeline-right p {
  font-size: .88rem;
  font-weight: 300;
  color: #465272;
  line-height: 1.8;
  margin-bottom: .8rem;
}
.timeline-right .coursework-heading {
  margin-bottom: .25rem;
  font-weight: 500;
}
.coursework-list {
  margin: 0 0 1rem 1.15rem;
  columns: 2;
  column-gap: 2rem;
}
.coursework-list li {
  break-inside: avoid;
  color: #465272;
  font-size: .82rem;
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: .25rem;
  padding-left: .15rem;
}

/* ============================================================
   Tags
   ============================================================ */
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.project-content .tag { background: var(--bg-alt); color: var(--mid); }
.tag {
  font-size: .68rem;
  font-weight: 400;
  letter-spacing: .06em;
  padding: .2rem .65rem;
  border-radius: 999px;
  background: rgba(0,0,0,.07);
  color: var(--mid);
}

/* ============================================================
   Tools Grid
   ============================================================ */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}
.tool-category h3 {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--black);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.tool-category ul { list-style: none; }
.tool-category li {
  font-size: .86rem;
  font-weight: 300;
  color: var(--text);
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.tool-category li::before {
  content: '›';
  color: var(--mid);
  font-weight: 400;
}

/* ============================================================
   Skills
   ============================================================ */
.skills-section { padding: 0; }
.skills-section .container { padding-top: 56px; padding-bottom: .7rem; max-width: 1120px; }

.skills-bg {
  position: relative;
  overflow: hidden;
  padding: 2.2rem 1.5rem 2.4rem;
}
.skills-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('skill-background.png') center/180% no-repeat;
  filter: grayscale(1) brightness(.55) contrast(.4);
  z-index: 0;
}

.skills-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.3rem 1.4rem;
}
.skill-tile {
  background: rgba(150, 150, 150, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.4rem 1.5rem;
  min-height: 78px;
}
.skill-tile span {
  color: var(--white);
  font-size: .95rem;
  font-weight: 400;
  letter-spacing: .04em;
}
.skill-tile span a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* ============================================================
   Cards (Extracurriculars)
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.4rem 2rem;
}
.card {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}
.card.visible { opacity: 1; transform: none; }

.card-icon { font-size: 1.5rem; margin-bottom: .8rem; }
.card h3 { font-size: .95rem; font-weight: 500; color: var(--black); margin-bottom: .5rem; }
.card p { font-size: .83rem; font-weight: 300; color: var(--muted); line-height: 1.65; }

/* ============================================================
   Portfolio
   ============================================================ */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.8rem;
}
.portfolio-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease, box-shadow .25s ease;
}
.portfolio-card.visible { opacity: 1; transform: none; }
.portfolio-card:hover { transform: translateY(-4px); box-shadow: 0 10px 36px rgba(0,0,0,.14); }

.portfolio-preview { height: 220px; background-size: cover; background-position: center; }

.portfolio-body { padding: 1.5rem 1.6rem; }
.portfolio-body h3 { font-size: .95rem; font-weight: 500; color: var(--black); margin-bottom: .6rem; }
.portfolio-body p { font-size: .83rem; font-weight: 300; color: var(--muted); margin-bottom: .9rem; line-height: 1.65; }

.portfolio-link {
  font-size: .78rem;
  font-weight: 500;
  color: var(--dark);
  letter-spacing: .06em;
  display: inline-block;
  margin-top: .6rem;
}
.portfolio-link:hover { text-decoration: underline; }

/* ============================================================
   Contact
   ============================================================ */
.contact-divider {
  height: 1px;
  background: var(--border);
  max-width: 200px;
  margin: 0 auto 2.5rem;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}
.contact-item {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.contact-label {
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-value {
  font-size: .95rem;
  font-weight: 300;
  color: var(--text);
}
.contact-value a { color: var(--text); }
.contact-value a:hover { text-decoration: underline; }

/* ============================================================
   Footer
   ============================================================ */
footer {
  text-align: center;
  padding: 2rem;
  font-size: .78rem;
  font-weight: 300;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 96px; left: 0; right: 0;
    background: var(--white);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
  }
  .hamburger { display: flex; }

  .hero-card { flex-direction: column; }
  .hero-photo { width: 100%; height: 280px; }

  .timeline::before { left: 0; }
  .timeline-item {
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
  }
  .timeline-left {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
    padding-right: 0;
    padding-left: 24px;
  }
  .timeline-dot {
    grid-column: 1;
    grid-row: 1 / 3;
    justify-content: center;
    padding-top: 4px;
    align-items: flex-start;
  }
  .timeline-right {
    grid-column: 2;
    grid-row: 2;
  }
  .coursework-list { columns: 1; }

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

  .dropdown-menu {
    display: block;
    position: static;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0 0 0 1rem;
  }
  .dropdown-menu li a { padding: .4rem 0; }
}

/* ============================================================
   Project Detail Pages
   ============================================================ */
.project-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 230px 2rem 0;
}
.project-hero-bg {
  position: absolute;
  inset: 0;
  background: url('background.png') center/cover no-repeat;
  filter: brightness(.85);
  z-index: 0;
}
.project-hero-stack {
  position: relative;
  z-index: 1;
  max-width: 940px;
  width: 100%;
}
.project-card {
  background: var(--white);
  width: 100%;
  padding: 3.4rem 3rem;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
}
.project-card-lg { padding: 5.4rem 3rem; }
.project-card h1 {
  font-family: 'Poppins', sans-serif;
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--black);
  margin-bottom: .8rem;
  letter-spacing: -.01em;
}
.project-card h1.muted-title {
  color: var(--mid);
  font-size: 2.4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.project-subtitle {
  font-size: .95rem;
  font-weight: 300;
  color: #465272;
}
.project-bar {
  height: 72px;
  max-width: 940px;
  width: 100%;
  margin: -4rem auto 3rem;
  background: #b3b3b3;
}

.project-content { padding: 4rem 1.5rem; }
.project-container { max-width: 780px; }
.project-content p {
  font-size: .95rem;
  font-weight: 300;
  color: #465272;
  line-height: 1.85;
  margin-bottom: 1.4rem;
}
.project-content ul {
  margin: 0 0 1.4rem 1.3rem;
}
.project-content li {
  font-size: .95rem;
  font-weight: 300;
  color: #465272;
  line-height: 1.85;
}
.project-content .tag-row { margin-bottom: 2rem; }
.project-back {
  display: inline-block;
  margin-top: 1rem;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--dark);
}
.project-back:hover { text-decoration: underline; }

.project-btn {
  display: inline-block;
  background: var(--bg-alt);
  color: var(--mid);
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .04em;
  padding: .55rem 1.1rem;
  margin: 0 .6rem .5rem 0;
}
.project-btn:hover { background: var(--border); color: var(--black); text-decoration: none; }

.project-subhead {
  font-size: .95rem;
  font-weight: 500;
  color: var(--black);
  margin: 2rem 0 .6rem;
}
.project-content ul.nested {
  margin-top: .3rem;
  margin-bottom: .8rem;
}
.project-content ul.nested li { font-size: .9rem; }

.project-figure { margin-top: 2rem; }
.project-figure img {
  max-width: 420px;
  width: 100%;
  display: block;
  border: 1px solid var(--border);
}
.project-figure.wide img { max-width: 100%; }

.project-gallery { margin-top: 3rem; }
.project-gallery-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--black);
  padding-bottom: .8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.6rem;
}
.project-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.6rem;
}
.project-gallery-item img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
}
.project-gallery-item figcaption {
  font-size: .8rem;
  font-weight: 500;
  color: var(--mid);
  margin-top: .6rem;
}
.code-block {
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .72rem;
  line-height: 1.6;
  padding: 1.2rem;
  overflow: auto;
  white-space: pre;
  height: 420px;
  box-sizing: border-box;
}
.code-block .kw { color: #cba6f7; }
.code-block .fn { color: #89b4fa; }
.code-block .cm { color: #6c7086; }
.code-block .st { color: #a6e3a1; }

@media (max-width: 700px) {
  .project-gallery-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .project-hero { padding: 180px 1.5rem 0; }
  .project-card { padding: 2.4rem 1.6rem; }
  .project-card h1 { font-size: 1.5rem; }
}

@media (max-width: 500px) {
  .hero-info { padding: 2rem 1.5rem; }
  .hero-info h1 { font-size: 1.8rem; }
  .section { padding: 70px 1rem; }
  .tools-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Portfolio List Page
   ============================================================ */
.portfolio-list { display: flex; flex-direction: column; }
.portfolio-list-item {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 3rem;
  align-items: center;
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
}
.portfolio-list-item:last-child { border-bottom: none; }
.portfolio-list-item:nth-child(even) .portfolio-list-text { order: 2; }
.portfolio-list-item:nth-child(even) .portfolio-list-image { order: 1; }

.portfolio-num {
  display: block;
  font-size: .78rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: .6rem;
}
.portfolio-list-text h3 {
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--mid);
  margin-bottom: 1rem;
  line-height: 1.4;
}
.portfolio-list-text p {
  font-size: .88rem;
  font-weight: 300;
  color: var(--mid);
  line-height: 1.75;
  margin-bottom: 1.4rem;
}
.portfolio-list-image img {
  width: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

@media (max-width: 800px) {
  .portfolio-list-item {
    grid-template-columns: 1fr;
  }
  .portfolio-list-item:nth-child(even) .portfolio-list-text,
  .portfolio-list-item:nth-child(even) .portfolio-list-image {
    order: initial;
  }
  .portfolio-list-image { max-width: 340px; }
}
