/* ============================================
   Suno til Obsidian – HugByte
   Dark, studio-desktop aesthetic
   ============================================ */

@font-face {
  font-family: 'LibreBaskerville';
  src: url('/fonts/LibreBaskerville-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LibreBaskerville';
  src: url('/fonts/LibreBaskerville-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SourceSerif4';
  src: url('/fonts/SourceSerif4-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'SourceSerif4';
  src: url('/fonts/SourceSerif4-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
:root {
  --bg: #120e0d;
  --bg-raised: #1a1513;
  --surface: #201a17;
  --surface-alt: #2a2220;
  --border: #3a2f2b;
  --border-soft: #2c2320;
  --text: #f6efe8;
  --text-muted: #c9bab0;
  --text-faint: #9a8c83;
  --accent-orange: #ff6a3d;
  --accent-pink: #ff3d81;
  --accent-gradient: linear-gradient(135deg, #ff6a3d 0%, #ff3d81 100%);
  --focus-ring: #ffd166;
  --danger: #ff8a65;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'SourceSerif4', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg { display: block; }
ul { list-style: none; }
h1, h2, h3 { font-family: 'LibreBaskerville', Georgia, serif; letter-spacing: -0.01em; }

/* ---- Focus states (never remove) ---- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--focus-ring);
  color: #1a1513;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- App shell ---- */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.app-sidebar {
  grid-row: 1 / 2;
  grid-column: 1 / 2;
  background: var(--bg-raised);
  border-right: 1px solid var(--border-soft);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  min-height: 44px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-family: 'LibreBaskerville', Georgia, serif;
  font-weight: 700;
  font-size: 0.9rem;
}
.brand-name {
  font-family: 'LibreBaskerville', Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.sidebar-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sidebar-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-tab:hover {
  background: var(--surface);
  color: var(--text);
}
.sidebar-tab[aria-selected="true"] {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent-orange);
}
.tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.promo-card {
  margin-top: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.promo-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a1513;
  background: var(--focus-ring);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.promo-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.promo-card strong { color: var(--text); }
.promo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-gradient);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  min-height: 44px;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.promo-link:hover { filter: brightness(1.08); transform: translateY(-1px); }
.promo-link svg { width: 14px; height: 14px; }

.sidebar-back {
  font-size: 0.85rem;
  color: var(--text-faint);
  padding: 0.5rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: color 0.15s ease;
}
.sidebar-back:hover { color: var(--text); }

/* ---- Workbench ---- */
.workbench {
  grid-row: 1 / 2;
  grid-column: 2 / 3;
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 3rem;
  max-width: 900px;
}
.panel-header {
  margin-bottom: 2rem;
}
.eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-orange);
  margin-bottom: 0.6rem;
}
.panel-header h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
  margin-bottom: 0.9rem;
}
.tldr {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 62ch;
  line-height: 1.65;
}

.panel h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
.panel h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.panel p {
  color: var(--text-muted);
  max-width: 68ch;
  margin-bottom: 0.5rem;
}
.panel-intro {
  font-size: 1.02rem;
  margin-bottom: 0.5rem;
}
.panel-intro strong { color: var(--text); }
.panel a {
  color: var(--accent-orange);
  text-decoration: underline;
  text-decoration-color: rgba(255, 106, 61, 0.4);
}
.panel a:hover { text-decoration-color: currentColor; }
.panel-note {
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.privacy-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}
.privacy-list li {
  color: var(--text-muted);
  padding-left: 1.4rem;
  position: relative;
}
.privacy-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent-orange);
  font-weight: 700;
}

/* ---- Form ---- */
.field-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
}
.field-group legend {
  font-family: 'LibreBaskerville', Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  padding: 0 0.5rem;
  color: var(--text);
}
.field {
  margin-top: 1.1rem;
}
.field:first-of-type { margin-top: 0.25rem; }
.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.req { color: var(--accent-orange); }
.optional {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 0.82rem;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.8rem;
  background: var(--bg-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}
.field textarea {
  min-height: unset;
  resize: vertical;
  line-height: 1.55;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--text-faint);
}
.field--number input {
  max-width: 10rem;
}
.field-error {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--danger);
  font-weight: 600;
}
input[aria-invalid="true"] {
  border-color: var(--danger);
}

/* ---- Preview ---- */
.preview-block {
  margin-bottom: 1.5rem;
}
.preview-block summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}
.preview-block[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.preview-pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  max-height: 22rem;
  overflow-y: auto;
}
.preview-pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Form actions ---- */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
}
.compat-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.privacy-note {
  font-size: 0.85rem;
  color: var(--text-faint);
}
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.85rem 1.4rem;
  border: none;
  border-radius: 999px;
  background: var(--accent-gradient);
  color: #fff;
  font-family: 'LibreBaskerville', Georgia, serif;
  font-weight: 700;
  font-size: 0.98rem;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.btn-download svg { width: 18px; height: 18px; }
.btn-download:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-download:active { transform: translateY(0); }
.form-status {
  font-size: 0.88rem;
  color: var(--accent-orange);
  font-weight: 600;
  min-height: 1.2em;
}

/* ---- Player bar ---- */
.player-bar {
  grid-row: 2 / 3;
  grid-column: 1 / 3;
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border-top: 1px solid var(--border-soft);
  min-height: 60px;
}

/* Thin, full-width scrubber sitting flush on the bar's top edge. */
.player-seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 0;
  background: var(--border-soft);
  accent-color: var(--accent-orange);
  cursor: pointer;
}
.player-seek:disabled {
  cursor: default;
  opacity: 0.6;
}
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-orange);
  border: 2px solid var(--bg-raised);
  margin-top: -4px;
}
.player-seek::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-orange);
  border: 2px solid var(--bg-raised);
}
.player-seek::-moz-range-track {
  height: 4px;
  background: var(--border-soft);
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.25rem;
}

.player-now {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.player-note {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  color: #fff;
  font-size: 1rem;
  transition: box-shadow 0.3s ease;
}
.player-bar.is-playing .player-note {
  animation: player-pulse 1.8s ease-in-out infinite;
}
@keyframes player-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 106, 61, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(255, 106, 61, 0); }
}
.player-now__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.player-now__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.player-now__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 34vw;
}

.player-transport {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.transport-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.transport-btn svg {
  width: 19px;
  height: 19px;
}
.transport-btn:hover:not(:disabled) {
  background: var(--surface-alt);
  color: var(--text);
}
.transport-btn:active:not(:disabled) {
  transform: scale(0.94);
}
.transport-btn:disabled {
  color: var(--text-faint);
  opacity: 0.4;
  cursor: not-allowed;
}
.transport-btn--main {
  width: 48px;
  height: 48px;
  color: var(--text);
  background: var(--surface-alt);
}
.transport-btn--main svg {
  width: 21px;
  height: 21px;
}
.transport-btn--main:hover:not(:disabled) {
  background: var(--accent-gradient);
  color: #fff;
}
.transport-btn--main:disabled {
  background: transparent;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  min-width: 0;
}
.player-time {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.player-mute svg {
  width: 17px;
  height: 17px;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .app-sidebar {
    grid-row: 1 / 2;
    grid-column: 1 / 2;
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    padding: 1rem;
  }
  .sidebar-tabs {
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar-tab {
    flex-shrink: 0;
  }
  .sidebar-tab[aria-selected="true"] {
    box-shadow: inset 0 -3px 0 var(--accent-orange);
  }
  .promo-card { margin-top: 0; }
  .workbench {
    grid-row: 2 / 3;
    grid-column: 1 / 2;
    padding: 1.75rem 1.25rem 2rem;
  }
  .player-bar {
    grid-row: 3 / 4;
    grid-column: 1 / 2;
  }
  .player-now__title { max-width: 30vw; }
}

@media (max-width: 560px) {
  .player-row { gap: 0.5rem; padding: 0.5rem 0.85rem; }
  .player-now__label { display: none; }
  .player-now__title { max-width: 26vw; }
  .player-time { display: none; }
  .field-group { padding: 1.1rem; }
}

/* ---- Print ---- */
@media print {
  .app-sidebar, .player-bar { display: none; }
  .app-shell { display: block; }
}
