/* Shared by the landing, member and admin pages: tokens, type, header, buttons, section frame. */

:root {
  --bg: #0d0e10;
  --surface: #17181b;
  --text: #f1ede6;
  --muted: #9b9791;
  --line: #ffffff1a;
  --line-strong: #ffffff40;
  --accent: #ff7b3d;
  --on-accent: #1f1109;
  --danger: #ff9385;
  /* Form fields need a 3:1 edge against the ground; --line-strong is for dividers. */
  --field-line: #ffffff5c;
  --ring: var(--accent);
  --sans: 'Inter Tight', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
  --gutter: clamp(20px, 4vw, 40px);
  --gap: clamp(32px, 6vw, 88px);
  --header: 64px;
  --band-pad: clamp(64px, 9vw, 120px);

  /* Nested surfaces stay concentric: outer radius = inner radius + inset. */
  --r-control: 10px;
  --r-button: 6px;
  --well-pad: 6px;
  --r-well: calc(var(--r-button) + var(--well-pad));
  --card-pad: 8px;
  --r-card: calc(var(--r-well) + var(--card-pad) + 1px);

  color-scheme: dark;
}

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

/* Scripts show and hide parts with the attribute; a display rule must never undo it. */
[hidden] {
  display: none !important;
}

html {
  scroll-padding-top: calc(var(--header) + 16px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.55 var(--sans);
  /* Inter Tight is drawn for display sizes; body text needs a little air. */
  letter-spacing: 0.012em;
}

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

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-weight: 600;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2.75rem, 7.2vw, 6.25rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: 0;
}

p {
  text-wrap: pretty;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.ext::after {
  content: '\00a0↗';
  color: var(--muted);
}

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

.wrap {
  width: 100%;
  max-width: calc(1200px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: var(--r-button);
  background: var(--text);
  color: var(--bg);
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

/* Header */

.nav {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header);
}

.brand {
  display: inline-flex;
}

#primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-inline-start: auto;
}

#primary-nav a:not(.btn) {
  padding-block: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin-inline-start: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-button);
  background: none;
  color: inherit;
  cursor: pointer;
}

.nav-toggle span {
  display: grid;
  gap: 5px;
  width: 20px;
  margin: auto;
}

.nav-toggle i {
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

/* Buttons, inline actions and status marks */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--on-accent);
  font: 600 1rem var(--sans);
  letter-spacing: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn-quiet {
  border-color: var(--line-strong);
  background: none;
  color: var(--text);
}

.btn-small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.status-done::before {
  background: currentColor;
}

.status-on {
  color: var(--text);
}

.status-on::before {
  border-color: var(--accent);
  background: var(--accent);
}

.fine {
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Sections */

.band {
  padding-block: var(--band-pad);
  border-top: 1px solid var(--line);
}

/* A sticky heading column beside longer content */
.cols {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 32px var(--gap);
  align-items: start;
}

@media (min-width: 961px) {
  .lead {
    position: sticky;
    inset-block-start: calc(var(--header) + 32px);
  }
}

.lead > p {
  max-width: 24rem;
  margin-top: 14px;
  color: var(--muted);
}

/* Running text beside a heading or a picture */
.prose > * + * {
  margin-top: 16px;
}

.prose > p:not(.status) {
  max-width: 60ch;
}

.prose > .status {
  margin-top: 12px;
}

.prose > .status + p {
  margin-top: 24px;
}

.prose > .actions {
  margin-top: 28px;
}

/* A separate surface. It holds wells and fields, so its radius is theirs plus the inset. */
.frame {
  padding: var(--card-pad);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
}

/* An address or link beside its copy button, inset in a framed surface */

.well {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: var(--well-pad);
  padding-inline-start: 14px;
  border-radius: var(--r-well);
  background: var(--bg);
}

.well > div {
  padding-block: 6px;
}

.well small {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

.well code {
  display: block;
  margin-top: 4px;
  font: 0.8125rem/1.45 var(--mono);
  letter-spacing: 0;
  word-break: break-all;
  text-wrap: balance;
}

.well button {
  min-width: 104px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-button);
  background: var(--surface);
  color: var(--text);
  font: 600 0.875rem var(--sans);
  cursor: pointer;
}

.well button.copied {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

/* Forms */

/* Line heights here resolve to whole pixels, so every field edge lands on the pixel grid. */
label {
  display: grid;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.6;
}

/* Fields share the height and radius of the button that submits them. */
input:not([type='checkbox']) {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field-line);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--text);
  font: 1rem var(--sans);
  letter-spacing: inherit;
}

input:not([type='checkbox']):focus-visible {
  border-color: transparent;
  outline-offset: -2px;
}

/* A checkbox with its sentence beside it */
.check {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  color: var(--muted);
  font-weight: 400;
  cursor: pointer;
}

.check input {
  appearance: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  border: 1px solid var(--field-line);
  border-radius: var(--r-button);
  background: var(--bg) center / 12px no-repeat;
  cursor: pointer;
}

.check input:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%231f1109' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.5 5 9l4.5-5.5'/%3E%3C/svg%3E");
}

/* Account pages (member, admin) */

/* They are read in short visits, so their sections sit closer than the landing's. */
.app {
  --band-pad: clamp(40px, 6vw, 72px);
}

/* Signed-out view: the brand above one centred block */

.gate {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100dvh;
  padding-block: 20px clamp(48px, 10vh, 96px);
}

.gate-card {
  align-self: center;
  max-width: 40rem;
  padding-block: 48px;
}

.gate-card h1 {
  font-size: clamp(2.75rem, 6vw, 4.5rem);
}

.gate-card > p:not(.fine) {
  margin-top: 24px;
  color: var(--muted);
  font-size: clamp(1.125rem, 1.4vw, 1.25rem);
  line-height: 1.45;
}

.gate-card .actions {
  margin-top: 32px;
}

.gate-card .fine {
  margin-top: 32px;
}

/* The page title with its summary figures */

.welcome {
  padding-block: clamp(48px, 8vh, 88px) clamp(48px, 7vh, 80px);
}

.welcome h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.5rem);
}

.welcome > p {
  max-width: 36rem;
  margin-top: 24px;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--gap);
  margin: clamp(40px, 6vh, 64px) 0 0;
}

.stats > div {
  padding-top: 16px;
  border-top: 1px solid var(--line-strong);
}

.stats dt {
  color: var(--muted);
  font-size: 0.9375rem;
}

.stats dd:first-of-type {
  margin-top: 6px;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stats dd:first-of-type span {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.012em;
}

.stats dd + dd {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.lead .status {
  margin-top: 14px;
}

.lead .fine {
  margin-top: 20px;
}

/* What a form or an action reports back */

.form-message {
  display: grid;
  gap: 4px;
  font-size: 0.9375rem;
}

.form-message:empty {
  display: none;
}

.form-message.error {
  color: var(--danger);
}

/* Footer */

.footer {
  padding-block: 36px 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 32px;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
}

.footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.footer p {
  margin-inline-start: auto;
}

/* Pointer and motion */

@media (hover: hover) {
  a:hover {
    text-decoration-color: var(--accent);
  }

  #primary-nav a:not(.btn):hover,
  .footer nav a:hover {
    color: var(--text);
  }

  .btn:hover {
    background: #ff905c;
  }

  .btn-quiet:hover,
  .well button:not(.copied):hover {
    border-color: var(--text);
  }

  .btn-quiet:hover {
    background: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  a,
  .btn,
  .well button {
    transition-property: color, background-color, border-color, text-decoration-color, scale;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
  }

  .btn:active,
  .well button:active {
    scale: 0.96;
  }
}

/* Narrow screens */

@media (max-width: 960px) {
  .nav-toggle {
    display: block;
  }

  #primary-nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    inset-block-start: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: calc(100dvh - var(--header));
    padding: 4px var(--gutter) 20px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .nav[data-open] #primary-nav {
    display: flex;
  }

  #primary-nav a:not(.btn) {
    display: flex;
    align-items: center;
    min-height: 48px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 1rem;
  }

  #primary-nav .btn {
    min-height: 48px;
    margin-top: 16px;
  }

  .cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .lead > p {
    max-width: 44rem;
  }
}

@media (max-width: 620px) {
  .stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .footer p {
    margin-inline-start: 0;
  }
}

@media (max-width: 440px) {
  .well {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding-inline-start: var(--well-pad);
  }

  .well > div {
    padding-inline: 8px;
  }

  .actions .btn {
    width: 100%;
  }
}
