/* Reset, page background, type, buttons and small shared utilities. */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 88% -8%, var(--glow), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 72px 72px, 72px 72px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Topographic contours behind everything, tinted by the theme. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: var(--topo-ink);
  -webkit-mask: url('../img/topo.svg') center / cover no-repeat;
  mask: url('../img/topo.svg') center / cover no-repeat;
}

#root {
  position: relative;
  z-index: 1;
}

.noscript {
  padding: 48px 16px;
  color: var(--ink);
  text-align: center;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--f-display);
  line-height: 1.15;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

a:hover {
  color: var(--accent-hi);
  text-decoration-color: currentColor;
}

a .icon {
  display: inline-block;
  margin-left: 3px;
  vertical-align: -1px;
}

strong {
  color: var(--ink);
  font-weight: 600;
}

code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

kbd {
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--mute);
  font-family: var(--f-mono);
  font-size: 11px;
  line-height: 1.4;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

::selection {
  background: var(--accent-fill);
  color: var(--on-accent);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Small mono labels above titles, with the banner's ornaments. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--blue);
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow--rule::before,
.ornament::before,
.ornament::after {
  content: '';
  flex: none;
  width: 44px;
  height: 8px;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='8'%3E%3Cpath d='M4 .5 7.5 4 4 7.5.5 4Z'/%3E%3Cpath d='M8 3.5h36v1H8z'/%3E%3C/svg%3E") no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='8'%3E%3Cpath d='M4 .5 7.5 4 4 7.5.5 4Z'/%3E%3Cpath d='M8 3.5h36v1H8z'/%3E%3C/svg%3E") no-repeat;
}

.ornament::after {
  transform: scaleX(-1);
}

.eyebrow--dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 14px var(--accent);
}

/* NuQta: an amber point sits in the counter of the Q. With line-height 1 the box's middle is the
   counter's middle in Saira; the box also holds the 0.06em letter-spacing after the Q, so the
   point moves back by half of it. */
.wordmark-q {
  position: relative;
  display: inline-block;
  line-height: 1;
}

.wordmark-q::after {
  content: '';
  position: absolute;
  top: 50%;
  left: calc(50% - 0.03em);
  width: 0.2em;
  height: 0.2em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fdc346, #f39e21 55%, #d9771a);
  transform: translate(-50%, -50%);
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  color: var(--accent);
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill--solid {
  border-color: transparent;
  background: var(--accent-fill);
  color: var(--on-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 120ms ease;
}

.btn:hover {
  border-color: var(--accent-line);
  color: var(--ink);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary,
.btn--complete {
  border-color: transparent;
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: 0 12px 30px -14px var(--accent);
}

.btn--primary:hover,
.btn--complete:hover {
  border-color: transparent;
  background: var(--accent-hi);
  color: var(--on-accent);
}

.btn--primary:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn--complete.is-done {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
  box-shadow: none;
}

.btn--block {
  width: 100%;
  height: 50px;
}

.btn--small {
  height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.iconbtn:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

/* Corner ticks, the HUD signature: on illustrations, the viewport and active cards. */
.hud {
  position: relative;
}

.hud::after {
  --c: rgba(243, 158, 33, 0.6);
  content: '';
  position: absolute;
  inset: 10px;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 1px 14px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 14px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 14px no-repeat;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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