/* Shared shell styling for the marketing site, church dashboard, and staff
   admin. Deliberately plain — the real visual identity (brand name TBD,
   design templates) is being worked out separately; this just needs to be
   usable while the structure gets built out. */
:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e2e5ea;
  --brand: #2b4c7e;
  --accent: #e8b04b;
  --bg: #f7f8fa;
  --card: #ffffff;
  --danger: #c0392b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; }
a { color: var(--brand); }

.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.shell-header .brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.1rem; }
.shell-header nav a { margin-left: 1rem; text-decoration: none; color: var(--muted); font-size: 0.9rem; }

.container { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.narrow { max-width: 480px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

h1 { font-size: 1.75rem; margin-top: 0; }
h2 { font-size: 1.2rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; min-height: 1.2em; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.75rem 0 0.25rem; }
input, textarea, select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}
textarea { min-height: 90px; resize: vertical; }

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--brand);
  color: #fff;
  margin-top: 1rem;
}
button.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.danger { background: var(--danger); }
button.small { padding: 0.3rem 0.7rem; font-size: 0.8rem; margin-top: 0; }

.tabs { display: flex; gap: 0.25rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tabs button {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 0;
  font-weight: 500;
}
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

.hero { text-align: center; padding: 4rem 1.5rem; background: var(--brand); color: #fff; }
.hero h1 { color: #fff; }
.hero .lead { font-size: 1.1rem; opacity: 0.9; max-width: 640px; margin: 0.5rem auto 1.5rem; }
.hero button { background: var(--accent); color: #1f2430; }

.hidden { display: none !important; }

/* --------------------------------------------------- design picker
   A visual chooser rather than a dropdown: each option is the real template
   rendered in an iframe (see functions/preview/[slug].js) at PREVIEW_W and
   scaled down by --preview-scale, which dashboard.js measures. */
.design-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}
.design-opt {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--card);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.design-opt:hover { border-color: #b9c0cc; }
/* The radio drives state and keyboard nav; it is off-screen, not display:none,
   so it stays focusable and reachable by screen readers. */
.design-opt input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.design-opt:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43, 76, 126, 0.18); }
.design-opt.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }

.design-opt-frame {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.design-opt-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  /* Stated here too, not only as attributes: without an explicit width an
     iframe defaults to 300x150 and would render the template's mobile
     layout rather than a desktop thumbnail. */
  width: 1400px;
  height: 875px;
  max-width: none;
  border: 0;
  transform: scale(var(--preview-scale, 0.16));
  transform-origin: top left;
  pointer-events: none;
  /* Left transparent on purpose so the fallback below shows through until the
     frame paints; each template draws its own body background over it. */
}
/* Behind the iframe: the template's own two colors, so a card is never blank. */
.design-opt-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--a) 0%, var(--a) 52%, var(--b) 52%, var(--b) 100%);
}
.design-opt-fallback::after {
  content: attr(data-name);
  background: rgba(31, 36, 48, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
}
.design-opt-cap { display: block; padding: 0.6rem 0.75rem 0.75rem; }
.design-opt-name { display: block; font-weight: 600; font-size: 0.92rem; }
.design-opt-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}
.design-opt-check {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  display: none;
}
.design-opt.selected .design-opt-check { display: block; }

/* If the scale never gets measured, an untransformed 1400px iframe bursts out
   of its card as a tall clipped sliver — that shipped once. Falling back to
   the color panel is the better failure. */
.design-opt-frame:not([style*="--preview-scale"]) iframe { visibility: hidden; }
