/* Hop landing page. Tokens first; dark mode only swaps the tokens. */

:root {
  color-scheme: light dark;

  --bg: #f6f6f3;
  --surface: #ffffff;
  --ink: #131316;
  --ink-2: #3b3b44;
  --muted: #74747f;
  --line: rgba(19, 19, 22, 0.08);
  --line-strong: rgba(19, 19, 22, 0.15);
  --accent: #5b4cff;
  --accent-2: #c04cff;
  --accent-soft: rgba(91, 76, 255, 0.1);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.1);
  --shadow:
    0 1px 2px rgba(19, 19, 22, 0.04),
    0 10px 30px -12px rgba(19, 19, 22, 0.14),
    0 30px 80px -30px rgba(91, 76, 255, 0.22);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0e;
    --surface: #151519;
    --ink: #f1f1f4;
    --ink-2: #c9c9d1;
    --muted: #8b8b96;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #7c6eff;
    --accent-2: #d17bff;
    --accent-soft: rgba(124, 110, 255, 0.16);
    --danger: #ff6369;
    --danger-soft: rgba(255, 99, 105, 0.14);
    --shadow:
      0 1px 2px rgba(0, 0, 0, 0.4),
      0 16px 48px -16px rgba(0, 0, 0, 0.7),
      0 30px 90px -30px rgba(124, 110, 255, 0.3);
  }
}

/* ------------------------------------------------------------------ base */

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(56rem 28rem at 50% -8rem, var(--accent-soft), transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* A faint dot grid behind the hero, fading out as you scroll. */
body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 620px;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
  pointer-events: none;
  z-index: -1;
}

.wrap {
  width: min(760px, 100% - 32px);
  margin-inline: auto;
}

a {
  color: inherit;
}

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

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

.icon,
.icon-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 550 14px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s,
    transform 0.1s;
}

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

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

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.primary {
  border-color: transparent;
  background: var(--ink);
  color: var(--bg);
}

.btn.primary:hover {
  background: var(--accent);
  color: #fff;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: var(--line);
  color: var(--ink);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.icon-btn.danger:hover,
.icon-btn.armed {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn.armed {
  animation: nudge 0.3s ease;
}

/* ---------------------------------------------------------------- header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.mark {
  width: 30px;
  height: 30px;
}

.mark rect {
  fill: var(--accent);
}

.mark path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 0.1 4.2;
}

.mark circle {
  fill: #fff;
}

.brand:hover .mark path {
  animation: hop 0.9s linear infinite;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.who {
  max-width: 220px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding: 64px 0 0;
  text-align: center;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(44px, 9vw, 78px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.045em;
}

.accent {
  background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 520px;
  margin: 0 auto 40px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  text-wrap: balance;
}

/* The shorten box: one card, the link on top and the optional alias below. */
.shorten {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.shorten:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow:
    0 0 0 4px var(--accent-soft),
    var(--shadow);
}

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
}

.field .icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.field input,
.alias input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
}

.field input {
  height: 52px;
  font: 400 17px var(--sans);
}

.field input::placeholder,
.alias input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.field .btn {
  height: 48px;
  padding: 0 24px;
  border-radius: 14px;
  font-size: 15px;
}

.alias {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 8px -8px -8px;
  padding: 11px 16px 11px 22px;
  border-top: 1px dashed var(--line-strong);
  border-radius: 0 0 20px 20px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  font: 400 14px var(--mono);
}

.prefix {
  flex: 0 1 auto;
  max-width: 60%;
  color: var(--muted);
}

/* Long prefixes are cut from the left, keeping the end of the path in view. */
.prefix,
.base {
  min-width: 0;
  overflow: hidden;
  direction: rtl;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alias input {
  font: 500 14px var(--mono);
}

.optional {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font: 500 11px var(--sans);
  letter-spacing: 0.02em;
}

.note,
.error {
  margin: 14px 0 0;
  font-size: 14px;
}

.note {
  color: var(--muted);
}

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

/* The "your link is ready" card. */
.result {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
  padding: 12px 16px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.result.pop {
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.result-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.label {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.result .short {
  font-size: 19px;
}

.qr-thumb {
  width: 76px;
  height: 76px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: zoom-in;
  transition: transform 0.15s;
}

.qr-thumb:hover {
  transform: scale(1.04);
}

.qr-thumb svg,
.qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}

.short {
  display: flex;
  min-width: 0;
  color: var(--ink);
  font-family: var(--mono);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.short .base {
  color: var(--muted);
  font-weight: 400;
}

.short b {
  flex: none;
  font-weight: 600;
}

a.short:hover b {
  color: var(--accent);
}

.dest {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------ your links */

.links {
  margin-top: 72px;
}

.links-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.count {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font: 500 12px var(--mono);
}

.count:empty {
  display: none;
}

.list {
  margin: 14px 0 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  list-style: none;
}

.list:empty {
  display: none;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 12px 12px 18px;
  transition: background-color 0.15s;
}

.row + .row {
  border-top: 1px solid var(--line);
}

.row:hover {
  background: color-mix(in srgb, var(--ink) 2.5%, var(--surface));
}

.row.fresh {
  animation: fresh 2.4s ease-out;
}

.row-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.row .short {
  font-size: 15px;
}

.clicks {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink-2);
  font: 500 12.5px var(--mono);
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 2px;
}

.empty {
  margin: 14px 0 0;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

/* -------------------------------------------------------------- features */

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 88px;
}

.features article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.features .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

h3 {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.features p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

code {
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--line);
  font: 500 12.5px var(--mono);
}

.foot {
  padding: 64px 0 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.foot a {
  color: var(--ink-2);
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------ QR dialog */

.qr-dialog {
  width: min(340px, 100% - 32px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: center;
}

.qr-dialog[open] {
  animation: pop 0.25s ease-out;
}

.qr-dialog::backdrop {
  background: rgba(10, 10, 14, 0.45);
  backdrop-filter: blur(4px);
}

.qr-code {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.qr-dialog .short {
  justify-content: center;
  margin: 16px 0 18px;
  font-size: 15px;
}

.qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------ animation */

@keyframes hop {
  to {
    stroke-dashoffset: -4.3;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

@keyframes fresh {
  from {
    background: var(--accent-soft);
  }
}

@keyframes nudge {
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

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

/* ---------------------------------------------------------------- small */

@media (max-width: 640px) {
  .hero {
    padding-top: 40px;
  }

  .lede {
    font-size: 16px;
  }

  .who,
  .optional {
    display: none;
  }

  .field {
    flex-wrap: wrap;
    padding-left: 12px;
  }

  .field input {
    flex-basis: calc(100% - 40px);
  }

  .field .btn {
    width: 100%;
  }

  .result {
    grid-template-columns: auto 1fr;
  }

  .result .btn {
    grid-column: 1 / -1;
  }

  .row {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .clicks {
    grid-row: 2;
    justify-self: start;
  }

  .actions {
    grid-row: 1 / 3;
    grid-column: 2;
  }

  .features {
    grid-template-columns: 1fr;
    margin-top: 64px;
  }
}
