:root {
  --bg-color: #f7f7f5;
  --bg-color-rgb: 247, 247, 245;
  --text-primary: #111111;
  --text-secondary: #71717a;
  --pill-bg: #FFFFFF;
  --pill-border: #e0e0dc;
  --preview-bg: #EDF4FF;
}

body.dark-mode {
  --bg-color: #121212;
  --bg-color-rgb: 18, 18, 18;
  --text-primary: #efefef;
  --text-secondary: #999999;
  --pill-bg: #1c1c1c;
  --pill-border: #333333;
  --preview-bg: #EDF4FF;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
}

.page-wrapper {
  width: 100%;
}

/* Header */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px 40px 40px;
  background-color: var(--bg-color);
  z-index: 100;
}

/* Gradient fade so cards dissolve into the bg as they scroll under the header.
   Constrained to the card column so it never overlaps the left panel text. */
.top-nav::after {
  content: '';
  position: absolute;
  left: calc(100px + (100vw - 140px) * 0.3);
  right: 40px;
  top: 100%;
  height: 30px;
  background: linear-gradient(to bottom,
    rgba(var(--bg-color-rgb), 1) 0%,
    rgba(var(--bg-color-rgb), 0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.top-nav.scrolled::after {
  opacity: 1;
}

.theme-toggle {
  width: 48px;
  height: 28px;
  background-color: var(--pill-border);
  border-radius: 14px;
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease;
}

body.dark-mode .theme-toggle {
  background-color: #4a4a4a;
}

.toggle-thumb {
  width: 22px;
  height: 22px;
  background-color: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(20px);
}

body.dark-mode .toggle-thumb {
  transform: translateX(0);
}

/* Main Content */
.content-wrapper {
  padding-left: calc(100px + (100vw - 140px) * 0.3);
  /* 40px left edge + 30% left panel + 60px gap */
  padding-right: 40px;
  padding-top: 108px;
  /* nav padding handles spacing below header */
}

.left-section {
  position: fixed;
  top: 108px;
  left: 40px;
  width: calc((100vw - 140px) * 0.3);
  height: calc(100vh - 108px);
}

.intro-section,
.project-detail-section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  scrollbar-width: none;
  padding-bottom: 40px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.intro-section {
  overflow-y: auto;
}

.project-detail-section {
  overflow-y: hidden;
}

.intro-section {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.intro-section.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

.project-detail-section {
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
}

.project-detail-section.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.intro-section::-webkit-scrollbar,
.project-detail-section::-webkit-scrollbar {
  display: none;
}

h1 {
  font-size: 32px;
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: 32px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.bio {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--text-primary);
  color: var(--bg-color);
  border: 1px solid var(--text-primary);
}

.btn-primary:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--pill-border);
}

.btn-ghost:hover {
  background-color: var(--pill-border);
}

.project-specs {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  margin-bottom: 32px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--pill-border);
  font-size: 14px;
}

.spec-row:first-child {
  border-top: 1px solid var(--pill-border);
}

.spec-key {
  color: var(--text-secondary);
}

.spec-val {
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
}

.current-work {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.current-work a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}

.social-links {
  display: flex;
  gap: 24px;
}

.icon-link {
  color: var(--text-primary);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.icon-link:hover {
  opacity: 1;
}

.right-section {
  width: 100%;
}

.overview-mode {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.overview-mode.hidden {
  display: none;
}

.details-mode {
  display: none;
  flex-direction: column;
  width: 100%;
}

.details-mode.visible {
  display: flex;
}

.scroll-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.placeholder-img {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: var(--preview-bg);
  border-radius: 20px;
  flex-shrink: 0;
}

.detail-image-card {
  width: 100%;
  flex-shrink: 0;
  background-color: var(--preview-bg);
  border-radius: 20px;
  overflow: hidden;
  padding: 40px;
}

/* Empty placeholder cards keep a fixed ratio; image cards grow to fit the design */
.detail-image-card:empty {
  aspect-ratio: 16 / 9;
  padding: 0;
}

.scroll-indicator {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  z-index: 10;
  animation: bounce 2s infinite ease-in-out;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.scroll-indicator svg {
  width: 20px;
  height: 20px;
}

.scroll-indicator.hidden {
  opacity: 0;
}

@keyframes bounce {

  0%,
  100% {
    transform: translate(-50%, 0);
  }

  50% {
    transform: translate(-50%, 8px);
  }
}

.preview-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* Project Cards */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding-bottom: 40px;
}

.project-card {
  cursor: pointer;
}

.card-media-wrap {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  background-color: var(--preview-bg);
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-screen {
  width: 85%;
  border-radius: 8px;
  overflow: hidden;
  background-color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.project-card:hover .card-screen {
  transform: scale(1.02);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.34);
}

.card-media {
  width: 100%;
  height: auto;
  display: block;
}

.card-placeholder {
  width: 100%;
  aspect-ratio: 7 / 5;
}

.card-meta {
  font-size: 15px;
  color: #999;
}

.card-title {
  font-weight: 600;
  color: var(--text-primary);
}

/* About page — Experience & Education
   Reuses the same divider lines + secondary text as the details page. */
.about-content {
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding-bottom: 40px;
}

/* Photo strip — squares filling the old banner slot */
.about-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  flex-shrink: 0;
}

.about-photo {
  margin: 0;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background-color: var(--preview-bg);
  overflow: hidden;
}

.about-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tall portrait — bias the crop upward so the face stays in frame */
.about-photo:first-child img {
  object-position: center 20%;
}

.about-heading {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.about-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--pill-border);
}

.about-row:first-of-type {
  border-top: 1px solid var(--pill-border);
}

.about-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-row-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.about-row-note {
  font-weight: 400;
  color: var(--text-secondary);
}

.about-row-sub {
  font-size: 14px;
  color: var(--text-secondary);
}

.about-row-meta {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: right;
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 40px;
  display: flex;
  justify-content: space-between;
  width: calc((100vw - 140px) * 0.3);
  padding-bottom: 40px;
  font-size: 13px;
  color: #999;
  background-color: var(--bg-color);
}

/* Media Queries */

/* Laptop / small desktop — keep two columns, tighten the rail */
@media (max-width: 1024px) {
  .top-nav {
    padding: 32px 32px 0;
  }

  .top-nav::after {
    left: 348px;
    right: 32px;
  }

  .content-wrapper {
    /* 32px edge + 280px rail + 36px gap = 348px */
    padding: 96px 32px 0 348px;
  }

  .left-section {
    top: 96px;
    left: 32px;
    width: 280px;
    height: calc(100vh - 96px);
  }

  .footer {
    left: 32px;
    width: 280px;
    padding-bottom: 32px;
    font-size: 12px;
  }

  h1 {
    font-size: 30px;
  }

  .projects-list {
    gap: 40px;
  }
}

/* Tablet & phone — single column, normal document flow */
@media (max-width: 900px) {
  .top-nav {
    position: static;
    padding: 24px 24px 0;
    margin-bottom: 32px;
  }

  .top-nav::after {
    display: none;
  }

  .content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 36px;
    padding: 0 24px;
  }

  .left-section {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    height: auto;
  }

  .intro-section,
  .project-detail-section {
    position: relative;
    width: 100%;
    height: auto;
    padding-bottom: 0;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    overflow: visible;
  }

  .intro-section.hidden {
    display: none;
  }

  .project-detail-section {
    display: none;
  }

  .project-detail-section.visible {
    display: block;
  }

  .right-section {
    width: 100%;
  }

  .footer {
    position: static;
    left: auto;
    bottom: auto;
    width: 100%;
    margin-top: 40px;
    padding: 0 24px 24px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 24px;
  }
}

/* Phone — fine-tune spacing and type */
@media (max-width: 480px) {
  .top-nav {
    padding: 20px 20px 0;
  }

  .content-wrapper {
    gap: 28px;
    padding: 0 20px;
  }

  h1 {
    font-size: 26px;
    margin-bottom: 20px;
  }

  .projects-list {
    gap: 28px;
  }

  .card-media-wrap {
    padding: 24px;
    border-radius: 12px;
  }

  .footer {
    flex-direction: column;
    gap: 4px;
    padding: 0 20px 20px;
  }
}