/* ------------------------------------------------------------------
   GBT-Hyttetur — dark botanical wedding song sheet
   Palette: ink / oxblood / dusty plum / tarnished brass / bone
   ------------------------------------------------------------------ */

:root {
  --ink:        #0b0c10;
  --ink-2:      #101118;
  --panel:      #15161f;
  --panel-soft: rgba(30, 27, 36, 0.55);
  --line:       rgba(232, 225, 214, 0.11);
  --line-warm:  rgba(154, 123, 79, 0.28);

  --oxblood:    #4a1d28;
  --plum:       #6b5566;
  --brass:      #9a7b4f;
  --brass-soft: #b79a6d;
  --sage:       #7d8a7a;

  --bone:       #e6dfd4;
  --bone-2:     #b4ada3;
  --bone-3:     #837c73;

  --display: "Marcellus", "Iowan Old Style", Georgia, serif;
  --lyric:   "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --ui:      "Karla", "Helvetica Neue", Helvetica, sans-serif;

  --lyric-size: 1.32rem;   /* adjusted by the A− / A+ controls */
  --bar-h: 62px;
  --measure: 34rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  /* faint vertical warmth so the page is never a flat black slab */
  background-image:
    radial-gradient(1100px 620px at 82% -8%, rgba(74, 29, 40, 0.42), transparent 62%),
    radial-gradient(760px 520px at 8% 22%, rgba(107, 85, 102, 0.18), transparent 64%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 42%, var(--ink) 100%);
  background-attachment: fixed;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--brass-soft); text-decoration-color: var(--line-warm); text-underline-offset: 3px; }
a:hover { color: var(--bone); }

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

.skip {
  position: fixed;
  top: -100px;
  left: 1rem;
  z-index: 60;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line-warm);
  color: var(--bone);
  font-size: 0.85rem;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip:focus { top: 1rem; }

/* film grain — fixed, non-interactive, never on a scrolling layer */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 40;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  background: rgba(11, 12, 16, 0.72);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-bottom: 1px solid var(--line);
}

.topbar__progress {
  height: 2px;
  background: rgba(232, 225, 214, 0.06);
}
.topbar__progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--oxblood), var(--brass));
  transform-origin: left;
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--bar-h);
  padding: 0 clamp(0.9rem, 3vw, 2.2rem);
  max-width: 1500px;
  margin: 0 auto;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--bone);
  text-decoration: none;
  flex: none;
}
.mark__glyph { color: var(--brass); display: grid; place-items: center; }
.mark__text {
  font-family: var(--display);
  font-size: 1.06rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.songnav {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 18px), transparent);
}
.songnav::-webkit-scrollbar { display: none; }

.songnav ul {
  display: flex;
  gap: 0.3rem;
  margin: 0;
  padding: 0 0.6rem;
  list-style: none;
}

.songnav a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--bone-2);
  font-size: 0.83rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.22s var(--ease), border-color 0.22s var(--ease), background 0.22s var(--ease);
}
.songnav a span {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--bone-3);
  font-variant-numeric: tabular-nums;
}
.songnav a:hover {
  color: var(--bone);
  background: rgba(232, 225, 214, 0.045);
  border-color: var(--line);
}
.songnav a[aria-current="true"] {
  color: var(--bone);
  border-color: var(--line-warm);
  background: linear-gradient(180deg, rgba(74, 29, 40, 0.5), rgba(74, 29, 40, 0.18));
}
.songnav a[aria-current="true"] span { color: var(--brass-soft); }

.tools { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.tools__group { display: flex; gap: 0.25rem; }

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 38px;
  height: 34px;
  padding: 0 0.6rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--bone-2);
  font-family: var(--ui);
  font-size: 0.86rem;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.12s var(--ease);
}
.tool__sub { font-size: 0.72rem; margin-left: -0.18rem; }
.tool:hover { color: var(--bone); border-color: var(--line-warm); background: rgba(232, 225, 214, 0.04); }
.tool:active { transform: translateY(1px) scale(0.98); }
.tool:disabled { opacity: 0.4; cursor: default; }
.tool--wide span { font-size: 0.8rem; letter-spacing: 0.04em; }

@media (max-width: 860px) {
  .tool--wide span { display: none; }
  .tool--wide { min-width: 38px; padding: 0; }
}
@media (max-width: 560px) {
  .mark__text { display: none; }
}

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  min-height: min(96vh, 860px);
  padding: calc(var(--bar-h) + clamp(3rem, 9vh, 7rem)) clamp(1.1rem, 5vw, 4.5rem) clamp(4rem, 9vh, 7rem);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: url("/.netlify/images?url=/img/hero-botanical.png&w=1800&fm=webp&q=72");
  background-size: cover;
  background-position: 50% 42%;
  opacity: 0.85;
  /* mirrored so the bouquet sits opposite the type, which runs down the left */
  animation: slow-drift 34s var(--ease) infinite alternate;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(100deg, rgba(11, 12, 16, 0.95) 0%, rgba(11, 12, 16, 0.86) 30%, rgba(11, 12, 16, 0.42) 58%, rgba(11, 12, 16, 0.2) 82%, rgba(11, 12, 16, 0.5) 100%),
    linear-gradient(0deg, var(--ink) 1%, rgba(11, 12, 16, 0) 40%);
}

@keyframes slow-drift {
  from { transform: scale(-1.04, 1.04); }
  to   { transform: scale(-1.11, 1.11) translate3d(1.2%, -1.2%, 0); }
}

.hero__inner {
  position: relative;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, min(54%, 620px));
  gap: clamp(2rem, 4vw, 2.8rem);
  align-content: end;
}

.eyebrow {
  margin: 0 0 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--brass-soft);
}
.eyebrow::after {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin-top: 0.85rem;
  background: linear-gradient(90deg, var(--brass), transparent);
}

.hero__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.7rem, 11vw, 7.6rem);
  line-height: 0.94;
  letter-spacing: -0.015em;
  color: #f1ebe1;
  text-shadow: 0 16px 60px rgba(0, 0, 0, 0.7);
}

.hero__sub {
  margin: 1.1rem 0 0;
  font-family: var(--lyric);
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  color: var(--bone-2);
}

.hero__meta {
  margin: 0.8rem 0 0;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass-soft);
}
.hero__meta[hidden] { display: none; }

.hero__lead {
  margin: 1.8rem 0 0;
  max-width: 34ch;
  font-size: 0.99rem;
  line-height: 1.75;
  color: var(--bone-2);
}

.hero__index {
  padding: 1.4rem 1.5rem 1.55rem;
  max-width: 30rem;
  background: rgba(13, 14, 19, 0.66);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line-warm);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero__index-title {
  margin: 0 0 1rem;
  font-family: var(--ui);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--bone-3);
}

.hero__index ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.15rem;
}

.hero__index a {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 0.2rem;
  border-bottom: 1px solid var(--line);
  color: var(--bone);
  font-family: var(--display);
  font-size: 1.04rem;
  text-decoration: none;
  transition: color 0.2s var(--ease), padding-left 0.24s var(--ease), background 0.2s var(--ease);
}
.hero__index li:last-child a { border-bottom: 0; }
.hero__index a i {
  font-style: normal;
  font-family: var(--ui);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.hero__index a em {
  font-style: normal;
  font-family: var(--ui);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-3);
}
.hero__index a:hover {
  color: #fff;
  padding-left: 0.55rem;
  background: rgba(232, 225, 214, 0.035);
}

.hero__cue {
  position: absolute;
  left: 50%;
  bottom: clamp(1rem, 3vh, 2rem);
  transform: translateX(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--bone-3);
  font-size: 0.68rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-decoration: none;
}
.hero__cue svg { animation: nudge 2.6s var(--ease) infinite; }
.hero__cue:hover { color: var(--bone); }

@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: 0.55; }
  50%      { transform: translateY(5px); opacity: 1; }
}

@media (max-width: 900px) {
  .hero { min-height: auto; align-items: stretch; }
  .hero__inner { grid-template-columns: 1fr; gap: 2.2rem; }
  .hero__media { background-position: 62% 34%; opacity: 0.5; }
  .hero__index { max-width: none; }
  .hero__cue { display: none; }
}

/* staggered entrance */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.9s var(--ease) forwards;
}
[data-reveal="1"] { animation-delay: 0.05s; }
[data-reveal="2"] { animation-delay: 0.16s; }
[data-reveal="3"] { animation-delay: 0.3s; }
[data-reveal="4"] { animation-delay: 0.42s; }
[data-reveal="5"] { animation-delay: 0.54s; }

@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ lyrics */

.lyrics {
  padding: clamp(3rem, 8vh, 6rem) clamp(1.1rem, 5vw, 3rem) clamp(3rem, 8vh, 5rem);
  max-width: calc(var(--measure) + 12rem);
  margin: 0 auto;
}

.song {
  margin: 0 0 clamp(3.5rem, 9vh, 6.5rem);
}

.song__head {
  max-width: var(--measure);
  margin: 0 auto clamp(1.8rem, 4vh, 2.8rem);
  text-align: center;
}

.song__num {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}

.song__title {
  margin: 0.7rem 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5.4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: 0.005em;
  color: #f1ebe1;
}

.song__rule {
  width: min(300px, 68%);
  margin: 1.15rem auto 0;
  opacity: 0.55;
  filter: saturate(0.5);
  pointer-events: none;
}

.song__body {
  max-width: var(--measure);
  margin: 0 auto;
}

.part { margin: 0 0 2.1rem; }
.part:last-child { margin-bottom: 0; }

.part__label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.85rem;
  font-family: var(--ui);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--bone-3);
}
.part__label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.part__lines {
  margin: 0;
  font-family: var(--lyric);
  font-size: var(--lyric-size);
  line-height: 1.62;
  color: var(--bone);
  text-wrap: pretty;
}
.part__lines span {
  display: block;
  padding: 0.06em 0;
}
.part__lines span:empty { height: 0.7em; }

/* the chorus is what everyone sings — give it its own weight */
.part--chorus {
  position: relative;
  padding: 1.15rem 1.3rem 1.25rem;
  background: var(--panel-soft);
  border-left: 2px solid var(--oxblood);
}
.part--chorus .part__label { color: var(--brass-soft); }
.part--chorus .part__label::after { background: linear-gradient(90deg, var(--line-warm), transparent); }
.part--chorus .part__lines {
  font-style: italic;
  font-weight: 600;
  color: #f0e9df;
}

.part__note {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--bone-3);
}

/* skeleton + states */
.skeleton {
  max-width: var(--measure);
  margin: 0 auto;
  display: grid;
  gap: 0.75rem;
}
.sk {
  display: block;
  height: 1rem;
  width: var(--w, 100%);
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(232, 225, 214, 0.05), rgba(232, 225, 214, 0.11), rgba(232, 225, 214, 0.05));
  background-size: 220% 100%;
  animation: shimmer 1.6s linear infinite;
}
.sk--label { width: 5.5rem; height: 0.6rem; margin: 0 auto; }
.sk--title { width: 60%; height: 2.4rem; margin: 0.4rem auto 1.6rem; }

@keyframes shimmer {
  from { background-position: 120% 0; }
  to   { background-position: -120% 0; }
}

.loading-note,
.fallback {
  max-width: var(--measure);
  margin: 1.6rem auto 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--bone-3);
}

.error-state {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.6rem;
  border: 1px solid var(--line-warm);
  background: rgba(74, 29, 40, 0.16);
  text-align: center;
}
.error-state h2 {
  margin: 0 0 0.5rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.3rem;
  color: #f1ebe1;
}
.error-state p { margin: 0 0 0.9rem; font-size: 0.9rem; color: var(--bone-2); }

/* ------------------------------------------------------------------ footer */

.footer {
  padding: clamp(2rem, 6vh, 4rem) 1.2rem clamp(3rem, 7vh, 4.5rem);
  text-align: center;
  border-top: 1px solid var(--line);
}
.footer__ornament {
  width: min(280px, 62vw);
  height: auto;
  margin: 0 auto 1.2rem;
  opacity: 0.5;
  filter: saturate(0.45);
}
.footer__line {
  margin: 0 0 0.7rem;
  font-family: var(--lyric);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--bone-2);
}
.footer__links {
  margin: 0;
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--bone-3);
}

.totop {
  position: fixed;
  right: clamp(0.8rem, 3vw, 1.6rem);
  bottom: clamp(0.8rem, 3vw, 1.6rem);
  z-index: 25;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-warm);
  background: rgba(13, 14, 19, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--bone-2);
  cursor: pointer;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease), opacity 0.25s var(--ease);
}
.totop:hover { color: var(--bone); transform: translateY(-2px); }
.totop[hidden] { display: none; }

/* ------------------------------------------------------------------ prefs */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ print */

@media print {
  :root { --lyric-size: 11.5pt; }
  body {
    background: #fff !important;
    color: #16161a;
    font-size: 11pt;
  }
  .grain, .topbar, .totop, .hero__media, .hero__scrim, .hero__cue,
  .footer__ornament, .skip, .song__rule { display: none !important; }

  .hero {
    min-height: 0;
    padding: 0 0 1.2rem;
    border-bottom: 1px solid #c9c4bb;
  }
  .hero__inner { display: block; max-width: none; }
  .hero__title { font-size: 26pt; color: #16161a; text-shadow: none; }
  .hero__sub, .hero__lead { color: #4a4740; }
  .hero__meta { color: #4a4740; }
  .hero__lead, .hero__index { display: none; }
  .eyebrow { color: #6b6257; }

  .lyrics { padding: 1.2rem 0 0; max-width: none; }
  .song { break-inside: avoid; margin-bottom: 1.6rem; }
  .song__title { font-size: 16pt; color: #16161a; }
  .song__num { color: #6b6257; }
  .part { break-inside: avoid; margin-bottom: 0.9rem; }
  .part__label { color: #6b6257; }
  .part__lines { color: #16161a; }
  .part--chorus {
    background: #f3f0ea !important;
    border-left: 2px solid #8a7b62;
    padding: 0.5rem 0.7rem;
  }
  .part--chorus .part__lines { color: #16161a; }
  .footer { border-color: #c9c4bb; }
  .footer__links { display: none; }
  a { color: #16161a; text-decoration: none; }
}
