/* Font Definitions */
@font-face {
  font-family: 'MonaspaceKrypton';
  src: url('../fonts/MonaspaceKrypton-WideBold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: 'MonaspaceRadon';
  src: url('../fonts/MonaspaceRadon-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

/* CSS Variables for theming */
:root {
  --bg-color: #f5f5f5;
  --text-color: #1a1a1a;
  --border-color: #1a1a1a;
  --font-menu: 'MonaspaceKrypton', monospace;
  --font-body: 'MonaspaceRadon', monospace;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #f5f5f5;
  --border-color: #f5f5f5;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout Container */
.site-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem 2rem;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 2rem;
  background-color: var(--bg-color);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
}


.site-header a {
  font-family: var(--font-menu);
  font-size: 1rem;
  color: var(--text-color);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}

.site-header a:hover {
  opacity: 0.7;
}

/* Category Navigation */
.nav-categories {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.nav-dot {
  font-family: var(--font-menu);
  font-size: 1rem;
  color: var(--text-color);
  user-select: none;
  transition: color 0.3s ease;
}

.nav-cat {
  opacity: 0.5;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.nav-cat.active {
  opacity: 1;
}

/* Hidden media items (filtered out) */
.media-item.hidden {
  display: none;
}

/* Clickable images */
.media-item img {
  cursor: pointer;
}

/* Image description label — positioned to the left */
.media-item--image {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  width: auto;
}

.media-description {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-color);
  opacity: 0.7;
  max-width: 160px;
  line-height: 1.4;
  flex-shrink: 0;
  white-space: pre-wrap;
  transition: color 0.3s ease;
}

.media-description a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.media-description a:hover {
  opacity: 0.6;
}

/* Lightbox overlay */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.visible {
  opacity: 1;
}

.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #f5f5f5;
  font-family: var(--font-menu);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 1.5rem 1.25rem;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-arrow:hover {
  opacity: 1;
}

.lightbox-arrow--prev {
  left: 0;
}

.lightbox-arrow--next {
  right: 0;
}

/* Footer */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 2rem;
  background-color: var(--bg-color);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
}


.random-quote {
  font-family: var(--font-menu);
  font-size: 0.875rem;
  max-width: 60%;
}

.theme-toggle {
  font-family: var(--font-menu);
  font-size: 1rem;
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  transition: color 0.3s ease;
}

.theme-toggle:hover {
  opacity: 0.7;
}

/* Main Content Area */
.main-content {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 60px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Clip mask for scroll behavior */
.content-clip {
  position: relative;
  width: 100%;
  min-height: 100%;
}

/* Landing Page - Media Grid */
.media-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: visible;
}

.media-item {
  position: absolute;
  display: block;
  border: none;
  background: none;
}

.media-item img {
  max-width: 400px;
  height: auto;
  display: block;
  border: none;
}

/* Video embeds - responsive with max width */
.media-item[class*="video"] {
  width: min(720px, calc(100vw - 80px));
}

.media-item[class*="video"] img {
  max-width: 100%;
}

.media-item[class*="video"] iframe {
  width: 100%;
  height: 100%;
}

/* Video thumbnail play button */
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.video-play-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 14px 0 14px 24px;
  border-color: transparent transparent transparent var(--text-color);
  position: absolute;
  top: 50%;
  left: 55%;
  transform: translate(-50%, -50%);
}

.media-item[class*="video"]:hover .video-play-btn {
  opacity: 0.9;
}


/* Film GIFs — match video width */
.media-item--image[data-category="film"] img {
  max-width: min(720px, calc(100vw - 80px));
}

/* Film video items from Are.na — flex row with description on the left */
.media-item--film-video {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
  width: auto !important;
}

.film-video-wrap {
  position: relative;
  width: min(720px, calc(100vw - 80px));
  flex-shrink: 0;
}

.film-video-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.media-item--film-video:hover .video-play-btn {
  opacity: 0.9;
}

/* Video lightbox */
.video-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-lightbox.visible {
  opacity: 1;
}

.video-lightbox-wrapper {
  width: min(100vw, 1280px);
  aspect-ratio: 16 / 9;
  cursor: default;
}

.video-lightbox-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Photo grid layout — 3 columns */
.media-container.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  padding: 2rem;
  min-height: auto;
  height: auto !important;
}

.media-container.photo-grid .media-item {
  position: static;
  transform: none !important;
}

.media-container.photo-grid .media-item--image {
  flex-direction: column;
  gap: 0.5rem;
}

.media-container.photo-grid .media-item--image img {
  max-width: 100%;
  width: 100%;
  height: auto;
}

.media-container.photo-grid .media-description {
  max-width: none;
  font-size: 0.7rem;
}

/* Context/About Page */
.content-clip:has(.context-page) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
}

.context-page {
  display: grid;
  grid-template-columns: minmax(auto, 400px) minmax(auto, 480px);
  gap: 4rem;
  padding: 2rem;
  justify-content: center;
  align-items: center;
}

.context-image {
  width: 100%;
  max-width: 400px;
}

.context-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.context-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 480px;
}

.context-text p {
  margin-bottom: 1.5rem;
  text-align: justify;
  hyphens: auto;
}

.context-text p:last-child {
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .site-header,
  .site-footer {
    padding: 1rem 1.5rem;
  }

  .context-page {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1rem;
  }

  .context-image {
    max-width: 100%;
  }

  .nav-categories {
    gap: 0.25em;
  }

  .nav-categories a,
  .nav-dot {
    font-size: 0.75rem;
  }

  .random-quote {
    max-width: 50%;
    font-size: 0.75rem;
  }

  .media-item--image {
    flex-direction: column;
  }

  .media-description {
    max-width: none;
  }

  .media-item img {
    max-width: 90vw;
  }

  .media-item[class*="video"] {
    width: calc(100vw - 40px);
  }

  .media-container.photo-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
}
