/* Songs v3: search, reading and login pages. Mobile first. */

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #5f6368;
  --line: #dcdcd7;
  --accent: #940d0d;
  --accent-text: #ffffff;
  --focus: #1a73e8;
  --error: #b3261e;
  --translation: #3c5a99;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --surface: #1e1e1e;
    --text: #ececec;
    --muted: #a5a5a5;
    --line: #333333;
    --accent: #e06666;
    --accent-text: #141414;
    --focus: #8ab4f8;
    --error: #f28b82;
    --translation: #9fb7e8;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

button, input, select { font: inherit; color: inherit; }

input[type="text"], input[type="password"], input[type="search"], select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

button {
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}

button.link {
  background: none;
  color: var(--accent);
  padding: 8px;
  font-weight: 500;
}

button:disabled { opacity: 0.6; cursor: default; }

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

/* Header */

#top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

#top:empty { display: none; }

#top .brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

#top .who { margin-left: auto; color: var(--muted); font-size: 15px; }

main { padding: 16px; max-width: 1200px; margin: 0 auto; }

.error { color: var(--error); font-weight: 600; }
.status, .meta, .back { color: var(--muted); }
.notice { padding: 8px 12px; border-left: 4px solid var(--error); background: var(--surface); }

/* Login */

form.login {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  margin: 10vh auto 0;
}

form.login button { margin-top: 12px; }

/* Search: one column on phones, list and song side by side from 720px */

form.search { display: flex; flex-wrap: wrap; gap: 8px; }
form.search input { flex: 1 1 14rem; }
form.search select { flex: 0 1 11rem; }

.results { list-style: none; margin: 0; padding: 0; }
.results li { border-bottom: 1px solid var(--line); }

.result {
  display: block;
  min-height: 44px;
  padding: 10px 4px;
  text-decoration: none;
  color: inherit;
}

.result .title { font-weight: 600; color: var(--accent); }
.result .lang { margin-left: 8px; color: var(--muted); font-size: 14px; }
.result .snippet { display: block; color: var(--muted); font-size: 15px; }

.song-pane { display: none; }

@media (min-width: 720px) {
  .search-layout {
    display: grid;
    grid-template-columns: minmax(16rem, 2fr) 3fr;
    gap: 24px;
    align-items: start;
  }
  .song-pane:not([hidden]) {
    display: block;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 0 16px;
    border-left: 1px solid var(--line);
  }
}

/* Reading a song */

.song h1 { margin: 8px 0 0; font-size: 26px; line-height: 1.25; }
.song .meta { margin: 4px 0 12px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}

.toggle input { width: 22px; height: 22px; }

.stanza { margin: 16px 0; }
.stanza .label {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stanza .lyrics, .stanza .translation { margin: 2px 0 0; white-space: pre-line; }
.stanza .translation { color: var(--translation); font-style: italic; }
