/* ---------- Tokens ---------- */

:root {
  --background: #f7f5f3;
  --foreground: #3d3830;
  --muted-foreground: #6f675c; /* 5.1:1 on --background (WCAG AA) */
  --primary: #c45a2c;
  --secondary: #efebe6;
  --border: #e5e0da;

  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --radius: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #1c1a17;
    --foreground: #ece7e1;
    --muted-foreground: #a39a8f;
    --primary: #e0784a;
    --secondary: #2a2723;
    --border: #3a3631;
  }
}

/* ---------- Base ---------- */

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

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius);
}

img {
  display: block;
  max-width: 100%;
}

section {
  margin-bottom: 2.5rem;
}

/* ---------- Header ---------- */

.header {
  position: relative;
  height: 16rem;
  width: 100%;
  overflow: hidden;
}

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

.header-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, var(--background) 100%);
}

/* ---------- Layout ---------- */

main {
  position: relative;
  z-index: 10;
  max-width: 42rem;
  margin: -2rem auto 0;
  padding: 0 1.5rem 4rem;
}

/* ---------- Title ---------- */

.title-wrapper {
  margin-bottom: 1.5rem;
}

h1 {
  position: relative;
  display: inline;
  font-size: 1.875rem;
  font-weight: 600;
}

.title-underline {
  position: absolute;
  left: 0;
  bottom: 0.25rem;
  z-index: -1;
  width: 100%;
  height: 0.5rem;
  background-color: var(--primary);
  opacity: 0.8;
}

.local-time {
  margin-top: 0.25rem;
  font-size: var(--text-sm);
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums; /* digits don't shift as the time changes */
}

/* ---------- Bio ---------- */

.bio {
  margin-bottom: 2rem;
}

.bio p {
  color: var(--muted-foreground);
  line-height: 1.7;
}

.bio strong {
  color: var(--foreground);
  font-weight: 500;
}

.bio-link:hover strong,
.bio-link:focus-visible strong {
  color: var(--primary);
}

/* The title stays on the text baseline; only the cover is centred on the line. */
/* Keep the cover attached to the first word of its title, but let long titles wrap */
.inline-album {
  white-space: nowrap;
}

.inline-album strong {
  white-space: normal;
}

.inline-album .cover {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.375rem;
  border-radius: 0.125rem;
  vertical-align: middle;
  position: relative;
  top: -0.1em; /* "middle" uses half the x-height, which sits a touch low */
}

/* Film posters are 2:3, and a little taller than the album squares */
.inline-poster .cover {
  width: 0.875rem;
  height: 1.3125rem;
  object-fit: cover;
}

/* Shown when there's no artwork, or the image fails to load */
.cover-missing {
  flex-shrink: 0;
  background-color: var(--secondary);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ---------- Loading placeholders ---------- */

.skeleton {
  border-radius: var(--radius);
  background-color: var(--secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
  display: inline-block;
  width: 14rem;
  max-width: 100%;
  height: 0.9em;
  vertical-align: middle;
}

.skeleton-text.short {
  width: 8rem;
  margin-left: 0.5rem;
}

.skeleton-card {
  height: 4.25rem;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}

/* ---------- Social links ---------- */

.social-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 5px;
  background-color: var(--secondary);
}

.social-link:hover,
.social-link:focus-visible {
  background-color: var(--border);
  color: var(--primary);
}

.social-link svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* ---------- Shared text styles ---------- */

.section-title {
  margin-bottom: 1rem;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.small-label {
  margin-bottom: 0.5rem;
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

.music-item-title,
.music-item-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Music ---------- */

.music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.music-item-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.music-item-content .cover {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
}

.music-item-info {
  min-width: 0; /* lets the text truncate inside the flex row */
}

.music-item-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--foreground);
}

.music-item-subtitle {
  font-size: var(--text-xs);
  color: var(--muted-foreground);
}

/* ---------- Recently played carousel ---------- */

.recent {
  margin-bottom: 1.5rem;
}

.marquee {
  display: flex;
  overflow: hidden;
  /* fade the edges so songs drift in and out instead of being cut off */
  mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
}

.marquee-track {
  display: flex;
  flex-shrink: 0;
  list-style: none;
  animation: marquee var(--duration, 100s) linear infinite;
}

/* Pause while someone is looking at (or tabbing through) a song */
.marquee:hover .marquee-track,
.marquee:focus-within .marquee-track {
  animation-play-state: paused;
}

/* Each track moves left by exactly its own width, then loops */
@keyframes marquee {
  to {
    transform: translateX(-100%);
  }
}

/* One line per song: cover, title, artist */
.recent-track {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding-right: 1.5rem; /* padding, not gap, so both copies are the same width */
  font-size: var(--text-sm);
  white-space: nowrap;
}

.recent-track .cover {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.125rem;
}

.recent-title {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: var(--foreground);
}

.recent-artist {
  color: var(--muted-foreground);
}

@media (prefers-reduced-motion: reduce) {
  /* No auto-scroll: let people scroll the list themselves instead */
  .marquee {
    overflow-x: auto;
    mask-image: none;
  }

  .marquee-track[aria-hidden] {
    display: none;
  }
}

.genres {
  font-size: var(--text-sm);
  color: var(--foreground);
}

.genres a:hover,
.genres a:focus-visible {
  color: var(--primary);
}

/* ---------- Projects ---------- */

.project-list {
  display: flex;
  flex-direction: column;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
}

.coming-soon {
  font-size: var(--text-sm);
  color: var(--muted-foreground);
}

.project-item:last-child {
  border-bottom: none;
}

.project-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.project-name {
  font-weight: 500;
  color: var(--foreground);
  transition: color 0.2s;
}

.project-desc {
  color: var(--muted-foreground);
}

.project-item svg {
  flex-shrink: 0;
  width: var(--text-sm);
  height: var(--text-sm);
  color: var(--muted-foreground);
  opacity: 0;
  transition: opacity 0.2s;
}

.project-item:hover .project-name,
.project-item:focus-visible .project-name {
  color: var(--primary);
}

.project-item:hover svg,
.project-item:focus-visible svg {
  opacity: 1;
}

/* ---------- Responsive ---------- */

@media (max-width: 500px) {
  .project-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
}

@media (min-width: 768px) {
  .header {
    height: 20rem;
  }

  h1 {
    font-size: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
