/*
 * Base: reset + mobile-first primitives. Designed at 375px first.
 * References theme tokens only. No hardcoded colors/fonts/radii.
 */

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

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: var(--texture-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 {
  font-size: 1.9rem;
}
h2 {
  font-size: 1.35rem;
}
h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--color-accent);
}

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

.mono {
  font-family: var(--font-mono);
}

.center {
  text-align: center;
}

/* Off-screen but still focusable and still labelable - used for the file
   input hidden behind its label-as-button, and for icon-button text. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Main container: narrow, phone-first, centered on larger screens. */
.page {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1.1rem 6rem; /* bottom padding leaves room for sticky actions */
}

/* Admin dashboards opt into a laptop-width container. Guest pages never do. */
.page-wide {
  max-width: 72rem;
}

/* Sticky, bottom-weighted action bar: primary buttons in thumb reach. */
.action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.85rem 1.1rem calc(0.85rem + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--color-border);
}

.action-bar .btn {
  width: 100%;
}

.stack > * + * {
  margin-top: 1rem;
}

.stack-sm > * + * {
  margin-top: 0.5rem;
}

/* Flash messages */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.flash-notice {
  border-color: color-mix(in srgb, var(--color-success) 40%, var(--color-border));
}
.flash-alert {
  border-color: color-mix(in srgb, var(--color-danger) 45%, var(--color-border));
}

/* Desktop is the exception: widen a touch, nothing more. */
@media (min-width: 48rem) {
  body {
    font-size: 18px;
  }
  h1 {
    font-size: 2.3rem;
  }
}
