/* ==========================================================================
   NICLAS BURDON — "Elbe Noir"
   Design tokens: see Design/color-palette.md (source of truth)
   ========================================================================== */

/* ---------- Fonts (self-hosted, GDPR-safe) ---------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../assets/fonts/spacegrotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../assets/fonts/jetbrainsmono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  /* Backgrounds */
  --bg-page: #0a0d12;
  --bg-surface: #10151c;
  --bg-elevated: #181f28;

  /* Text */
  --text-primary: #f2f4f6;
  --text-muted: #9aa3ad;
  --text-faint: #5c6670;

  /* Accent — use sparingly */
  --accent: #14b8e6;
  --accent-hover: #45cdf2;
  --accent-deep: #1d78b0;

  /* Depth / decoration */
  --navy: #14264f;
  --border: #262e38;
  --border-strong: rgba(242, 244, 246, 0.25);

  /* Type */
  --font-display: "Space Grotesk", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;

  /* Rhythm */
  --space-section: clamp(96px, 14vh, 180px);
  --gutter: clamp(20px, 5vw, 64px);
  --max-width: 1280px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-reveal: 900ms;

  --header-h: 72px;
}

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

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

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.7;
  font-weight: 300;
  overflow-x: hidden;
}

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

h1, h2, h3, p, ul { margin: 0; }

a { color: var(--text-primary); text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

::selection { background: var(--accent-deep); color: var(--text-primary); }

section[id] { scroll-margin-top: var(--header-h); }

/* ---------- Film grain ---------- */
.grain {
  position: fixed;
  inset: -100px;
  z-index: 200;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.2s steps(6) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-30px, 20px); }
  40%  { transform: translate(20px, -35px); }
  60%  { transform: translate(-25px, -15px); }
  80%  { transform: translate(35px, 25px); }
  100% { transform: translate(0, 0); }
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 var(--gutter);
  transition: background-color 400ms ease, border-color 400ms ease, backdrop-filter 400ms ease;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(10, 13, 18, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.brand-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.35em;
}
.brand-logo {
  width: 30px;
  height: auto;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  gap: clamp(16px, 3vw, 40px);
}
.header-nav a {
  position: relative;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  padding: 14px 2px;
  transition: color 250ms ease;
}
.header-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 8px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease-out);
}
.header-nav a:hover { color: var(--text-primary); }
.header-nav a:hover::after { transform: scaleX(1); }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.2em;
}
.lang-switch button {
  color: var(--text-faint);
  padding: 12px 4px;
  transition: color 250ms ease;
}
.lang-switch button:hover { color: var(--text-primary); }
.lang-switch button[aria-pressed="true"] { color: var(--accent); }
.lang-sep { color: var(--text-faint); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-media {
  position: absolute;
  inset: 0;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 50%; /* Niclas stands in the right third */
  transform: scale(1.08);
  animation: hero-settle 2.4s var(--ease-out) forwards;
}
@keyframes hero-settle {
  to { transform: scale(1); }
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(10,13,18,0.55) 0%, rgba(10,13,18,0) 30%),
    linear-gradient(90deg, rgba(10,13,18,0.75) 0%, rgba(10,13,18,0.25) 55%, rgba(10,13,18,0.05) 100%),
    linear-gradient(0deg, rgba(10,13,18,0.9) 0%, rgba(10,13,18,0) 45%);
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 var(--gutter) clamp(96px, 16vh, 180px);
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}
.hero-kicker {
  font-size: clamp(10px, 1.2vw, 13px);
  letter-spacing: 0.5em;
  color: var(--text-muted);
  margin-bottom: clamp(16px, 3vh, 32px);
  opacity: 0;
  animation: fade-in 1.2s ease 1.1s forwards;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 11vw, 148px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0.08em;
}
.hero-line {
  display: block;
  overflow: hidden;
  padding-right: 0.1em; /* room for tracking of last letter */
}
.hero-line .ch {
  display: inline-block;
  transform: translateY(115%);
  animation: rise 1s var(--ease-out) forwards;
  animation-delay: calc(0.25s + var(--i) * 55ms);
}
@keyframes rise {
  to { transform: translateY(0); }
}
@keyframes fade-in {
  to { opacity: 1; }
}
.hero-box {
  display: inline-block;
  margin-top: clamp(24px, 4vh, 44px);
  padding: 14px 26px;
  border: 1px solid var(--border-strong);
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.42em;
  color: var(--text-primary);
  opacity: 0;
  animation: fade-in 1.2s ease 1.5s forwards;
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 2;
  width: 44px;
  height: 88px;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: fade-in 1s ease 2.2s forwards;
}
.hero-scroll-line {
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--text-muted));
  transform-origin: top;
  animation: scroll-pulse 2.2s ease-in-out infinite;
}
@keyframes scroll-pulse {
  0%, 100% { transform: scaleY(0.55); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* ---------- Sections (shared) ---------- */
.section {
  padding: var(--space-section) 0;
  background: var(--bg-page);
}
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section-kicker {
  font-size: 11px;
  letter-spacing: 0.45em;
  color: var(--accent);
  margin-bottom: clamp(20px, 3vh, 36px);
}
.accent { color: var(--accent); }
.section-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.5vw, 72px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: 0.06em;
  margin-bottom: clamp(28px, 4vh, 48px);
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
/* Curtain wipe: transform-based so IntersectionObserver and lazy-loading
   still see the full element (clip-path would zero its intersection area) */
.reveal-clip {
  transform: none;
  position: relative;
}
.reveal-clip::after {
  content: "";
  position: absolute;
  inset: -1px;
  background: var(--bg-page);
  transform-origin: bottom;
  transition: transform 1200ms var(--ease-out);
}
.reveal-clip.is-visible {
  transform: none;
}
.reveal-clip.is-visible::after {
  transform: scaleY(0);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}
.about-left {
  align-self: stretch; /* match the text block's height */
  display: flex;
  align-items: center;   /* logo vertically centered on the text block */
  justify-content: center;
}
.about-logo {
  perspective: 900px;
}
.about-logo img {
  width: clamp(192px, 20vw, 300px);
  height: auto;
  will-change: transform;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, 0.6));
}
.about-media img {
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.04);
}
.about-text {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 58ch;
  margin-bottom: 1.4em;
}
.about-facts {
  list-style: none;
  padding: 0;
  margin-top: clamp(28px, 4vh, 44px);
  border-top: 1px solid var(--border);
}
.about-facts li {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  letter-spacing: 0.22em;
}
.fact-label { color: var(--text-faint); white-space: nowrap; }
.fact-value { color: var(--text-primary); text-align: right; }

/* ---------- Interstitials ---------- */
.interstitial {
  position: relative;
  height: clamp(420px, 72vh, 720px);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.interstitial-media {
  position: absolute;
  inset: 0;
}
.interstitial-media img {
  width: 100%;
  height: 130%; /* headroom for parallax travel */
  object-fit: cover;
  will-change: transform;
}
/* Wide/short desktop viewports crop this tall portrait shot vertically —
   default center crop pushes Niclas' head above the frame. Bias toward
   the top so his face stays in view (costs some legroom on ultra-wide
   screens, which is the right trade-off). */
.interstitial-roots .interstitial-media img {
  object-position: 50% 15%;
}
.interstitial::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(10,13,18,0.85) 0%, rgba(10,13,18,0.15) 40%, rgba(10,13,18,0.35) 100%);
}
.interstitial-caption {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(48px, 8vh, 88px);
}
.interstitial-kicker {
  font-size: 11px;
  letter-spacing: 0.45em;
  color: var(--accent);
  margin-bottom: 14px;
}
.interstitial-line {
  font-family: var(--font-display);
  font-size: clamp(20px, 3.4vw, 40px);
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1.3;
}

/* ---------- Music / Tracklist ---------- */
.music { background: var(--bg-surface); }

.music-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: clamp(20px, 3vh, 36px);
}
.music-head .section-kicker { margin-bottom: 0; }

.autoplay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  transition: color 250ms ease, border-color 250ms ease;
}
.autoplay-toggle:hover { color: var(--text-muted); border-color: var(--border-strong); }
.autoplay-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: background 250ms ease, box-shadow 250ms ease;
}
.autoplay-toggle[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.autoplay-toggle[aria-pressed="true"] .autoplay-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.tracklist {
  border-top: 1px solid var(--border);
}
.track {
  display: grid;
  grid-template-columns: 56px 44px minmax(0, 1fr) auto auto;
  grid-template-areas:
    "toggle index meta eq time"
    "wave   wave  wave wave wave";
  align-items: center;
  gap: 0 clamp(14px, 2.5vw, 28px);
  padding: clamp(18px, 3vh, 28px) 0;
  border-bottom: 1px solid var(--border);
  transition: background-color 300ms ease;
}
.track:hover { background: rgba(24, 31, 40, 0.5); }

.track-toggle {
  grid-area: toggle;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 250ms ease, background-color 250ms ease, transform 200ms var(--ease-out);
}
.track-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}
.track-toggle:active { transform: scale(0.96); }
.track-toggle svg {
  width: 18px;
  height: 18px;
  fill: var(--text-primary);
  transition: fill 250ms ease;
}
.track-toggle:hover svg { fill: var(--accent); }
.track .ico-pause { display: none; }
.track.playing .ico-pause { display: block; }
.track.playing .ico-play { display: none; }
.track.playing .track-toggle {
  border-color: var(--accent);
  background: rgba(20, 184, 230, 0.08);
}

.track-index {
  grid-area: index;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.2em;
}
.track-meta { grid-area: meta; min-width: 0; }
.track-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.2;
}
.track-tag {
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
  margin-top: 6px;
}

.track-eq {
  grid-area: eq;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  opacity: 0;
  transition: opacity 300ms ease;
}
.track.playing .track-eq { opacity: 1; }
.track-eq i {
  width: 3px;
  background: var(--accent);
  animation: eq-bounce 0.9s ease-in-out infinite;
}
.track-eq i:nth-child(1) { height: 60%; animation-delay: 0ms; }
.track-eq i:nth-child(2) { height: 100%; animation-delay: 150ms; }
.track-eq i:nth-child(3) { height: 40%; animation-delay: 300ms; }
@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
.track.paused .track-eq i { animation-play-state: paused; }

.track-time {
  grid-area: time;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  min-width: 88px;
  text-align: right;
}

.track-wave {
  grid-area: wave;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  cursor: pointer;
  transition: height 500ms var(--ease-out), opacity 400ms ease, margin 500ms var(--ease-out);
}
.track.active .track-wave {
  height: 48px;
  opacity: 1;
  margin-top: 20px;
}
.track-wave .bar {
  flex: 1;
  min-width: 2px;
  background: var(--border);
  border-radius: 1px;
  transition: background-color 120ms linear;
}
.track-wave .bar.played { background: var(--accent); }
.track-wave:hover .bar:not(.played) { background: var(--text-faint); }

/* ---------- Contact ---------- */
.contact-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contact-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 8vw, 110px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.06em;
  margin-bottom: clamp(20px, 3vh, 36px);
}
.contact-sub {
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.06em;
  max-width: 52ch;
  margin-bottom: clamp(36px, 6vh, 64px);
}
.contact-mail {
  display: inline-block;
  padding: 20px 40px;
  border: 1px solid var(--border-strong);
  font-size: clamp(13px, 1.6vw, 16px);
  letter-spacing: 0.24em;
  transition: border-color 300ms ease, color 300ms ease, background-color 300ms ease;
}
.contact-mail:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: rgba(20, 184, 230, 0.05);
}
.contact-location {
  margin-top: clamp(28px, 4vh, 44px);
  font-size: 11px;
  letter-spacing: 0.45em;
  color: var(--text-faint);
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px var(--gutter) 40px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}
.footer-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-link {
  color: var(--text-faint);
  transition: color 250ms ease;
}
.footer-link:hover { color: var(--accent); }
.footer-credit {
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.12em;
  font-size: 9px;
}
.footer-credit img {
  display: block;
  height: 13px;
  width: auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 899px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-left { max-width: 480px; margin: 0 auto; }

  /* narrow portrait crops this wide shot hard on the sides — keep Niclas in frame */
  .interstitial-studio .interstitial-media img { object-position: 18% 50%; }
  /* roots loads a dedicated pre-cropped portrait image below — already centered on Niclas */
  .interstitial-roots .interstitial-media img { object-position: 50% 50%; }
}

@media (max-width: 640px) {
  :root { --header-h: 60px; }

  .site-header { padding: 0 16px; gap: 12px; }
  .brand-name { font-size: 10px; letter-spacing: 0.2em; }
  .brand-logo { width: 22px; }
  .header-nav a { font-size: 10px; letter-spacing: 0.14em; padding: 14px 0; }
  .header-nav { gap: 12px; }
  .lang-switch { gap: 4px; font-size: 10px; }
  .lang-switch button { padding: 12px 2px; }

  /* dedicated pre-cropped portrait image below — already centered on Niclas */
  .hero-media img { object-position: 50% 50%; }

  .track {
    grid-template-columns: 44px 1fr auto;
    grid-template-areas:
      "toggle meta time"
      "wave   wave wave";
  }
  .track-index, .track-eq { display: none; }
  .track-toggle { width: 44px; height: 44px; }
  .track-time { min-width: 0; }

  .about-facts li { flex-direction: column; gap: 6px; }
  .fact-value { text-align: left; }
}

@media (max-width: 480px) {
  /* keep the one-line kicker inside the viewport (DE: MUSIKPRODUZENT) */
  .hero-kicker { letter-spacing: 0.3em; }
}

@media (max-width: 400px) {
  .brand-name { display: none; } /* logo alone; frees room for nav + EN/DE */
  .contact-mail { padding: 16px 20px; font-size: 12px; letter-spacing: 0.18em; }
}

/* ---------- Legal pages (Impressum) ---------- */
.legal-page {
  padding-top: calc(var(--header-h) + var(--space-section));
}
.legal-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--gutter) var(--space-section);
}
.legal-back {
  display: inline-block;
  margin-bottom: clamp(48px, 7vh, 72px);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
  transition: color 250ms ease;
}
.legal-back:hover { color: var(--accent); }
.legal-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 500;
  letter-spacing: 0.05em;
  margin-bottom: clamp(32px, 5vh, 56px);
}
.legal-block { margin-bottom: clamp(32px, 5vh, 48px); }
.legal-block h2 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.14em;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.legal-block p, .legal-block address {
  font-style: normal;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-muted);
  max-width: 62ch;
}
.legal-block a {
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-strong);
}
.legal-block a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  .hero-media img { animation: none; transform: none; }
  .hero-line .ch { animation-duration: 1ms; animation-delay: 0ms; }
  .hero-kicker, .hero-box, .hero-scroll { animation-duration: 1ms; animation-delay: 0ms; }
  .hero-scroll-line { animation: none; }
  .reveal, .reveal-clip {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .reveal-clip::after { display: none; }
  .interstitial-media img { transform: none !important; height: 100%; }
  .about-logo img { transform: none !important; }
  .track-eq i { animation: none; }
}
