@import "tokens.css";

:root {
  /* Match WPF WidgetPillBar / Styles.xaml */
  --pill: #161a22;
  --pill-border: #2a3140;
  --pill-art: #1a1d21;
  --pill-text: #f1f5f9;
  --pill-artist: #94a3b8;
  --pill-btn: #ffffff;
  --pill-icon: #0a0a0a;
  --pill-blue: #3b82f6;
  --scale: 1.24;
  --max-w: 1280px;
  --pill-hover-expand: calc(30px * var(--scale));
  --pill-hover-half: calc(15px * var(--scale));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-size: 17.5px;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}

.hero-viewport {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.shell-panel {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(22px, 4vw, 48px) 86px;
  display: flex;
  align-items: center;
}

.hero-full,
.hero-inner {
  width: 100%;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(500px, 1fr);
  gap: clamp(44px, 7vw, 96px);
  align-items: center;
}

.hero-left {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.chapter-rail {
  display: flex;
  justify-content: center;
}

.chapter-rail-inner {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.chapter-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d9d9d9;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chapter-dot:hover,
.chapter-dot.is-active {
  background: var(--text);
}

.chapter-dot.is-active {
  transform: scale(1.25);
}

.chapter-dot:focus-visible,
.btn:focus-visible,
.desktop-hide-tab:focus-visible,
.beats-pill:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.hero-stages {
  position: relative;
  min-height: 420px;
}

.hero-stage {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-50% + 14px));
  transition: opacity 0.36s var(--ease-out), transform 0.36s var(--ease-out);
}

.hero-stage.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%);
}

.hero-copy {
  align-items: flex-start;
  text-align: left;
}

h1 {
  margin: 0 0 18px;
  color: var(--text);
  font-family: var(--font-brand);
  font-size: clamp(5rem, 12vw, 9.25rem);
  font-weight: 700;
  letter-spacing: -0.095em;
  line-height: 0.82;
}

.lead {
  max-width: 36rem;
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: clamp(1.0625rem, 1.65vw, 1.2rem);
  line-height: 1.7;
}

.cta-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
}

.btn {
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--border-strong);
  font-size: 0.9375rem;
  font-weight: 700;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.btn-primary:hover {
  background: #2a2a2a;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--text);
  background: var(--surface);
}

.meta {
  color: var(--text-faint);
  font-size: 0.8125rem;
}

.info-section,
.download-section {
  width: 100%;
  max-width: 600px;
}

.features-heading {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(2.125rem, 4.4vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 1;
}

.section-subtitle,
.download-lead {
  max-width: 36rem;
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.7;
}

.info-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.feature-card {
  min-height: 124px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.feature-card:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.feature-icon,
.download-badge svg {
  display: none;
}

.info-name {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.info-desc {
  display: block;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.download-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.download-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.desktop-sim {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: #111;
  box-shadow: var(--shadow-lg);
}

.desktop-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  flex-shrink: 0;
}

.desktop-wallpaper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.desktop-hide-tab {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 4;
  width: calc(40px * var(--scale));
  height: calc(14px * var(--scale));
  padding: 0;
  transform: translateX(-50%);
  border: 1px solid var(--pill-border);
  border-top: none;
  border-radius: 0 0 calc(8px * var(--scale)) calc(8px * var(--scale));
  background: var(--pill);
  color: var(--pill-blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-hide-tab svg {
  width: calc(10px * var(--scale));
  height: calc(10px * var(--scale));
  fill: currentColor;
  transition: transform 0.22s ease;
}

.desktop-hide-tab.is-widget-hidden svg { transform: rotate(180deg); }

.desktop-widget-wrap {
  position: absolute;
  left: 50%;
  top: 42%;
  width: fit-content;
  max-width: calc(100% - 24px);
  transform: translate(-50%, -50%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.desktop-widget-wrap.is-positioned { transform: none; }

.desktop-widget-wrap.is-pill-expanded {
  transform: translate(calc(-50% - var(--pill-hover-half)), -50%);
}

.desktop-widget-wrap.is-positioned.is-pill-expanded {
  transform: translateX(calc(-1 * var(--pill-hover-half)));
}

.desktop-widget-wrap.is-animating {
  transition:
    left 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    top 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease;
}

.desktop-widget-wrap.is-animating.is-pill-expanded,
.desktop-widget-wrap.is-animating:not(.is-positioned) {
  transition:
    left 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    top 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s ease,
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.desktop-widget-wrap.is-hidden { opacity: 0; pointer-events: none; }

.desktop-widget-wrap.is-dragging {
  z-index: 2;
  transition: none !important;
}

.desktop-taskbar-wrap {
  width: 100%;
  flex-shrink: 0;
  line-height: 0;
}

.desktop-taskbar {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.widget-tips {
  width: 100%;
}

.widget-tips-title {
  display: none;
}

.widget-tips-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.widget-tip-card {
  min-height: 64px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.widget-tip-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.widget-tips kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 700;
}

.widget-tip-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 8px;
  margin: 0 2px;
  vertical-align: middle;
  border: 1px solid var(--pill-border);
  border-top: none;
  border-radius: 0 0 5px 5px;
  background: var(--pill);
  color: var(--pill-blue);
}

.widget-tip-tab svg {
  width: 7px;
  height: 7px;
  fill: currentColor;
}

.beats-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  padding: calc(8px * var(--scale)) calc(10px * var(--scale)) calc(8px * var(--scale)) calc(8px * var(--scale));
  border: 1px solid var(--pill-border);
  border-radius: calc(14px * var(--scale));
  background: var(--pill);
  cursor: default;
  user-select: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.12));
  transition: filter 0.25s ease;
}

.beats-pill:hover,
.beats-pill:focus-within,
.beats-pill.is-expanded {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.22)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.14));
}

.pill-hover-controls {
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--scale));
  width: 0;
  min-width: 0;
  margin-right: 0;
  overflow: hidden;
  opacity: 0;
  flex-shrink: 0;
  transition:
    width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease,
    margin-right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.beats-pill:hover .pill-hover-controls,
.beats-pill:focus-within .pill-hover-controls,
.beats-pill.is-expanded .pill-hover-controls {
  width: calc(24px * var(--scale));
  margin-right: calc(6px * var(--scale));
  opacity: 1;
}

.pill-core {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pill-art {
  width: calc(48px * var(--scale));
  height: calc(48px * var(--scale));
  padding: calc(3px * var(--scale));
  margin-right: calc(10px * var(--scale));
  overflow: hidden;
  border-radius: calc(8px * var(--scale));
  background: var(--pill-art);
  box-sizing: border-box;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
}

.pill-art.is-dragging { cursor: grabbing; }

.pill-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: calc(5px * var(--scale));
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.pill-info {
  width: calc(112px * var(--scale));
  flex: 0 0 calc(112px * var(--scale));
  margin-right: calc(10px * var(--scale));
  overflow: hidden;
}

.pill-title,
.pill-artist {
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.pill-info.is-changing .pill-title,
.pill-info.is-changing .pill-artist {
  opacity: 0;
}

.pill-title {
  color: var(--pill-text);
  font-size: calc(12.5px * var(--scale));
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-artist {
  margin-top: 2px;
  color: var(--pill-artist);
  font-size: calc(10.5px * var(--scale));
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--pill-btn);
  color: var(--pill-icon);
  flex-shrink: 0;
  pointer-events: none;
}

.pill-controls .ctrl,
.beats-pill.is-expanded .pill-hover-controls .ctrl,
.beats-pill:hover .pill-hover-controls .ctrl,
.beats-pill:focus-within .pill-hover-controls .ctrl {
  pointer-events: auto;
  cursor: pointer;
}

.ctrl-loop.is-active {
  background: var(--pill-icon);
}

.ctrl-loop.is-active img {
  filter: brightness(0) invert(1);
}

.ctrl:hover { filter: brightness(0.96); }
.ctrl:active { transform: scale(0.96); }

.ctrl-util { width: calc(24px * var(--scale)); height: calc(24px * var(--scale)); }
.ctrl-sm { width: calc(26px * var(--scale)); height: calc(26px * var(--scale)); }
.ctrl-lg { width: calc(40px * var(--scale)); height: calc(40px * var(--scale)); margin: 0 calc(6px * var(--scale)); }

.ctrl svg { display: block; fill: currentColor; }
.ctrl-util svg { width: calc(12px * var(--scale)); height: calc(12px * var(--scale)); }
.ctrl-sm svg { width: calc(12px * var(--scale)); height: calc(12px * var(--scale)); }
.ctrl-lg svg { width: calc(24px * var(--scale)); height: calc(24px * var(--scale)); }

.ctrl-loop img {
  width: calc(12px * var(--scale));
  height: calc(12px * var(--scale));
  display: block;
  object-fit: contain;
}

.panel-footer {
  position: absolute;
  inset: auto 0 0;
  padding: 18px clamp(22px, 4vw, 48px);
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-faint);
  font-size: 0.75rem;
}

.footer-brand {
  color: var(--text);
  font-weight: 700;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-nav a {
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--text);
}

.footer-copy {
  color: var(--text-faint);
}

@media (max-width: 1040px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  .hero-viewport {
    min-height: 0;
    overflow: visible;
  }

  .shell-panel {
    padding-bottom: 42px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .hero-left {
    display: block;
  }

  .chapter-rail {
    display: none;
  }

  .hero-stages {
    min-height: 0;
  }

  .hero-stage,
  .hero-stage.is-active {
    position: static;
    display: block;
    margin-bottom: 52px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .hero-stage:last-child {
    margin-bottom: 0;
  }

  .preview {
    max-width: 760px;
    margin: 0 auto;
  }

  .panel-footer {
    position: static;
  }
}

@media (max-width: 720px) {
  :root {
    /* Slightly reduce scale on small screens for comfort. */
    --scale: 1.1;
  }

  .shell-panel {
    padding: 34px 18px 36px;
  }

  h1 {
    font-size: clamp(4.5rem, 24vw, 6.5rem);
  }

  .info-list,
  .widget-tips-list {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
