:root {
  color-scheme: light;

  /* Palette */
  --paper: #faf8f3;
  --ink: #16140f;
  --muted: #75706620;
  --muted-text: #756f63;
  --faint: #b7b1a4;
  --hairline: rgba(22, 20, 15, 0.12);
  --logo-bg: var(--ink);
  --logo-text: rgba(250, 248, 243, 0.72);

  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --logo-size: min(82vw, 360px);
  --gutter: max(1.25rem, env(safe-area-inset-left, 0px));

  /* Intro */
  --intro-shrink-duration: 1.05s;
  --intro-line-stagger: 0.045s;
  --intro-line-duration: 0.38s;
}

/* ---------- Keyframes ---------- */

@keyframes introPanelShrink {
  to {
    top: var(--intro-target-top);
    left: var(--intro-target-left);
    width: var(--intro-target-width);
    height: var(--intro-target-height);
  }
}

@keyframes lineCascade {
  from { opacity: 0; transform: translateY(-0.25em); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes logoShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.045); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(0.6rem); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* ---------- Intro splash ---------- */

.intro-splash {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: var(--paper);
  pointer-events: none;
}

.intro-splash__panel {
  position: fixed;
  top: 0;
  left: 0;
  background: var(--logo-bg);
  overflow: hidden;
  will-change: top, left, width, height;
}

.intro-splash__panel.is-shrinking {
  animation: introPanelShrink var(--intro-shrink-duration) var(--ease-out) forwards;
}

.intro-splash__block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  overflow: hidden;
  text-align: center;
  font-size: clamp(2.25rem, 11vw, 4.125rem);
  font-style: oblique;
  line-height: 0.6em;
  color: var(--logo-text);
}

.intro-splash__block.is-logo-fit {
  justify-content: center;
}

.intro-splash__line {
  display: block;
  opacity: 0;
  animation: lineCascade var(--intro-line-duration) var(--ease-out) forwards;
}

/* Hold the real UI back while the intro plays */
body.is-intro-active .topbar,
body.is-intro-active .hero__tagline {
  opacity: 0;
}

body.is-intro-active .logo__line {
  opacity: 0;
  animation: none;
}

body.is-intro-complete .animation-logo {
  animation: logoShimmer 4s ease-in-out 1.75s infinite;
}

/* ---------- Topbar ---------- */

.topbar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 5rem;
  padding:
    max(0px, env(safe-area-inset-top, 0px))
    var(--gutter)
    0
    var(--gutter);
}

body.is-intro-complete .topbar {
  animation: fadeUp 0.7s var(--ease-out) 0.2s both;
}

.topbar__start {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  padding-left: 1rem;
}

.brand-switch {
  display: flex;
  align-items: center;
}

.brand-switch__track {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.16rem;
  border: 1px solid var(--hairline);
  border-radius: 2rem;
}

.brand-switch__option {
  padding: 0.24rem 0.7rem;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--muted-text);
  text-decoration: none;
  border-radius: 1.5rem;
  transition:
    color 0.25s var(--ease-out),
    background 0.25s var(--ease-out);
}

.brand-switch__option.is-active {
  color: var(--paper);
  background: var(--ink);
  font-style: oblique;
}

.brand-switch__option:not(.is-active):hover,
.brand-switch__option:not(.is-active):focus-visible {
  color: var(--ink);
}

.brand-switch__option:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 4vw, 1.75rem);
  margin-left: auto;
  padding-right: 1rem;
}

.navlink {
  position: relative;
  padding: 0.25rem 0;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--muted-text);
  text-decoration: none;
  transition: color 0.25s var(--ease-out);
}

.navlink::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s var(--ease-out);
}

.navlink:hover,
.navlink:focus-visible {
  color: var(--ink);
}

.navlink:hover::after,
.navlink:focus-visible::after {
  transform: scaleX(1);
}

.navlink:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

  /* ---------- Page ---------- */

.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 5.75rem var(--gutter) 3rem;
}

body.page-landing .page {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.page-collection .page {
  max-width: 72rem;
  margin: 0 auto;
}

.view {
  width: 100%;
}

/* ---------- Hero / logo ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.logo {
  position: relative;
  width: var(--logo-size);
  height: var(--logo-size);
  flex-shrink: 0;
  overflow: hidden;
}

.logo__block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  text-align: center;
  font-size: clamp(2.25rem, 11vw, 4.125rem);
  font-style: oblique;
  line-height: 0.6em;
  color: var(--logo-text);
  background: var(--logo-bg);
}

body.is-intro-complete .logo__block {
  cursor: pointer;
}

.logo__line {
  display: block;
  opacity: 0;
  animation: lineCascade 0.38s var(--ease-out) forwards;
}

.logo__line:nth-child(1) { animation-delay: 0.08s; }
.logo__line:nth-child(2) { animation-delay: 0.13s; }
.logo__line:nth-child(3) { animation-delay: 0.18s; }
.logo__line:nth-child(4) { animation-delay: 0.23s; }
.logo__line:nth-child(5) { animation-delay: 0.28s; }
.logo__line:nth-child(6) { animation-delay: 0.33s; }
.logo__line:nth-child(7) { animation-delay: 0.38s; }
.logo__line:nth-child(8) { animation-delay: 0.43s; }
.logo__line:nth-child(9) { animation-delay: 0.48s; }
.logo__line:nth-child(10) { animation-delay: 0.53s; }
.logo__line:nth-child(11) { animation-delay: 0.58s; }
.logo__line:nth-child(12) { animation-delay: 0.63s; }
.logo__line:nth-child(13) { animation-delay: 0.68s; }
.logo__line:nth-child(14) { animation-delay: 0.73s; }
.logo__line:nth-child(15) { animation-delay: 0.78s; }
.logo__line:nth-child(16) { animation-delay: 0.83s; }
.logo__line:nth-child(17) { animation-delay: 0.88s; }
.logo__line:nth-child(18) { animation-delay: 0.93s; }
.logo__line:nth-child(19) { animation-delay: 0.98s; }
.logo__line:nth-child(20) { animation-delay: 1.03s; }
.logo__line:nth-child(21) { animation-delay: 1.08s; }
.logo__line:nth-child(22) { animation-delay: 1.13s; }
.logo__line:nth-child(23) { animation-delay: 1.18s; }
.logo__line:nth-child(24) { animation-delay: 1.23s; }
.logo__line:nth-child(25) { animation-delay: 1.28s; }
.logo__line:nth-child(26) { animation-delay: 1.33s; }
.logo__line:nth-child(27) { animation-delay: 1.38s; }
.logo__line:nth-child(28) { animation-delay: 1.43s; }
.logo__line:nth-child(29) { animation-delay: 1.48s; }
.logo__line:nth-child(30) { animation-delay: 1.53s; }
.logo__line:nth-child(31) { animation-delay: 1.58s; }

.hero__tagline {
  margin: 0;
  max-width: 26rem;
  font-size: 0.95rem;
  line-height: 1.6;
  text-align: center;
  color: var(--muted-text);
}

body.is-intro-complete .hero__tagline {
  animation: fadeUp 0.7s var(--ease-out) 0.45s both;
}

/* ---------- Collection ---------- */

.collection-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  margin-bottom: 2.25rem;
}

body.page-collection .collection-header {
  animation: fadeUp 0.7s var(--ease-out) 0.1s both;
}

.collection-header__title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 400;
  font-style: oblique;
  letter-spacing: 0.02em;
}

.collection-header__meta {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted-text);
}

.collection-search {
  flex: 1 1 14rem;
  max-width: 22rem;
}

.collection-search__input {
  width: 100%;
  padding: 0.55rem 0;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: transparent;
  transition: border-color 0.25s var(--ease-out);
}

.collection-search__input::placeholder {
  color: var(--faint);
}

.collection-search__input:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

.collection-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-bottom: 2rem;
}

.collection-filter {
  position: relative;
  padding: 0.2rem 0;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--muted-text);
  text-decoration: none;
  transition: color 0.25s var(--ease-out);
}

.collection-filter::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s var(--ease-out);
}

.collection-filter:hover,
.collection-filter:focus-visible,
.collection-filter.is-active {
  color: var(--ink);
}

.collection-filter:hover::after,
.collection-filter:focus-visible::after,
.collection-filter.is-active::after {
  transform: scaleX(1);
}

.collection-filter:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 1.5rem 1.1rem;
}

.collection-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out) forwards;
}

.collection-card:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

.collection-card__cover {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--muted);
}

.collection-card__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease-out), filter 0.45s var(--ease-out);
}

.collection-card:hover .collection-card__cover img,
.collection-card:focus-visible .collection-card__cover img {
  transform: scale(1.03);
  filter: brightness(0.94);
}

.collection-card__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.collection-card__artist {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card__title {
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-card__detail {
  font-size: 0.72rem;
  color: var(--faint);
}

.collection-empty {
  margin: 3rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted-text);
}

.collection-footer {
  margin-top: 3rem;
  padding-bottom: 1rem;
  text-align: center;
}

.collection-footer__note {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.collection-footer__note a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.collection-footer__note a:hover,
.collection-footer__note a:focus-visible {
  color: var(--ink);
}

.navlink.is-active {
  color: var(--ink);
}

.navlink.is-active::after {
  transform: scaleX(1);
}

/* ---------- Footer ---------- */

.site-footer {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 0;
  right: 0;
  padding:
    0
    var(--gutter)
    max(1rem, env(safe-area-inset-bottom, 0px));
  text-align: center;
  pointer-events: none;
}

.site-footer__note {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* ---------- Mobile ---------- */

@media (max-width: 600px) {
  :root {
    --gutter: max(1.1rem, env(safe-area-inset-left, 0px));
    --logo-size: min(calc(100vw - 2.5rem), 360px);
  }

  .topbar {
    height: 4.5rem;
  }

  .topbar__nav {
    gap: 1.1rem;
  }

  .navlink {
    font-size: 0.875rem;
  }

  .brand-switch__option {
    padding: 0.2rem 0.58rem;
    font-size: 0.72rem;
  }

  .topbar__start {
    padding-left: 0.75rem;
  }

  .page {
    padding-top: 5.25rem;
  }

  .collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 1.25rem 0.85rem;
  }

  .collection-header {
    margin-bottom: 1.75rem;
  }
}

/* ---------- Dark (system) ---------- */

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --paper: #000000;
    --ink: #f5f3ee;
    --muted: rgba(255, 255, 255, 0.06);
    --muted-text: #9a9589;
    --faint: #6b665c;
    --hairline: rgba(245, 243, 238, 0.14);
    --logo-bg: #16140f;
    --logo-text: rgba(250, 248, 243, 0.72);
  }

  .intro-splash__panel,
  .logo {
    border: 1px solid var(--hairline);
  }

  .collection-card:hover .collection-card__cover img,
  .collection-card:focus-visible .collection-card__cover img {
    filter: brightness(1.06);
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .intro-splash {
    display: none;
  }

  .navlink,
  .navlink::after {
    transition: none;
  }

  .brand-switch__option {
    transition: none;
  }

  body.is-intro-complete .topbar,
  body.is-intro-complete .hero__tagline,
  body.is-intro-complete .animation-logo {
    animation: none;
  }

  .logo__line {
    opacity: 1;
    animation: none;
    transform: none;
  }

  body:not(.is-intro-active) .topbar,
  body:not(.is-intro-active) .hero__tagline {
    opacity: 1;
  }
}
