/* =========================================================
   base.css — global resets, safe-area, native-app feel
   ========================================================= */

/* CSS Variables (theme tokens) */
:root {
  --bg: #000000;
  --bg-elevated: #111111;
  --surface: rgba(20, 20, 20, 0.92);
  --surface-translucent: rgba(0, 0, 0, 0.55);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.65);
  --text-faint: rgba(255, 255, 255, 0.4);
  --accent: #ffd54f;          /* yellow halo */
  --accent-glow: rgba(255, 213, 79, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);
  --danger: #ff5c5c;
  --success: #4ade80;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);

  /* Safe-area insets (fall back to 0 on devices without notch) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --header-h: 52px;

  /* Touch tap target minimum */
  --tap-min: 44px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Disable iOS double-tap zoom & 300ms delay */
html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* Lock body to viewport — map fills the screen */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  /* No bounce-out of the app shell */
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  position: fixed;
  inset: 0;
}

/* App chrome — UI elements, never selectable */
.app-chrome,
.app-chrome * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Content surfaces (post body, comments) — selectable */
.selectable, .selectable * {
  -webkit-user-select: text;
  user-select: text;
}

/* Buttons */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Form inputs */
input, textarea, select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input, textarea {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* Hover states only on devices that actually hover (desktop) */
@media (hover: hover) {
  button:hover:not(:disabled) {
    opacity: 0.85;
  }
}

/* Scroll containers (used inside overlays) */
.scroll-y {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; /* iOS momentum */
}

/* Visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Toast root */
#toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-bottom) + 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 9999;
}
