/* base.css
   Reset, typography and the page shell.
   Portrait phone is the default. Landscape and wide screens are handled at the bottom. */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

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

.muted { color: var(--text-2); }
.small { font-size: var(--text-sm); }
.center { text-align: center; }
.hidden { display: none !important; }

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

/* ---------- Page shell ---------- */
/* <div class="app-shell"> <main class="app-main"> ... </main> <nav class="bottom-nav"> ... </nav> </div> */

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
}

.app-main {
  padding: calc(var(--space-6) + var(--safe-top)) calc(var(--space-4) + var(--safe-right))
           var(--space-6) calc(var(--space-4) + var(--safe-left));
}

.page-narrow { width: min(100%, var(--narrow)); margin-inline: auto; }
.page-wide   { width: min(100%, var(--wide));   margin-inline: auto; }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }

/* Centred single-purpose screens (join, homepage) */
.screen-center {
  min-height: calc(100dvh - var(--space-6) * 2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}

/* Bottom navigation (client: Home, Bookings, Me. Owner: Today, Calendar, Manage) */
.bottom-nav {
  position: sticky; bottom: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface-1);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: var(--nav-height);
  color: var(--text-2); font-size: var(--text-xs);
}
.bottom-nav a[aria-current="page"] { color: var(--accent); }

/* ---------- Wider screens: tablets and laptops ---------- */
@media (min-width: 900px) {
  .app-main { padding-inline: var(--space-8); }
  /* Owner pages: two columns, e.g. appointments left, queue and waitlist right */
  .layout-2col {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: var(--space-8); align-items: start;
  }
}

/* ---------- Landscape phones (short screens) ----------
   The bottom bar turns into a slim rail on the left to save vertical space. */
@media (orientation: landscape) and (max-height: 520px) {
  .app-shell {
    grid-template-columns: var(--rail-width) 1fr;
    grid-template-rows: 1fr;
  }
  .bottom-nav {
    order: -1;
    position: sticky; top: 0; height: 100dvh;
    grid-template-columns: 1fr; grid-auto-rows: 1fr; align-content: center;
    border-top: 0; border-right: 1px solid var(--border);
    padding: var(--safe-top) 0 var(--safe-bottom) var(--safe-left);
  }
  .app-main { padding-block: var(--space-4); }
  .screen-center { min-height: calc(100dvh - var(--space-4) * 2); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
