/*
 * WebDLNA site — landing page and documentation.
 *
 * Deliberately dark-only. The app is dark-first and its identity is a mint
 * accent on near-black; a second, weaker light theme would dilute that for no
 * one's benefit. The tokens below are the app's own (src/styles/tokens.css),
 * copied rather than imported so this folder stays self-contained: it can be
 * served from a running instance at /site/ or dropped onto any static host.
 */

:root {
  --bg: #0a0a0f;
  --bg-raised: #12121a;
  --bg-sunken: #08080c;
  --bg-code: #14141d;
  --border: #23232f;
  --border-strong: #32323f;

  --text: #f0f0f5;
  --text-dim: #a0a0b0;
  --text-faint: #6d6d7e;

  --brand: #63e2b7;
  --brand-dim: #3dbd95;
  --brand-wash: rgba(99, 226, 183, 0.09);
  --brand-edge: rgba(99, 226, 183, 0.28);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --page: 1140px;
  --prose: 68ch;
}

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

html {
  scroll-behavior: smooth;
  /* Anchored headings clear the sticky header. */
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 700;
}

p {
  margin: 0 0 1rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

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

/* --- Shell ------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #06110d;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* --- Header ------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 15, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}

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

.brand svg {
  width: 26px;
  height: 26px;
  color: var(--brand);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  color: var(--text-dim);
  font-size: 0.94rem;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-raised);
  text-decoration: none;
}

.site-nav a[aria-current='page'] {
  color: var(--brand);
}

.github-stars {
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

/* --- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.btn:hover {
  text-decoration: none;
  border-color: var(--brand-edge);
  color: var(--text);
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #06110d;
}

.btn--primary:hover {
  background: var(--brand-dim);
  border-color: var(--brand-dim);
  color: #06110d;
}

.btn--small {
  padding: 7px 14px;
  font-size: 0.88rem;
}

/* --- Hero -------------------------------------------------------------- */
.hero {
  padding: 88px 0 72px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 420px at 72% -8%, rgba(99, 226, 183, 0.11), transparent 70%),
    radial-gradient(700px 380px at 8% 12%, rgba(99, 226, 183, 0.05), transparent 65%);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-wash);
  border: 1px solid var(--brand-edge);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--brand);
}

.hero__lede {
  font-size: 1.12rem;
  color: var(--text-dim);
  max-width: 46ch;
  margin-bottom: 30px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hero__note {
  margin: 22px 0 0;
  font-size: 0.88rem;
  color: var(--text-faint);
}

/* --- Sections ---------------------------------------------------------- */
.section {
  padding: 76px 0;
  border-bottom: 1px solid var(--border);
}

.section--sunken {
  background: var(--bg-sunken);
}

.section__head {
  max-width: var(--prose);
  margin-bottom: 44px;
}

.section__head h2 {
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  margin-bottom: 14px;
}

.section__head p {
  color: var(--text-dim);
  font-size: 1.03rem;
  margin: 0;
}

.section__kicker {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 12px;
}

/* --- Cards ------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card__icon {
  width: 34px;
  height: 34px;
  color: var(--brand);
  margin-bottom: 14px;
}

.card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-dim);
  font-size: 0.94rem;
  margin: 0;
}

/* --- Flow diagram (servers → WebDLNA → browser) ------------------------ */
.flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.flow__col {
  display: flex;
}

.flow__box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.flow__box--accent {
  background: var(--brand-wash);
  border-color: var(--brand-edge);
}

.flow__icon {
  width: 28px;
  height: 28px;
  color: var(--brand);
}

.flow__box strong {
  font-size: 1rem;
}

.flow__box span {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.flow__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--border-strong);
}

.flow__link svg {
  width: 56px;
  height: 12px;
}

.flow__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --- Split feature rows ------------------------------------------------ */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 52px;
  align-items: center;
}

.split + .split {
  margin-top: 76px;
}

.split--flip .split__media {
  order: -1;
}

.split h3 {
  font-size: 1.45rem;
  margin-bottom: 14px;
}

.split p {
  color: var(--text-dim);
}

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

/* --- Steps ------------------------------------------------------------- */
.steps {
  counter-reset: step;
  display: grid;
  gap: 26px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

.step {
  position: relative;
  padding-left: 52px;
}

.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand-wash);
  border: 1px solid var(--brand-edge);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.95rem;
}

.step h3 {
  font-size: 1.05rem;
  margin: 4px 0 8px;
}

.step p {
  color: var(--text-dim);
  font-size: 0.94rem;
}

/* --- Code -------------------------------------------------------------- */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: #cfe9df;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 1rem;
  line-height: 1.6;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.86rem;
  color: #d6e7e0;
}

/* Comments inside the shell snippets, dimmed so the commands read first. */
.tok-comment {
  color: var(--text-faint);
}

/* --- Tables ------------------------------------------------------------ */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.4rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  min-width: 460px;
}

th,
td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-raised);
  white-space: nowrap;
}

td {
  color: var(--text-dim);
}

td code {
  white-space: nowrap;
}

kbd {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--text);
  white-space: nowrap;
}

/* --- Callouts ---------------------------------------------------------- */
.note {
  border-left: 3px solid var(--brand);
  background: var(--brand-wash);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 0 0 1.4rem;
  font-size: 0.94rem;
  color: var(--text-dim);
}

.note strong {
  color: var(--text);
}

.note--warn {
  border-left-color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
}

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

/* --- Footer ------------------------------------------------------------ */
.site-footer {
  padding: 52px 0 64px;
  color: var(--text-faint);
  font-size: 0.92rem;
}

.site-footer__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

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

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

.site-footer__legal {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}

/* --- Docs layout ------------------------------------------------------- */
.docs {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 44px 0 96px;
}

.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: 0.9rem;
  padding-right: 8px;
}

.toc h2 {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 5px 12px;
  color: var(--text-dim);
  border-left: 2px solid var(--border);
  line-height: 1.45;
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
  border-left-color: var(--border-strong);
}

.toc a.is-active {
  color: var(--brand);
  border-left-color: var(--brand);
  background: var(--brand-wash);
}

.doc-body {
  max-width: var(--prose);
  min-width: 0;
}

.doc-intro {
  font-size: 1.08rem;
  color: var(--text-dim);
  margin-bottom: 40px;
}

.doc-section {
  padding-top: 12px;
  margin-bottom: 56px;
}

.doc-section > h2 {
  font-size: 1.6rem;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.doc-section h3 {
  font-size: 1.1rem;
  margin: 32px 0 10px;
}

.doc-section h4 {
  font-size: 0.98rem;
  margin: 24px 0 8px;
  color: var(--text);
}

.doc-section ul,
.doc-section ol {
  color: var(--text-dim);
  padding-left: 22px;
  margin: 0 0 1.2rem;
}

.doc-section li {
  margin-bottom: 8px;
}

.doc-section li strong {
  color: var(--text);
}

.anchor {
  color: var(--text-faint);
  font-weight: 400;
  margin-left: 10px;
  opacity: 0;
  font-size: 0.8em;
  transition: opacity 150ms ease;
}

h2:hover .anchor,
h3:hover .anchor,
.anchor:focus {
  opacity: 1;
}

/* Definition-style rows used for settings and env-var references. */
.deflist {
  display: grid;
  gap: 18px;
  margin: 0 0 1.4rem;
}

.deflist__row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.deflist__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.deflist__term {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.deflist__desc {
  color: var(--text-dim);
  font-size: 0.94rem;
}

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

/* --- Legal pages ------------------------------------------------------- */
.legal {
  max-width: 74ch;
  margin: 0 auto;
  padding: 48px 0 88px;
}

.legal h1 {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  margin-bottom: 10px;
}

.legal__meta {
  color: var(--text-faint);
  font-size: 0.88rem;
  margin-bottom: 32px;
}

/* The plain-language précis that opens each document. Explicitly not the
   binding text — the sections below it are. */
.legal__summary {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 22px 24px;
  margin-bottom: 44px;
}

.legal__summary h2 {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 12px;
}

.legal__summary ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.legal__summary li {
  margin-bottom: 7px;
}

.legal__summary li:last-child {
  margin-bottom: 0;
}

.legal__summary p {
  margin: 14px 0 0;
  font-size: 0.86rem;
  color: var(--text-faint);
}

.legal section {
  margin-bottom: 40px;
}

.legal section > h2 {
  font-size: 1.22rem;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.legal h3 {
  font-size: 1.02rem;
  margin: 26px 0 10px;
}

.legal p,
.legal li {
  color: var(--text-dim);
  font-size: 0.97rem;
}

.legal ul,
.legal ol {
  padding-left: 22px;
  margin: 0 0 1.1rem;
}

.legal li {
  margin-bottom: 8px;
}

.legal strong {
  color: var(--text);
}

/* Cross-links between the three legal documents. */
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}

.legal-nav a {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.89rem;
}

.legal-nav a:hover {
  border-color: var(--brand-edge);
  color: var(--text);
  text-decoration: none;
}

.legal-nav a[aria-current='page'] {
  background: var(--brand-wash);
  border-color: var(--brand-edge);
  color: var(--brand);
}

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 940px) {
  .hero__grid,
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  /* The flow stacks, so its arrows have to turn to match. */
  .flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .flow__link {
    flex-direction: row;
    gap: 12px;
    padding: 4px 0;
  }

  .flow__link svg {
    transform: rotate(90deg);
    width: 36px;
  }

  .split--flip .split__media {
    order: 0;
  }

  .hero {
    padding: 60px 0 56px;
  }

  .section {
    padding: 60px 0;
  }

  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    background: var(--bg-raised);
  }

  .toc a {
    border-left: none;
    padding: 4px 0;
  }

  .toc a.is-active {
    background: none;
  }
}

@media (max-width: 620px) {
  .wrap {
    padding: 0 18px;
  }

  .site-nav a {
    padding: 7px 8px;
  }

  .site-nav .btn {
    padding: 7px 12px;
  }

  .site-nav__github {
    display: none;
  }

  .deflist__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .hero__actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

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

  * {
    transition-duration: 1ms !important;
  }
}
