/* resk.bio – shared foundation: font, tokens, reset, buttons, form controls */

@font-face {
  font-family: 'Outfit Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/outfit-latin-wght-normal.woff2') format('woff2');
  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: 'Outfit Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/outfit-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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: dark;

  --bg: #08090d;
  --bg-raised: #0e1017;
  --surface: #131621;
  --surface-hover: #1a1e2c;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  --text: #f3f4f8;
  --text-soft: #a5abbf;
  --text-faint: #6c7288;

  --accent: #7c8cff;
  --accent-ink: #0b0c12;
  --danger: #ff6b7a;
  --success: #4ade80;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --font: 'Outfit Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/*
 * Two companion hues derived from the accent, used for gradients and glows.
 * Profiles set their own --accent inline, so the hues are re-derived there too.
 */
:root,
[style*='--accent'] {
  --glow-a: var(--accent);
  --glow-b: var(--accent);
}

@supports (color: oklch(from red l c h)) {
  :root,
  [style*='--accent'] {
    --glow-a: oklch(from var(--accent) l c calc(h + 55));
    --glow-b: oklch(from var(--accent) l c calc(h - 45));
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: inherit;
}

img,
video {
  display: block;
  max-width: 100%;
}

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

button {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Verified badge behind a name: a seal in the accent colour with a tick on top. */
.verified {
  display: inline-grid;
  place-items: center;
  width: 0.82em;
  height: 0.82em;
  margin-left: 0.26em;
  vertical-align: -0.07em;
  color: var(--accent);
}

.verified .icon {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.verified .icon + .icon {
  color: var(--accent-ink);
}

/* ------------------------------------------------------------------ logo */

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 550;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}

.btn--primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 86%, white);
}

.btn--soft {
  background: var(--surface);
  border-color: var(--line);
}

.btn--soft:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.btn--ghost {
  color: var(--text-soft);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.btn--danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 24%, transparent);
}

/* Discord's brand colour, so the button is recognisable at a glance */
.btn--discord {
  background: #5865f2;
  color: #fff;
}

.btn--discord:hover:not(:disabled) {
  background: #6b77f5;
}

.btn--block {
  width: 100%;
}

.btn--sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.88rem;
}

/* ----------------------------------------------------------------- forms */

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span,
.field__label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-soft);
}

.input,
.field input:not([type='range'], [type='checkbox'], [type='radio'], [type='file'], [type='color']),
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.5;
}

.field select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a5abbf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-faint);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Input with a fixed prefix such as "resk.bio/" */
.prefixed {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding-left: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.prefixed:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.prefixed > span {
  color: var(--text-faint);
  white-space: nowrap;
}

.field .prefixed input,
.prefixed input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0 14px 0 2px;
  border: 0;
  background: none;
  box-shadow: none;
  outline: none;
}

.hint {
  font-size: 0.84rem;
  color: var(--text-faint);
}

.hint.is-ok {
  color: var(--success);
}

.hint.is-bad,
.form-error {
  color: var(--danger);
}

.form-error {
  font-size: 0.9rem;
}

/* Toggle switch – a styled checkbox */
.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background-color 0.2s;
}

.switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--ease);
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::before {
  transform: translateX(18px);
}

/*
 * Range slider with a slim bar as its handle.
 * --p is the filled share (0–1) and is kept in sync by script (paintRange).
 * The fill ends exactly under the middle of the handle: the handle can only
 * travel the track width minus its own width, so the stop is offset the same way.
 */
.range {
  --p: 0;
  --thumb-w: 5px;
  --thumb-h: 15px;
  --track-h: 4px;
  --fill: calc(var(--thumb-w) / 2 + (100% - var(--thumb-w)) * var(--p));
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 20px;
  margin: 0;
  background: none;
  cursor: pointer;
}

/* The handle shows keyboard focus (below), so neither the page-wide focus outline
   nor the focus ring that text fields get (.field input:focus) belongs on a slider. */
.range:focus,
.range:focus-visible,
.field .range:focus {
  outline: none;
  box-shadow: none;
}

.range::-webkit-slider-runnable-track {
  height: var(--track-h);
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, 0.16) 0);
}

.range::-moz-range-track {
  height: var(--track-h);
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, 0.16) 0);
}

.range::-webkit-slider-thumb {
  appearance: none;
  width: var(--thumb-w);
  height: var(--thumb-h);
  margin-top: calc((var(--track-h) - var(--thumb-h)) / 2); /* centre the bar on the track */
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  transition: transform 0.15s, box-shadow 0.15s;
}

.range::-moz-range-thumb {
  width: var(--thumb-w);
  height: var(--thumb-h);
  border: 0;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  transition: transform 0.15s, box-shadow 0.15s;
}

.range:hover::-webkit-slider-thumb,
.range:active::-webkit-slider-thumb {
  transform: scaleY(1.15);
}

.range:hover::-moz-range-thumb,
.range:active::-moz-range-thumb {
  transform: scaleY(1.15);
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);
}

.range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  display: grid;
  gap: 8px;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 420px);
  padding: 11px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #1b1f2d;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  font-size: 0.92rem;
  animation: toast-in 0.3s var(--ease) both;
}

.toast .icon {
  color: var(--success);
}

.toast--error .icon {
  color: var(--danger);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

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