@import url("https://fonts.googleapis.com/css2?family=Chewy&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Nanum+Gothic+Coding&family=VT323&family=Yatra+One&family=Workbench&display=swap");

:root {
  --font-1: monospace;
  --font-3: "VT323", monospace;
  --clr-green: rgba(98, 187, 139, 1);
}

body {
  background-color: #f5fff5;
  font-family: var(--font-1);
  padding: 30px 40px;
  font-size: 1em;
  overflow: hidden;

  background-image: url(https://storage.googleapis.com/fredito-online/assets/images/scanned-imgs/scans__2023/scan3.jpeg);
  background-size: cover;
  background-position: right;
  background-blend-mode: color;
  background-attachment: fixed;
}

main {
  display: flex;
  gap: 10px;
  height: calc(100vh - 80px);
  position: relative;
  z-index: 1;
}

.left-side-section {
  position: static;
  padding-top: 40px;
}

.right-side-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  max-width: 950px;
  height: 100%;
}

.index-content {
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 700px;
}

.index-content p {
  position: relative;
  top: 200px;
}

@keyframes logo-spin {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

.logo-spin {
  width: 65%;
  max-width: 100%;
  pointer-events: none;
  animation: logo-spin 10s linear infinite;
  will-change: transform;
}

.scramble-word.active {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.page-header {
  margin: 0;
  padding: 4px 0;
  font-weight: 800 !important;
  font-size: 1.4em;
}

.page-desc {
  padding: 4px 0;
}

.intro-txt {
  width: 200px;
}

.scramble-word {
  display: inline-block;
  font-size: 1em;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: default;
  user-select: none;
}

.scramble-word .ch {
  display: inline-block;
  color: #111;
  transition: color 0.08s;
}

.scramble-word .ch.hot {
  color: #111;
}

.scramble-word .ch.warm {
  color: #111;
}

.bg-vid-container-small,
.bg-vid-container {
  pointer-events: none;
}

.bg-vid-container video {
  pointer-events: none;
}

.bg-vid-container-small video {
  padding: 8px 0;
  width: 70%;
  height: 1px;
  object-fit: cover;
  filter: blur(1.4px);
}

.bg-vid-container video {
  padding: 8px 0;
  width: 100%;
  height: 1px;
  object-fit: cover;
  filter: blur(1.4px);
}

/* MENU */
.menu {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu p {
  margin: 0;
  padding: 6px 0;
}

.menu p a {
  text-decoration: none;
  color: black;
  cursor: pointer;
}

.menu p a .ch {
  cursor: pointer;
}

.menu p a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.archive-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scroll-snap-align: start;
  scrollbar-width: none;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.video-grid-item {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3;
  box-sizing: border-box;
  cursor: pointer;
  overflow: hidden;
}

.grid-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-video-date {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: whitesmoke;
  padding: 2px 6px;
  font-family: var(--font-3);
  font-size: 0.9em;
  border-radius: 2px;
}

footer {
  position: fixed;
  bottom: 0;
  right: 12px;
  font-size: 0.8em;
  z-index: 1;
}

/* BLEND TOGGLE */
#blend-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-1);
  font-size: 0.72em;
  letter-spacing: 0.08em;
  color: #111;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #d0d0d0;
  border-radius: 999px;
  border: 1px solid #999;
  transition:
    background 0.2s,
    border-color 0.2s;
  display: block;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #111;
  transition:
    transform 0.2s,
    background 0.2s;
  display: block;
}

#blend-toggle.dark .toggle-track,
#drawer-blend-toggle.dark .toggle-track {
  background: #111;
  border-color: #444;
}

#blend-toggle.dark .toggle-thumb,
#drawer-blend-toggle.dark .toggle-thumb {
  transform: translateX(16px);
  background: #f5fff5;
}

#blend-toggle.dark .toggle-label,
#drawer-blend-toggle.dark .toggle-label {
  color: #f5fff5;
}

body.dark::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 3, 0.9);
  z-index: 0;
  pointer-events: none;
}

body.dark,
body.dark a,
body.dark .menu p a,
body.dark .scramble-word .ch,
body.dark .scramble-word .ch.hot,
body.dark .scramble-word .ch.warm,
body.dark #blend-toggle {
  color: #f5fff5;
}

body.dark .toggle-track {
  border-color: #f5fff5;
}

body.dark #stream-btn {
  border-color: #f5fff5;
  color: #f5fff5;
}

body.dark #stream-btn:hover {
  background: #f5fff5;
  color: #111;
}

/* STREAM BUTTON */
#stream-btn {
  font-family: var(--font-1);
  font-size: 0.85em;
  letter-spacing: 0.08em;
  background: none;
  border: 1px solid #111;
  padding: 4px 12px;
  cursor: pointer;
  color: #111;
  transition:
    background 0.15s,
    color 0.15s;
}

#stream-btn:hover {
  background: #111;
  color: #f5fff5;
}

/* GALLERY BUTTON ROW */
.gallery-btn-row {
  display: flex;
  width: 100%;
  gap: 8px;
  margin: 6px 0 10px;
  flex-wrap: wrap;
}

.gallery-btn-row #stream-btn,
.gallery-btn-row #music-btn {
  margin: 0;
  flex: 1;
}

/* MUSIC BUTTON */
#music-btn {
  font-family: var(--font-1);
  font-size: 0.85em;
  letter-spacing: 0.08em;
  background: none;
  border: 1px solid #111;
  padding: 4px 12px;
  cursor: pointer;
  color: #111;
  transition:
    background 0.15s,
    color 0.15s;
}

#music-btn:hover {
  background: #111;
  color: #f5fff5;
}

body.dark #music-btn {
  border-color: #f5fff5;
  color: #f5fff5;
}

body.dark #music-btn:hover {
  background: #f5fff5;
  color: #111;
}

/* MUSIC POPUP */
.music-popup {
  display: none;
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  background: #f5fff5;
  border: 1px solid #111;
  z-index: 1500;
  font-family: var(--font-1);
  font-size: 0.82em;
  letter-spacing: 0.04em;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
}

.music-popup.open {
  display: block;
}

body.dark .music-popup {
  background: #111;
  border-color: #f5fff5;
  color: #f5fff5;
  box-shadow: 3px 3px 0 rgba(255, 255, 255, 0.08);
}

.music-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #111;
}

body.dark .music-popup-header {
  border-bottom-color: #f5fff5;
}

.music-popup-title {
  font-weight: 700;
  letter-spacing: 0.1em;
}

.music-header-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

#music-collapse,
#music-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.7em;
  padding: 0 2px;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
  transition: opacity 0.15s;
}

#music-collapse:hover,
#music-close:hover {
  opacity: 1;
}

#music-collapse {
  transition:
    transform 0.2s,
    opacity 0.15s;
}

/* Collapsed state */
.music-popup.collapsed {
  width: auto;
}

.music-popup.collapsed .music-tracklist {
  display: none;
}

.music-popup.collapsed #music-collapse {
  transform: rotate(180deg);
}

.music-popup-body {
  display: flex;
  flex-direction: row;
  min-height: 0;
}

.music-now-playing {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  width: 140px;
  flex-shrink: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

body.dark .music-now-playing {
  border-right-color: rgba(255, 255, 255, 0.15);
}

.music-track-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
}

.music-title-wrap {
  overflow: hidden;
  width: 100%;
}

#music-track-title {
  display: inline-block;
  font-weight: 700;
  white-space: nowrap;
  will-change: transform;
}

/* music-title-scroll keyframes are injected dynamically by JS */

#music-track-artist {
  opacity: 0.6;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.music-controls button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  line-height: 1;
  padding: 4px 6px;
  color: inherit;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.music-controls button:hover {
  opacity: 1;
}

#music-play-pause {
  font-size: 1em !important;
  border: 1px solid currentColor !important;
  padding: 0 8px !important;
  padding-top: 2px !important;
  padding-bottom: 4px !important;
  border-radius: 0 !important;
}

.music-progress-wrap {
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  position: relative;
}

body.dark .music-progress-wrap {
  background: rgba(255, 255, 255, 0.2);
}

.music-progress-bar {
  height: 100%;
  width: 0%;
  background: #111;
  transition: width 0.25s linear;
  pointer-events: none;
}

body.dark .music-progress-bar {
  background: #f5fff5;
}

.music-time {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.78em;
  opacity: 0.5;
  margin-top: 2px;
}

.music-tracklist {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  max-height: 110px;
  overflow-y: scroll;
  scrollbar-width: none;
}

body.dark .music-tracklist {
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.music-tracklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: background 0.1s;
}

body.dark .music-tracklist-item {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.music-tracklist-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.dark .music-tracklist-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.music-tracklist-item.active {
  font-weight: 700;
}

.music-tracklist-item .track-num {
  opacity: 0.4;
  font-size: 0.85em;
  min-width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.music-tracklist-item.active .track-num::before {
  content: "▶";
  opacity: 1;
  padding: 0 5px;
  font-size: 0.7em;
}

.music-tracklist-item .track-name {
  flex: 1;
  font-size: 0.75em;
}

.music-tracklist-item .track-artist {
  opacity: 0.5;
  font-size: 0.75em;
  width: 40%;
  flex-shrink: 1;
}

/* STREAM OVERLAY */
.stream-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #000;
}

.stream-overlay.open {
  display: block;
}

#stream-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#stream-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1;
  z-index: 1;
}

#stream-close.visible {
  opacity: 0.7;
}

#stream-close.visible:hover {
  opacity: 1;
}

#stream-orient {
  display: none;
}

/* STREAM MARQUEE */
.stream-marquee-wrap {
  position: absolute;
  bottom: 28px;
  left: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  background-color: black;
  mix-blend-mode: screen;
  opacity: 0.3;
}

.stream-marquee-track {
  display: flex;
  width: max-content;
  animation: stream-scroll 30s linear infinite;
  font-family: var(--font-3);
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.1em;
  white-space: nowrap;
  will-change: transform;
}

@keyframes stream-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-1 * var(--marquee-offset, 50%)));
  }
}

/* VIDEO MODAL */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.video-modal.open {
  display: flex;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  cursor: pointer;
}

.video-modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.video-modal-content video,
.video-modal-content img {
  width: 800px;
  height: 600px;
  object-fit: cover;
  outline: none;
}

.video-modal-content img {
  object-position: 50% 10%;
}

.video-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4em;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  opacity: 0.8;
  transition: opacity 0.15s;
  pointer-events: auto;
}

.video-modal-close:hover {
  opacity: 1;
}

.video-modal-prev,
.video-modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: none;
  border: none;
  color: #fff;
  font-size: 3em;
  line-height: 1;
  padding: 12px 20px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s;
  user-select: none;
}

.video-modal-prev {
  left: 20px;
}
.video-modal-next {
  right: 20px;
}

.video-modal-prev:hover,
.video-modal-next:hover {
  opacity: 1;
}

/* HAMBURGER - hidden on desktop */
.hamburger-btn {
  display: none;
}

.menu-backdrop {
  display: none;
}

/* DRAWER MOBILE SECTION - hidden on desktop */
.drawer-mobile-section {
  display: none;
}

@media (max-width: 689px) {
  body {
    padding: 16px;
    overflow-x: hidden;
    height: 100dvh;
  }

  .content {
    text-align: left;
  }

  main {
    height: calc(100dvh - 50px);
  }

  .intro-txt {
    font-size: 1.1em;
    position: fixed;
  }

  .hamburger-btn {
    display: block;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1000;
    background: rgba(245, 255, 245, 0.85);
    border: none;
    border-radius: 4px;
    font-size: 2em;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    color: #111;
  }

  #blend-toggle {
    display: none;
  }

  .menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 800;
    background: rgba(0, 0, 0, 0.4);
  }

  .menu-backdrop.open {
    display: block;
    z-index: inherit;
  }

  .left-side-section {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 220px;
    background: #f5fff5;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding: 60px 24px 24px;
    box-sizing: border-box;
    overflow-y: auto;
  }

  .left-side-section.open {
    transform: translateX(0);
  }

  .right-side-section {
    width: 100%;
    padding-top: 48px;
    box-sizing: border-box;
  }

  #stream-close {
    opacity: 0.8;
  }

  #stream-orient {
    display: block;
    position: absolute;
    top: 18px;
    left: 22px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6em;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    z-index: 1;
  }

  .stream-overlay.horizontal #stream-video {
    width: 100vh;
    height: 100vw;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    object-fit: cover;
  }

  .video-modal-content video {
    width: 100%;
    height: 300px;
    object-fit: cover;
    outline: none;
    overflow: hidden;
  }

  footer {
    position: fixed;
    bottom: 0;
    margin: 0 auto;
    font-size: 0.2em;
  }

  .index-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .logo-spin {
    width: 100%;
    margin-top: -100px;
  }

  body.dark .left-side-section {
    background: #111;
    z-index: 9999;
  }

  body.dark .hamburger-btn {
    color: #f5fff5;
    background: transparent !important;
  }

  .drawer-mobile-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(17, 17, 17, 0.15);
  }

  body.dark .drawer-mobile-section {
    border-top-color: rgba(245, 255, 245, 0.15);
  }

  #drawer-blend-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: var(--font-1);
    font-size: 0.72em;
    letter-spacing: 0.08em;
    color: #111;
  }

  body.dark #drawer-blend-toggle {
    color: #f5fff5;
  }

  /* MUSIC PLAYER — mobile */
  .music-popup {
    width: 100%;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-radius: 0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
    font-size: 0.78em;
  }

  .music-popup.collapsed {
    width: 100%;
  }

  .music-popup-body {
    flex-direction: column;
  }

  .music-now-playing {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    box-sizing: border-box;
    border-right: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: unset;
  }

  .music-progress-wrap,
  .music-time {
    width: 100%;
    flex-shrink: 0;
  }

  body.dark .music-now-playing {
    border-bottom-color: rgba(255, 255, 255, 0.1);
    border-right: none;
  }

  .music-track-info {
    flex: 1;
    min-width: 0;
  }

  .music-controls {
    width: auto;
    flex-shrink: 0;
    justify-content: flex-end;
    gap: 2px;
  }

  .music-tracklist {
    max-height: calc(3 * 21px);
    overflow-y: auto;
  }

  .music-tracklist-item .track-artist {
    display: flex;
  }
}
