/* The public site's one stylesheet. Plain CSS, no build step: shared values are custom
   properties on :root, components nest their own rules. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --line: #e4e2dc;
  --accent: #0b6e4f;
  --up: #0b6e4f;
  --down: #a4372b;
  --error: #a4372b;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --radius: 6px;
  --measure: 48rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1f1f1d;
    --text: #ecebe6;
    --muted: #9c9a93;
    --line: #34332f;
    --accent: #4cc39a;
    --up: #4cc39a;
    --down: #e4796b;
    --error: #e4796b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--step-0) / 1.45 var(--font);
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.top {
  border-bottom: 1px solid var(--line);
  background: var(--surface);

  & .bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    max-width: var(--measure);
    margin: 0 auto;
    padding: var(--space-2) var(--space-3);
  }

  & .brand {
    font-weight: 700;
    text-decoration: none;
    color: var(--accent);
  }

  & .feeds {
    display: flex;
    gap: var(--space-3);
    flex: 1;

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

    & a[aria-current="page"] {
      color: var(--text);
      font-weight: 600;
    }
  }

  & .account form {
    margin: 0;
  }
}

button.link {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-3);
}

.hint,
.empty,
.muted {
  color: var(--muted);
  font-size: var(--step--1);
}

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

.item {
  display: grid;
  grid-template-columns: 2ch auto 1fr;
  align-items: start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--line);

  & .rank {
    color: var(--muted);
    font-size: var(--step--1);
    text-align: right;
    padding-top: 0.15rem;
  }

  & .title {
    font-weight: 600;
    text-decoration: none;

    &:visited {
      color: var(--muted);
    }
  }

  & .domain,
  & .meta {
    color: var(--muted);
    font-size: var(--step--1);
  }

  & .domain {
    margin-left: var(--space-1);
  }
}

.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.5rem;
  margin: 0;

  & .arrow {
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0 var(--space-2);
    line-height: 1;
    font-size: var(--step--1);
  }

  & .arrow[value="1"][aria-pressed="true"] {
    color: var(--up);
  }

  & .arrow[value="-1"][aria-pressed="true"] {
    color: var(--down);
  }

  & .score {
    font-size: var(--step--1);
    font-variant-numeric: tabular-nums;
  }

  &.htmx-request {
    opacity: 0.5;
  }
}

.card {
  max-width: 24rem;
  margin: var(--space-4) auto;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);

  & h1 {
    font-size: var(--step-1);
    margin: 0 0 var(--space-1);
  }
}

.stack {
  display: grid;
  gap: var(--space-3);

  & label {
    display: grid;
    gap: var(--space-1);
    font-size: var(--step--1);
  }

  & input {
    font: inherit;
    padding: var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
  }
}

button.primary {
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  cursor: pointer;
}

.error {
  color: var(--error);
}
