/* ═══════════════════════════════════════════════════
   Miuix Base — Reset & foundation
   ═══════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: flex;
  flex-direction: column;
  font-family: var(--font-system);
  font-size: var(--fs-body1);
  font-weight: var(--fw-normal);
  color: var(--mi-on-background);
  background: var(--mi-surface);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Scroll area ── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  background: transparent;
  padding-top: calc(var(--topbar-h) + var(--safe-top));
  padding-bottom: calc(var(--navbar-h) + var(--safe-bottom) + 20px);
  scrollbar-width: none;
}

.scroll-area::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ── Button reset ── */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  color: inherit;
  font-size: inherit;
}

button,
.editor-photo-thumb {
  touch-action: manipulation;
}

/* ── Input / Textarea reset ── */
input, textarea {
  font-family: inherit;
  outline: none;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  caret-color: var(--mi-primary);
  accent-color: var(--mi-primary);
}

input::selection,
textarea::selection {
  color: var(--mi-on-primary);
  background: var(--mi-primary);
}

/* ── Image reset ── */
img {
  display: block;
  max-width: 100%;
}

/* ── Keyboard focus (PC) ──
   Text fields keep their own focus styling (ring/background), so the
   outline only applies to buttons and links to avoid double indicators. */
button:focus-visible,
a:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 2px solid var(--mi-primary);
  outline-offset: 2px;
}

/* ── Utility ── */
.hidden {
  display: none !important;
}

@keyframes miuixFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes miuixFadeScaleIn {
  from {
    opacity: 0;
    transform: scale(var(--mi-media-enter-scale));
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes miuixExpandIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: var(--mi-duration-reduced-motion) !important;
    transition-duration: var(--mi-duration-reduced-motion) !important;
    scroll-behavior: auto !important;
  }
}
