/* Puttesange, moderne app-udtryk med light/dark via prefers-color-scheme + manuel vælger */

:root {
  color-scheme: light;

  /* Typografisk skala: alt spacing er multipla af linjehøjden (rytme) */
  --font-size: 1.125rem;      /* 18px brødtekst */
  --line-height: 1.6;         /* grundlinje: 28.8px */
  --rhythm: calc(var(--font-size) * var(--line-height));

  /* Palette: mættede, varme neutrals (Refactoring UI / Hobday) */
  --bg: #faf6f1;
  --surface: #ffffff;
  --surface-hover: #fdfaf6;
  --text: #2b2620;
  --muted: #7a7062;
  --accent: #9a5b2e;
  --accent-soft: #f3e4d7;
  --border: #eae2d8;
  --shadow: 0 2px 4px rgba(43, 38, 32, 0.06), 0 8px 24px rgba(43, 38, 32, 0.08);
  --header-bg: rgba(250, 246, 241, 0.85);
  --cloud-art-opacity: 0.9;
  --cloud-art-filter: none;
}

/* Mørkt tema: hævede overflader, ingen skygger (Hobday: "no shadows in dark UI") */
:root[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #191613;
    --surface: #221e1a;
    --surface-hover: #282320;
    --text: #ece5da;
    --muted: #a89d8e;
    --accent: #e0a370;
    --accent-soft: #3a2e24;
    --border: #322c26;
    --shadow: none;
    --header-bg: rgba(25, 22, 19, 0.85);
    --cloud-art-opacity: 0.48;
    --cloud-art-filter: brightness(0.52) sepia(0.12);
  }
}

:root[data-theme="dark"] {
  --bg: #191613;
  --surface: #221e1a;
  --surface-hover: #282320;
  --text: #ece5da;
  --muted: #a89d8e;
  --accent: #e0a370;
  --accent-soft: #3a2e24;
  --border: #322c26;
  --shadow: none;
  --header-bg: rgba(25, 22, 19, 0.85);
  --cloud-art-opacity: 0.48;
  --cloud-art-filter: brightness(0.52) sepia(0.12);
}

* {
  box-sizing: border-box;
}

html {
  position: relative;
  min-height: 100%;
  background: var(--bg);
  overflow-x: clip;
  transition: background-color 0.2s ease;
}

body {
  position: relative;
  z-index: 1;
  isolation: isolate;
  min-height: 100vh;
  margin: 0 auto;
  max-width: 48rem;
  padding: calc(var(--rhythm) * 3.5) 1.25rem calc(var(--rhythm) * 3);
  font-family: Charter, Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-size: var(--font-size);
  line-height: var(--line-height);
  background: transparent;
  color: var(--text);
  transition: color 0.2s ease;
}

html::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  z-index: 0;
  width: 100%;
  height: clamp(9rem, 21.75vw, 17.4rem);
  background: url("/assets/cloud-bank.svg") center bottom / 100% auto no-repeat;
  filter: var(--cloud-art-filter);
  opacity: var(--cloud-art-opacity);
  pointer-events: none;
  transform: translateX(-50%);
  transition: filter 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 40rem) {
  html::after {
    background-size: auto 100%;
  }
}

/* Header: sticky med frosted glass, ingen kant */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: calc(var(--rhythm) * -2.5) -1.25rem var(--rhythm);
  padding: 0.75rem 1.25rem;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-title {
  font-size: 1.25rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
}

.tagline {
  display: none;
}

/* Sangliste: kort-grid */
.song-list {
  list-style: none;
  padding: 0;
  margin: calc(var(--rhythm) * 1.5) 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--rhythm);
}

.song-list li {
  margin: 0;
}

.song-list a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  height: 100%;
  padding: calc(var(--rhythm) * 0.75);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.song-list a:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.song-list a::before {
  content: none;
}

.song-icon {
  width: 48px;
  height: 48px;
  opacity: 0.9;
}

.song-list-title {
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--accent);
  line-height: 1.3;
}

.song-list-meta {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Sangside: smal kolonne, ca. 60 tegn, rolig læsning */
.song {
  max-width: 34rem;
}

.song h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 calc(var(--rhythm) * 0.5);
}

.song-meta {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 calc(var(--rhythm) * 2);
  font-size: 0.95rem;
}

/* Strofer adskilt af præcis én grundlinje (lodret rytme) */
.song-text p {
  margin: 0 0 var(--rhythm);
}

.song-text p:last-child {
  margin-bottom: 0;
}

.intro {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 34rem;
}

/* Tema-vælger: pill-knapper */
.theme-picker {
  display: flex;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem;
}

.theme-picker button {
  background: none;
  border: none;
  border-radius: 999px;
  padding: 0.3rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-picker button:hover {
  color: var(--accent);
}

.theme-picker button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Footer: diskret, én linje */
.site-footer {
  margin-top: calc(var(--rhythm) * 2);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--muted);
}

.song-source {
  margin-top: calc(var(--rhythm) * 2);
  font-size: 0.85rem;
  color: var(--muted);
  word-break: break-all;
}

.song-source a {
  color: var(--muted);
}

@media (min-width: 40rem) {
  .tagline {
    display: block;
    margin: 0;
    color: var(--muted);
    font-style: italic;
    font-size: 0.95rem;
  }
}

.more-songs {
  margin-top: calc(var(--rhythm) * 2);
  padding-top: var(--rhythm);
  border-top: 1px solid var(--border);
}

.more-songs h2 {
  font-size: 1.1rem;
  margin: 0 0 calc(var(--rhythm) * 0.5);
  color: var(--muted);
}

.more-songs ul {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--rhythm);
}

.more-songs li {
  padding: 0.25rem 0;
}

.more-songs a {
  color: var(--accent);
  text-decoration: none;
}

.more-songs a:hover {
  text-decoration: underline;
}

.more-songs p {
  margin: 0;
  font-size: 0.9rem;
}

.more-songs p a {
  color: var(--muted);
}
