/* Ascend with Ang — reset, body, banners, toast, typography scale, forms. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

#app, .screen { min-height: 100vh; min-height: 100dvh; }
body { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }

/* Phone-width by construction. Centre on anything wider. */
#app { max-width: 480px; margin: 0 auto; }

/* --- Type scale (spec §4): 34 / 28 / 22 / 17 / 15 / 13 / 11 --- */
.display { font-family: var(--font-display); font-weight: 400; line-height: 1.12; letter-spacing: .01em; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; }
.t-34 { font-size: 34px; } .t-28 { font-size: 28px; } .t-22 { font-size: 22px; }
.t-17 { font-size: 17px; } .t-15 { font-size: 15px; } .t-13 { font-size: 13px; } .t-11 { font-size: 11px; }

.label {
  font-family: var(--font-body); font-weight: 500;
  text-transform: uppercase; letter-spacing: .18em; font-size: 11px;
  color: var(--muted);
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Banners + toast --- */
.offline-banner {
  position: fixed; top: var(--safe-top); left: 0; right: 0; z-index: 60;
  background: var(--amber-pale); color: var(--text);
  text-align: center; padding: 10px 16px; font-size: 13px;
}
.update-banner {
  position: fixed; left: 16px; right: 16px; bottom: calc(24px + var(--safe-bottom)); z-index: 60;
  max-width: 448px; margin: 0 auto;
  background: var(--moss); color: #fff;
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.update-banner button {
  background: #fff; color: var(--moss); border: 0;
  border-radius: var(--radius-pill); padding: 8px 16px;
  font-weight: 500; font-size: 13px; cursor: pointer;
}
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(24px + var(--safe-bottom)); z-index: 70;
  max-width: 448px; margin: 0 auto;
  background: var(--text); color: #fff;
  border-radius: var(--radius); padding: 12px 16px; font-size: 14px;
  text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* --- Loading / placeholder states --- */
.loading { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 48px 20px; color: var(--muted); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--stone); border-top-color: var(--olive);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.placeholder { padding: 56px 24px; text-align: center; }
.placeholder h2 { font-size: 22px; margin-bottom: 8px; }
.placeholder p { color: var(--muted); margin-bottom: 20px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #ece7df 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* --- Forms --- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font-family: var(--font-body); font-weight: 300;
  font-size: 16px;                               /* 16px: never trigger iOS zoom on focus */
  color: var(--text); background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 13px 14px; -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sage-deep); background: var(--surface); }
select { background-image: none; }

.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;
}
:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 2px; }

/* Defensive: an unsized inline SVG defaults to 300x150 and blows out layout. */
svg:not([width]):not([height]) { max-width: 24px; max-height: 24px; }

a { color: inherit; }
img { max-width: 100%; display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
