html, body {
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 400;
  overflow-x: hidden;
}

html {
  scroll-snap-type: y proximity;
}

@media (max-width: 900px) {
  html {
    scroll-snap-type: none;
  }

  header {
    padding: 16px 5vw;
  }

  header .resume-button {
    font-size: 0.7rem;
    padding: 4px 10px;
    white-space: nowrap;
  }
}

/* ── Header ── */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 10vw;
  z-index: 13050;
}
header img {
  height: 28px;
  width: auto;
  display: block;
}
#logo-wrap {
  position: relative;
  height: 28px;
}
#logo-wrap img {
  height: 28px;
  width: auto;
  display: block;
}
#logo-white {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 1;
  transition: opacity 220ms ease;
}

html.logo-use-dark #logo-white {
  opacity: 0;
}
header button {
  background: rgba(244, 244, 244, 0.35);
  border: 0px solid #111;
  color: #111;
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.03em;
}
header button:hover {
  background: #111;
  color: #fff;
}
header .resume-button {
  background: rgba(244, 244, 244, 0.35);
  border: 0px solid #111;
  color: #111;
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.03em;
  text-decoration: none;
  display: inline-block;
  transition: background 220ms ease, color 220ms ease;
}
header .resume-button:hover {
  background: #111;
  color: #fff;
}

html.logo-use-dark header .resume-button {
  background: rgba(0, 0, 0, 0.04);
}

/* ── Scroll indicator ── */
#scroll-indicator {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#scroll-indicator video {
  height: 48px;
  width: auto;
  display: block;
}

/* ── Video stage ── */
#stage {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  scroll-snap-align: start;
}
#crop {
  width: 35vw;
  height: 60vh;
  overflow: hidden;
  position: relative;
}
#vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Experience section ── */
#experience {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  scroll-snap-align: start;
}
#experience img {
  position: absolute;
  width: 100%;
  height: 120%;
  top: -10%;
  object-fit: cover;
  opacity: 1;
  transform: translate3d(0, var(--experience-parallax-y, 0px), 0);
  transition: none;
}
#experience-text {
  position: absolute;
  width: 60%;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 400;
  font-size: 36pt;
  line-height: 1.15;
  color: #fff;
  transform: translateY(-8vh);
}
#experience-text .line-left   { text-align: left; }
#experience-text .line-centre { text-align: center; }
#experience-text .line-right  { text-align: right; }
#experience-text em {
  font-style: normal;
  font-weight: 700;
  color: #FFC06C;
}

#experience-text span {
  display: block;
  opacity: 0;
  transform: translateY(40px);
}

/* Triggered when #experience gains .in-view */
#experience.in-view img {
  opacity: 1;
  transform: translate3d(0, var(--experience-parallax-y, 0px), 0);
}
#experience.in-view .line-left {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.55s forwards;
}
#experience.in-view .line-centre {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.75s forwards;
}
#experience.in-view .line-right {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.95s forwards;
}

@keyframes slideUpBounce {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Projects timeline ── */
#projects-timeline {
  position: relative;
  z-index: 3;
  background: #f4f4f4;
  width: 100%;
  margin-top: 24px;
  padding: 140px 0 120px;
  --timeline-image-zoom: 1.0;
}
.timeline-shell {
  width: min(1280px, 92vw);
  margin: 0 auto;
}
.timeline-kicker {
  margin: 0 0 24px;
  text-align: center;
  font-family: sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  color: #2a2a2a;
}
#timeline-items {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 84px;
}
#timeline-items::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: #d7d7d7;
}
.timeline-item {
  position: relative;
  min-height: 66vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
  align-items: center;
  gap: 0;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #151515;
  transform: translate(-50%, -50%);
  z-index: 2;
}
.timeline-content {
  grid-column: 1;
  grid-row: 1;
  max-width: 360px;
  justify-self: end;
  align-self: center;
  margin-right: 26px;
  opacity: 1;
  transform: none;
}
.timeline-item.is-right .timeline-content {
  grid-column: 3;
  justify-self: start;
  margin-left: 26px;
  margin-right: 0;
}
.timeline-type {
  margin: 0 0 8px;
  color: #464646;
  font-size: 0.95rem;
  font-family: sans-serif;
}
.timeline-title {
  margin: 0;
  color: #171717;
  font-size: clamp(1.6rem, 3.6vw, 2.7rem);
  line-height: 1.02;
  font-weight: 400;
}
.timeline-logo {
  margin: 0 0 16px;
  width: min(100%, 340px);
  height: auto;
  display: block;
  cursor: pointer;
}
.timeline-item:nth-child(4) .timeline-logo {
  width: min(100%, 200px);
}
.timeline-summary {
  margin: 16px 0 0;
  color: #727272;
  font-family: sans-serif;
  font-size: 0.86rem;
  line-height: 1.65;
}
.timeline-media {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  --timeline-parallax-room: 240px;
  width: min(100%, 560px);
  max-width: 560px;
  height: clamp(300px, 44vw, 520px);
  align-self: center;
  overflow: hidden;
  display: block;
  text-decoration: none;
  justify-self: end;
  margin-right: 0;
}
.timeline-item.is-right .timeline-media {
  grid-column: 1;
  justify-self: start;
  margin-right: 0;
  margin-left: 0;
}
.timeline-media img {
  position: absolute;
  left: 0;
  top: calc(var(--timeline-parallax-room) * -0.5);
  width: 100%;
  height: calc(100% + var(--timeline-parallax-room));
  margin-top: 0;
  display: block;
  object-fit: cover;
  object-position: calc(var(--timeline-image-pos-x, 50%) + var(--timeline-image-pan-x, 0px)) calc(var(--timeline-image-pos-y, 50%) + var(--timeline-image-pan-y, 0px));
  transform: translate(
    var(--timeline-image-offset-x, 0px),
    calc(var(--timeline-image-offset-y, 0px) + var(--timeline-image-shift, 0px))
  ) scale(var(--timeline-image-zoom, 1.24));
  transform-origin: var(--timeline-image-origin-x, 50%) var(--timeline-image-origin-y, 50%);
  will-change: transform;
  cursor: pointer;
}

.timeline-fullscreen-viewer {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 12000;
  pointer-events: none;
  transition: none;
}

.timeline-fullscreen-viewer[aria-hidden='true'] {
  display: none;
}

.timeline-fullscreen-viewer.is-open {
  background: transparent;
  pointer-events: auto;
}

.timeline-fullscreen-viewer.is-closing {
  background: transparent;
  pointer-events: none;
}

.timeline-fullscreen-image {
  position: fixed;
  margin: 0;
  object-fit: cover;
  object-position: center center;
  transition:
    left 820ms cubic-bezier(0.22, 1, 0.36, 1),
    top 820ms cubic-bezier(0.22, 1, 0.36, 1),
    width 820ms cubic-bezier(0.22, 1, 0.36, 1),
    height 820ms cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-item.in-view .timeline-content {
  animation: none;
}

@media (min-width: 901px) {
  html,
  body {
    scroll-snap-type: y mandatory;
  }

  #stage,
  #experience {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  #timeline-items::before {
    left: 50%;
    transform: translateX(-50%);
  }
  .timeline-item {
    grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
    padding-left: 0;
  }
}

@media (max-width: 900px) {
  #projects-timeline {
    padding: 96px 0 86px;
  }
  #timeline-items {
    gap: 62px;
  }
  #timeline-items .timeline-item:nth-child(1) {
    --timeline-mobile-image-zoom:1.5;
    --timeline-mobile-image-x: 60%;
    --timeline-mobile-image-y: 00%;
  }
  #timeline-items .timeline-item:nth-child(2) {
    --timeline-mobile-image-zoom: 1.4;
    --timeline-mobile-image-x: 40%;
    --timeline-mobile-image-y: 20%;
  }
  #timeline-items .timeline-item:nth-child(3) {
    --timeline-mobile-image-zoom: 1.1;
    --timeline-mobile-image-x: 0%;
    --timeline-mobile-image-y: 50%;
  }
  #timeline-items .timeline-item:nth-child(4) {
    --timeline-mobile-image-zoom: 1.8;
    --timeline-mobile-image-x: 20%;
    --timeline-mobile-image-y: 00%;
  }
  #timeline-items::before {
    left: 18px;
    transform: none;
  }
  .timeline-item {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding-left: 42px;
  }
  .timeline-item::before {
    left: 18px;
    top: 12px;
    transform: translate(-50%, 0);
  }
  .timeline-content,
  .timeline-item.is-right .timeline-content,
  .timeline-media,
  .timeline-item.is-right .timeline-media {
    grid-column: 1;
    justify-self: start;
    width: 40vw;
    max-width: 40vw;
    margin: 0;
  }
  .timeline-content,
  .timeline-item.is-right .timeline-content {
    grid-row: 1;
    justify-self: start;
    width: 100%;
    max-width: none;
  }
  .timeline-media,
  .timeline-item.is-right .timeline-media {
    grid-row: 2;
    justify-self: start;
    width: 80vw;
    max-width: 80vw;
    margin-left: 0;
    margin-right: 0;
  }
  .timeline-media {
    height: clamp(144px, 34.8vw, 252px);
  }
  .timeline-media img,
  .timeline-item.is-right .timeline-media img {
    object-position: var(--timeline-mobile-image-x) var(--timeline-mobile-image-y);
    transform: translate(
      var(--timeline-image-offset-x, 0px),
      calc(var(--timeline-image-offset-y, 0px) + var(--timeline-image-shift, 0px))
    ) scale(var(--timeline-mobile-image-zoom));
    transform-origin: var(--timeline-mobile-image-x) var(--timeline-mobile-image-y);
  }
  .timeline-type {
    margin-bottom: 5px;
    font-size: 0.75rem;
  }
  .timeline-title {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
  }
  .timeline-logo {
    margin-bottom: 12px;
    width: min(36vw, 150px);
  }

  .timeline-item:nth-child(4) .timeline-logo {
    width: min(36vw, 100px);
  }
  .timeline-summary {
    margin-top: 10px;
    font-size: 0.72rem;
    line-height: 1.45;
  }
}

/* ── Skills cards ── */
#skills {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  gap: 16px;
  padding: 0 10vw;
}
.skill-card {
  flex: 1;
  background: #f4f4f4;
  border-radius: 16px 16px 0 0;
  padding: 44px 24px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  opacity: 0;
  transform: translateY(60px);
}
.skill-card h3 {
  margin: 0 0 16px;
  font-size: 1.22rem;
  font-weight: 700;
  font-family: sans-serif;
  color: #111;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags span {
  font-size: 0.72rem;
  font-family: sans-serif;
  color: #333;
  background: rgba(185, 185, 185, 0.2);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

/* Cards pop in when #skills gains .in-view */
#skills.in-view .skill-card:nth-child(1) {
  animation: slideUpBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s forwards;
}
#skills.in-view .skill-card:nth-child(2) {
  animation: slideUpBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s forwards;
}
#skills.in-view .skill-card:nth-child(3) {
  animation: slideUpBounce 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.25s forwards;
}

@media (max-width: 900px) {
  #experience img {
    object-position: right center;
  }

  #experience-text {
    width: 70%;
    font-size: 24pt;
    transform: translateY(-6vh);
    text-align: center;
  }

  #experience-text .line-left,
  #experience-text .line-centre,
  #experience-text .line-right {
    display: inline;
    text-align: center;
  }

  #skills {
    flex-direction: column;
    gap: 8px;
    padding: 0 5vw;
  }

  .skill-card {
    padding: 18px 16px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .skill-card h3,
  .skill-card .tags {
    display: none;
  }

  .skill-card h3 {
    margin-bottom: 8px;
    font-size: 1rem;
  }

  .tags span {
    font-size: 0.65rem;
    padding: 4px 8px;
  }
}

/* ── Contact section ── */
#contact {
  position: relative;
  z-index: 4;
  background: #f5f4f3;
  color: #2b2b2b;
  min-height: 100vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.contact-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  padding: 60px 10vw;
  flex: 1;
  justify-content: center;
}

.contact-image {
  position: relative;
  width: 400px;
  aspect-ratio: 4 / 4;
  margin-left: auto;
  margin-right: 0;
  margin-bottom: -80px;
  z-index: 5;
  opacity: 0;
  transform: translateY(40px);
}

.contact-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 32px;
  display: block;
}

.contact-content h2 {
  margin: 0 0 48px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  line-height: 1.2;
  color: #8A8989;
  font-family: 'Newsreader', Georgia, serif;
  opacity: 0;
  transform: translateY(40px);
}

#contact.in-view .contact-content h2 {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.contact-button {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.00);
  text-decoration: none;
  transition: all 280ms ease;
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  opacity: 0;
  transform: translateY(40px);
}

#contact.in-view .contact-image {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}

#contact.in-view .contact-button:nth-child(1) {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards;
}

#contact.in-view .contact-button:nth-child(2) {
  animation: slideUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s forwards;
}

.contact-button:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateX(8px);
}

.contact-icon-wrapper {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-icon-wrapper img {
  width: 32px;
  height: 32px;
  display: block;
}

.contact-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.contact-info h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Newsreader', Georgia, serif;
  color: #2b2b2b;
  text-align: left;
}

.contact-info p {
  margin: 0;
  font-size: 0.95rem;
  font-family: 'Newsreader', Georgia, serif;
  color: #8A8989;
  text-align: left;
}

.contact-footer {
  background: #2F2D2B;
  text-align: center;
  padding: 60px 10vw 40px;
  margin: 40px -10vw 0 -10vw;
  width: calc(100% );
  font-family: Newsreader, Georgia, serif;
}

.contact-footer p {
  margin: 0;
  font-size: 0.95rem;
  font-family: 'Newsreader', Georgia, serif;
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 900px) {
  #contact {
    min-height: 0;
    padding: 60px 0 0;
    gap: 0;
  }

  .contact-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 5vw;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
    justify-items: center;
    text-align: center;
    gap: 20px;
  }

  .contact-image {
    aspect-ratio: 1 / 1;
    max-width: 280px;
    width: 100%;
    margin: 0;
  }

  .contact-content {
    text-align: center;
    width: 100%;
  }

  .contact-content h2 {
    font-size: 1.4rem;
    margin-bottom: 24px;
  }

  .contact-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 16px;
  }

  .contact-button {
    position: relative;
    padding: 16px;
    justify-content: center;
    width: 280px;
    box-sizing: border-box;
    margin-inline: auto;
  }

  .contact-button .contact-icon-wrapper {
    position: absolute;
    left: 16px;
  }

  .contact-button .contact-info {
    width: 100%;
  }

  .contact-info h3,
  .contact-info p {
    text-align: center;
  }

  .contact-icon-wrapper {
    width: 56px;
    height: 56px;
  }

  .contact-icon-wrapper img {
    width: 28px;
    height: 28px;
  }

  .contact-info h3 {
    font-size: 0.95rem;
  }

  .contact-info p {
    font-size: 0.85rem;
  }

  .contact-footer {
    margin: 40px 0 0;
    padding: 32px 5vw 24px;
    width: 100%;
    box-sizing: border-box;
  }
}
