@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=Fraunces:wght@400;600;700;800&display=swap');

@view-transition {
  navigation: auto;
}

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

:root {
  --page-scale: 1;
  --nav-height: calc(48px * var(--page-scale));
  --nav-font-size: calc(12px * var(--page-scale));
  --nav-border: calc(3px * var(--page-scale));
  --page-padding: calc(48px * var(--page-scale));
  --heading-size: calc(48px * var(--page-scale));
  --body-size: calc(14px * var(--page-scale));
  --section-gap: calc(36px * var(--page-scale));
  --subheading-size: calc(26px * var(--page-scale));
  --subheading-gap: calc(14px * var(--page-scale));
  --poster-min-width: calc(132px * var(--page-scale));
  --poster-gap: calc(14px * var(--page-scale));

  /* Typography & colors */
  --text-dark: #0a0a0a;
  --text-secondary: rgba(0, 0, 0, 0.55);
  --text-tertiary: rgba(0, 0, 0, 0.5);
  --font-serif: 'Fraunces', serif;
  --font-mono: 'DM Mono', monospace;
  --text-line-height: 1.8;
}

body {
  font-family: var(--font-mono);
  /* var(--accent) is set dynamically by nav.js from each page's pageColor.
     This means the body background automatically becomes that page's color.
     No hardcoding needed here at all. */
  background: var(--accent, lavender);
  background-image: repeating-linear-gradient(45deg,
      rgb(0, 0, 0, 0.025) 0,
      rgb(0, 0, 0, 0.025) 2px,
      transparent 2px,
      transparent 15px);
  color: var(--text-dark);
  min-height: 100vh;
}

/* ── NAV ─────────────────────────────────────────── */

#site-nav {
  display: flex;
  flex-direction: column;
  /* make all tabs the same height as the nav bar */
  width: 100%;
  min-height: var(--nav-height);
  /* background is set directly by nav.js since it's a derived JS value */
}

.nav-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: var(--nav-height);
}

.nav-tab {
  /* flex: 1 is the magic property that makes equal spacing work.
     Each tab says "I want 1 equal share of the total width."
     With 8 tabs, each gets exactly 1/8 of the nav bar. */
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: center;
  /* vertically center the text */
  justify-content: center;
  /* horizontally center the text */

  font-family: var(--font-mono);
  font-size: var(--nav-font-size);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  text-decoration: none;
  /* removes the underline links have by default */
  color: var(--text-dark);
  white-space: nowrap;

  /* border-bottom creates the visual "ledge" that separates nav from page.
     We'll remove this on the active tab so it blends in. */
  border-bottom: var(--nav-border) solid rgba(0, 0, 0, 0.2);

  transition: opacity 0.15s ease;
}

.nav-tab:not(.active):hover {
  opacity: 0.8;
}

.nav-tab.active {
  /* The active tab's background is set to pageColor in nav.js,
     which matches the body background exactly — creating the fusion effect.
     Here in CSS we just remove the bottom border so there's no dividing line. */
  border-bottom: var(--nav-border) solid transparent;
  font-weight: 700;
}

/* ── PAGE CONTENT ─────────────────────────────────── */

.page-content {
  padding: var(--page-padding);
}

h1 {
  font-family: var(--font-serif);
  font-size: var(--heading-size);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: calc(16px * var(--page-scale));
  line-height: 1.1;
}

p {
  font-size: var(--body-size);
  line-height: var(--text-line-height);
  color: var(--text-secondary);
}

li {
  font-size: var(--body-size);
  line-height: var(--text-line-height);
  color: var(--text-secondary);
}

a {
  color: var(--text-secondary);
}

.collage,
.discography {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--poster-min-width), 1fr));
  gap: var(--poster-gap);
}

.collage-item,
.album {
  position: relative;
  display: flex;
  flex-direction: column;
  color: var(--text-dark);
  text-decoration: none;
  transform: rotate(var(--tilt, 0deg));
}

.collage-item:focus-visible,
.album:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

.collage-item img,
.album img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 2px solid rgba(0, 0, 0, 0.15);
}

.album img {
  aspect-ratio: 1 / 1;
}

.collage-item:hover img,
.collage-item:focus-visible img,
.album:hover img,
.album:focus-visible img {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.26);
  transform: translateY(-4px);
}

.collage-item span,
.album span {
  padding: 8px 0;
  font-size: calc(12px * var(--page-scale));
  line-height: 1.25;
}

.collage-item:not(.has-image) span,
.album:not(.has-image) span {
  background: none;
  color: var(--text-dark);
  font-family: var(--font-serif);
  font-size: calc(18px * var(--page-scale));
  font-weight: 700;
  text-shadow: none;
}

.collage-item.missing-image::before,
.album.missing-image::before {
  content: "can't find a poster </3";
  position: absolute;
  top: 50%;
  left: calc(10px * var(--page-scale));
  right: calc(10px * var(--page-scale));
  font-size: calc(10px * var(--page-scale));
  color: var(--text-tertiary);
}

.album.missing-image::before {
  content: "can't find album art </3";
}

@media (max-width: 640px) {
  :root {
    --page-scale: 0.9;
    --page-padding: 32px 20px;
    --heading-size: 38px;
    --poster-gap: 12px;
  }

  .page-content {
    max-width: none;
  }

  .collage,
  .discography {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collage-item,
  .album {
    min-height: 0;
  }
}

@media (max-width: 420px) and (orientation: portrait) {
  :root {
    --page-scale: 0.82;
    --page-padding: 28px 16px;
    --heading-size: 34px;
    --nav-height: 44px;
  }
}

@media (min-width: 1440px) {
  :root {
    --page-scale: 1.16;
  }
}

@media (min-width: 1800px) and (min-resolution: 2dppx) {
  :root {
    --page-scale: 1.24;
  }
}