/* ============================================================
   Bryant Phamvu — Portfolio
   Apple-inspired narrative layout
   ============================================================ */

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

html { font-size: 16px; overflow: hidden; height: 100vh; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, 'Inter', Arial, sans-serif;
  color: #1d1d1f;
  background: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden; height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 40px; }

/* ============================================================
   Scroll Reveal
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.25,.46,.45,.94),
              transform 0.7s cubic-bezier(.25,.46,.45,.94);
}
.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Navigation
   ============================================================ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
  transition: background .3s ease;
}

.nav-container {
  max-width: 1080px; margin: 0 auto; padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  height: 48px;
}

.nav-logo { font-weight: 700; font-size: 1.125rem; letter-spacing: -.03em; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-link {
  font-size: .75rem; font-weight: 500; color: #6e6e73;
  transition: color .2s ease; letter-spacing: .01em;
}
.nav-link:hover, .nav-link.active { color: #1d1d1f; }

.nav-dropdown { position: relative; }
.nav-dropdown .dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,.06); border-radius: 12px;
  padding: 6px 0; min-width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,.08);
  opacity: 0; visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}
.nav-dropdown:hover .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.dropdown-menu a {
  display: block; padding: 8px 18px; font-size: .75rem; color: #6e6e73;
  transition: background .15s ease, color .15s ease;
}
.dropdown-menu a:hover { background: rgba(0,0,0,.04); color: #1d1d1f; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 4px; }
.nav-toggle span { display: block; width: 18px; height: 1.5px; background: #1d1d1f; transition: transform .3s ease, opacity .3s ease; }
.nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-menu {
  display: none; position: fixed; top: 48px; left: 0; right: 0; bottom: 0;
  background: #fff; z-index: 999; padding: 32px 40px;
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease;
}
.mobile-menu.open { opacity: 1; visibility: visible; }
.mobile-nav-links a {
  display: block; font-size: 1.125rem; font-weight: 500; color: #1d1d1f;
  padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,.04);
}
.mobile-dropdown { padding-left: 20px; }
.mobile-dropdown a { font-size: .9375rem; font-weight: 400; color: #6e6e73; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .mobile-menu { display: block; }
}

/* ============================================================
   Sections — General
   ============================================================ */
main { position: relative; width: 100%; height: 100vh; overflow: hidden; }

.section {
  position: absolute; inset: 0;
  height: 100vh; overflow-y: auto; overflow-x: hidden;
  padding: 80px 0 40px;
  background: #fff;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .4s ease, visibility .4s ease;
}
.section.active { opacity: 1; visibility: visible; pointer-events: auto; }

.section-heading {
  font-size: 2.75rem; font-weight: 700; letter-spacing: -.04em;
  color: #1d1d1f; margin-bottom: 6px; line-height: 1.1;
}
.section-subheading {
  font-size: 1rem; color: #86868b; font-weight: 400;
  margin-bottom: 36px; letter-spacing: -.01em;
}

/* ============================================================
   1. Hero
   ============================================================ */
.section-hero {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 48px;
  overflow-y: hidden;
}

.hero {
  display: flex; align-items: center;
  justify-content: center; text-align: center; padding: 10px 40px 20px;
  margin-top: auto; margin-bottom: auto;
}

.hero-content { max-width: 680px; }

.hero-photo { margin-bottom: 16px; }
.hero-headshot {
  width: 200px; height: 200px; border-radius: 50%;
  object-fit: cover; object-position: center top;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
  border: 3px solid #fff; outline: 1px solid rgba(0,0,0,.06);
}

.hero-name {
  font-size: clamp(2.75rem, 8vw, 4.5rem);
  font-weight: 700; letter-spacing: -.05em; line-height: 1.05;
  margin-bottom: 8px;
}

.hero-title {
  font-size: .8125rem; font-weight: 500; text-transform: uppercase;
  letter-spacing: .14em; color: #86868b; margin-bottom: 12px;
}

.hero-value {
  font-size: 1.0625rem; color: #424245; line-height: 1.7;
  max-width: 580px; margin: 0 auto 20px; letter-spacing: -.01em;
}

.hero-stats {
  display: flex; align-items: center; justify-content: center; gap: 32px;
}

.stat { text-align: center; }
.stat-number {
  display: block; font-size: 2.25rem; font-weight: 700;
  letter-spacing: -.03em; color: #1d1d1f; line-height: 1.1;
}
.stat-label {
  display: block; font-size: .6875rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .1em;
  color: #86868b; margin-top: 4px;
}

.stat-divider {
  width: 1px; height: 40px; background: #d2d2d7;
}

/* ============================================================
   2. Engineering Process
   ============================================================ */
.section-process {
  background: #fafafa;
  display: flex; align-items: flex-start; justify-content: center;
}
.section-process > .container {
  margin-top: auto; margin-bottom: auto;
}

.process-timeline {
  position: relative; display: flex; justify-content: space-between;
  gap: 16px; margin-top: 12px;
}

.process-line {
  position: absolute; top: 22px; left: 22px; right: 22px;
  height: 1px; background: #d2d2d7; z-index: 0;
}

.process-phase {
  flex: 1; text-align: center; position: relative; z-index: 1;
}

.phase-node {
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: 1.5px solid #d2d2d7;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
}
.phase-number { font-size: .8125rem; font-weight: 600; color: #86868b; }

.phase-content h3 {
  font-size: .75rem; font-weight: 600; color: #1d1d1f;
  letter-spacing: .01em; margin-bottom: 6px;
}

.phase-desc {
  font-size: .6875rem; color: #86868b; line-height: 1.6;
}

@media (max-width: 768px) {
  .process-timeline { flex-direction: column; gap: 0; }
  .process-line { top: 0; bottom: 0; left: 22px; right: auto; width: 1px; height: auto; }
  .process-phase {
    display: flex; align-items: flex-start; gap: 16px;
    text-align: left; padding: 12px 0;
  }
  .phase-node { margin: 0; flex-shrink: 0; }
}

/* Extra breathing room at bottom of content-heavy sections */
#portfolio, #patents, #resume { padding-bottom: 100px; }

/* ============================================================
   3. Portfolio — Case Studies
   ============================================================ */
.case-study {
  border: 1px solid #e8e8ed; border-radius: 16px;
  margin-bottom: 16px; overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.case-study:hover { border-color: #d2d2d7; box-shadow: 0 2px 16px rgba(0,0,0,.04); }

.case-toggle {
  width: 100%; display: flex; align-items: center;
  padding: 24px 28px; gap: 16px; text-align: left;
  transition: background .2s ease;
}
.case-toggle:hover { background: #fafafa; }

.case-preview { flex: 1; }

.case-domain {
  display: inline-block; font-size: .625rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
  color: #86868b; margin-bottom: 4px;
}

.case-name {
  font-size: 1.25rem; font-weight: 600; color: #1d1d1f;
  letter-spacing: -.02em; margin-bottom: 2px;
}

.case-company { font-size: .75rem; color: #86868b; }

.case-arrow {
  width: 20px; height: 20px; color: #86868b;
  transition: transform .3s ease; flex-shrink: 0;
}
.case-study.open .case-arrow { transform: rotate(180deg); }

.case-body {
  max-height: 0; overflow: hidden;
  transition: max-height .5s cubic-bezier(.25,.46,.45,.94);
}
.case-study.open .case-body { max-height: 8000px; }

.case-hero-img {
  padding: 0 28px 24px;
}
.case-hero-img > img {
  width: 100%; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.case-narrative { padding: 0 28px 24px; }

.case-section { margin-bottom: 24px; }
.case-section:last-child { margin-bottom: 0; }

.case-section h4 {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: #86868b; margin-bottom: 8px;
}

.case-section p {
  font-size: .9375rem; color: #424245; line-height: 1.75;
}

.case-section ul {
  padding-left: 18px; list-style: disc;
}
.case-section li {
  font-size: .875rem; color: #424245; line-height: 1.7; margin-bottom: 4px;
}

/* Expandable Tech Panels */
.tech-detail {
  border-top: 1px solid #f0f0f2;
}

.tech-toggle {
  width: 100%; padding: 16px 28px;
  font-size: .75rem; font-weight: 600; color: #6e6e73;
  letter-spacing: .02em; text-align: left;
  display: flex; align-items: center; gap: 8px;
  transition: background .15s ease, color .15s ease;
}
.tech-toggle::after {
  content: '+'; margin-left: auto; font-size: 1rem;
  font-weight: 400; transition: transform .3s ease;
}
.tech-detail.open .tech-toggle::after { content: '−'; }
.tech-toggle:hover { background: #fafafa; color: #1d1d1f; }

.tech-panel {
  max-height: 0; overflow: hidden;
  transition: max-height .4s ease;
  padding: 0 28px;
}
.tech-detail.open .tech-panel {
  max-height: 2000px; padding-bottom: 24px;
}

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table th {
  text-align: left; font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: #86868b;
  padding: 8px 14px; border-bottom: 1px solid #e8e8ed;
}
.spec-table td {
  font-size: .8125rem; color: #424245; padding: 8px 14px;
  border-bottom: 1px solid rgba(0,0,0,.03);
}
.spec-table tr:last-child td { border-bottom: none; }

.component-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.component-tags span {
  font-size: .6875rem; color: #424245; background: #f5f5f7;
  padding: 5px 12px; border-radius: 100px;
}

.inline-patent {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: #fafafa; border-radius: 8px;
  margin-bottom: 6px; flex-wrap: wrap;
}
.ip-badge {
  font-size: .5625rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; padding: 2px 8px; border-radius: 100px;
}
.inline-patent.issued .ip-badge { background: #e8f5e8; color: #2d7d2d; }
.inline-patent.pending .ip-badge { background: #fff3e0; color: #b87a00; }
.inline-patent span:not(.ip-badge) { font-size: .8125rem; color: #1d1d1f; flex: 1; }
.ip-link {
  font-size: .6875rem; color: #0066cc; font-weight: 500;
  transition: color .2s ease;
}
.ip-link:hover { color: #004499; }

.flow-diagram { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.flow-node { padding: 10px 20px; background: #f5f5f7; border-radius: 8px; font-size: .75rem; font-weight: 500; }
.flow-node.accent { background: #1d1d1f; color: #fff; }
.flow-connector { font-size: 1rem; color: #86868b; font-weight: 500; }
.flow-arrow { font-size: 1.125rem; color: #86868b; }

/* Gallery (inside case studies) */
.gallery { border-radius: 12px; overflow: hidden; }
.gallery-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.gallery-prev, .gallery-next {
  width: 44px; height: 44px; border-radius: 50%; background: #1d1d1f;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; color: #fff; transition: background .2s ease, transform .15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.gallery-prev:hover, .gallery-next:hover { background: #333; transform: scale(1.08); }
.gallery-counter { font-size: .8125rem; color: #1d1d1f; font-weight: 600; min-width: 50px; text-align: center; }
.gallery-track { position: relative; overflow: hidden; border-radius: 10px; }
.gallery-slide { display: none; }
.gallery-slide.active, .gallery-slide:only-child { display: block; }
.gallery-slide img { width: 100%; border-radius: 10px; box-shadow: 0 1px 8px rgba(0,0,0,.04); }
.gallery-caption { font-size: .6875rem; color: #86868b; text-align: center; margin-top: 10px; line-height: 1.5; }

/* ============================================================
   4. Patents — Card Grid
   ============================================================ */
.patent-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}

.patent-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px; border: 1px solid #e8e8ed; border-radius: 14px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
a.patent-card:hover {
  border-color: #d2d2d7;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
}

.pc-badge {
  display: inline-block; width: fit-content;
  font-size: .5625rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; padding: 3px 10px; border-radius: 100px;
}
.pc-badge.issued { background: #e8f5e8; color: #2d7d2d; }
.pc-badge.pending { background: #fff3e0; color: #b87a00; }

.pc-title {
  font-size: .875rem; font-weight: 600; color: #1d1d1f;
  line-height: 1.4; flex: 1;
}

.pc-number { font-size: .6875rem; color: #0066cc; font-weight: 500; }
.pc-domain { font-size: .625rem; color: #86868b; text-transform: uppercase; letter-spacing: .06em; }

@media (max-width: 900px) { .patent-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .patent-grid { grid-template-columns: 1fr; } }

/* ============================================================
   5. Resume / Experience
   ============================================================ */
.resume-block {
  margin-bottom: 40px;
}
.resume-block:last-child { margin-bottom: 0; }

.resume-block-title {
  font-size: 1.125rem; font-weight: 600; color: #1d1d1f;
  margin-bottom: 20px; letter-spacing: -.01em;
  padding-bottom: 10px; border-bottom: 1px solid #e8e8ed;
}

/* Experience Entries */
.exp-entry {
  border: 1px solid #e8e8ed; border-radius: 10px;
  margin-bottom: 10px; overflow: hidden;
  transition: border-color .2s ease;
}
.exp-entry:hover { border-color: #d2d2d7; }

.exp-toggle {
  width: 100%; display: flex; align-items: center;
  padding: 16px 20px; gap: 12px; text-align: left;
  transition: background .2s ease;
}
.exp-toggle:hover { background: #fafafa; }

.exp-header { flex: 1; }
.exp-role { font-size: .9375rem; font-weight: 600; color: #1d1d1f; margin-bottom: 1px; }
.exp-company { font-size: .75rem; color: #86868b; }
.exp-dates { font-size: .6875rem; color: #86868b; white-space: nowrap; }

.exp-arrow {
  width: 18px; height: 18px; color: #86868b;
  transition: transform .3s ease; flex-shrink: 0;
}
.exp-entry.open .exp-arrow { transform: rotate(180deg); }

.exp-details {
  max-height: 0; overflow: hidden;
  transition: max-height .4s ease;
}
.exp-entry.open .exp-details { max-height: 800px; }

.exp-details ul {
  padding: 0 20px 20px 38px; list-style: disc;
}
.exp-details li {
  font-size: .8125rem; color: #424245; line-height: 1.7; margin-bottom: 4px;
}

/* Education */
.edu-entry {
  padding: 16px 20px; border: 1px solid #e8e8ed; border-radius: 10px;
}
.edu-entry h4 { font-size: .9375rem; font-weight: 600; color: #1d1d1f; margin-bottom: 2px; }
.edu-entry span { font-size: .8125rem; color: #86868b; }

/* Skills Grid */
.skills-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}

.skill-group {
  padding: 16px 18px; background: #f5f5f7; border-radius: 12px;
}
.skill-group h4 {
  font-size: .6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: #1d1d1f; margin-bottom: 6px;
}
.skill-group p { font-size: .75rem; color: #6e6e73; line-height: 1.55; }

@media (max-width: 768px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .skills-grid { grid-template-columns: 1fr; } }

/* Interests */
.interests-row { display: flex; flex-wrap: wrap; gap: 10px; }
.interest-tag {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: #f5f5f7; border-radius: 10px;
  transition: background .2s ease;
}
.interest-tag:hover { background: #e8e8ed; }
.interest-tag svg { width: 22px; height: 22px; color: #1d1d1f; flex-shrink: 0; }
.interest-tag span { font-size: .8125rem; font-weight: 500; color: #1d1d1f; }

/* ============================================================
   6. Connect
   ============================================================ */
.section-connect {
  text-align: center;
  background: #fafafa;
  display: flex; align-items: flex-start; justify-content: center;
}
.section-connect > .container {
  margin-top: auto; margin-bottom: auto;
}

.section-footer-note {
  position: absolute; bottom: 20px; left: 0;
  width: 100%; text-align: center;
  font-size: .75rem; color: #86868b;
}

.connect-links {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 400px; margin: 0 auto;
}

.connect-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%;
  padding: 14px 24px; border-radius: 12px;
  font-size: .875rem; font-weight: 500; color: #1d1d1f;
  border: 1px solid #e8e8ed;
  transition: background .2s ease, border-color .2s ease;
}
.connect-btn:hover {
  background: #fff; border-color: #d2d2d7;
}
.connect-btn svg { flex-shrink: 0; }

.connect-btn.primary {
  background: #1d1d1f; color: #fff; border-color: #1d1d1f;
}
.connect-btn.primary:hover {
  background: #333; border-color: #333;
}

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
  padding: 40px;
}
.lightbox.open { opacity: 1; visibility: visible; pointer-events: auto; }

.lightbox-close {
  position: absolute; top: 16px; right: 24px;
  font-size: 2rem; color: #fff; background: none; border: none;
  cursor: pointer; line-height: 1; padding: 8px;
  transition: opacity .2s ease;
}
.lightbox-close:hover { opacity: .7; }

.lightbox-img {
  max-width: 90vw; max-height: 80vh;
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.4);
}

.lightbox-caption {
  color: rgba(255,255,255,.7); font-size: .8125rem;
  margin-top: 12px; text-align: center; max-width: 600px;
}

/* Make gallery/case images clickable */
.gallery-slide img, .case-hero-img > img {
  cursor: zoom-in;
}

/* Footer removed — copyright folded into Contact section */

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .container { padding: 0 24px; }
  .section { padding: 60px 0 32px; }
  .section-heading { font-size: 2rem; }

  .section-hero { overflow-y: auto; }
  .hero { padding: 20px 24px 60px; }
  .hero-headshot { width: 160px; height: 160px; }
  .hero-name { font-size: 2.5rem; }
  .hero-value { font-size: .9375rem; }
  .hero-stats { gap: 20px; }
  .stat-number { font-size: 1.75rem; }

  /* Process — disable flex centering so it scrolls naturally on mobile */
  .section-process { display: block; }
  .section-process > .container { margin-top: 0; margin-bottom: 0; padding-bottom: 100px; }

  /* Extra bottom breathing room on mobile for content-heavy sections */
  #patents, #resume { padding-bottom: 140px; }

  .case-toggle { padding: 18px 20px; }
  .case-narrative, .case-hero-img { padding-left: 20px; padding-right: 20px; }
  .tech-toggle { padding-left: 20px; padding-right: 20px; }
  .tech-panel { padding-left: 20px; padding-right: 20px; }

  .process-section { padding: 0 24px 40px; }
  .nav-container { padding: 0 24px; }
}
