/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0d14;
  --surface:    #16161f;
  --surface-2:  #1e1e2c;
  --border:     #262636;
  --text:       #e2e2ee;
  --text-muted: #7878a0;
  --accent:     #9d7cf4;
  --accent-dim: #6b54a8;
  --radius:     12px;
  --font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ─── Site Header ──────────────────────────────────────────────────────────── */

.site-header {
  padding: 2.5rem 0 1.75rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.brand-icon {
  font-size: 1.9rem;
  line-height: 1;
  color: var(--accent);
}

.brand-name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ─── Main Content ─────────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

/* ─── App Card Grid ────────────────────────────────────────────────────────── */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  gap: 1.5rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.app-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.app-card-icon {
  padding: 2.25rem;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Decorative circle-of-fifths preview using conic-gradient */
.cof-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  position: relative;
  background: conic-gradient(
    hsl(  0, 58%, 42%) 0deg   30deg,
    hsl( 30, 58%, 42%) 30deg  60deg,
    hsl( 60, 58%, 42%) 60deg  90deg,
    hsl( 90, 58%, 42%) 90deg  120deg,
    hsl(120, 58%, 42%) 120deg 150deg,
    hsl(150, 58%, 42%) 150deg 180deg,
    hsl(180, 58%, 42%) 180deg 210deg,
    hsl(210, 58%, 42%) 210deg 240deg,
    hsl(240, 58%, 42%) 240deg 270deg,
    hsl(270, 58%, 42%) 270deg 300deg,
    hsl(300, 58%, 42%) 300deg 330deg,
    hsl(330, 58%, 42%) 330deg 360deg
  );
}

.cof-preview::after {
  content: '';
  position: absolute;
  inset: 26%;
  background: var(--surface-2);
  border-radius: 50%;
}

/* Decorative progression preview for chord-progression card */
.prog-preview {
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.pp-slot {
  background: hsl(var(--hue), 48%, 28%);
  border: 1px solid hsl(var(--hue), 50%, 40%);
  border-radius: 8px;
  width: 44px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
}

/* Decorative mini piano preview for chord-builder card */
.chord-preview {
  width: 120px;
  height: 72px;
  background: #1a1a22;
  border-radius: 6px;
  padding: 6px 8px 0;
  overflow: hidden;
}

.cp-keys {
  display: flex;
  height: 100%;
  position: relative;
  gap: 2px;
}

.cp-key {
  flex: 1;
  border-radius: 0 0 3px 3px;
}

.cp-white {
  background: #d8d8e8;
  height: 100%;
}

.cp-white.cp-lit {
  background: var(--accent);
}

.cp-black {
  flex: 0 0 10px;
  height: 60%;
  background: #111118;
  margin-top: 0;
  align-self: flex-start;
  border-radius: 0 0 2px 2px;
}

.cp-black.cp-lit {
  background: var(--accent-dim);
}

/* Decorative lead-sheet preview for progression-sheet card */
.sheet-preview {
  width: 132px;
  height: 78px;
  background: linear-gradient(180deg, #f8f2df 0%, #eee4ca 100%);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(60, 45, 22, 0.12);
}

.sheet-staff,
.sheet-staff::before,
.sheet-staff::after {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 1px;
  background: rgba(63, 49, 24, 0.42);
  content: '';
}

.sheet-staff {
  top: 38px;
  box-shadow:
    0 -8px 0 rgba(63, 49, 24, 0.42),
    0 8px 0 rgba(63, 49, 24, 0.42),
    0 -16px 0 rgba(63, 49, 24, 0.42),
    0 16px 0 rgba(63, 49, 24, 0.42);
}

.sheet-bar {
  position: absolute;
  top: 10px;
  width: 30px;
  height: 52px;
  border-right: 1px solid rgba(63, 49, 24, 0.42);
}

.sheet-bar span {
  position: absolute;
  top: 0;
  left: 3px;
  font-size: 0.5rem;
  font-weight: 700;
  color: #3a2f18;
}

.sheet-bar-1 { left: 14px; }
.sheet-bar-2 { left: 44px; }
.sheet-bar-3 { left: 74px; }
.sheet-bar-4 { left: 104px; }

.app-card-content {
  padding: 1.4rem 1.5rem 1rem;
  flex: 1;
}

.app-card-content h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.app-card-content p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.app-card-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--accent);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
}

/* ─── App Page Header ──────────────────────────────────────────────────────── */

.app-header {
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
}

.app-nav a {
  color: var(--accent);
  text-decoration: none;
}

.app-nav a:hover { text-decoration: underline; }

.app-nav .sep { color: var(--border); }

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.app-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.2rem;
}

/* ─── Site Footer ──────────────────────────────────────────────────────────── */

.site-footer {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.825rem;
  color: var(--text-muted);
}
