/* ============================
   Variables & reset
   ============================ */
:root {
  --bg: #1c0f09;
  --tan: #967647;
  --mint: #a1e0d7;
  --cream: #e0d1b5;

  --font: "sofia-pro-soft", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --header-pad: 2.5rem;

  --stage-width: 80vw;
  --stage-margin: 10vw;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ============================
   Accessibility helpers
   ============================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

/* ============================
   Site header / nav
   ============================ */
.site-header {
  position: fixed;
  top: var(--header-pad);
  left: var(--header-pad);
  z-index: 10;
  max-width: calc(var(--stage-margin) - var(--header-pad));
}

.site-name {
  display: inline-block;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.75rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--cream);
  opacity: 0.8;
  transition: opacity 0.2s ease, color 0.2s ease;
  width: fit-content;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  opacity: 1;
  color: var(--mint);
}

.site-nav a[aria-current="page"] {
  opacity: 1;
  color: var(--mint);
}

/* ============================
   Explorer (home page)
   ============================ */
html {
  scroll-snap-type: y mandatory;
}

body {
  overflow-x: hidden;
}

.scene {
  width: var(--stage-width);
  margin: 0 auto;
}

.scene--overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--stage-margin);
  width: var(--stage-width);
  z-index: 5;
  overflow: hidden;
}

.scene--sliding {
  transition: transform 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .scene--sliding {
    transition: none;
  }
}

.hero-section,
.gallery-section {
  position: relative;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
}

.hero-section {
  overflow: hidden;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scroll-hint {
  position: fixed;
  right: 0;
  bottom: 2.5rem;
  z-index: 10;
  width: var(--stage-margin);
  padding: 0 var(--header-pad) 0 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--cream);
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scroll-hint.is-visible {
  opacity: 1;
}

.scroll-hint kbd {
  display: inline-block;
  font-family: inherit;
  border: 1px solid var(--tan);
  border-radius: 3px;
  padding: 0 0.35em;
  font-size: 0.85em;
}

/* ============================
   Autoplay toggle
   ============================ */
.autoplay-toggle {
  position: fixed;
  top: var(--header-pad);
  right: var(--header-pad);
  z-index: 10;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tan);
  border-radius: 50%;
  color: var(--tan);
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.autoplay-toggle:hover,
.autoplay-toggle:focus-visible {
  opacity: 1;
  color: var(--mint);
  border-color: var(--mint);
}

.autoplay-icon {
  position: relative;
  width: 0.6rem;
  height: 0.7rem;
}

.autoplay-icon::before,
.autoplay-icon::after {
  content: "";
  position: absolute;
  top: 0;
  width: 0.18rem;
  height: 100%;
  background: currentColor;
}

.autoplay-icon::before {
  left: 0;
}

.autoplay-icon::after {
  right: 0;
}

.autoplay-toggle.is-paused .autoplay-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.4rem 0 0.4rem 0.65rem;
  border-color: transparent transparent transparent currentColor;
}

.autoplay-toggle.is-paused .autoplay-icon::before,
.autoplay-toggle.is-paused .autoplay-icon::after {
  content: none;
}

.gallery-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--header-pad);
}

.gallery-photo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ============================
   Explorer sidebar (project info)
   ============================ */
.explorer-sidebar {
  position: fixed;
  left: 0;
  bottom: 2.5rem;
  z-index: 10;
  width: var(--stage-margin);
  padding: 0 1rem 0 var(--header-pad);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  gap: 0.4rem;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.project-info h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.project-category {
  color: var(--mint);
  font-weight: 400;
}

.project-caption {
  margin: 0;
  font-size: 0.85rem;
  color: var(--tan);
}

.photo-counter {
  margin: 0;
  font-size: 0.8rem;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
  white-space: nowrap;
}

/* ============================
   Project switch arrows
   ============================ */
.project-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: var(--stage-margin);
  height: 4rem;
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  color: var(--tan);
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.project-arrow:hover,
.project-arrow:focus-visible {
  opacity: 1;
  color: var(--mint);
}

.project-arrow-left {
  left: 0;
  justify-content: flex-end;
  padding-right: 1rem;
}

.project-arrow-right {
  right: 0;
  justify-content: flex-start;
  padding-left: 1rem;
}

@media (max-width: 720px) {
  :root {
    --stage-width: 100vw;
    --stage-margin: 0px;
  }

  .site-header {
    max-width: none;
  }

  .explorer-sidebar {
    width: auto;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(0deg, rgba(28, 15, 9, 0.85) 0%, rgba(28, 15, 9, 0) 100%);
  }

  .swatches {
    grid-template-columns: repeat(2, 14px);
    gap: 0.5rem;
  }

  .swatch {
    width: 14px;
    height: 14px;
  }

  .project-info h1 {
    font-size: 1.4rem;
  }

  .scroll-hint {
    top: calc(var(--header-pad) + 3rem);
    right: var(--header-pad);
    bottom: auto;
    left: auto;
    width: auto;
    max-width: 9rem;
    padding: 0;
    text-align: right;
  }

  .autoplay-toggle {
    background-color: rgba(28, 15, 9, 0.5);
  }

  .autoplay-toggle:hover,
  .autoplay-toggle:focus-visible {
    background-color: rgba(28, 15, 9, 0.75);
  }

  .project-arrow {
    width: 2.5rem;
    height: 2.5rem;
    justify-content: center;
    padding: 0;
    font-size: 1.2rem;
    border-radius: 50%;
    background-color: rgba(28, 15, 9, 0.5);
  }

  .project-arrow:hover,
  .project-arrow:focus-visible {
    background-color: rgba(28, 15, 9, 0.75);
  }

  .project-arrow-left {
    left: 1rem;
  }

  .project-arrow-right {
    right: 1rem;
  }

  .gallery-section {
    padding: 1.5rem;
  }
}

/* ============================
   Connect page
   ============================ */
.connect-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--header-pad);
  padding-right: calc(var(--header-pad) + 4rem);
}

.connect-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.5rem;
  width: min(46vw, 30rem);
}

.connect-portrait-wrap {
  width: min(34vw, 380px);
  aspect-ratio: 1;
}

.connect-portrait {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.connect-accent {
  position: absolute;
  top: calc(min(34vw, 380px) - 1.75rem);
  left: 0;
  width: 1.75rem;
  aspect-ratio: 1;
  border: 1px solid var(--cream);
  border-radius: 50%;
}

.connect-bio {
  width: 100%;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--cream);
  text-align: left;
}

.connect-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  font-size: 0.95rem;
}

.connect-links a {
  color: var(--mint);
  width: fit-content;
}

.connect-links a:hover,
.connect-links a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .connect-page {
    justify-content: center;
    padding-right: var(--header-pad);
  }

  .connect-content {
    align-items: center;
    width: 100%;
    max-width: 26rem;
  }

  .connect-portrait-wrap {
    width: min(60vw, 280px);
  }

  .connect-accent {
    top: calc(min(60vw, 280px) - 1.5rem);
    width: 1.5rem;
  }

  .connect-bio {
    text-align: center;
  }

  .connect-links {
    align-items: center;
  }
}

/* ============================
   Grid page
   ============================ */
.grid-page {
  padding: var(--header-pad) 0 3rem var(--stage-margin);
}

.grid-masonry {
  column-count: 4;
  column-gap: 0.75rem;
}

.grid-item {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
  background: none;
  break-inside: avoid;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.grid-item:hover,
.grid-item:focus-visible {
  opacity: 0.85;
}

.grid-item img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 1100px) {
  .grid-masonry {
    column-count: 3;
  }
}

@media (max-width: 720px) {
  .grid-page {
    padding: 11rem 1rem 2rem;
  }

  .grid-masonry {
    column-count: 2;
    column-gap: 0.5rem;
  }

  .grid-item {
    margin-bottom: 0.5rem;
  }
}

/* ============================
   Lightbox
   ============================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 15, 9, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .lightbox {
    transition: none;
  }
}

body.lightbox-open {
  overflow: hidden;
}

.lightbox-photo {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
}

.lightbox-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.5rem;
  text-align: center;
  pointer-events: none;
}

.lightbox-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cream);
}

.lightbox-category {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--mint);
}

.lightbox-close {
  position: fixed;
  top: var(--header-pad);
  right: var(--header-pad);
  z-index: 51;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tan);
  border-radius: 50%;
  color: var(--tan);
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  opacity: 1;
  color: var(--mint);
  border-color: var(--mint);
}

.lightbox-close-icon {
  position: relative;
  width: 0.9rem;
  height: 0.9rem;
}

.lightbox-close-icon::before,
.lightbox-close-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 0.14rem;
  background: currentColor;
}

.lightbox-close-icon::before {
  transform: translateY(-50%) rotate(45deg);
}

.lightbox-close-icon::after {
  transform: translateY(-50%) rotate(-45deg);
}

.lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 51;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--tan);
  opacity: 0.7;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.lightbox-arrow:hover,
.lightbox-arrow:focus-visible {
  opacity: 1;
  color: var(--mint);
}

.lightbox-arrow-left {
  left: var(--header-pad);
}

.lightbox-arrow-right {
  right: var(--header-pad);
}

@media (max-width: 720px) {
  .lightbox-close {
    background-color: rgba(28, 15, 9, 0.5);
  }

  .lightbox-close:hover,
  .lightbox-close:focus-visible {
    background-color: rgba(28, 15, 9, 0.75);
  }

  .lightbox-arrow {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.2rem;
    background-color: rgba(28, 15, 9, 0.5);
  }

  .lightbox-arrow:hover,
  .lightbox-arrow:focus-visible {
    background-color: rgba(28, 15, 9, 0.75);
  }

  .lightbox-arrow-left {
    left: 0.75rem;
  }

  .lightbox-arrow-right {
    right: 0.75rem;
  }

  .lightbox-photo {
    max-width: 94vw;
    max-height: 72vh;
  }

  .lightbox-caption {
    bottom: 1rem;
  }
}
