/*
 * The base styles every page starts from: sensible box sizes, the page font and colours,
 * headings, links, buttons with their browser look removed, the keyboard focus ring, and a few
 * small helpers. Loaded on every page by index.html, right after tokens.css. Colours come from
 * tokens.css.
 */

/* Widths include padding and borders, which makes layouts far easier to reason about. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The whole page: font, colours and smooth text. */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Headings and paragraphs: no browser margins, so each component sets its own spacing. */
h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

/* Lists that have a class are menus or layouts, not bullet lists. */
ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

/* Pictures never overflow their box. */
img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Buttons and form fields use the page's font instead of the browser's. */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

button:disabled {
  cursor: not-allowed;
}

/* The ring that shows where you are when moving around with the keyboard. */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}

/* Anything marked hidden stays hidden, whatever other styles say. */
[hidden] {
  display: none !important;
}

/* Text for screen readers only: there for them, invisible on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* "Skip to content": the first thing keyboard users reach, shown only when focused. */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
}

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

/* The "Globe Social" name beside the logo. */
.wordmark {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Small layout helpers: push things apart, or stack them with even gaps. */
.spacer {
  flex: 1;
}

.stack {
  display: grid;
  gap: 16px;
}

/* Invite-only servers (core/site-flags.js): no sign-up buttons, except ones that carry an invite. */
.invite-only a[href^="/register"]:not([href*="invite="]),
.invite-only a[href="/join"],
.invite-only [data-signup] {
  display: none !important;
}

/* Phones: iPhone Safari zooms the whole page in when you tap a field whose text is smaller
   than 16px, and leaves it zoomed (cards then look cut off on the right). Fields on touch
   screens are kept at 16px or more so that never happens. */
@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: max(16px, 1em);
  }
}
