@import url("https://use.typekit.net/mfq7sdw.css");

/* ==========================================================================
   TOKENS
   ========================================================================== */
:root {
  --color-bg: #f7faf8;
  --color-text: #000000;
  --color-accent: #f3e600;
  --color-muted: darkgray;

  --font-body: "helvetica-lt-pro", sans-serif;
  --font-display: "riant-display", sans-serif;

  --page-margin: 20px;
  --grid-gap: 24px;
  --section-gap: 80px;

  --reveal-duration: 700ms;
  --reveal-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   RESET / BASE
   ========================================================================== */
* {
  box-sizing: border-box;
}

html,
body {
  body {
  margin: 40;
  padding: 40;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 400;
  font-style: normal;
  isolation: isolate; /* NEW — makes body its own stacking context so
                          .hover-stage (z-index:-1) renders above body's
                          background instead of getting hidden behind it */
}
}

body {
  padding-left: var(--page-margin);
  padding-right: var(--page-margin);
  padding-top: 15px;
  overflow-x: hidden;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

/* p5.js ambient canvas sits fixed behind all content */
canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

/* ==========================================================================
   HOVER STAGE
   Fixed full-viewport background image, driven by data-hover-src attributes.
   See script.js for the interaction logic.
   ========================================================================== */
.hover-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.hover-stage.is-visible {
  opacity: 1;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.navigation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 30px 65px;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-end;
  z-index: 100;
  pointer-events: none;
}

.nav-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: normal;
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: auto;
}

.nav-list li {
  background-color: var(--color-bg);
  padding: 8px 14px;
}

.nav-list a {
  text-decoration: none;
}

.nav-list a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   INTRO
   ========================================================================== */
.intro {
  text-transform: uppercase;
}

.intro-image {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 15px;
}

.intro-title {
  margin-top: 50px;
  font-weight: normal;
}

.intro-description {
  font-weight: normal;
  font-size: 70px;
  line-height: 1.05;
}

.intro-description span {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
}

/* ==========================================================================
   SECTION TITLES (shared)
   ========================================================================== */
.section-title {
  font-weight: normal;
  text-align: center;
}

/* ==========================================================================
   PROJECTS
   Apelles / Zenith: image pinned to the right edge, description sits
   behind/left of it — top-aligned with the top of the image, and
   overlapping underneath it (lower z-index, pulled right with a
   negative margin).
   ========================================================================== */
.projects {
  margin: var(--section-gap) 0;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr 68%;
  gap: 32px;
  align-items: start;
  margin: 60px 0;
}

.project-figure,
.project-description {
  margin: 0;
  z-index: auto; /* no more stacking/overlap */
}

.project-figure {
  justify-self: end;
  width: 100%;
  max-width: 900px;
}

.project-description {
  justify-self: start;
  width: 100%;
  max-width: 640px;
  padding-top: 8px;
  overflow-wrap: break-word; /* safety net so long words never overflow their box */
}

@media (max-width: 900px) {
  .project-row {
    grid-template-columns: 1fr;
    row-gap: 16px;
  }

  .project-figure,
  .project-description {
    justify-self: stretch;
    width: 100%;
    max-width: none;
  }

  .project-description {
    order: 2;
  }

  .project-figure {
    order: 1;
  }
}

@media (max-width: 900px) {
  .project-row {
    grid-template-rows: auto auto;
    row-gap: 16px;
  }

  .project-figure,
  .project-description {
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
    z-index: auto;
  }

  .project-description {
    order: 2;
  }

  .project-figure {
    order: 1;
  }
}

/* ==========================================================================
   REPOSITORY — dynamic poster grid
   4 equal-width columns, unlimited auto rows. Column width =
   (100% - 3 gaps) / 4, remaining space distributed automatically by
   the grid. Each poster keeps its natural aspect ratio (auto height).
   ========================================================================== */
.repo {
  margin: var(--section-gap) 0;
}

.repo-intro {
  text-align: center;
  max-width: 60ch;
  margin: 16px auto 48px;
}

.poster-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: var(--grid-gap);
  padding: 0;
  margin: 0;
}

.poster-item {
  display: block;
}

.poster-item figure {
  margin: 0;
}

.poster-item img {
  display: block;
  width: 100%;
  height: auto; /* preserves each poster's original aspect ratio */
}

.poster-item figcaption {
  margin-top: 4px; /* was 8px */
  font-size: 14px;
}

/* hide captions the user hasn't written a title into */
.poster-item figcaption:empty {
  display: none;
}

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

@media (max-width: 560px) {
  .poster-grid {
    grid-template-columns: 1fr;
  }
}

.collab-note {
  text-align: center;
  margin: 6px 0 0;
  line-height: 1.2;
}

.SOPH,
.portfolio-link {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: normal;
  font-size: 35px;
}

/* ==========================================================================
   SCROLL REVEAL
   Content fades / rises into view as the page is scrolled — see script.js
   for the IntersectionObserver that toggles .in-view.
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--reveal-duration) var(--reveal-ease),
    transform var(--reveal-duration) var(--reveal-ease);
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

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

/* ==========================================================================
   FOOTER / OTHER LINKS
   ========================================================================== */
#other-links {
  margin: var(--section-gap) 0 40px;
}

.other-links {
  display: flex;
  flex-direction: row;
  justify-content: right;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.other-links li {
  background-color: var(--color-muted);
  padding: 8px 14px;
}

.other-links a {
  color: var(--color-accent);
  text-decoration: none;
}

.other-links a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   FIGMA WORK PAGE (pages/work.html)
   ========================================================================== */
.work-document {
  margin: 0;
}

.work-page {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  margin: 0 !important;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: #fff;
  color: #000;
  font-family: Arial, sans-serif;
  font-size: 20px;
}

.work-page a {
  color: inherit;
  text-decoration: none;
}

.work-page a:hover,
.work-page a:focus-visible {
  color: var(--color-accent);
  transition: color 160ms ease;
}

.work-page a:hover img,
.work-page a:focus-visible img {
  filter: brightness(0) saturate(100%) invert(84%) sepia(98%) saturate(1540%)
    hue-rotate(2deg) brightness(107%) contrast(101%);
  transition: filter 160ms ease;
}

.work-header,
.work-footer {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.work-header {
  top: -10px;
  width: min(752px, 100%);
  min-height: 74px;
}

.work-contact-links,
.work-social-links {
  display: flex;
  align-items: center;
}

.work-contact-links {
  gap: 35px;
}

.work-contact-link {
  display: flex;
  align-items: flex-start;
  gap: 1px;
  min-height: 74px;
}

.work-contact-link img {
  width: 47.5px;
  height: 49px;
  flex: 0 0 auto;
}

.work-contact-link span,
.work-nav-link,
.work-label,
.work-social-link,
.work-year {
  line-height: normal;
  font-weight: 400;
}

.work-contact-link span,
.work-nav-link {
  display: flex;
  align-items: center;
  min-height: 74px;
  padding: 10px;
  box-sizing: border-box;
  white-space: nowrap;
}

.work-nav-link {
  padding: 10px 15px;
}

.work-label {
  position: absolute;
  top: 84px;
  right: 64px;
  margin: 0;
  text-align: center;
}

.work-footer {
  bottom: 0;
  width: min(712px, 100%);
}

.work-social-links {
  gap: 220px;
}

.work-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  white-space: nowrap;
}

.work-social-link img {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.work-year {
  padding: 10px 5px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .work-page {
    font-size: 16px;
  }

  .work-header,
  .work-footer {
    width: 100%;
  }

  .work-header {
    align-items: flex-start;
  }

  .work-contact-links {
    gap: 8px;
    flex-direction: column;
    align-items: flex-start;
  }

  .work-contact-link,
  .work-contact-link span,
  .work-nav-link {
    min-height: 48px;
  }

  .work-contact-link img {
    width: 31px;
    height: 32px;
  }

  .work-contact-link span,
  .work-nav-link {
    padding: 6px;
  }

  .work-label {
    top: 88px;
    right: 20px;
  }

  .work-social-links {
    gap: 8px;
  }

  .work-social-link,
  .work-year {
    padding: 6px;
  }
}

@media (min-width: 761px) and (max-width: 1023px) {
  .work-header {
    width: calc(100% - 32px);
  }

  .work-footer {
    width: calc(100% - 32px);
  }

  .work-contact-links {
    gap: clamp(12px, 3vw, 35px);
  }

  .work-social-links {
    gap: clamp(24px, 14vw, 220px);
  }

  .work-label {
    right: 32px;
  }
}
