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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  color: #666;
  background: #fff;
  font-family: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

img,
video {
  max-width: 100%;
  height: auto;
  vertical-align: bottom;
  border: 0;
  image-rendering: auto;
}

iframe {
  max-width: 100%;
  border: 0;
}

a {
  color: #000;
  text-decoration: none;
}

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

/* —— Layout —— */
.page {
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 250px;
  height: 100%;
  overflow: auto;
  background: #fff;
  color: #aaa;
  font-size: 11px;
  text-align: left;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 50px 30px 30px;
}

.brand {
  display: block;
  margin-bottom: 36px;
  color: #000;
}

.brand-mark {
  font-family: "Special Elite", "American Typewriter", "Courier Prime", Courier, monospace;
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: #111;
}

.nav {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1px;
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav > ul > li {
  margin-bottom: 6px;
}

.nav a,
.nav .nav-parent {
  position: relative;
  display: block;
  padding-left: 1.35em;
  color: #444;
}

.nav .nav-parent {
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

.nav a::before,
.nav .nav-parent::before {
  content: ">";
  position: absolute;
  left: 0;
  top: 0;
  width: 1em;
  color: #3dff4a;
  font-family: "Special Elite", "Courier New", Courier, monospace;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: none;
  opacity: 0;
  pointer-events: none;
  text-shadow:
    0 0 4px #39ff14,
    0 0 10px rgba(57, 255, 20, 0.7);
}

.nav a:hover::before,
.nav a:focus-visible::before,
.nav a.is-current::before,
.nav .nav-parent:hover::before {
  opacity: 1;
}

.nav:hover a.is-current:not(:hover)::before {
  opacity: 0;
}

.nav a:hover,
.nav .nav-parent:hover {
  color: #111;
}

.nav a.is-current {
  font-weight: 700;
  color: #000;
}

.nav .subnav {
  display: none;
  margin-top: 6px;
  margin-left: 8px;
}

.nav-group.is-open > .subnav {
  display: block;
}

.nav .subnav li {
  margin-bottom: 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 40px;
  font-size: 11px;
  color: #aaa;
}

.main {
  margin-left: 250px;
  padding: 50px 30px 40px 0;
  min-height: 100vh;
}

.main.is-home {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 30px;
}

.main.is-centered {
  padding: 50px 30px 40px;
}

.main-wrap {
  max-width: 1600px;
  min-width: 0;
  width: 100%;
}

.main.is-home .main-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.page-title {
  margin: 0 0 1.2em;
  font-size: 16px;
  font-weight: 700;
  color: #000;
}

.page-title a {
  color: inherit;
}

.album-card {
  display: block;
  max-width: 420px;
}

.album-card .cover {
  display: block;
  background: #f4f4f4;
}

.album-card img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.album-card img.is-loaded {
  opacity: 1;
}

.album-card h2 {
  margin: 0.7em 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #000;
}

/* —— Home film scanner —— */
.scanner {
  width: min(100%, 900px);
  max-width: 100%;
  margin: 0 auto;
}

.film {
  background: transparent;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 100%;
}

.gate {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
  overflow: hidden;
  cursor: zoom-in;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.gate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  image-rendering: auto;
  background: transparent;
}

.gate .frame-current {
  z-index: 1;
  opacity: 0;
}

.gate .frame-current.is-loaded {
  opacity: 1;
}

.gate .frame-incoming {
  z-index: 2;
  opacity: 0;
  visibility: hidden;
}

.scanner.is-scanning .frame-current.is-loaded {
  animation: frame-fade-out 2.6s ease-in-out forwards;
}

.scanner.is-scanning .frame-incoming {
  visibility: visible;
  animation: frame-fade 2.6s ease-in-out forwards;
}

@keyframes frame-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes frame-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .scanner.is-scanning .frame-current.is-loaded,
  .scanner.is-scanning .frame-incoming {
    animation: none;
  }

  .scanner.is-scanning .frame-incoming {
    opacity: 1;
    visibility: visible;
  }
}

/* —— About —— */
.about {
  max-width: 640px;
  margin: 0 auto;
  color: #555;
  text-align: left;
}

.about-photo {
  display: block;
  width: auto;
  max-width: min(100%, 520px);
  height: auto;
  max-height: min(80vh, 1024px);
  margin: 1.5em auto 0;
  object-fit: contain;
}

.about p {
  margin: 0 0 1em;
}

.about .lede {
  color: #333;
}

/* —— Masonry grid —— */
.grid {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  background: transparent;
  overflow: hidden;
  cursor: zoom-in;
}

.grid.is-scrambling {
  pointer-events: none;
}

.grid.is-scrambling .tile {
  will-change: transform;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.grid.is-settling {
  transition: height 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}

.tile img,
.tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  image-rendering: auto;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.tile img.is-loaded,
.tile video.is-loaded {
  opacity: 1;
}

.tile video {
  background: #000;
  pointer-events: none;
}

.grid.is-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 28px;
  max-width: min(100%, 920px);
}

.grid.is-stack .tile {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  height: auto;
}

.grid.is-stack .tile img,
.grid.is-stack .tile video {
  width: 100%;
  height: auto;
}

.yt-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 36px;
  max-width: min(100%, 920px);
}

.main-wrap.is-centered {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-wrap.is-centered .grid {
  width: 100%;
}

.yt-stack.is-centered {
  width: 100%;
  max-width: min(100%, 860px);
  margin: 0 auto;
}

.yt-stack.is-centered .yt-item {
  width: 100%;
}

.yt-item {
  width: 100%;
}

.yt-meta {
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: #666;
  text-align: left;
  overflow-wrap: anywhere;
}

.yt-title {
  color: #444;
}

.yt-year {
  color: #888;
}

.yt-length {
  color: #888;
}

.yt-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
}

.yt-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

.yt-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.yt-thumb.is-loaded {
  opacity: 1;
}

.yt-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 48px;
  margin: -24px 0 0 -34px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.yt-play-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -5px;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #fff;
}

.yt-play:hover .yt-play-icon,
.yt-play:focus-visible .yt-play-icon {
  background: #f00;
}

.yt-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* —— Mobile bar + menu —— */
.mob-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 320;
  width: 100%;
  min-height: 50px;
  background: #fff;
  align-items: center;
  overflow: visible;
}

.menu-toggle {
  position: relative;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
}

.menu-toggle:hover,
.menu-toggle:focus {
  color: #000;
}

.mob-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0 12px 0 2px;
  color: #111;
}

.mob-bar .brand-mark {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: visible;
}

.hamburger {
  position: relative;
  width: 18px;
  height: 12px;
}

.hamburger span,
.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 1.5px;
  background: currentColor;
}

.hamburger span {
  top: 5.25px;
}

.hamburger::before {
  top: 0;
}

.hamburger::after {
  bottom: 0;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(0, 0, 0, 0.35);
}

.mobile-drawer {
  display: none;
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  align-items: stretch;
  justify-content: stretch;
  padding: 24px 56px;
  background: rgba(255, 255, 255, 0.97);
  overflow: hidden;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-image-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img,
.lightbox video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  object-position: center center;
  image-rendering: auto;
}

.lightbox video {
  display: none;
  background: #000;
}

.lightbox.is-video img {
  display: none;
}

.lightbox.is-video video {
  display: block;
}

/* —— Video player —— */
.video-player {
  position: fixed;
  inset: 0;
  z-index: 410;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}

.video-player.is-open {
  display: flex;
}

.video-player-frame {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: calc(100% - 80px);
  max-height: calc(100% - 80px);
}

.video-player video {
  display: block;
  max-width: 100%;
  max-height: calc(100% - 40px);
  width: auto;
  height: auto;
  background: #000;
}

.video-player-scrub {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  height: 18px;
  accent-color: #fff;
  cursor: pointer;
}

.video-player-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  color: #ddd;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
}

.video-player-close:hover {
  color: #fff;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  color: #444;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  color: #000;
}

.lightbox-close {
  top: 12px;
  right: 12px;
  font-size: 28px;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 32px;
}

.lightbox-prev {
  left: 8px;
}

.lightbox-next {
  right: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— Responsive —— */
@media (max-width: 767px), (max-width: 950px) and (hover: none) and (orientation: landscape) {
  .mob-bar {
    display: flex;
    width: 100%;
    max-width: 100%;
  }

  .sidebar {
    display: none;
  }

  .main,
  .main.is-home,
  .main.is-centered {
    margin-left: 0;
    padding: 66px 12px 32px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    overflow-x: hidden;
    max-width: 100%;
  }

  .main-wrap,
  .main-wrap.is-centered,
  .grid,
  .yt-stack,
  .yt-stack.is-centered,
  .about,
  .scanner,
  .film,
  .gate {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .about-photo {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .tile {
    max-width: 100%;
  }

  .backdrop.is-open {
    display: block;
  }

  .mobile-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    width: min(280px, 86vw);
    height: 100%;
    overflow: auto;
    background: #111;
    color: #fff;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: none;
  }

  .mobile-drawer.is-open {
    transform: translateX(0);
  }

  .mobile-drawer .sidebar-inner {
    padding: 56px 24px 24px;
  }

  body.is-menu-open .mob-bar {
    background: transparent;
  }

  body.is-menu-open .mob-brand {
    visibility: hidden;
  }

  body.is-menu-open .menu-toggle,
  body.is-menu-open .menu-toggle:hover,
  body.is-menu-open .menu-toggle:focus {
    color: #fff;
  }

  .mobile-drawer .nav a,
  .mobile-drawer .nav .nav-parent {
    color: #ccc;
  }

  .mobile-drawer .nav a:hover,
  .mobile-drawer .nav a.is-current,
  .mobile-drawer .nav .nav-parent:hover {
    color: #fff;
  }

  .mobile-drawer .sidebar-footer {
    color: #888;
  }

  .lightbox {
    padding: 56px 56px 16px;
  }

  .lightbox img,
  .lightbox video,
  .lightbox-image-wrap {
    max-width: 100%;
    max-height: 100%;
  }

  .lightbox-prev,
  .lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 64px;
  }

  .lightbox-prev {
    left: 2px;
  }

  .lightbox-next {
    right: 2px;
  }

  .video-player-frame,
  .video-player video {
    max-width: calc(100% - 16px);
    max-height: calc(100% - 72px);
  }
}

@media (min-width: 768px) and (max-width: 1024px) and (min-height: 600px) {
  .sidebar {
    width: 210px;
  }

  .sidebar-inner {
    padding: 36px 22px 24px;
  }

  .brand-mark {
    font-size: 24px;
    letter-spacing: 0.03em;
  }

  .main {
    margin-left: 210px;
    padding: 36px 20px 32px 0;
  }

  .main.is-home,
  .main.is-centered {
    padding: 36px 20px 32px;
  }
}
