/* ==========================================================================
   Design tokens
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;

  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --line: #e7e2d8;
  --line-strong: #d7d0c2;

  --ink: #1b1a24;
  --ink-2: #4b4958;
  --ink-3: #807c8c;

  --primary: #3d3b93;
  --primary-hover: #312f7c;
  --primary-soft: #ecebf8;
  --primary-ink: #2d2b70;
  --on-primary: #ffffff;

  --accent: #d98a2b;
  --accent-soft: #fbefdc;

  --success: #2c7a57;
  --success-soft: #e2f2e9;
  --warning: #9a6111;
  --warning-soft: #fcf0d9;
  --danger: #bf4038;
  --danger-soft: #fbe6e4;

  --night-1: #1d1c4a;
  --night-2: #3d3b93;
  --dawn: #e9a14c;

  --radius-lg: 22px;
  --radius: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(27, 26, 36, 0.05);
  --shadow: 0 1px 2px rgba(27, 26, 36, 0.04), 0 10px 30px -12px rgba(27, 26, 36, 0.12);
  --shadow-lg: 0 30px 80px -20px rgba(27, 26, 36, 0.35);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);

  --header-h: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121219;
  --surface: #1a1a23;
  --surface-2: #22222d;
  --line: #2c2c39;
  --line-strong: #3b3b4b;

  --ink: #f2f0f7;
  --ink-2: #bebbcb;
  --ink-3: #8b8899;

  --primary: #9d9bf5;
  --primary-hover: #b4b2f8;
  --primary-soft: rgba(157, 155, 245, 0.14);
  --primary-ink: #cbcaff;
  --on-primary: #14131f;

  --accent: #f0a64a;
  --accent-soft: rgba(240, 166, 74, 0.14);

  --success: #5fc596;
  --success-soft: rgba(95, 197, 150, 0.14);
  --warning: #ebb357;
  --warning-soft: rgba(235, 179, 87, 0.14);
  --danger: #f07c72;
  --danger-soft: rgba(240, 124, 114, 0.14);

  --night-1: #191838;
  --night-2: #34327f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }

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

.icon { flex: none; }

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding-inline: 24px;
}

.main {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 72px;
}

.main.narrow { max-width: 760px; }

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lede {
  color: var(--ink-2);
  font-size: 1.075rem;
  line-height: 1.65;
  max-width: 560px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.94rem;
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 0.86rem; gap: 6px; }
.btn-lg { height: 50px; padding: 0 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--primary) 70%, transparent);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--ink-3); }

.btn-outline {
  background: transparent;
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  color: var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-outline:disabled { border-color: var(--line); color: var(--ink-3); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-success {
  background: var(--success-soft);
  color: var(--success);
}
.btn-success:hover { background: var(--danger-soft); color: var(--danger); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }

.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }

.btn-light {
  background: #fff;
  color: var(--night-1);
}
.btn-light:hover { background: #f4f2ff; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.theme-toggle {
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.theme-toggle:hover { border-color: var(--line-strong); }
.site-nav-end .theme-toggle { margin-left: 6px; }

.back-link,
.text-link,
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
}

.back-link { color: var(--ink-2); font-size: 0.9rem; }
.back-link:hover { color: var(--ink); }
.text-link { color: var(--primary); }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Header & footer
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--night-2) 0%, var(--night-1) 55%, var(--dawn) 140%);
  color: #ffe2b8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 6px 14px -6px rgba(29, 28, 74, 0.6);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.site-nav-end { justify-content: flex-end; flex: none; }
.site-header-inner > .brand:first-child:has(+ .site-nav-end) { flex: 1; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 160ms ease, color 160ms ease;
}

.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.86rem;
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 24px;
}

.footer-link { color: var(--ink-3); font-weight: 500; }
.footer-link:hover { color: var(--ink); }

/* ==========================================================================
   Profile
   ========================================================================== */

.profile { position: relative; flex: none; }

.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 220px;
  height: 40px;
  padding: 3px 14px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease;
}

.profile-trigger:hover { border-color: var(--line-strong); }

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--night-2), var(--night-1) 70%, var(--dawn) 160%);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar-lg { width: 42px; height: 42px; }

.profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 12px;
  width: min(300px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 160ms ease-out;
}

.popover-head { display: grid; gap: 2px; }
.popover-head label { font-weight: 600; }
.popover-head span { color: var(--ink-3); font-size: 0.85rem; }
.popover .alert { margin: 0; }

.popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   Home hero
   ========================================================================== */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: 56px;
  align-items: center;
  padding: 40px 0 64px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -80px -10% auto auto;
  width: 60%;
  height: 120%;
  z-index: -1;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--dawn) 22%, transparent), transparent),
    radial-gradient(closest-side at 30% 70%, color-mix(in srgb, var(--primary) 16%, transparent), transparent);
  filter: blur(20px);
  pointer-events: none;
}

.hero-copy { display: grid; gap: 22px; justify-items: start; }

.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.6rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.hero-copy h1 em {
  font-style: italic;
  color: var(--primary);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  width: 100%;
  max-width: 520px;
}

.hero-stats > div {
  flex: 1;
  min-width: 110px;
  padding-right: 20px;
}

.hero-stats > div + div {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.hero-stats dt { color: var(--ink-3); font-size: 0.82rem; }

.hero-stats dd {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Featured card */

.featured {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 30px;
  border-radius: 28px;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 70% at 100% 110%, color-mix(in srgb, var(--dawn) 70%, transparent), transparent 60%),
    linear-gradient(165deg, var(--night-2) 0%, var(--night-1) 70%);
  box-shadow: var(--shadow-lg);
}

.featured::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 55%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 55%);
}

.featured-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffe2b8;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.featured h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.featured-when { color: rgba(255, 255, 255, 0.72); }

.featured-body {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 10px 0 8px;
}

.ring {
  --p: 0;
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  width: 116px;
  height: 116px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(#ffd08f calc(var(--p) * 1%), rgba(255, 255, 255, 0.14) 0);
}

.ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--night-1);
}

.ring strong, .ring span { position: relative; }
.ring strong { font-family: var(--font-display); font-size: 1.6rem; font-weight: 500; line-height: 1; }
.ring span { color: rgba(255, 255, 255, 0.65); font-size: 0.74rem; margin-top: 2px; }

.featured-facts { display: grid; gap: 10px; flex: 1; }
.featured-facts > div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.featured-facts > div:last-child { border-bottom: 0; padding-bottom: 0; }
.featured-facts dt { color: rgba(255, 255, 255, 0.65); font-size: 0.88rem; }
.featured-facts dd { font-weight: 600; }

/* ==========================================================================
   Sections & project cards
   ========================================================================== */

.section-head,
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-head h2,
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.page-head h1 { margin: 6px 0 6px; }
.section-head p { color: var(--ink-3); margin-top: 4px; }

.page-intro {
  display: grid;
  gap: 12px;
  padding: 16px 0 36px;
}

.page-intro h1 {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.project-card:focus-within { border-color: var(--primary); box-shadow: var(--ring); }

.project-card-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.date-badge {
  display: grid;
  place-items: center;
  width: 56px;
  flex: none;
  padding: 8px 0 9px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-ink);
  line-height: 1;
}

.date-badge span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.date-badge strong {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.card-link {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  line-height: inherit;
  font: inherit;
}

.card-link:focus-visible { outline: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }

.project-card-when { margin-top: 5px; color: var(--ink-3); font-size: 0.88rem; }

.project-card-desc {
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 500;
}

.project-card-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.project-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.project-card-cta .icon { transition: transform 200ms ease; }
.project-card:hover .project-card-cta .icon { transform: translateX(3px); }

/* Progress */

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-3);
  font-size: 0.85rem;
}

.progress-meta strong { color: var(--ink); font-weight: 600; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 300ms ease;
}

/* ==========================================================================
   Prayer detail
   ========================================================================== */

.crumbs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.crumbs-path {
  color: var(--ink-3);
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.detail-aside {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: grid;
  gap: 16px;
}

.panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.summary-panel { display: grid; gap: 14px; justify-items: start; }

.summary-panel h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.summary-desc { color: var(--ink-2); }

.facts {
  display: grid;
  width: 100%;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

.facts > div {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.facts .icon { color: var(--ink-3); }
.facts dt { color: var(--ink-2); }
.facts dd { font-weight: 600; text-align: right; }

.coverage { display: grid; gap: 8px; width: 100%; margin-top: 4px; }
.coverage .progress { height: 8px; }

.identity-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}

.identity-panel div { display: grid; gap: 2px; min-width: 0; }
.identity-panel strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-panel span:not(.avatar) { color: var(--ink-3); font-size: 0.86rem; }

.schedule { padding: 26px 26px 14px; }

.schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 8px;
}

.schedule-head h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease;
}

.segmented button:hover { color: var(--ink); }

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--line);
}

.segmented .count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink-3);
  font-size: 0.74rem;
  text-align: center;
}

.segmented button[aria-pressed="true"] .count { background: var(--primary-soft); color: var(--primary-ink); }

.slot-group + .slot-group { margin-top: 8px; }

.slot-group-label {
  position: sticky;
  top: var(--header-h);
  z-index: 2;
  padding: 14px 0 10px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.slot-list { display: grid; gap: 8px; padding-bottom: 12px; }

.slot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease, background-color 160ms ease;
}

.slot:hover { border-color: var(--line-strong); }

.slot-day {
  display: grid;
  place-items: center;
  width: 48px;
  padding: 6px 0;
  border-radius: 11px;
  background: var(--surface-2);
  line-height: 1;
}

.slot-day span {
  color: var(--ink-3);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.slot-day strong {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
}

.slot-body { display: grid; gap: 4px; min-width: 0; }

.slot-time { font-weight: 600; }
.slot-time span { color: var(--ink-3); font-weight: 400; }

.slot-capacity {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 0.84rem;
}

.seats { display: inline-flex; gap: 3px; }

.seats i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.seats i.is-taken { background: var(--primary); box-shadow: none; }

.slot-action { min-width: 108px; }

.slot.is-mine {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: color-mix(in srgb, var(--success-soft) 55%, var(--surface));
}

.slot.is-mine .slot-day { background: var(--success-soft); color: var(--success); }
.slot.is-mine .slot-day span { color: inherit; }
.slot.is-mine .seats i.is-taken { background: var(--success); }

.slot.is-full .slot-day,
.slot.is-full .slot-time { opacity: 0.55; }

/* ==========================================================================
   Feedback: alerts, empty, status
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.92rem;
  font-weight: 500;
  animation: pop-in 200ms ease-out;
}

.alert .icon { margin-top: 2px; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert-notice { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 20%, transparent); }

.schedule .alert { margin-top: 10px; }

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 12px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty strong { font-size: 1.05rem; }
.empty p { color: var(--ink-3); max-width: 360px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-published { background: var(--success-soft); color: var(--success); }
.status-draft { background: var(--warning-soft); color: var(--warning); }
.status-archived { background: var(--surface-2); color: var(--ink-3); }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(14, 13, 28, 0.5);
  animation: fade-in 120ms ease-out;
}

.modal {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modal-in 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}

.modal-close { position: absolute; top: 14px; right: 14px; }

.modal-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}

.modal-icon.is-danger { background: var(--danger-soft); color: var(--danger); }

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.modal-lede { margin-top: 8px; color: var(--ink-2); }
.modal-lede strong { color: var(--ink); }

.summary {
  display: grid;
  margin: 20px 0;
  padding: 4px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.summary > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: 0.9rem;
}

.summary > div + div { border-top: 1px solid var(--line); }
.summary dt { color: var(--ink-3); }
.summary dd { font-weight: 600; text-align: right; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form { display: grid; gap: 18px; }

.field { display: grid; gap: 7px; min-width: 0; }

.field-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.optional { color: var(--ink-3); font-weight: 400; }
.field-hint { color: var(--ink-3); font-size: 0.82rem; }

input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea { resize: vertical; min-height: 100px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, textarea:hover, select:hover { border-color: var(--ink-3); }

input:focus, textarea:focus, select:focus,
.input-group:focus-within {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-group input {
  border: 0;
  border-radius: 0;
  box-shadow: none !important;
  min-width: 0;
}

.input-addon {
  display: grid;
  place-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 0.88rem;
  white-space: nowrap;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-section { display: grid; gap: 16px; }
.form-section + .form-section { padding-top: 22px; border-top: 1px solid var(--line); }

.form-section legend {
  float: left;
  width: 100%;
  margin-bottom: 4px;
  color: var(--ink-3);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.main.narrow .back-link { margin-bottom: 18px; }

/* ==========================================================================
   Auth
   ========================================================================== */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  min-height: 100vh;
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 40px 48px;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(90% 60% at 0% 110%, color-mix(in srgb, var(--dawn) 65%, transparent), transparent 60%),
    linear-gradient(165deg, var(--night-2) 0%, var(--night-1) 70%);
}

.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 60%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 60%);
}

.auth-aside .brand { color: #fff; justify-self: start; align-self: flex-start; }

.auth-aside-body { display: grid; gap: 32px; max-width: 440px; }

.auth-aside h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.auth-points { display: grid; gap: 20px; }

.auth-points li { display: flex; gap: 14px; }
.auth-points .icon { margin-top: 2px; color: #ffd08f; }
.auth-points div { display: grid; gap: 2px; }
.auth-points span { color: rgba(255, 255, 255, 0.7); font-size: 0.92rem; }

.auth-aside-foot {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.auth-main {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px 24px;
}

.auth-theme { position: absolute; top: 20px; right: 20px; }

.auth-card { display: grid; gap: 10px; width: min(100%, 400px); }
.auth-card .back-link { justify-self: start; margin-bottom: 24px; }

.auth-card h1 {
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.auth-card > .muted { margin-bottom: 18px; }
.auth-card .btn-block { margin-top: 6px; }

.auth-switch {
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 0.92rem;
  text-align: center;
}

/* ==========================================================================
   Admin
   ========================================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat dt { color: var(--ink-3); font-size: 0.84rem; }

.stat dd {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.1;
}

.admin-list { display: grid; gap: 12px; }

.admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-item-main { display: grid; gap: 8px; min-width: 0; }

.admin-item-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-item-title h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
}

.admin-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--ink-3);
  font-size: 0.85rem;
}

.admin-item-meta span { display: inline-flex; align-items: center; gap: 6px; }

.admin-item-stats {
  display: grid;
  grid-template-columns: auto auto minmax(100px, 1fr);
  align-items: center;
  gap: 22px;
}

.admin-item-stats > div:not(.admin-item-coverage) { display: grid; }
.admin-item-stats strong { font-size: 1.15rem; font-weight: 600; }
.admin-item-stats > div > span { color: var(--ink-3); font-size: 0.78rem; }
.admin-item-coverage { display: grid; gap: 6px; }

.admin-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  width: min(460px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 180ms ease-out;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast > span { flex: 1; min-width: 0; }
.toast-success > .icon { color: var(--success); }
.toast-error > .icon { color: var(--danger); }
.toast-notice > .icon { color: var(--warning); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.toast-close { width: 30px; height: 30px; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ==========================================================================
   App states, links, tables, and form errors
   ========================================================================== */

a { color: inherit; text-decoration: none; }
a.btn, a.nav-link, a.brand, a.back-link, a.footer-link, a.text-link { cursor: pointer; }
.admin-item-title h3 a:hover { color: var(--primary); }

.field-error { color: var(--danger); font-size: 0.82rem; font-weight: 500; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; background: var(--surface-2); }
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
select { appearance: auto; }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 40vh;
  color: var(--ink-3);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-actions { display: flex; gap: 8px; margin-top: 10px; }

.admin-project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-project-layout .alert { margin: 0; }
.admin-signups { padding: 0; overflow: hidden; }
.admin-signups .schedule-head { padding: 18px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.admin-signups .schedule-head h2 { font-size: 1.3rem; }
.admin-signups > .empty { margin: 20px; }

.table-wrap { max-height: 640px; overflow: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  position: sticky;
  top: 0;
  padding: 10px 20px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}
.data-table td { padding: 10px 20px; border-top: 1px solid var(--line); vertical-align: top; }
.data-table td:nth-child(2) { white-space: nowrap; color: var(--ink-2); }

@media (max-width: 960px) {
  .admin-project-layout { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Motion
   ========================================================================== */

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1040px) {
  .admin-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .admin-item-actions { grid-column: 1 / -1; justify-content: flex-start; padding-top: 14px; border-top: 1px solid var(--line); }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-bottom: 48px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { position: static; }
  .auth-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-aside { justify-content: flex-start; padding: 24px; gap: 28px; }
  .auth-main { place-items: start center; padding-top: 32px; }
  .auth-aside-body { gap: 20px; }
  .auth-points { display: none; }
  .auth-aside-foot { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --header-h: 60px; }
  .container { padding-inline: 16px; }
  .main { padding-top: 22px; padding-bottom: 48px; }
  .site-header-inner { gap: 12px; }
  .site-nav .nav-link:first-child { display: none; }
  .site-nav-end .nav-link:first-child { display: inline-flex; }
  .site-nav-end .nav-link span { display: none; }
  .site-nav-end .nav-link { padding: 0 10px; }
  .profile-trigger { max-width: 150px; }
  .hero { padding-top: 16px; }
  .hero-stats dd { font-size: 1.6rem; }
  .project-grid { grid-template-columns: 1fr; }
  .section-head, .page-head { flex-direction: column; align-items: stretch; }
  .crumbs-path { display: none; }
  .panel, .schedule { padding: 20px; }
  .schedule { padding-bottom: 8px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; justify-content: center; padding: 0 8px; }
  .slot { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  .slot-action { grid-column: 1 / -1; width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .admin-item { grid-template-columns: 1fr; gap: 16px; padding: 18px; }
  .admin-item-actions { grid-column: auto; }
  .modal { padding: 24px 20px; }
  .modal-actions > .btn { flex: 1; }
  .featured { padding: 24px; }
  .ring { width: 96px; height: 96px; }
  .site-footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .site-nav { display: none; }
  .site-nav-end { display: flex; }
  .site-header-inner { justify-content: space-between; }
  .hero-stats > div { min-width: 0; padding-right: 12px; }
  .hero-stats > div + div { padding-left: 12px; }
  .featured-body { flex-direction: column; align-items: stretch; }
  .ring { align-self: center; }
}
