/**
 * Melofy Layout Architecture
 */

/* ==========================================================================
   Loud Top Bar
   ========================================================================== */
.bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--bar);
  z-index: 100;
  background: var(--primary);
  color: var(--background);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 32px);
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line-light);
  backdrop-filter: blur(8px);
}

.bar .mark {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--background);
  flex-shrink: 0;
}

.bar .mark img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: block;
}

.bar .mark i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--secondary);
  box-shadow: inset 0 0 0 4px var(--primary), 0 0 0 2px var(--secondary);
}

.bar-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.bar-nav a {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--secondary-light);
  position: relative;
  padding: 4px 0;
}

.bar-nav a:hover,
.bar-nav a[aria-current="page"] {
  color: var(--background);
}

.bar-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--secondary);
}

/* Marquee in Bar */
.marq {
  flex: 1;
  max-width: 440px;
  overflow: hidden;
  white-space: nowrap;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marq-inner {
  display: inline-block;
  animation: barMarquee 26s linear infinite;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--secondary);
}

.marq-inner span {
  margin-right: 2.2rem;
}

@keyframes barMarquee {
  to { transform: translateX(-50%); }
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

/* Theme Toggle Button */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-light);
  color: var(--secondary);
  display: grid;
  place-items: center;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.theme-toggle:hover {
  background: rgba(242, 244, 241, 0.12);
  color: var(--background);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Mobile Nav Toggle */
.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  color: var(--background);
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Signature Stem Rail (Fixed Bottom Bar & Track Progress)
   ========================================================================== */
.rail {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--rail);
  z-index: 100;
  background: var(--text);
  color: var(--background);
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(23, 24, 22, 0.12);
}

.rail ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex: 1;
  min-width: 0;
}

.rail li {
  flex: 1;
  min-width: 0;
  position: relative;
}

.rail a {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0 0.75rem 0.45rem;
  text-decoration: none;
  font-family: var(--f-text);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9aa394;
  border-left: 1px solid rgba(242, 244, 241, 0.12);
  overflow: hidden;
  transition: color 0.3s, background 0.3s;
}

.rail a::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--secondary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}

.rail a .lv {
  position: absolute;
  top: 9px;
  left: 0.75rem;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
}

.rail a .lv b {
  width: 3px;
  height: 100%;
  background: currentColor;
  transform-origin: bottom;
  transform: scaleY(0.2);
  border-radius: 1px;
  transition: transform 0.1s linear;
}

.rail li.on a {
  color: var(--secondary);
  background: rgba(173, 197, 160, 0.08);
}

.rail li.on a::before {
  transform: scaleX(1);
}

.rail li.now a {
  color: #ffffff;
  background: rgba(173, 197, 160, 0.16);
}

/* Sound Switch & Master Level */
.rail-controls {
  display: flex;
  align-items: center;
  background: var(--accent);
  color: var(--text);
  padding: 0 1rem;
  gap: 0.8rem;
  flex-shrink: 0;
}

.snd-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 0;
  color: var(--text);
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  height: 100%;
}

.snd-btn .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text);
  display: inline-block;
  transition: transform 0.2s;
}

.snd-btn[aria-pressed="true"] .dot {
  animation: soundPulse 1.2s infinite ease-in-out;
  background: #ffffff;
}

@keyframes soundPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.6; }
}

.rail-volume {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rail-volume input[type="range"] {
  width: 70px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   Section Cuts (Rhythmic Hard-Cuts)
   ========================================================================== */
.cut {
  position: relative;
  padding: clamp(64px, 8vw, 130px) var(--gutter);
  overflow: hidden;
}

.cut-lead {
  text-align: left;
}

.cut-center {
  text-align: center;
  margin-inline: auto;
}

.cut-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: #171816;
  color: #f2f4f1;
  padding: clamp(60px, 8vw, 110px) var(--gutter) calc(var(--rail) + 40px);
  border-top: 2px solid var(--primary);
}

[data-theme="dark"] .site-footer {
  background: #10120f;
  color: #f2f4f1;
  border-top: 2px solid var(--secondary);
}

.footer-grid {
  max-width: var(--max-w);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: clamp(32px, 5vw, 64px);
}

.footer-brand .mark {
  font-family: var(--f-display);
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #f2f4f1;
  text-decoration: none;
}

.footer-brand .mark img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: block;
}

.footer-brand .mark i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--secondary);
}

.footer-brand p {
  margin-top: 1rem;
  font-size: var(--step--1);
  color: #cde0c2;
  line-height: 1.6;
}

.footer-col h4 {
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 1.2rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-col a {
  text-decoration: none;
  color: #dbe5d6;
  font-size: var(--step--1);
}
.footer-col a:hover {
  color: #ffffff;
}

.footer-bottom {
  max-width: var(--max-w);
  margin: 3.5rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(242, 244, 241, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: var(--step--2);
  color: #c4cdc0;
}
.footer-bottom a {
  color: #dbe5d6;
  text-decoration: none;
}
.footer-bottom a:hover {
  color: #ffffff;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .marq { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root {
    --bar: 56px;
    --rail: 56px;
    --gutter: 1.25rem;
  }
  
  .bar {
    padding: 0 1rem;
    gap: 0.5rem;
  }
  
  .cut-split {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  
  /* Mobile Navigation Drawer */
  .bar-nav {
    display: none;
    position: fixed;
    top: var(--bar);
    left: 0;
    right: 0;
    background: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding: 1.25rem 1.25rem 1.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    z-index: 1000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  }
  
  .bar-nav.is-open {
    display: flex !important;
    animation: drawerSlide 0.22s var(--ease);
  }
  
  .bar-nav a {
    font-size: 1.15rem;
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid rgba(242, 244, 241, 0.12);
    color: var(--background);
    display: block;
  }
  
  .bar-nav a[aria-current="page"] {
    color: var(--secondary);
    font-weight: 800;
  }
  
  .bar-nav a[aria-current="page"]::after {
    display: none;
  }
  
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--background);
    cursor: pointer;
    border-radius: 8px;
    padding: 8px;
    transition: background 0.2s;
  }
  
  .menu-toggle:hover {
    background: rgba(242, 244, 241, 0.12);
  }
  
  /* Stem Rail on Mobile */
  .rail {
    height: calc(var(--rail) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  
  .rail ol {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  
  .rail ol::-webkit-scrollbar {
    display: none;
  }
  
  .rail li {
    min-width: 38px;
    flex: 1;
  }
  
  .rail a {
    font-size: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .rail a .lv {
    position: static;
    transform: none;
    height: 16px;
    gap: 2px;
  }
  
  .rail a .lv b {
    width: 3px;
  }
  
  .rail-controls {
    flex-shrink: 0;
    padding: 0 0.75rem;
  }
  
  .snd-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
  }
  
  .rail-volume {
    display: none;
  }
  
  /* Footer on Mobile */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }
  
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
  }
}

@keyframes drawerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  .bar-actions .btn--light {
    padding: 6px 12px;
    font-size: 0.78rem;
  }
  .bar .mark span {
    font-size: 1.35rem;
  }
}

