/* ==========================================================================
   HighlifeNg — download page
   Light editorial. Flat surfaces separated by hairline borders (no shadows
   except overlays), one accent, warm neutral grays.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
  --bg: #fbfaf9;
  --surface: #ffffff;
  --surface-sunken: #f4f2ef;
  --border: #e5e2dc;
  --border-strong: #d5d1c9;

  --text: #1a1815;
  --muted: #6b665e;

  --accent: #5a3fd6;
  --accent-hover: #4a32be;
  --accent-fg: #ffffff;
  --accent-subtle: #f1eefc;

  --danger: #b3261e;
  --success: #1a7f4b;
  --warning: #a35a00;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    monospace;

  /* Duration tiers — micro for feedback, short/medium for entrances. */
  --t-micro: 100ms;
  --t-short: 150ms;
  --t-medium: 220ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211;
    --surface: #1c1a18;
    --surface-sunken: #232120;
    --border: #302d2a;
    --border-strong: #423e3a;

    --text: #ededea;
    --muted: #a5a099;

    --accent: #a794ff;
    --accent-hover: #b9abff;
    --accent-fg: #17141f;
    --accent-subtle: #241f38;

    --danger: #f2b8b5;
    --success: #6cd39b;
    --warning: #e8a75c;
  }
}

/* --- Base ----------------------------------------------------------------- */

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

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

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Components below set their own `display`, which would otherwise beat the
   `hidden` attribute. Keep this above them. */
[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

/* One focus style for everything interactive. */
:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* --- Layout --------------------------------------------------------------- */

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 24px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--text);
  text-decoration: none;
}

.site-header .eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Site notice ---------------------------------------------------------- */

/* Set from the admin screen. Colour lives on the left edge and the icon; the
   message itself stays at full text contrast in both schemes. */
.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px 14px;
  margin-top: 20px;
}

.notice-banner--warning {
  border-left-color: var(--warning);
}

.notice-banner__icon {
  flex: none;
  margin-top: 2px; /* optical: aligns the glyph to the first line's cap height */
  color: var(--accent);
}

.notice-banner--warning .notice-banner__icon {
  color: var(--warning);
}

.notice-banner__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* --- Track header --------------------------------------------------------- */

.track {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: center;
  padding: 28px 0 24px;
}

@media (min-width: 640px) {
  .track {
    grid-template-columns: 132px 1fr;
    gap: 24px;
    padding: 40px 0 32px;
  }
}

.artwork {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  object-fit: cover;
}

/* Fallback tile when the post has no usable image. */
.artwork--empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.track-meta {
  min-width: 0;
}

.track-title {
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 6px;
  /* Long titles wrap rather than blow out the grid. */
  overflow-wrap: anywhere;
}

@media (min-width: 640px) {
  .track-title {
    font-size: 34px;
  }
}

.track-artist {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 12px;
}

.track-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.badge svg {
  /* Optical nudge: icons sit a touch high next to lowercase text. */
  margin-top: -1px;
  flex: none;
}

/* --- Player --------------------------------------------------------------- */

.player {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.player-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.player audio {
  width: 100%;
  height: 36px;
  display: block;
}

/* --- Specs ---------------------------------------------------------------- */

.specs {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin: 0 0 24px;
  overflow: hidden;
}

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.spec-row:last-child {
  border-bottom: 0;
}

.spec-key {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  flex: none;
}

.spec-val {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  text-align: right;
  /* Sizes and dates shouldn't jitter as digits change. */
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Skeleton for the size, which resolves after first paint. */
.skeleton {
  display: inline-block;
  width: 62px;
  height: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  vertical-align: middle;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: pulse 1.4s var(--ease-out) infinite;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px 13px; /* 1px less on top — optical centering */
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--t-micro) var(--ease-out),
    border-color var(--t-micro) var(--ease-out),
    transform var(--t-micro) var(--ease-out);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
  .btn:active {
    transform: none;
  }
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.btn--primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 17px;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--accent-fg);
}

.btn--ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.action {
  margin-bottom: 12px;
}

.action-note {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 32px;
}

/* --- Ad slot -------------------------------------------------------------- */

/* Ads are labelled and visually separated so they never masquerade as UI. */
.ad-slot {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
  padding: 16px;
  margin-bottom: 28px;
  text-align: center;
  overflow: hidden;
}

.ad-slot__label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.ad-slot img,
.ad-slot iframe {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 0;
  border-radius: var(--radius-md);
}

.ad-slot iframe {
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
}

/* --- Notice / error state ------------------------------------------------- */

.notice {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

.notice h2 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0 0 8px;
}

.notice p {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 16px;
}

/* --- Modal ---------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 14, 12, 0.6);
}

.modal[hidden] {
  display: none;
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  /* Overlays are the one place shadows are used. */
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.24);
}

@media (prefers-reduced-motion: no-preference) {
  .modal:not([hidden]) {
    animation: fade-in var(--t-short) var(--ease-out);
  }

  .modal:not([hidden]) .modal__panel {
    animation: panel-in var(--t-medium) var(--ease-out);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.modal__title {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0 0 6px;
}

.modal__body {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
}

.modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--t-micro) var(--ease-out),
    color var(--t-micro) var(--ease-out);
}

.modal__close:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.modal__ad {
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
}

/* The creative is a fixed-width block; centre it in the panel. */
.modal__ad img {
  margin-inline: auto;
  border-radius: var(--radius-md);
}

.modal__hint {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 0;
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
