:root {
  --bg: #0f1117;
  --fg: #e6e9ef;
  --accent: #7c5cff;
  --accent-hover: #a48bff;
  --muted: #8a92a6;
  --radius: 999px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  /* svh keeps the layout stable while the mobile URL bar shows/hides */
  min-height: 100svh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top, #1a1d2e, var(--bg));
  background-attachment: fixed;
  color: var(--fg);
  /* flex (not grid place-items:center): keeps the container at the viewport
     width instead of shrinking to content, which caused horizontal overflow
     on phones when a label/heading was wider than the screen. */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* fluid gutter + respect notches/safe areas on phones */
  padding: clamp(1rem, 4vw, 2.5rem);
  padding-top: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-top, 0px));
  padding-bottom: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-bottom, 0px));
}

.container {
  width: 100%;
  max-width: 900px;
  text-align: center;
}

h1 {
  margin: 0 0 clamp(1.5rem, 5vw, 2.5rem);
  font-weight: 300;
  font-size: clamp(1.35rem, 5vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* ---------------------------------------------------------------
   MOBILE FIRST: a clean vertical list of equal-sized tap targets.
   The per-link inline `--size` weight is intentionally ignored here
   so every menu item is uniform and comfortable to tap on a phone.
   --------------------------------------------------------------- */
.tag-cloud {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: stretch;
}

.tag-cloud a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;            /* >= 44px touch target, with breathing room */
  padding: 0.85rem 1.25rem;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, color 0.2s ease,
              background 0.2s ease, border-color 0.2s ease;
}

/* touch feedback */
.tag-cloud a:active {
  transform: scale(0.98);
  background: rgba(124, 92, 255, 0.14);
  border-color: var(--accent);
}

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

/* hover effects only where a real pointer exists (not on touch) */
@media (hover: hover) {
  .tag-cloud a:hover,
  .tag-cloud a:focus-visible {
    color: var(--accent-hover);
    background: rgba(124, 92, 255, 0.12);
    border-color: var(--accent);
    transform: translateY(-2px);
    outline: none;
  }
}

/* ---------------------------------------------------------------
   TABLET / DESKTOP: the weighted "word cloud".
   Pill size = per-link inline --size weight, but made fluid:
   it scales gently with the viewport and is clamped so the
   heaviest item never overflows and the lightest stays readable.
   --------------------------------------------------------------- */
@media (min-width: 600px) {
  .tag-cloud {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.6rem 0.85rem;
    justify-content: center;
    align-items: center;
    line-height: 1.2;
  }

  .tag-cloud a {
    --size: 1rem;
    display: inline-block;
    min-height: 0;
    padding: 0.4em 0.95em;
    /* floor 1rem · target grows with viewport toward the weight · cap 2.25rem */
    font-size: clamp(1rem, calc(0.7rem + var(--size) * 0.45 + 0.4vw), 2.25rem);
    font-weight: 400;
    border-radius: var(--radius);
  }

  @media (hover: hover) {
    .tag-cloud a:hover,
    .tag-cloud a:focus-visible {
      transform: translateY(-2px) scale(1.05);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .tag-cloud a { transition: none; }
  .tag-cloud a:active,
  .tag-cloud a:hover,
  .tag-cloud a:focus-visible { transform: none; }
}
