/* Page chrome: navbar, theme picker, piece switcher, footer, listing cards. */

/* ── Fixed navbar offset ─────────────────────────────────── */
body {
  padding-top: 68px;
}

/* ── Homepage (catalog) layout + promo card ──────────────── */
.home-wrap--promo { display: flex; align-items: flex-start; gap: 1.75rem; }
.home-main { flex: 1 1 auto; min-width: 0; }
.home-promo { flex: 0 0 300px; position: sticky; top: 84px; }
.home-promo-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 1.6rem 1.4rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
/* Illustration band at the bottom of the card (below the text/buttons), bled to
   the card edges and faded into the white at its top so it doesn't crowd the
   copy — like Reddit's sign-up card. */
.home-promo-art {
  height: 200px;
  margin: 1.3rem -1.4rem -1.6rem;
  background: url("../promo-piano.jpg") center bottom / cover no-repeat;
  -webkit-mask: linear-gradient(to bottom, transparent 0, #000 56px);
          mask: linear-gradient(to bottom, transparent 0, #000 56px);
}
.home-promo-card::before {           /* gold accent bar along the top */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--gp-gold), var(--gp-walnut));
}
.home-promo-badge {
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(200, 169, 107, 0.16);
  color: var(--gp-walnut);
  font-size: 1.3rem;
  margin-bottom: .9rem;
}
.home-promo-title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 .6rem;
  color: var(--gp-black, #1c1c1e);
}
.home-promo-lede { font-size: .9rem; color: #5c5c5c; margin-bottom: 1rem; }
.home-promo-points { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.home-promo-points li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: .5rem;
  font-size: .86rem;
  color: #333;
}
.home-promo-points li::before {
  content: '♪';
  position: absolute;
  left: 0;
  color: var(--gp-gold);
  font-weight: 700;
}
.home-promo-alt {
  display: block;
  text-align: center;
  margin-top: .65rem;
  font-size: .85rem;
  color: var(--gp-walnut);
  text-decoration: none;
}
.home-promo-alt:hover { text-decoration: underline; }
@media (max-width: 992px) {
  .home-wrap--promo { flex-direction: column; }
  .home-promo { position: static; flex-basis: auto; width: 100%; max-width: 520px; }
}

#main-nav {
  height: 68px;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  /* thin bottom separator matching the menu dividers */
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12), 0 2px 1px rgba(0, 0, 0, .45);
}
/* When the switcher is open the menu supplies the seam divider, so drop the
   bar's own separator to avoid a doubled line under the current-piece row. */
#main-nav.switcher-open { box-shadow: none !important; }

#main-nav .container-fluid {
  height: 100%;
}

#main-nav .navbar-brand {
  padding: 0;
  height: 100%;
}

/* ── Split-circle theme picker ──────────────────────────── */
.split-circle {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  border: 1.5px solid rgba(255,255,255,0.35);
  flex-shrink: 0;
  cursor: pointer;
}
.split-half          { flex: 1; height: 100%; transition: filter .15s; }
.split-half:hover    { filter: brightness(0.88); }
.split-left          { background: var(--tile-bg, #fff); border-right: 1.5px solid rgba(0,0,0,0.3); }
.split-right         { background: var(--strip-bg, #fff); }

/* ── User avatar + menu ──────────────────────────────────── */
/* Round button showing the email's first letter; background colour is set
   per-user in base.html. Opens the account dropdown (My library / Log out). */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.35);
  background: var(--gp-walnut);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  cursor: pointer;
  text-transform: uppercase;
  user-select: none;
  transition: filter .15s;
}
.user-avatar:hover  { filter: brightness(1.1); }
.user-avatar-anon   { background: #6c757d; font-size: 1.15rem; }

/* Library counter: pulse + gold glow when the count changes (add/remove). */
@keyframes lib-bump {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); color: var(--gp-gold); text-shadow: 0 0 10px var(--gp-gold); }
  100% { transform: scale(1); }
}
#library-count.bump {
  display: inline-block;
  animation: lib-bump 0.6s ease;
}
#main-nav.nav-light .user-avatar { border-color: rgba(0,0,0,0.25); }

/* Light navbar (when strip-bg = light) */
#main-nav.nav-light                         { background-color: #f8f8f8 !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .10), 0 2px 1px rgba(255, 255, 255, .8); }
#main-nav.nav-light .navbar-brand           { color: #1c1c1e !important; }
#main-nav.nav-light .navbar-center          { color: #1c1c1e !important; }
#main-nav.nav-light .navbar-center a        { color: rgba(0,0,0,0.4) !important; }
#main-nav.nav-light .btn-outline-light      { color: #1c1c1e; border-color: rgba(0,0,0,0.35); }
#main-nav.nav-light .btn-outline-light:hover{ background: #1c1c1e; color: #fff; }
#main-nav.nav-light .split-circle           { border-color: rgba(0,0,0,0.25); }

/* Strip background driven by --strip-bg */
#score-wrapper { background: var(--strip-bg, #fff); }

/* ── Navbar centered title ───────────────────────────────── */
.navbar-center {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  margin: 0 auto;
  width: max-content;
  max-width: 60%;
  white-space: nowrap;
  pointer-events: none;
}
.navbar-center a { pointer-events: auto; }
.navbar-center .dropdown { pointer-events: auto; height: 100%; }

/* Catalog search bar (centered in the navbar). */
.catalog-search {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}
.catalog-search-icon {
  position: absolute;
  left: 13px;
  font-size: .85rem;
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.catalog-search-input {
  width: min(52vw, 620px);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  padding: .4rem .9rem .4rem 2.2rem;
  font-size: .9rem;
  outline: none;
  transition: background .15s, border-color .15s;
}
.catalog-search-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.catalog-search-input:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--gp-gold);
}
/* Replace Chrome's default (blue) search-clear "×" with one in our palette that
   follows the input's text colour. */
.catalog-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
          appearance: none;
  width: 14px;
  height: 14px;
  cursor: pointer;
  background-color: currentColor;
  opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 4l8 8M12 4l-8 8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.catalog-search-input::-webkit-search-cancel-button:hover { opacity: 1; }
#main-nav.nav-light .catalog-search-input {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.15);
  color: #1c1c1e;
}
#main-nav.nav-light .catalog-search-icon { color: rgba(0, 0, 0, 0.4); }

/* Piece switcher — a pill in the bar that doubles as the current piece (first
   entry); clicking it drops the other pieces directly below, blended into the
   bar. The toggle and the menu items share padding/gap so the pencil tile and
   the thumbnails line up in one column. */
.piece-switch-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;                   /* fill the bar height — the row IS the bar */
  padding: 0 1rem;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--gp-black);     /* same surface as the menu it heads */
  transition: background .15s;
}
.piece-switch-toggle:hover { background: var(--gp-charcoal); }
/* Open: the row is the menu's first entry, so it carries the exact menu
   background — the seam divider then looks identical to the others. */
.piece-switch-dd.show .piece-switch-toggle { background: var(--gp-black); }
.piece-switch-name { pointer-events: none; }   /* clicks fall through to the toggle */

.piece-switch-menu {
  position: fixed;                /* top/left/width set in JS — flush under the row */
  margin: 0;
  background: var(--gp-black);
  border: 1px solid rgba(255, 255, 255, .14);
  border-top: none;               /* flush under the current-piece row */
  border-radius: 0 0 12px 12px;
  padding: 0;
  overflow: hidden;               /* clip item hover to the rounded bottom corners */
  max-width: calc(100vw - 2rem);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}
.piece-switch-menu .dropdown-item {
  color: var(--gp-ivory);
  font-size: 1.15rem;
  padding: .55rem 1rem;
  border-radius: 0;
  white-space: nowrap;   /* one line per entry — JS widens the panel to fit */
}
/* classy separators between rows (and between the current-piece row and the
   list): a thin line with a soft shadow beneath it. */
.piece-switch-menu li::before {
  content: "";
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, .12);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .45);
}
.piece-switch-menu .dropdown-item:hover,
.piece-switch-menu .dropdown-item:focus {
  background: var(--gp-charcoal);
  color: var(--gp-ivory);
}
/* light theme: row + menu follow the navbar/background toggle */
#main-nav.nav-light .piece-switch-toggle { background: var(--gp-ivory); color: var(--gp-black); }
#main-nav.nav-light .piece-switch-toggle:hover { background: #e9e2d2; }
#main-nav.nav-light .piece-switch-dd.show .piece-switch-toggle { background: var(--gp-ivory); }
#main-nav.nav-light .piece-switch-menu {
  background: var(--gp-ivory);
  border-color: rgba(0, 0, 0, .12);
}
#main-nav.nav-light .piece-switch-menu .dropdown-item {
  color: var(--gp-black) !important;   /* beat .nav-light .navbar-center a !important */
}
#main-nav.nav-light .piece-switch-menu li::before {
  background: rgba(0, 0, 0, .10);
  box-shadow: 0 1px 1px rgba(255, 255, 255, .8);
}
#main-nav.nav-light .piece-switch-menu .dropdown-item:hover,
#main-nav.nav-light .piece-switch-menu .dropdown-item:focus {
  background: #e9e2d2;
  color: var(--gp-black);
}
.piece-switch-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--gp-charcoal);
  flex-shrink: 0;
  display: inline-block;
}
/* First entry = the current piece: a pencil tile (edit) in place of a thumbnail */
.piece-switch-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--gp-ivory);
  background: var(--gp-charcoal);
}
.piece-switch-toggle:hover .piece-switch-edit { color: #fff; }
#main-nav.nav-light .piece-switch-toggle:hover .piece-switch-edit { color: var(--gp-black); }
#main-nav.nav-light .piece-switch-edit { background: #e0d8c6; color: var(--gp-black); }

/* ── Performance-page footer ──────────────────────────────── */
/* Shown only in performance mode. A grayscale, blurred piano photo sits behind
   classic About / Terms / Contact columns so it sets a mood without grabbing
   the eye. */
.perf-footer { display: none; }
/* In perf mode the content wrapper becomes a column that fills the area below
   the fixed navbar, so the footer can grow into all the empty space. */
body.performance-mode #page-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 68px);
}
body.performance-mode .perf-footer {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;                /* absorb the leftover height */
  position: relative;
  overflow: hidden;
  color: var(--gp-ivory);
  background: var(--gp-black);   /* fallback while the photo loads */
}
/* Push the © bar to the very bottom; the photo fills the gap above it. */
body.performance-mode .perf-footer-base { margin-top: auto; }
.perf-footer-bg {
  position: absolute;
  inset: -16px;                  /* extend past the edges so blur shows no seam */
  background: url("../footer-piano.jpg") center / cover no-repeat;
  filter: grayscale(1) blur(4px) brightness(.45);
  z-index: 0;
}
.perf-footer-inner {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding: 3rem 2rem 1.5rem;
}
.perf-footer-col h5 {
  color: var(--gp-gold);
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: .9rem;
}
.perf-footer-col p  { font-size: .9rem; line-height: 1.5; opacity: .85; margin: 0; }
.perf-footer-col ul { list-style: none; padding: 0; margin: 0; }
.perf-footer-col li { margin-bottom: .5rem; }
.perf-footer-col a  { color: var(--gp-ivory); text-decoration: none; opacity: .85; }
.perf-footer-col a:hover { color: var(--gp-gold); opacity: 1; }
.perf-footer-base {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem;
  font-size: .8rem;
  opacity: .7;
  border-top: 1px solid rgba(246, 242, 232, .15);
}
@media (max-width: 600px) {
  .perf-footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* ── Repertoire listing cards ─────────────────────────────── */
.piece-card {
  border: 1px solid rgba(132, 98, 74, .18);   /* faint walnut hairline */
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: transform .15s, box-shadow .15s;
}
.piece-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(16, 16, 16, .14) !important;
}
/* Whole-card click target (open, add-to-library, log in, …). */
.card-cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
/* A catalog piece already in the library: shown but not clickable. */
.piece-card.in-library { opacity: .72; }
.piece-card.in-library:hover { opacity: 1; }   /* un-grey on hover — it's clickable (opens the piece) */
/* Glow the card just added to the library — an outline ring that fades.
   (outline isn't clipped by the card's overflow:hidden, and isn't overridden
   by Bootstrap's .shadow-sm !important box-shadow the way box-shadow would be.) */
@keyframes card-added { to { outline-color: transparent; } }
.piece-card.just-added {
  outline: 3px solid var(--gp-gold);
  outline-offset: 3px;
  animation: card-added 1.8s ease-out forwards;
}
.piece-card .card-img-top {
  height: 150px;
  object-fit: cover;
}
.piece-card .card-body { padding: 1rem; }
.piece-card .card-title { color: var(--gp-black); }
.piece-card .piece-creator { color: var(--gp-walnut); font-style: italic; }
.piece-card .piece-date { color: var(--gp-walnut); }

/* YouTube link beside the title — sits above the card's stretched-link */
.piece-yt {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  line-height: 0;
  opacity: .85;
  transition: opacity .15s, transform .15s;
}
.piece-yt:hover { opacity: 1; transform: scale(1.1); }
.piece-yt img { width: 22px; height: 22px; display: block; }

/* Edit (pencil) link beside the YouTube icon */
.piece-edit {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  line-height: 0;
  color: var(--gp-walnut);
  opacity: .85;
  transition: opacity .15s, transform .15s;
}
.piece-edit:hover { opacity: 1; transform: scale(1.1); }
.piece-edit svg { width: 20px; height: 20px; display: block; }

.badge-score {
  background: var(--gp-gold);
  color: var(--gp-black);
}
.badge-empty {
  background: transparent;
  color: var(--gp-walnut);
  border: 1px solid rgba(132, 98, 74, .4);
}

/* Delete button: walnut by default, danger-red on hover. z-index beats the
   card's stretched-link so it stays clickable. */
.piece-delete-btn {
  z-index: 2;
  padding: 2px 6px;
  line-height: 1;
  color: rgba(255, 255, 255, .85);
  background: rgba(53, 53, 53, .45);   /* --gp-charcoal at 45% */
  border: none;
}
.piece-delete-btn:hover {
  color: #fff;
  background: rgba(220, 53, 69, .85);
}

/* Practice page: why each exercise matters for this piece */
.practice-usage { color: var(--gp-walnut); }
