/* The shared styles of every page: tokens, the top bar, buttons, forms, cards and badges. No build
   step: native nesting, flexbox, light-dark() for the system's light or dark mode.
   The brand is the first block of tokens, ALSO's green and teal by default. A partner changes these
   values (and the logo and favicon in brand/) and every page follows; the pages' own sheets use
   tokens only. Corners are square throughout. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* the brand */
  --brand: #89e872; /* bright accent: buttons, live marks */
  --brand-deep: #006b7d; /* deep accent: links and focus in light mode */
  --on-brand: #181818;

  /* surfaces and text */
  --bg: light-dark(#f3f3eb, #0e100e);
  --surface: light-dark(#ffffff, #171a17);
  --surface-2: light-dark(#f8f8f2, #1e221e);
  --text: light-dark(#181818, #ecefe8);
  --muted: light-dark(#5a5a55, #a2a89d);
  --line: light-dark(#e3e3d8, #2b302a);
  --accent: light-dark(var(--brand-deep), var(--brand));
  --tint: light-dark(#e7fae3, #1b2a1a);
  --on-tint: light-dark(#1d5c12, var(--brand));
  --live: #e5484d;
  --warn: light-dark(#8a5a00, #f5c46b);
  --warn-tint: light-dark(#fff4dc, #2e2412);
  --danger: light-dark(#b42318, #ff8a80);
  --stage: #101210; /* behind a deck while it loads */
  --on-stage: #c9cec5;

  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  font: 16px/1.5 var(--font);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

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

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
}

[hidden] {
  display: none !important;
}

/* square corners everywhere: the look has none, and some browsers round controls by default */
button,
input,
select,
textarea {
  border-radius: 0;
}

.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

.offscreen {
  position: fixed;
  top: 0;
  left: -9999px;
}

/* a column of blocks with even gaps: cards, forms, panels; tight for a title and its details */
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;

  &.tight {
    gap: 6px;
  }
}

/* items side by side that wrap on narrow screens */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;

  &.end {
    justify-content: flex-end;
  }
  &.bottom {
    align-items: flex-end;
  }
  &.split {
    justify-content: space-between;
  }
  /* equal columns, at least 180px each */
  &.even > * {
    flex: 1 1 180px;
    min-width: 0;
  }
}

/* ------------------------------------------------------------------ the top bar */
.bar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);

  & .logo {
    display: flex;
    flex: none;

    & img {
      width: auto;
      height: 30px;
    }
  }
  & .name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-left: 14px;
    color: inherit;
    text-decoration: none;
    border-left: 1px solid var(--line);

    & small {
      color: var(--muted);
      font-size: 0.75rem;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    & strong,
    & h1 {
      margin: 0;
      overflow: hidden;
      font-size: 1rem;
      font-weight: 700;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
  & .end {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    margin-left: auto;
  }
}

/* ------------------------------------------------------------------ buttons */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s;

  &:hover {
    border-color: color-mix(in srgb, var(--text) 30%, var(--line));
  }
  &:active {
    transform: translateY(1px);
  }
  &:disabled {
    opacity: 0.5;
    cursor: default;
  }
  &.primary {
    color: var(--on-brand);
    background: var(--brand);
    border-color: var(--brand);

    &:hover {
      background: color-mix(in srgb, var(--brand) 85%, var(--on-brand));
    }
  }
  &.quiet {
    color: var(--muted);
    background: transparent;
    border-color: transparent;

    &:hover {
      color: var(--text);
      background: var(--surface-2);
    }
  }
  &.danger {
    color: var(--danger);

    /* the button that deletes, in a dialog that asks first */
    &.solid {
      color: var(--surface);
      background: var(--danger);
      border-color: var(--danger);
    }
  }
  /* a button that reads as a link, inside a line of text */
  &.link {
    padding: 0;
    color: var(--accent);
    font-size: inherit;
    text-decoration: underline;
    background: none;
    border: 0;
  }
  &.small {
    padding: 6px 12px;
    font-size: 0.8125rem;
  }
  &.icon-only {
    padding: 7px;
  }
}

/* the app's own dialogs, instead of the browser's: a title, a few words, the buttons */
dialog.box {
  width: min(480px, calc(100vw - 32px));
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);

  &[open] {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  & h2 {
    margin: 0;
    font-size: 1.25rem;
  }
  & p {
    margin: 0;
    color: var(--muted);
  }
  &::backdrop {
    background: rgb(0 0 0 / 45%);
  }
}

/* the legal notice and the privacy notice, linked from every page: the page's footer, at the
   bottom of the window however short the page is. Without specificity, so a page's own layout
   (the event page on a phone) wins. */
:where(body:has(> .legal)) {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
.legal {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-top: auto;
  padding: 18px 20px;
  font-size: 0.8125rem;

  & a {
    color: var(--muted);

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

/* ------------------------------------------------------------------ tabs (js/tabs.js) */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;

  & button {
    color: var(--muted);
    background: transparent;
    border-color: transparent;

    &:hover {
      color: var(--text);
      background: var(--surface-2);
    }
    &[aria-selected="true"] {
      color: var(--surface);
      background: var(--text);
    }
  }
}

/* ------------------------------------------------------------------ forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;

  & > span {
    font-size: 0.875rem;
    font-weight: 600;
  }
}
.field small,
.hint {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

input:is([type="text"], [type="email"], [type="search"], [type="date"], [type="time"], :not([type])),
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9375rem;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);

  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 0;
    border-color: transparent;
  }
}
textarea {
  min-height: 3.2lh;
  resize: vertical;
  field-sizing: content;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;

  & input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 3px 0 0;
    accent-color: var(--brand-deep);
  }
}

.error {
  margin: 0;
  color: var(--danger);
  font-size: 0.875rem;
}

/* ------------------------------------------------------------------ cards, badges, notes */
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);

  & > :is(h2, h3) {
    margin: 0;
    font-size: 1.0625rem;
  }
  & > .lede {
    margin: -6px 0 0;
    color: var(--muted);
    font-size: 0.9375rem;
  }
}

/* the small heading above a list */
.label {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;

  & small {
    display: block;
    margin-top: 4px;
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
  }
}

/* a small square with an icon, in front of a heading or a link */
.ic {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--tint);
  color: var(--accent);
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);

  &.ok {
    color: var(--on-tint);
    background: var(--tint);
    border-color: transparent;
  }
  &.warn {
    color: var(--warn);
    background: var(--warn-tint);
    border-color: transparent;
  }
  &.live {
    color: var(--live);
    background: color-mix(in srgb, var(--live) 14%, transparent);
    border-color: transparent;
  }
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  background: currentColor;
}
.badge.live .dot,
.pulse {
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-size: 0.9375rem;
  text-align: center;
  border: 1px dashed var(--line);
}
.sent {
  margin: 0;
  padding: 12px 14px;
  background: var(--tint);
}

/* the note at the bottom of the page */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 18px;
  font-size: 0.9375rem;
  color: light-dark(#fff, #111);
  background: light-dark(#1d211d, #e9ede6);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 20px);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;

  &.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  &.is-error {
    color: #fff;
    background: var(--danger);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
