:root {
  --ink: #141414;
  --muted: #9b9b9b;
  --line: #ececec;
  --line-strong: #d8d8d8;
  --bg: #ffffff;
  --accent: #070BEE;

  --serif: "Chiron Sung HK", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

::selection {
  background-color: var(--accent);
  color: #fff;
}

::-moz-selection {
  background-color: var(--accent);
  color: #fff;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Site title ---- */
.topbar {
  text-align: center;
  padding-top: 22px;
}
.brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.16s ease;
}
.brand:hover,
.brand:focus-visible {
  color: var(--accent);
  outline: none;
}

.page {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vh, 48px) 24px;
}

.songs {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---- Song row ---- */
.song__head {
  position: relative;
  width: 100%;
  display: block;
  padding: 24px 0;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.song__title {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(1.2rem, 6.4vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.song__sep {
  margin: 0 0.3em;
  color: var(--muted);
  font-weight: 400;
}

.song__artist {
  color: var(--muted);
  font-weight: 700;
}

/* album art — appears only on hover, floating left of the title */
.song__cover {
  position: absolute;
  top: 50%;
  right: calc(100% + 20px);
  width: 60px;
  height: 60px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) translateX(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.song__head:hover .song__cover,
.song__head:focus-visible .song__cover,
.song--open .song__cover {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.song__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- Expanding panel ---- */
.panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.1, 1);
}
.song--open .panel {
  grid-template-rows: 1fr;
}
.panel__body {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.song--open .panel__body {
  opacity: 1;
}

/* padding lives on an inner wrapper so .panel__body can collapse to 0 */
.panel__inner {
  padding-top: 20px;
  padding-bottom: 60px;
}

/* key tabs (same song, different key) */
.keybar {
  margin: 2px 0 22px;
}
.keys {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.key {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0;
  border: 0;
  background: none;
  /* background-color: var(--line); */
  color: var(--muted);
  cursor: pointer;
  transition: color 0.16s ease;
}
.key:hover {
  color: var(--accent);
}
.key--active,
.key--active:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

/* download grid */
.grid > * {
  padding-block: 16px;
  border-top: 1px solid var(--line);
}
.grid > *:first-child {
  border-top: 0;
}

/* original row */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.row__name {
  font-weight: 500;
}

/* instrument block */
.inst {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: start;
}
.inst__name {
  font-family: var(--serif);
  font-weight: 500;
  padding-top: 2px;
}
.inst__lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.line__label {
  font-size: 0.85em;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* download buttons */
.dl {
  display: flex;
  gap: 8px;
  flex: none;
}
.dl__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 30px;
  padding: 0 12px;
  /* border: 1px solid var(--line-strong); */
  /* border-radius: 999px; */
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.dl__btn:hover,
.dl__btn:focus-visible {
  background-color: var(--accent);
  color: white;
  outline: none;
}

/* ---- Back to top ---- */
/* grid-rows trick (panel 과 동일): 높이가 펼쳐지며 서서히 나타난다 */
.to-top {
  display: grid;
  margin-top: 24px;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.1, 1);
}
.to-top--show {
  grid-template-rows: 1fr;
}
.to-top__btn {
  overflow: hidden;
  min-height: 0;
  justify-self: center;
  background: none;
  border: 0;
  padding: 16px 8px 8px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transition: opacity 0.3s ease, color 0.16s ease;
}
.to-top--show .to-top__btn {
  opacity: 1;
}
.to-top__btn:hover,
.to-top__btn:focus-visible {
  color: var(--accent);
  outline: none;
}

/* focus ring for keyboard */
.song__head:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
  border-radius: 4px;
}

/* floating album art needs a side gutter; hide it when the column fills the viewport */
@media (max-width: 820px) {
  .song__cover {
    display: none;
  }
}

@media (max-width: 460px) {
  .panel__inner {
    padding-top: 0px;
  }
  .row__name {
    font-size: 0.85em;
  }
  .inst {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .inst__name {
    font-size: 0.85em;
    padding-top: 0px;
    line-height: 30px;
  }
  .dl__btn {
    min-width: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .panel__body,
  .song__cover,
  .dl__btn {
    transition: none;
  }
}
