/* Pioneer Garden — fluid foundations (plan §2: no fixed widths, tokens, container queries). */

:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --text: #24312a;
  --muted: #5f6f66;
  --brand: #2e5339;
  --brand-contrast: #ffffff;
  --border: #dcded6;
  --radius: 14px;
  --space: clamp(0.75rem, 2vw, 1.25rem);
  --tabbar-h: calc(3.5rem + env(safe-area-inset-bottom, 0px));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171d19;
    --surface: #212925;
    --text: #e7ece8;
    --muted: #9fb0a6;
    --brand: #7cb08c;
    --brand-contrast: #14201a;
    --border: #33403a;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: clamp(15px, 1.6vw, 17px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--space) var(--space) calc(var(--tabbar-h) + var(--space));
  container-type: inline-size;
}

.page-header h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(1.4rem, 4cqw, 1.8rem);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
  margin-top: var(--space);
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.empty-state p {
  color: var(--muted);
}

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

/* Bottom tab bar: the phone-primary navigation (plan §2 tier ≤640px). */
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.7rem;
}

.tab.active {
  color: var(--brand);
  font-weight: 600;
}

.tab-icon {
  font-size: 1.15rem;
}

/* Tablet/laptop and up: the tab bar becomes a left rail; content widens.
   Fuller pane tiers (3-pane, dashboard) land with real content in M1. */
@media (min-width: 640px) {
  .app {
    flex-direction: row;
  }

  .tabbar {
    position: sticky;
    top: 0;
    inset: auto;
    height: 100dvh;
    width: 5.5rem;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: var(--space);
    border-top: none;
    border-right: 1px solid var(--border);
  }

  .tab {
    flex: 0 0 auto;
    padding: 0.8rem 0;
  }

  .app-main {
    max-width: 60rem;
    padding-bottom: var(--space);
  }
}

@media (min-width: 1280px) {
  .app-main {
    max-width: 80rem;
  }
}

/* Auth pages */
.auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space);
  background: var(--bg);
}

.auth-card {
  width: min(24rem, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(var(--space) * 1.5);
  text-align: center;
}

.auth-card h1 {
  font-size: 1.3rem;
  margin: 0.5rem 0;
}

.auth-card form {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

input[type='email'] {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

button {
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-contrast);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--border);
}

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