/**
 * screens.css
 * Per screen adjustments. Kept thin: anything reusable belongs in components.
 */

/* ---------- busy indicator ---------- */
/* A thin bar rather than a blocking spinner. Apps Script has a cold start of
   one to three seconds, and a blocked screen for that long reads as broken. */

.busy-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 50;
  background: linear-gradient(90deg, transparent, var(--verd), transparent);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: busy 1.1s ease-in-out infinite;
}
@keyframes busy {
  from { background-position: -50% 0; }
  to   { background-position: 150% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .busy-bar { animation: none; background: var(--verd); opacity: 0.5; }
}

/* ---------- welcome ---------- */

#s-welcome.on {
  /* Fills the body, edge to edge, with no card around it. */
  margin: -14px;
  min-height: calc(100% + 36px);
  display: flex;
}

.welcome {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 18px;
  padding: 26px 22px calc(26px + var(--safe-bottom));
  background: linear-gradient(175deg, #16233B 0%, #24384F 46%, #2F6B5E 140%);
  color: #fff;
}

.welcome-mark {
  position: absolute;
  top: calc(56px + var(--safe-top));
  left: 22px;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: #fff;
  padding: 6px;
}

.welcome-copy h1 {
  /* Scales down on a narrow phone rather than running off the edge. */
  font-size: clamp(26px, 8vw, 33px);
  line-height: 1.1;
  color: #fff;
  margin-bottom: 10px;
  text-wrap: balance;
}
.welcome-copy p {
  color: #C6D2DE;
  font-size: 14px;
  max-width: 30ch;
}

/* The router moves focus to the heading on entry, for screen readers. Give it
   room so the ring is not clipped by the edge of the screen. */
.welcome-copy h1:focus-visible {
  outline-offset: 4px;
  border-radius: 6px;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Google renders its own button in here, so the branding is exactly what
   Google requires. It is centred rather than stretched. */
.gis-button {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.welcome .btn.ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.welcome .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.signin-status {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-ctrl);
  background: rgba(255, 255, 255, 0.1);
  color: #E8EDF3;
  text-align: center;
}
.signin-status.refused {
  background: rgba(142, 46, 59, 0.28);
  color: #FBE4E7;
}
.signin-status.error {
  background: rgba(142, 46, 59, 0.28);
  color: #FBE4E7;
}
.signin-status.done {
  background: rgba(47, 107, 94, 0.35);
  color: #DFF0EA;
}

.welcome-note {
  display: block;
  color: #93A6B8;
  font-size: 11.5px;
  line-height: 1.5;
}

/* ---------- home ---------- */

.welcome-back {
  margin-bottom: 14px;
}
.greeting {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
}

.phase-note b { font-size: 14.5px; display: block; margin-bottom: 3px; }

.access-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.access-row {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line2);
  font-size: 14px;
}
.access-row:last-child { border-bottom: 0; }
.access-row.off { opacity: 0.45; }
.access-mark {
  color: var(--verd-dk);
  font-weight: 700;
  text-align: center;
}
.access-row.off .access-mark { color: var(--mute); }
.access-label { min-width: 0; }

/* ---------- people ---------- */

.giftaid-row {
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 2px;
  border-top: 1px solid var(--line2);
  margin-top: 4px;
}
.giftaid-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

/* A real checkbox, sized to the 44px touch target. */
.switch {
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--line);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background var(--dur) var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(22, 35, 59, 0.3);
  transition: transform var(--dur) var(--ease);
}
.switch:checked {
  background: var(--brass);
  border-color: var(--brass);
}
.switch:checked::after { transform: translateX(20px); }

/* ---------- account ---------- */

.account-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
}
.account-name {
  font-family: var(--font-head);
  font-size: 18px;
  display: block;
}

/* ---------- confirm dialog ---------- */

.confirm-dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  max-width: 340px;
  width: calc(100% - 40px);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 50px -12px rgba(22, 35, 59, 0.5);
}
.confirm-dialog::backdrop {
  background: rgba(22, 35, 59, 0.45);
}
.confirm-body { padding: 20px; }
.confirm-body h2 { font-size: 18px; margin-bottom: 6px; }
.confirm-body p {
  font-size: 14px;
  color: var(--slate);
  margin-bottom: 16px;
}
.confirm-actions > .btn { flex: 1; }

/* ---------- update bar ---------- */

.update-bar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 14px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 28px);
  max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius-ctrl);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 8px 24px -8px rgba(22, 35, 59, 0.5);
}
.update-bar span { flex: 1; }
.update-bar .btn { background: var(--verd); border-color: var(--verd); }
