* {
  box-sizing: border-box;
}

@font-face {
  font-family: "ChicagoFLF";
  src: url("ChicagoFLF.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --mac-navbar-height: 30px;
  --retro-ui-font: "ChicagoFLF", "Geneva", "Verdana", "Tahoma", sans-serif;
  --retro-ui-face: #efefef;
  --retro-ui-shadow-light: #fff;
  --retro-ui-shadow-dark: #999;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  color: #fff;
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'><text x='0' y='28' font-size='28'>🌴</text></svg>")
      4 4,
    auto;
}

body > :not(#page-loader) {
  opacity: 1;
  transition: opacity 900ms ease;
}

body.is-site-hidden > :not(#page-loader) {
  opacity: 0;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 1;
  transition: opacity 500ms ease;
}

.page-loader.is-fading {
  opacity: 0;
  pointer-events: none;
}

.page-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.page-loader-image {
  display: block;
  width: 480px;
  max-width: 640px;
  height: auto;
  filter:
    drop-shadow(0 0 5px rgba(255, 255, 255, 0.62))
    drop-shadow(0 0 18px rgba(255, 255, 255, 0.4))
    drop-shadow(0 0 32px rgba(255, 255, 255, 0.28));
  animation: loader-neon-flicker 2.7s infinite;
}

.page-loader-text {
  margin: 0;
  color: #fff;
  font-family: var(--retro-ui-font);
  font-size: clamp(13px, 1.5vw, 17px);
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.38);
}

.page-loader-dots {
  display: inline-block;
  width: 3ch;
}

.page-loader-dots::before {
  content: "...";
  display: inline-block;
  width: 1ch;
  overflow: hidden;
  animation: loader-dots 1.1s steps(1, end) infinite;
}

@keyframes loader-neon-flicker {
  0%,
  12%,
  18%,
  26%,
  34%,
  100% {
    opacity: 1;
    filter:
      drop-shadow(0 0 5px rgba(255, 255, 255, 0.62))
      drop-shadow(0 0 18px rgba(255, 255, 255, 0.42))
      drop-shadow(0 0 32px rgba(255, 255, 255, 0.3));
  }
  14% {
    opacity: 0.93;
    filter:
      drop-shadow(0 0 4px rgba(255, 255, 255, 0.48))
      drop-shadow(0 0 13px rgba(255, 255, 255, 0.32))
      drop-shadow(0 0 24px rgba(255, 255, 255, 0.22));
  }
  30% {
    opacity: 0.96;
    filter:
      drop-shadow(0 0 4px rgba(255, 255, 255, 0.5))
      drop-shadow(0 0 14px rgba(255, 255, 255, 0.35))
      drop-shadow(0 0 27px rgba(255, 255, 255, 0.24));
  }
}

@keyframes loader-dots {
  0%,
  100% {
    width: 1ch;
  }
  33% {
    width: 2ch;
  }
  66% {
    width: 3ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-loader,
  .page-loader-image,
  .page-loader-dots::before {
    animation: none;
    transition: none;
  }

  .page-loader-dots::before {
    width: 3ch;
  }
}

.soundcloud-audio-container {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.soundcloud-audio-container iframe {
  width: 1px;
  height: 1px;
  border: 0;
}

.mac-navbar-sound-btn {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.mac-navbar-sound-btn:hover {
  opacity: 0.8;
}

.mac-navbar-sound-btn:focus-visible {
  outline: 1px dotted #000;
  outline-offset: 1px;
}

.mac-navbar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: var(--mac-navbar-height);
  padding: 0 8px 0 7px;
  border-top: 1px solid #fff;
  border-bottom: 1px solid #000;
  background: repeating-linear-gradient(to bottom, #fafafa 0 1px, #ececec 1px 2px);
  box-shadow: inset 0 -1px 0 #7a7a7a;
  color: #000;
  font-family: var(--retro-ui-font);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
  cursor: pointer;
}

.mac-navbar-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  min-width: 0;
}

.mac-navbar-logo {
  display: block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  object-fit: contain;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.mac-navbar-menu {
  display: flex;
  align-items: center;
  height: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mac-navbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.mac-navbar-time {
  flex: 0 0 auto;
  min-width: 46px;
  text-align: right;
  font-family: var(--retro-ui-font);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

#ascii-bg {
  position: absolute;
  top: var(--mac-navbar-height);
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: calc(100vh - var(--mac-navbar-height));
  margin: 0;
  padding: 0.5rem;
  overflow: hidden;
  white-space: pre;
  font-weight: 100;
  font-family: ui-monospace, "Courier New", SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.45rem, 0.8vw, 0.72rem);
  line-height: 0.92;
  letter-spacing: 0;
  color: #ccc;
  background: #000;
  user-select: none;
  pointer-events: none;
}

body.video-page {
  overflow: hidden;
}

body.video-page #ascii-bg {
  padding: 0;
  height: calc(100vh - var(--mac-navbar-height));
}

.desktop-folder-icon {
  position: fixed;
  left: 70%;
  top: 50%;
  bottom: auto;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 0;
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
}

.desktop-folder-icon:focus-visible {
  outline: 1px dotted #fff;
  outline-offset: 4px;
}

.desktop-folder-glyph {
  display: block;
  width: 75px;
  height: 57px;
  background-image: url("folder-transparent.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: invert(1) brightness(1.08);
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.desktop-folder-label {
  margin: 0;
  padding: 0;
  color: #fff;
  font-family: var(--retro-ui-font);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
  text-shadow: 1px 1px 0 #222;
}

.photobook-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.photobook-overlay.is-open {
  display: flex;
}

.photobook-window {
  position: absolute;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  row-gap: clamp(6px, 0.95vw, 9px);
  width: min(990px, 94vw);
  max-height: min(94vh, 782px);
  aspect-ratio: 828 / 621;
  border: 1px solid #000;
  background: var(--retro-ui-face);
  box-shadow:
    inset 1px 1px 0 #fff,
    inset -1px -1px 0 #9d9d9d,
    0 14px 44px rgba(0, 0, 0, 0.5);
  color: #000;
  font-family: var(--retro-ui-font);
  user-select: none;
  overflow: hidden;
}

.photobook-titlebar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(20px, 3.2vw, 26px);
  border-bottom: 1px solid #000;
  background:
    repeating-linear-gradient(
      to bottom,
      #f2f2f2 0 1px,
      #d0d0d0 1px 2px
    );
  cursor: move;
  touch-action: none;
}

.photobook-title {
  margin: 0;
  padding: 0 7px;
  color: #000;
  font-size: clamp(12px, 1.02vw, 14px);
  line-height: 1;
  letter-spacing: 0;
  background: var(--retro-ui-face);
}

.photobook-photo-viewport {
  position: relative;
  display: flex;
  min-height: 0;
  margin: clamp(10px, 1.5vw, 14px) clamp(12px, 1.9vw, 16px) 0;
  padding: clamp(5px, 0.8vw, 7px);
  border: 1px solid #000;
  background: #fff;
  overflow: hidden;
}

.photobook-photo-inner {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid #000;
  overflow: hidden;
  background: #d7d7d7;
}

.photobook-photo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.photobook-video {
  background: #000;
}

.photobook-empty-message {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 16px;
  color: #222;
  font-family: var(--retro-ui-font);
  font-size: clamp(11px, 0.9vw, 13px);
  text-align: center;
}

.photobook-scrollbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  gap: 0;
  height: clamp(18px, 2.7vw, 22px);
  margin: 0 clamp(18px, 3.2vw, 26px) 0;
}

.photobook-scroll-button {
  width: clamp(18px, 2.7vw, 22px);
  border: 1px solid #000;
  background: var(--retro-ui-face);
  color: #000;
  font: inherit;
  font-size: clamp(10px, 0.9vw, 12px);
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 1px 1px 0 var(--retro-ui-shadow-light),
    inset -1px -1px 0 var(--retro-ui-shadow-dark);
}

.photobook-scroll-button:active:not(:disabled) {
  box-shadow:
    inset -1px -1px 0 #fff,
    inset 1px 1px 0 #999;
}

.photobook-scroll-button:disabled {
  cursor: default;
  color: #555;
}

.photobook-scroll-track {
  position: relative;
  border: 1px solid #000;
  border-left: none;
  border-right: none;
  background:
    radial-gradient(circle at 1px 1px, #808080 0.7px, transparent 0.8px) 0 0 / 4px 4px,
    #ececec;
  cursor: ew-resize;
  overflow: hidden;
}

.photobook-scroll-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: rgba(0, 0, 0, 0.1);
  pointer-events: none;
}

.photobook-scroll-thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border: 1px solid #000;
  background: #fff;
  cursor: grab;
  touch-action: none;
  box-shadow:
    inset 1px 1px 0 var(--retro-ui-shadow-light),
    inset -1px -1px 0 #9a9a9a;
}

.photobook-scroll-thumb:active {
  cursor: grabbing;
  box-shadow:
    inset -1px -1px 0 #fff,
    inset 1px 1px 0 #9a9a9a;
}

.photobook-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 clamp(22px, 3.4vw, 30px) clamp(10px, 1.5vw, 14px);
  font-size: clamp(11px, 0.92vw, 12px);
}

.photobook-status-count {
  margin: 0;
}

.photobook-status-type {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.photobook-close {
  position: absolute;
  top: 50%;
  left: 5px;
  transform: translateY(-50%);
  width: clamp(12px, 1.25vw, 14px);
  height: clamp(12px, 1.25vw, 14px);
  border: 1px solid #000;
  background: var(--retro-ui-face);
  box-shadow:
    inset 1px 1px 0 var(--retro-ui-shadow-light),
    inset -1px -1px 0 var(--retro-ui-shadow-dark);
  cursor: pointer;
}

.photobook-close:active {
  box-shadow:
    inset -1px -1px 0 #fff,
    inset 1px 1px 0 #999;
}

.photobook-resize-handle {
  position: absolute;
  z-index: 6;
  touch-action: none;
}

.photobook-resize-handle-n {
  top: 0;
  left: 10px;
  right: 10px;
  height: 10px;
  cursor: ns-resize;
}

.photobook-resize-handle-s {
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 10px;
  cursor: ns-resize;
}

.photobook-resize-handle-e {
  top: 10px;
  right: 0;
  bottom: 10px;
  width: 10px;
  cursor: ew-resize;
}

.photobook-resize-handle-w {
  top: 10px;
  left: 0;
  bottom: 10px;
  width: 10px;
  cursor: ew-resize;
}

.photobook-resize-handle-ne {
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.photobook-resize-handle-nw {
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.photobook-resize-handle-se {
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}

.photobook-resize-handle-sw {
  left: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}

.photobook-scroll-button:focus-visible,
.photobook-scroll-thumb:focus-visible,
.photobook-close:focus-visible {
  outline: 1px dotted #000;
  outline-offset: 1px;
}

@media (max-width: 900px), (pointer: coarse) and (max-width: 1100px) {
  body > * {
    display: none !important;
  }

  body::before {
    content: "Switch to desktop for optimal viewing experience";
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #fff;
    font-family: "Geneva", "Verdana", "Tahoma", sans-serif;
    font-size: clamp(18px, 2.4vw, 28px);
    line-height: 1.3;
    text-align: center;
    background: #000;
  }
}
