:root {
  --cream: #fefaf3;
  --ink: #14100d;
  --olive: #30370f;
  --sage: #99a755;
  --rose: #d25c73;
  --pink: #ffaeba;

  --font-display: "Instrument Serif", serif;
  --font-display-weight: 400;
  --font-display-style: italic;
  --font-body: "Archivo", sans-serif;

  --overlay-width: clamp(18rem, 30vw, 27rem);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--pink);
  color: var(--ink);
}

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

/* ---------- Layout ---------- */

.layout {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sticky-panel {
  flex: 1 1 auto;
  width: 100%;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 2.5rem 3rem;
  display: grid;
  grid-template-columns: minmax(12rem, 23%) 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "wordmark reels"
    "index    reels"
    "footer   reels";
  column-gap: 2.5rem;
  overflow: hidden;
}

.project-index__track {
  flex: 0 0 0;
  width: 0;
  pointer-events: none;
}

.project-index__anchor {
  position: relative;
  left: calc(-1 * var(--overlay-width));
  width: var(--overlay-width);
  height: 100vh;
}

/* ---------- Wordmark ---------- */

.panel-header {
  grid-area: wordmark;
}

.wordmark {
  display: inline-block;
  font-family: var(--font-display);
  font-style: var(--font-display-style);
  font-weight: var(--font-display-weight);
  font-size: clamp(2rem, 2.6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--ink);
}

/* ---------- Footer links (About / Contact) ---------- */

.footer-links {
  grid-area: footer;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-link {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--pink);
  transition: color 0.25s ease;
}

.footer-link:hover,
.footer-link:focus-visible,
.footer-link.is-current {
  color: var(--olive);
}

.home-page .footer-link.is-current {
  color: var(--rose);
}

/* ---------- Reels ---------- */

.reel {
  grid-area: reels;
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.reel-track {
  display: block;
  width: 100%;
  height: 100%;
  transition: opacity 0.2s ease;
}

.reel-track.is-fading {
  opacity: 0;
}

.reel-item {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
}

.reel.is-single .reel-item {
  cursor: default;
}

.reel-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
  transition: transform 0.6s ease;
}

.reel-item:hover img,
.reel-item:focus-visible img {
  transform: scale(1.04);
}

.reel-item:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: -2px;
}

.reel-item--video {
  cursor: default;
}

.reel-video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  background: var(--ink);
}

.reel-frame {
  position: absolute;
}

.play-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(20, 16, 13, 0.35);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease;
}

.play-icon::after {
  content: "";
  border-style: solid;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent var(--cream);
  margin-left: 3px;
}

.reel-item:hover .play-icon,
.reel-item:focus-visible .play-icon {
  background: rgba(20, 16, 13, 0.55);
}

.reel-hint {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  font-family: var(--font-body);
  font-size: 8pt;
  letter-spacing: 0.05em;
  color: var(--cream);
  text-shadow: 0 1px 10px rgba(20, 16, 13, 0.55);
  opacity: 0.85;
}

/* ---------- Project index (sidebar) ---------- */

.project-index__list {
  position: static;
  grid-area: index;
  width: auto;
  display: flex;
  align-items: flex-start;
  padding: calc(3rem + 200px) 0 0;
  pointer-events: auto;
}

.project-index__paragraph {
  display: flex;
  flex-direction: column;
  width: 100%;
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
  line-height: 1.15;
}

.project-index__link {
  display: block;
  pointer-events: auto;
}

.project-index__name {
  font-family: var(--font-body);
  font-size: 10pt;
  color: var(--sage);
  transition: color 0.4s ease;
}

.project-index__tag {
  font-family: var(--font-display);
  font-style: var(--font-display-style);
  font-weight: var(--font-display-weight);
  font-size: 0.8em;
  color: var(--sage);
  opacity: 0.65;
  transition: color 0.4s ease, opacity 0.4s ease;
}

.project-index__link:hover .project-index__name,
.project-index__link:focus-visible .project-index__name,
.project-index__link.is-active .project-index__name {
  color: var(--olive);
}

.project-index__link:hover .project-index__tag,
.project-index__link:focus-visible .project-index__tag,
.project-index__link.is-active .project-index__tag {
  color: var(--olive);
  opacity: 0.85;
}

.project-index__link:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 2px;
}

/* ---------- About page ---------- */

.about-page {
  background: var(--ink);
  color: var(--cream);
}

.about-page .wordmark {
  color: var(--cream);
}

.about-page .footer-link.is-current {
  color: var(--rose);
}

.about-page .footer-link:hover,
.about-page .footer-link:focus-visible {
  color: var(--cream);
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 23%) 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "wordmark content"
    ".        content"
    "footer   content";
  column-gap: 2.5rem;
  height: 100vh;
  padding: 2.5rem 3rem;
  overflow: hidden;
}

.about-content {
  grid-area: content;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5vh;
}

.about-portrait {
  flex: 1 1 0;
  min-height: 0;
  display: block;
  width: 100%;
  object-fit: contain;
  object-position: left center;
}

.about-bio {
  flex: 0 0 auto;
  max-width: 32rem;
  margin: 0;
  font-size: clamp(0.8rem, 1.6vh, 1rem);
  line-height: 1.6;
  color: var(--rose);
}

/* ---------- Grid page ---------- */

.grid-page .footer-link.is-current {
  color: var(--rose);
}

.grid-layout {
  display: grid;
  grid-template-columns: minmax(12rem, 23%) 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "wordmark content"
    ".        content"
    "footer   content";
  column-gap: 2.5rem;
  height: 100vh;
  padding: 2.5rem 3rem;
  overflow: hidden;
}

.grid-content {
  grid-area: content;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-content: start;
}

.grid-tile {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.grid-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.grid-tile__caption {
  font-family: var(--font-body);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--sage);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reel-item img,
  .reel-track,
  .play-icon,
  .project-index__name,
  .project-index__tag {
    transition: none;
  }

  .reel-item:hover img,
  .reel-item:focus-visible img {
    transform: none;
  }
}

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

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .sticky-panel {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    min-width: 0;
    height: auto;
    overflow: visible;
    padding: 2rem 1.5rem;
    gap: 3rem;
  }

  .reel {
    height: min(60vh, 32rem);
  }

  .project-index__track {
    display: none;
  }

  .project-index__list {
    position: static;
    width: 100%;
    display: block;
    padding: 2rem 1.5rem 1rem;
    pointer-events: auto;
  }

  .about-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 2rem 1.5rem;
    gap: 2rem;
  }

  .about-content {
    height: auto;
    gap: 1.25rem;
  }

  .about-portrait {
    flex: none;
    aspect-ratio: 3 / 4;
  }

  .about-bio {
    max-width: none;
    font-size: 1rem;
    line-height: 1.85;
  }

  .grid-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    padding: 2rem 1.5rem;
    gap: 2rem;
  }

  .grid-content {
    height: auto;
    overflow-y: visible;
    gap: 1rem;
  }
}
