@import url("../../fonts/fonts.css");

/*
 * Design tokens and basics.
 *
 * The UI is meant for three device classes: a phone in the judge's hand,
 * a tablet at the organisers' table, a laptop for the evaluation. The
 * values here apply everywhere, the layout per view is set by the
 * individual stylesheets.
 */

:root {
  color-scheme: light;

  --bg: #eceff1;
  --surface: #ffffff;
  --surface-quiet: #f4f6f8;
  --ink: #101315;
  --ink-soft: #3d464e;
  --muted: #5b656e;
  --line: #ced5db;
  --line-strong: #aeb8c0;

  /* Hint, not an error: pending transfers, a waiting queue. */
  --warn-bg: #fbf0dd;
  --warn-line: #e0bd85;
  --warn-ink: #8a5a12;

  /* Error: something went wrong and needs a decision. */
  --error-bg: #fdeceb;
  --error-line: #eab5b1;
  --error-ink: #9c2f24;

  --radius: 12px;
  --radius-small: 9px;

  /* Smallest tap target. Nothing goes below it. */
  --target: 44px;

  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-numeric: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  --shadow-top: 0 -6px 18px rgba(16, 19, 21, 0.07);
  --shadow-button: 0 3px 10px rgba(16, 19, 21, 0.22);
}

* {
  box-sizing: border-box;
}

/*
 * Own display values would otherwise override the hidden attribute.
 * Without this line an empty pill stayed in the header where the message
 * about pending transfers should have been.
 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  /* Digits have equal width, so a value does not jump while counting. */
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  /* No overscroll at the edge: the page should stand still while counting. */
  overscroll-behavior-y: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  margin: 0;
}

::selection {
  background: var(--ink);
  color: var(--surface);
}

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

/* Every tap target is a button. touch-action removes the delay the
   browser otherwise waits for a possible double-tap zoom. */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

input {
  font: inherit;
  color: inherit;
}

.numeric {
  font-family: var(--font-numeric);
  font-weight: 600;
}

/* Only visible to screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Jump to the main area, for keyboard users. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 50;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: var(--radius-small);
  transition: top 140ms ease-out;
}

.skip-link:focus {
  top: 12px;
}

/* --- Recurring building blocks ------------------------------------ */

.surface-button {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background-color 120ms ease-out,
    border-color 120ms ease-out;
}

.surface-button:hover {
  background: var(--surface-quiet);
  border-color: var(--line-strong);
}

.surface-button[aria-checked="true"],
.surface-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
  font-weight: 600;
}

.surface-button[aria-checked="true"]:hover,
.surface-button.active:hover {
  background: #24292e;
  border-color: #24292e;
}

.primary-button {
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-button);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  min-height: 56px;
  padding: 0 18px;
  font-weight: 600;
  transition: background-color 120ms ease-out;
}

.primary-button:hover:not(:disabled) {
  background: #24292e;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge--hint {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn-ink);
}

.badge--error {
  background: var(--error-bg);
  border-color: var(--error-line);
  color: var(--error-ink);
}

.badge--quiet {
  background: var(--surface-quiet);
  color: var(--muted);
  font-weight: 500;
}

.badge--done {
  background: var(--ink);
  color: var(--surface);
}

/*
 * Notice page: the failure message from shared/access.js.
 *
 * It lives here and not with the page styles because it can appear on
 * every page - including the station, which does not load pages.css. When
 * it lived there, the "Keine Verbindung" message stood unstyled in the top
 * left corner.
 */
.notice-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 24px 16px;
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.notice-page__card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.notice-page__title {
  font-size: 1.5rem;
}

.notice-page__text {
  color: var(--muted);
  font-size: 0.9375rem;
  max-width: 60ch;
}

.notice-page .primary-button {
  align-self: stretch;
}

@media (min-width: 760px) {
  .notice-page__card {
    padding: 30px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
