:root {
  color-scheme: dark;

  --gold: #e5a00d;
  --gold-light: #f8cf5c;
  --text: #fafafa;
  --text-muted: #a3a3a3;
  --line: rgb(255 255 255 / 10%);
  --glass: rgb(255 255 255 / 3%);
  --gutter: 1rem;
  --width: 72rem;
  --font:
    -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, helvetica, arial,
    sans-serif;
  --mono: ui-monospace, sfmono-regular, menlo, consolas, monospace;
}

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

/* No scroll padding: each section's own top padding already clears the
   header */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #000;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgb(255 255 255 / 25%);
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-wrap: balance;
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}

h3 {
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
}

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

/* The app's starfield, drifting slowly behind everything */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #000;

  &::before {
    position: absolute;
    inset: 0 0 0 -1000px;
    background: url('assets/twinkling.png') repeat;
    opacity: 0.6;
    content: '';
    animation: drift 80s linear infinite;
  }

  /* A warm glow at the top, above the stars so their texture doesn't show */
  &::after {
    position: absolute;
    inset: 0;
    background: radial-gradient(
      ellipse 60% 40% at 50% 0%,
      rgb(229 160 13 / 18%),
      transparent 70%
    );
    content: '';
  }
}

@keyframes drift {
  to {
    transform: translate3d(1000px, 0, 0);
  }
}

.gold {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  background-clip: text;
  color: transparent;
}

/* An underlined link in running text, kept on one line with its arrow */
.text-link {
  text-decoration: underline;
  text-decoration-color: var(--underline, rgb(255 255 255 / 30%));
  text-underline-offset: 0.2em;
  white-space: nowrap;
  transition: text-decoration-color 0.2s;

  &:hover {
    text-decoration-color: currentcolor;
  }
}

/* Marks a text link as leaving the page */
.link-arrow {
  display: inline-block;
  width: 0.875em;
  height: 0.875em;
  margin-left: 0.125em;
  vertical-align: -0.0625em;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.eyebrow {
  margin-bottom: 0.75rem;
  color: var(--gold);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  transition:
    opacity 0.2s,
    background-color 0.2s;
  cursor: pointer;

  &:hover {
    opacity: 0.85;
  }

  svg {
    width: 1rem;
    height: 1rem;
  }
}

/* Marks a link that leaves the page */
.button-heart {
  fill: #db2777;
}

.button-coffee {
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.button-external {
  margin-right: -0.25rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  opacity: 0.7;
}

.button--glass {
  background: rgb(255 255 255 / 8%);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  backdrop-filter: blur(24px);

  &:hover {
    background: rgb(255 255 255 / 14%);
    opacity: 1;
  }
}

.button--small {
  min-height: 2.25rem;
  padding: 0 1rem;
  font-size: 0.875rem;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem
    max(var(--gutter), calc((100% - var(--width)) / 2 + var(--gutter)));
  transition:
    background-color 0.3s,
    backdrop-filter 0.3s;
}

/* Clear at the top of the page, frosted once the page scrolls under it */
.nav--scrolled {
  background-color: rgb(0 0 0 / 50%);
  backdrop-filter: blur(16px) saturate(150%);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-right: auto;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-links {
  display: none;
  gap: 1.5rem;
  font-size: 0.875rem;

  a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;

    &:hover {
      color: var(--text);
    }
  }
}

/* Sections */
main > section {
  max-width: var(--width);
  margin: 0 auto;
  padding: 5rem var(--gutter);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 4rem;
  padding-bottom: 2rem;
  text-align: center;
}

.hero-icon {
  margin-bottom: 2.5rem;
  filter: drop-shadow(0 0 32px rgb(229 160 13 / 35%));
  animation: rise 0.6s ease both;
}

.hero-title {
  font-size: clamp(3rem, 11vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  animation: rise 0.6s 0.1s ease both;
}

.hero-lead {
  max-width: 46rem;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: clamp(1.0625rem, 2.5vw, 1.25rem);
  text-wrap: balance;
  animation: rise 0.6s 0.2s ease both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2rem;
  animation: rise 0.6s 0.3s ease both;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin: 2.5rem 0 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  list-style: none;
  animation: rise 0.6s 0.35s ease both;

  a {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.75rem 0.3125rem 0.5rem;
    border-radius: 999px;
    background: var(--glass);
    box-shadow:
      inset 0 0 0 1px var(--line),
      inset 0 1px 0 0 rgb(255 255 255 / 6%);
    text-decoration: none;
    backdrop-filter: blur(24px);
    transition: background-color 0.2s;

    &:hover {
      background-color: rgb(255 255 255 / 10%);
    }
  }

  svg {
    width: 1.125rem;
    height: 1.125rem;
    fill: none;
    stroke: var(--gold);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.75;
  }

  strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
}

.showcase {
  display: grid;
  align-items: center;
  gap: 2.5rem;
}

/* Phone-sized screenshots, a pair staggered so they read as a set */
.phones {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
}

.phone {
  flex: 0 1 17rem;
  margin: 0;
  padding: 0.375rem;
  border-radius: 2.25rem;
  background: var(--glass);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 40px 80px -30px rgb(0 0 0 / 80%);

  img {
    width: 100%;
    height: auto;
    border-radius: 1.875rem;
  }

  & + & {
    margin-top: 3rem;
  }
}

/* Phones drift against the scroll, the second of a pair further, so they
   slide past each other */
@supports (animation-timeline: view()) {
  .phone {
    animation: drift-phone linear both;
    animation-timeline: view();
  }

  .phone + .phone {
    animation-name: drift-phone-far;
  }
}

@keyframes drift-phone {
  from {
    translate: 0 3rem;
  }

  to {
    translate: 0 -3rem;
  }
}

@keyframes drift-phone-far {
  from {
    translate: 0 6rem;
  }

  to {
    translate: 0 -6rem;
  }
}

.showcase-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;

  .showcase-lead {
    color: var(--text-muted);
    font-size: 1.0625rem;
  }

  .eyebrow {
    margin-bottom: -0.25rem;
  }
}

.checks {
  display: grid;
  gap: 0.75rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;

  li {
    position: relative;
    padding-left: 1.75rem;
    text-wrap: pretty;
  }

  li::before {
    position: absolute;

    /* Centred on the first line, however the text wraps */
    top: calc((1lh - 1rem) / 2);
    left: 0;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: rgb(229 160 13 / 20%)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23f8cf5c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4.5 8.5 2.25 2.25L11.5 5.5'/%3E%3C/svg%3E")
      center / 100% no-repeat;
    content: '';
  }
}

.feature,
.compat-table,
.code {
  border-radius: 1.5rem;
  background: linear-gradient(to bottom, rgb(255 255 255 / 4%), transparent)
    var(--glass);
  box-shadow: inset 0 1px 0 0 var(--line);
  backdrop-filter: blur(24px);
}

.features h2,
.install h2 {
  max-width: 20ch;
}

.features-grid {
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
}

.feature {
  padding: 1.5rem;

  h3 {
    margin-bottom: 0.5rem;
  }

  p {
    color: var(--text-muted);
    font-size: 0.9375rem;
  }
}

.feature-icon {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 1rem;
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.compat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.compat-table {
  width: 100%;
  max-width: 32rem;
  margin-top: 2rem;
  padding: 0.5rem 1.5rem;
  text-align: left;
}

.compat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 0;
  align-items: center;

  & + & {
    border-top: 1px solid var(--line);
  }
}

.compat-logo-link {
  width: fit-content;
  transition: opacity 0.2s;

  &:hover {
    opacity: 0.8;
  }
}

/* Each logo's letters at about the same height as the other's */
.compat-logo {
  width: auto;
}

.compat-logo--plex {
  height: 1.5rem;
}

.compat-logo--jellyfin {
  height: 1.625rem;
}

.compat-row--head {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.compat-note {
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;

  .text-link {
    color: var(--text);
  }
}

.steps {
  display: grid;
  gap: 0.75rem;
  margin: 2rem 0;
  padding: 0;
  counter-reset: step;
  list-style: none;

  li {
    position: relative;
    padding-left: 2.75rem;
    color: var(--text-muted);
    counter-increment: step;
  }

  li::before {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: rgb(229 160 13 / 15%);
    color: var(--gold-light);
    font-size: 0.875rem;
    font-weight: 700;
    content: counter(step);
  }

  code {
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    background: rgb(255 255 255 / 8%);
    color: var(--text);
  }
}

.code {
  position: relative;

  pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.7;
  }
}

.code-copy {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem 0.375rem 0.75rem;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 10%);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;

  &:hover {
    background: rgb(255 255 255 / 18%);
  }
}

.code-icon {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.code-icon-done {
  display: none;
}

.code-copy--done {
  color: #4ade80;

  .code-icon-copy {
    display: none;
  }

  .code-icon-done {
    display: inline;
  }
}

.yaml-key {
  color: var(--gold-light);
}

.yaml-value {
  color: #a5d6a7;
}

.yaml-number {
  color: #90caf9;
}

.install-more {
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;

  .text-link {
    --underline: rgb(248 207 92 / 35%);

    color: var(--gold-light);
  }
}

.support {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  p {
    max-width: 32rem;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 1.0625rem;
    text-wrap: balance;
  }
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--width);
  margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.875rem;

  nav {
    display: flex;
    gap: 1.25rem;
  }

  a {
    text-decoration: none;
    white-space: nowrap;

    &:hover {
      color: var(--text);
    }
  }
}

@media (width >= 48rem) {
  :root {
    --gutter: 2rem;
  }

  .nav-links {
    display: flex;
  }

  .stats {
    gap: 0.5rem;
    font-size: 0.875rem;

    a {
      padding: 0.375rem 0.875rem 0.375rem 0.625rem;
    }
  }

  main > section {
    padding-block: 7rem;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (width >= 64rem) {
  .showcase {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
  }

  .showcase--flip .showcase-text {
    order: 1;
  }

  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before {
    animation: none !important;
  }
}
