/* ==========================================================================
   Chan Luu — Portfolio
   Design tokens from Figma (Chan's Portfolio)
   ========================================================================== */

:root {
  --gray-900: #1d1d1d;
  --gray-700: #474747;
  --gray-600: #636363;
  --gray-200: #d4d4d4;
  --gray-150: #e7e7e7;
  --gray-100: #f4f4f4;
  --background-grey: #fbfbfb;

  /* Fluid horizontal page padding: 24px on small screens → 120px on desktop */
  --page-pad: clamp(24px, 8vw, 120px);
  /* Fluid vertical section padding: 64px → 120px */
  --section-pad: clamp(64px, 8vw, 120px);
  /* Gap between a side category title and the section content */
  --side-gap: 80px;
  /* Width of the sticky side column on desktop */
  --side-col: 340px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 28px;
  color: var(--gray-900);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: 1512px;
  margin: 0 auto;
}

/* Type scale (from Figma text styles) */
.header-2 {
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 400;
  line-height: normal;
}

.header-3 {
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 500;
  line-height: normal;
}

.title-l {
  font-size: 22px;
  font-weight: 500;
  line-height: normal;
}

.title-m {
  font-size: 18px;
  font-weight: 600;
  line-height: normal;
}

.body-l {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.4;
}

.body-m {
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
}

.body-s {
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--gray-100);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px var(--page-pad);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 18px;
  line-height: 28px;
}

.nav__brand img {
  width: 24px;
  height: 24px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 36px);
  font-size: 18px;
  line-height: 28px;
}

.nav__links a:hover {
  color: var(--gray-600);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  background: #fff;
  padding: clamp(64px, 9vw, 140px) var(--page-pad);
  /* Fill the viewport (minus the sticky nav) so the next section sits below
     the fold and only reveals once the visitor starts scrolling. */
  min-height: calc(100vh - 77px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero__inner {
  display: flex;
  gap: var(--side-gap);
  align-items: flex-start;
}

.hero__photo {
  width: clamp(180px, 22vw, 340px);
  height: auto;
  border-radius: 50%;
  flex-shrink: 0;
}

.hero__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.hero__heading {
  color: var(--gray-600);
}

.hero__heading strong {
  font-weight: 600;
  color: var(--gray-900);
}

.hero__text {
  display: flex;
  flex-direction: column;
  gap: 24px;
  color: var(--gray-600);
}

.hero__links {
  display: flex;
  width: 100%;
}

.hero__link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 0 16px;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 20px;
  line-height: 1.4;
}

.hero__link:last-child {
  justify-content: flex-end;
}

.hero__link img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

a.hero__link:hover {
  color: var(--gray-900);
}

/* --------------------------------------------------------------------------
   Sections with a side category title
   -------------------------------------------------------------------------- */

.section {
  background: #fff;
  padding: var(--section-pad) var(--page-pad);
}

.section--split {
  display: flex;
  gap: var(--side-gap);
  align-items: flex-start;
}

.side-category {
  width: var(--side-col);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 108px; /* below the sticky nav */
}

.side-category p {
  color: var(--gray-600);
  font-size: 20px;
  line-height: 1.4;
}

.section__content {
  flex: 1;
  min-width: 0;
}

/* Stacked section (title above content) */
.section > .side-category {
  position: static;
  width: min(100%, 360px);
  margin-bottom: 40px;
}

/* --------------------------------------------------------------------------
   What I do
   -------------------------------------------------------------------------- */

.whatido-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

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

.whatido__image {
  width: 100%;
  height: clamp(280px, 26vw, 392px);
  object-fit: cover;
  border-radius: 16px;
}

.whatido__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.whatido__text p:last-child {
  color: var(--gray-600);
}

/* --------------------------------------------------------------------------
   Clients
   -------------------------------------------------------------------------- */

.clients-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: clamp(24px, 4vw, 48px);
  min-height: 145px;
}

.clients-row img {
  height: clamp(20px, 2.3vw, 34px);
  width: auto;
}

.clients-row img.clients-row__tall {
  height: clamp(24px, 2.6vw, 37px);
}

/* --------------------------------------------------------------------------
   Project cards
   -------------------------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 280px;
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
}

.project-card__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  transition: transform 0.4s ease;
}

a.project-card:hover .project-card__image {
  transform: scale(1.03);
}

.project-card__caption {
  margin: 0 16px 24px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Ghost button ("See all projects") */
.button-ghost {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  font-size: 20px;
  line-height: 1.4;
  color: #000;
  margin-top: 40px;
}

.button-ghost img {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

.button-ghost:hover img {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-block {
  display: flex;
  flex-direction: column;
  gap: 40px;
  justify-content: center;
  padding-top: clamp(40px, 10vw, 160px);
}

.contact-row {
  display: flex;
  gap: 24px;
  align-items: baseline;
}

.contact-row__label {
  width: 160px;
  flex-shrink: 0;
  color: var(--gray-600);
  font-size: 20px;
  line-height: 1.4;
}

.contact-row__values {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.contact-row__values a,
.contact-row__values p {
  font-size: clamp(22px, 2.5vw, 36px);
  font-weight: 500;
  line-height: normal;
  color: #000;
  overflow-wrap: anywhere;
}

.contact-row__values a:hover {
  color: var(--gray-600);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  background: #fff;
  padding: var(--section-pad) var(--page-pad);
}

.footer__inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer__inner img {
  width: 24px;
  height: 24px;
}

.footer__inner p {
  font-size: 22px;
  font-weight: 500;
  color: var(--gray-600);
}

/* --------------------------------------------------------------------------
   Project page (case study)
   -------------------------------------------------------------------------- */

/* Case-study layout: sticky left column, only the right column scrolls */
.case-split {
  display: flex;
  gap: var(--side-gap);
  align-items: flex-start;
  /* Pull the whole case study up 40px so the title + header sit higher */
  padding-top: calc(var(--section-pad) - 40px);
}

/* Left column: title at the top, project facts pushed down to ~40px above the
   bottom of the viewport. It is pinned at its own natural position (below the
   nav + the section's top padding) so it never slides — the sidebar stays put
   and only the right column scrolls. `min-height` lets it grow (and the page
   scroll take over) only when the viewport is too short to fit its content. */
.case-side {
  width: var(--side-col);
  flex-shrink: 0;
  position: sticky;
  top: calc(77px + var(--section-pad) - 40px); /* 77px nav + the article's top padding (nudged up 40px) */
  min-height: calc(100vh - 77px - var(--section-pad) + 40px);
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
}

.case-side .article-info {
  margin-top: auto; /* push the fact chips to the bottom of the column */
}

/* Side info: project title + fact chips */
.article-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  margin: 0; /* reset default <dl> margin */
}

.article-info__chip {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-200);
}

.article-info__chip dt {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--gray-600);
  font-size: 18px;
  line-height: 1.4;
}

.article-info__chip dd {
  flex: 1;
  min-width: 0;
  margin: 0;
  text-align: right;
  font-size: 18px;
  font-weight: 500;
  color: var(--gray-900);
}

/* Article body */
.case-body {
  display: flex;
  flex-direction: column;
  gap: 80px;
}

.case-intro {
  color: #000;
}

.case-part {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.case-part__title {
  font-size: 22px;
  font-weight: 500;
  line-height: normal;
  color: var(--gray-900);
}

.case-part__text {
  color: var(--gray-700);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case-part__text ul {
  padding-left: 27px;
  display: flex;
  flex-direction: column;
}

.case-part__text a {
  text-decoration: underline;
  text-underline-position: from-font;
}

.case-img {
  width: 100%;
  border-radius: 20px;
  object-fit: cover;
}

.case-img--bordered {
  border: 1px solid var(--gray-150);
}

.case-figure {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin: 0;
  width: 100%;
}

.case-figure figcaption {
  font-size: 16px;
  line-height: 24px;
  color: var(--gray-600);
}

.case-img-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
}

/* Cropped horizontal band (e.g. a wide process diagram shown as a strip) */
.case-band {
  position: relative;
  width: 100%;
  aspect-ratio: 852 / 207;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--gray-150);
}

.case-band img {
  position: absolute;
  top: -84.03%;
  left: 0;
  width: 100%;
  height: 231.52%;
  max-width: none;
  object-fit: cover;
}

/* Image pair with equal heights (e.g. screens + component sheet) */
.case-img-pair--fixed .case-img {
  aspect-ratio: 414 / 255;
}

.case-img--contain {
  object-fit: contain;
  background: #fbfbfb;
}

/* Step row: text beside a fixed media panel (e.g. audit / build / finalize) */
.futu-step {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  width: 100%;
}

.futu-step__text {
  flex: 1;
  min-width: 0;
}

.futu-step__media {
  flex: 0 0 45%;
  max-width: 450px;
  height: 218px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gray-100);
}

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

.futu-step__media--contain {
  background: #f2f2f2;
}

.futu-step__media--contain img {
  object-fit: contain;
}

/* Research collage panel: a grey board holding a grid of artifacts */
.futu-collage {
  flex: 0 0 45%;
  max-width: 450px;
  aspect-ratio: 450 / 253;
  background: var(--gray-100);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.futu-collage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  min-width: 0;
  min-height: 0;
}

.futu-collage--cols2 {
  grid-template-columns: 1fr 1fr;
}

.futu-collage--grid4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

@media (max-width: 760px) {
  .futu-step {
    flex-direction: column;
  }
  .futu-step__media {
    flex-basis: auto;
    max-width: 100%;
    width: 100%;
    height: 260px;
  }
  .futu-collage {
    flex-basis: auto;
    max-width: 100%;
    width: 100%;
  }
}

/* Illustration gallery: square images, two per row */
.illo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
}

.illo-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  display: block;
}

/* Stacked cards (Insights / Problem / Product direction) */
.stacked-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--gray-700);
}

.stacked-card {
  display: flex;
  gap: 32px;
  padding: 16px;
  background: var(--background-grey);
  border: 1px solid var(--gray-150);
  border-radius: 12px;
}

.stacked-card__label {
  width: 200px;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: normal;
}

.stacked-card__content {
  flex: 1;
  min-width: 0;
  padding-left: 24px;
  border-left: 1px solid var(--gray-150);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stacked-card__content .title-m + .title-m,
.stacked-card__group + .stacked-card__group {
  padding-top: 8px;
}

.stacked-card__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stacked-card__content ul {
  padding-left: 24px;
}

/* Next project section */
.section--next {
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

/* --------------------------------------------------------------------------
   Scroll reveal
   Sections start hidden and ease in to full opacity as they scroll into view.
   Scoped to `.js` so content is never stuck hidden if JavaScript is off.
   -------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transition: opacity 0.8s ease-in;
  transition-delay: 0.1s;
}

.js .reveal.is-visible {
  opacity: 1;
}

/* "What I do" cards cascade in: left first, then middle +0.4s, then right +0.4s.
   Applied only in the 3-column layout; stacked layouts fall back to the base
   reveal so cards fade in as they are scrolled to. */
@media (min-width: 1101px) {
  .js .whatido-grid .reveal:nth-child(1) { transition-delay: 0s; }
  .js .whatido-grid .reveal:nth-child(2) { transition-delay: 0.4s; }
  .js .whatido-grid .reveal:nth-child(3) { transition-delay: 0.8s; }
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Password lock
   -------------------------------------------------------------------------- */

/* Gated content is hidden by default; the head inline-script adds
   `is-unlocked` to <html> once the visitor has entered the password.
   Hiding by default (rather than showing by default) means the content stays
   locked even if JavaScript is disabled. */
.lockable {
  display: none;
}

html.is-unlocked .lockable {
  display: block;
}

.lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 77px); /* viewport minus the nav */
  padding: var(--section-pad) var(--page-pad);
}

.lock__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 478px;
  transform: translateY(-40px); /* sit 40px above centre */
}

.lock__title {
  margin: 0;
  text-align: center;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 500;
  line-height: normal;
  color: #000;
}

.lock__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.lock__field {
  display: flex;
  align-items: center;
  height: 60px;
  padding-left: 32px;
  background: var(--gray-100);
  border: 1px solid var(--gray-100);
  border-radius: 60px;
  overflow: hidden;
}

.lock__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  color: var(--gray-900);
  outline: none;
}

.lock__input::placeholder {
  color: #979797;
}

.lock__button {
  flex-shrink: 0;
  height: 60px;
  padding: 0 clamp(28px, 4vw, 50px);
  border: none;
  border-radius: 60px;
  background: var(--gray-900);
  color: var(--gray-100);
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lock__button:hover {
  background: #000;
}

.lock__error {
  margin: 0;
  text-align: center;
  font-size: 16px;
  line-height: 24px;
  color: #c0392b;
}

.lock__hint {
  margin: 0;
  text-align: center;
  font-size: 16px;
  line-height: 24px;
  color: var(--gray-700);
}

.lock__hint a {
  text-decoration: underline;
  text-underline-position: from-font;
}

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

@media (max-width: 1100px) {
  .section--split {
    flex-direction: column;
    gap: 40px;
  }

  .side-category {
    position: static;
    width: min(100%, 480px);
  }

  .section__content {
    width: 100%;
  }

  .whatido-grid {
    grid-template-columns: 1fr 1fr;
  }

  .whatido__image {
    height: clamp(280px, 34vw, 392px);
  }

  /* Tablet: fixed 3-per-row logo grid (2 rows of 3) instead of random wrapping */
  .clients-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    justify-items: center;
    row-gap: clamp(28px, 5vw, 48px);
  }
}

/* Tablet: keep the two-column sticky case layout, but tighten the widths */
@media (max-width: 1024px) and (min-width: 761px) {
  .case-split {
    gap: 40px;
  }

  .case-side {
    width: 260px;
  }
}

@media (max-width: 760px) {
  .hero__inner {
    flex-direction: column;
    gap: 40px;
  }

  .hero__links {
    flex-direction: column;
  }

  .hero__link:last-child {
    justify-content: flex-start;
  }

  .whatido-grid {
    grid-template-columns: 1fr;
  }

  .whatido__image {
    height: clamp(280px, 60vw, 392px);
  }

  /* Mobile: two logos per row, 40px apart */
  .clients-row {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card__caption {
    margin: 0 12px 12px;
    padding: 16px;
  }

  .contact-row {
    flex-direction: column;
    gap: 8px;
  }

  .contact-row__label {
    width: auto;
  }

  /* Mobile: stack the case layout and drop the sticky/full-height column */
  .case-split {
    flex-direction: column;
    gap: 40px;
  }

  .case-side {
    width: 100%;
    position: static;
    min-height: auto;
    padding-bottom: 0;
  }

  .case-side .article-info {
    margin-top: 0;
  }

  .case-img-pair {
    grid-template-columns: 1fr;
  }

  .stacked-card {
    flex-direction: column;
    gap: 12px;
  }

  .stacked-card__label {
    width: auto;
  }

  .stacked-card__content {
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 1px solid var(--gray-150);
  }
}
