/* Huron Book Club - May 2026 brand tokens (fonts embedded via fonts.css, loaded first) */

:root {
  /* fonts */
  --primary-font: Roboto, Tahoma, Arial, sans-serif;
  --display-font: 'Bricolage Grotesque', 'Aptos Display', Tahoma, sans-serif;

  /* Brand colors (foundational shade per role) */
  --huron-color-primary-aubergine: #5d013a;
  --huron-color-primary-ecru: #ebe9e4;
  --huron-color-accent-mint: #bcffec;
  --huron-color-emphasis-butterscotch: #f8b808;
  --huron-color-action-guava: #d62440;
  --huron-color-type-stone: #2b2623;

  /* Tonal variants */
  --huron-colors-aubergine-500: #850253;
  --huron-colors-aubergine-700: #5d013a;
  --huron-colors-aubergine-800: #370022;
  --huron-colors-ecru-50: #f7f5f4;
  --huron-colors-ecru-100: #ebe9e4;
  --huron-colors-ecru-200: #e3e1d4;
  --huron-colors-mint-300: #bcffec;
  --huron-colors-mint-500: #70cdb3;
  --huron-colors-mint-700: #22887d;
  --huron-colors-butterscotch-500: #f8b808;
  --huron-colors-guava-500: #ff3d5a;
  --huron-colors-guava-600: #d62440;
  --huron-colors-guava-700: #a01b30;
  --huron-colors-stone-400: #9e9995;
  --huron-colors-stone-600: #5d5652;
  --huron-colors-stone-900: #2b2623;

  /* utility */
  --alpha-80-alt: #ffffff33;
  --huron-colors-button-primary-hover: #ff3d5a;

  /* corner radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--primary-font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--huron-colors-stone-900);
  background: var(--huron-colors-ecru-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--display-font);
  font-weight: 400;
  color: var(--huron-colors-aubergine-800);
  margin: 0;
}

/* ---------- header ---------- */

.site-header {
  background: linear-gradient(180deg, var(--huron-colors-aubergine-800) 0%, #2a0019 100%);
  color: #fff;
  padding: 16px 20px 32px;
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; min-height: 44px; margin-right: auto; }
.wordmark { width: 120px; height: auto; display: block; }
.header-tools { display: flex; align-items: center; gap: 8px; order: 2; flex: none; }
.nav-panel { display: flex; align-items: center; gap: 8px; }
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--alpha-80-alt);
  background: transparent;
  color: var(--huron-colors-mint-300);
  cursor: pointer;
}
.nav-toggle:hover { background: var(--alpha-80-alt); }
.nav-toggle:focus-visible { outline: 2px solid var(--huron-colors-mint-500); outline-offset: 2px; }
.nav-toggle-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 18px;
}
.nav-toggle-box span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-box span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-box span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-box span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--alpha-80-alt);
  background: transparent;
  color: var(--huron-colors-mint-300);
  font: 600 14px var(--primary-font);
  text-decoration: none;
  cursor: pointer;
}
.header-link:hover { background: var(--alpha-80-alt); }
.nav-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--huron-colors-ecru-200);
  background: #fff;
  color: var(--huron-colors-aubergine-700);
  box-shadow: 0 8px 20px rgba(43, 38, 35, 0.08);
  line-height: 0;
  appearance: none;
  text-decoration: none;
  cursor: pointer;
}
.nav-icon svg { display: block; width: 22px; height: 22px; }
.nav-icon:hover { background: var(--huron-colors-ecru-100); }
.nav-icon:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }
.account-menu { position: relative; display: flex; align-items: center; line-height: 0; }
.account-btn { padding: 0; overflow: hidden; }
#account-face { position: absolute; inset: 0; display: flex; }
.account-btn .avatar {
  width: 100%;
  height: 100%;
  font-size: 14px;
  box-shadow: none;
  background: transparent;
  color: var(--huron-colors-aubergine-700);
}
.account-btn .avatar-fallback { color: var(--huron-colors-aubergine-700); }
.account-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--huron-colors-ecru-200);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(43, 38, 35, 0.18);
  padding: 12px;
  line-height: 1.35;
}
.account-who { display: flex; align-items: center; gap: 10px; }
.account-who > span:last-child { min-width: 0; }
.account-who strong { display: block; color: var(--huron-colors-aubergine-800); font-size: 14px; line-height: 1.3; }
.account-who small { display: block; margin-top: 2px; color: var(--huron-colors-stone-600); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.account-panel .sign-out-form { display: block; margin-top: 10px; }
.account-signout {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font: 600 14px var(--primary-font);
  color: var(--huron-colors-aubergine-800);
  cursor: pointer;
}
.account-signout:hover,
.account-signout:focus-visible { background: var(--huron-colors-ecru-100); }
.header-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  color: var(--huron-colors-mint-300);
  font: 600 14px var(--primary-font);
}
.header-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--avatar, var(--huron-colors-aubergine-700));
  color: #fff;
  font-family: var(--primary-font);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
}
.avatar--xs { width: 18px; height: 18px; font-size: 8px; }
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--md { width: 36px; height: 36px; font-size: 13px; }
.avatar-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-fallback { position: relative; color: #fff; }
.avatar:has(.avatar-img) .avatar-fallback { display: none; }
.header-user .avatar {
  width: 36px;
  height: 36px;
  font-size: 13px;
  box-shadow: 0 0 0 2px #fff;
}
.sign-out-form { margin: 0; }
.auth-signin { margin-top: 26px; width: 100%; }

.bell-dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--huron-colors-butterscotch-500);
  box-shadow: 0 0 0 2px #fff;
}
.bell[data-on="true"] { border-color: var(--huron-colors-aubergine-700); }
.bell[data-on="true"] .bell-shape { fill: currentColor; }
.bell[data-on="true"] .bell-slash { display: none; }
.bell[data-on="true"] .bell-dot { display: block; }

.header-hero {
  max-width: 1080px;
  margin: 24px auto 0;
}

.eyebrow {
  font-family: var(--display-font);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--huron-colors-mint-300);
  margin-bottom: 8px;
}

.header-hero h1 {
  color: #fff;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
}

.header-sub {
  color: var(--huron-colors-ecru-200);
  margin: 8px 0 20px;
  max-width: 48ch;
}

.header-search {
  width: 100%;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--alpha-80-alt);
  background: #ffffff14;
  color: #fff;
  font-family: var(--primary-font);
  font-size: 16px;
  color-scheme: dark;
  appearance: none;
}
.header-search::placeholder { color: var(--huron-colors-stone-400); }
.header-search:focus-visible { outline: 2px solid var(--huron-colors-mint-500); outline-offset: 2px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--huron-colors-guava-600);
  color: var(--huron-colors-ecru-50);
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--primary-font);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
  min-height: 44px;
}
.btn-primary:hover { background: var(--huron-colors-button-primary-hover); }
.btn-primary:focus-visible { outline: 2px solid var(--huron-colors-mint-500); outline-offset: 2px; }
.btn-primary[disabled] { opacity: 0.4; cursor: not-allowed; }

.add-error {
  color: var(--huron-colors-guava-500);
  font-size: 14px;
  margin: 10px 0 0;
}

/* ---------- main / controls ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.kind-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid var(--huron-colors-ecru-200);
  border-radius: var(--radius-md);
}
.kind-btn {
  min-height: 36px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--huron-colors-aubergine-700);
  font-family: var(--primary-font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.kind-btn:hover { background: rgba(93, 1, 58, 0.08); }
.kind-btn:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }
.kind-btn[aria-pressed="true"] {
  background: var(--huron-colors-aubergine-700);
  color: #fff;
}
.detail .kind-switch { margin: 16px 0 4px; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.controls[hidden] { display: none; }

.controls-heading {
  font-size: 16px;
}

.controls-hint {
  font-size: 13px;
  color: var(--huron-colors-stone-600);
  margin: 4px 0 0;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: rgba(93, 1, 58, 0.08);
  color: var(--huron-colors-aubergine-700);
  font-family: var(--primary-font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}
.chip:hover { background: rgba(93, 1, 58, 0.16); }
.chip:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }
.chip[aria-pressed="true"] {
  background: var(--huron-colors-aubergine-700);
  color: #fff;
}
.chip--static { cursor: default; }
.chip .chip-x {
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

/* ---------- book grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.grid--videos {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.book-card {
  background: #fff;
  border: 1px solid var(--huron-colors-ecru-200);
  border-radius: var(--radius-lg);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--primary-font);
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(43, 38, 35, 0.10);
}
.book-card:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }

.book-card--add {
  border-style: dashed;
  background: transparent;
}
.book-card--add:hover {
  background: rgba(93, 1, 58, 0.04);
  border-color: var(--huron-colors-aubergine-700);
}

.add-card-cover {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  background: var(--huron-colors-ecru-100);
  color: var(--huron-colors-aubergine-700);
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-card--add:hover .add-card-cover {
  background: rgba(93, 1, 58, 0.08);
}

.cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--huron-colors-ecru-100);
}
.book-card--video {
  grid-column: span 2;
}
.book-card--video .cover-wrap,
.grid--videos .add-card-cover {
  aspect-ratio: 16 / 9;
}
.grid--videos .book-card--video {
  grid-column: auto;
}
.play-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(43, 38, 35, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}
.cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--huron-colors-aubergine-800) 0%, #2a0019 100%);
  color: var(--huron-colors-ecru-200);
  font-family: var(--display-font);
  font-size: 15px;
  line-height: 1.3;
  padding: 14px 10px;
  display: flex;
  align-items: flex-end;
}

.book-title {
  font-family: var(--display-font);
  font-size: 15px;
  line-height: 1.25;
  color: var(--huron-colors-aubergine-800);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 13px;
  color: var(--huron-colors-stone-600);
}

.book-stars {
  font-size: 13px;
  color: var(--huron-colors-aubergine-700);
}

.badge-new {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--huron-colors-mint-700);
  color: #fff;
  font-family: var(--primary-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.empty {
  color: var(--huron-colors-stone-600);
  text-align: center;
  padding: 48px 0;
}

/* ---------- detail overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 35, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}
.overlay[hidden] { display: none; }

.detail {
  background: #fff;
  border-radius: var(--radius-lg);
  max-width: 760px;
  width: 100%;
  max-height: min(85vh, 900px);
  overflow-y: auto;
  padding: 28px;
}

.detail-head {
  display: flex;
  gap: 24px;
}

.detail-cover {
  flex: 0 0 180px;
}
.detail-cover .cover-wrap { border-radius: var(--radius-md); }

.detail-info { flex: 1; min-width: 0; }

.detail-close {
  float: right;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--huron-colors-ecru-100);
  color: var(--huron-colors-stone-900);
  font-size: 18px;
  cursor: pointer;
  margin-left: 12px;
}
.detail-close:hover { background: var(--huron-colors-ecru-200); }
.detail-close:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }

.detail h2 {
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 4px;
}

.detail-authors {
  font-size: 16px;
  color: var(--huron-colors-aubergine-700);
  margin: 0 0 12px;
}

.detail-meta {
  font-size: 13px;
  color: var(--huron-colors-stone-600);
  margin: 0 0 12px;
}

.detail-desc {
  font-size: 15px;
  color: var(--huron-colors-stone-900);
  margin: 16px 0 0;
  white-space: pre-line;
}

.video-player {
  position: relative;
  margin-top: 20px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}
.video-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.detail-link {
  color: var(--huron-colors-aubergine-700);
  font-weight: 500;
}
.added-by {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--huron-colors-stone-600);
}
.added-by b { color: var(--huron-colors-aubergine-700); }

.detail-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--huron-colors-ecru-200);
}
.detail-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.tag-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  max-width: 320px;
}
.tag-add input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--huron-colors-ecru-200);
  font-family: var(--primary-font);
  font-size: 14px;
}
.tag-add input:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--alpha-80-alt);
  background-color: var(--huron-colors-aubergine-800);
  color: var(--huron-colors-ecru-50);
  font-family: var(--primary-font);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn-secondary::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0;
  background: var(--alpha-80-alt);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.btn-secondary:hover::before { opacity: 1; }
.btn-secondary:focus-visible { outline: 2px solid var(--huron-colors-mint-500); outline-offset: 2px; }

/* stars */

.stars-summary {
  font-size: 14px;
  color: var(--huron-colors-stone-600);
  margin-bottom: 8px;
}

.stars-input {
  display: inline-flex;
  gap: 2px;
}
.star-btn {
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  width: 44px;
  height: 44px;
  color: var(--huron-colors-stone-400);
  cursor: pointer;
  padding: 0;
}
.star-btn.on, .star-btn:hover, .star-btn:has(~ .star-btn:hover) { color: var(--huron-colors-butterscotch-500); }
.star-btn:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }

.stars-avg { color: var(--huron-colors-butterscotch-500); letter-spacing: 2px; }

.rater-list { margin-top: 10px; }
.rater {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--huron-colors-stone-600);
  margin-top: 6px;
}
.rater b { color: var(--huron-colors-aubergine-700); }
.rater-who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#clear-rating { margin-top: 8px; }

/* comments */

.comment {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--huron-colors-ecru-50);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 10px;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--huron-colors-stone-600);
  margin-bottom: 4px;
}
.comment-meta b { color: var(--huron-colors-aubergine-700); }
.comment-email { color: var(--huron-colors-stone-400); }
.comment-actions { display: flex; gap: 12px; flex: none; }
.comment-action,
.comment-delete {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--huron-colors-stone-600);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.comment-action:hover,
.comment-delete:hover { color: var(--huron-colors-guava-700); }
.comment-action:focus-visible,
.comment-delete:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }
.comment-text { font-size: 14px; margin: 0; }
.comment-as {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--huron-colors-stone-600);
}
.comment-as b { color: var(--huron-colors-aubergine-700); }
.comment-edit { display: flex; flex-direction: column; gap: 8px; }
.comment-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.comment-form input, .comment-form textarea, .comment-edit textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--huron-colors-ecru-200);
  font-family: var(--primary-font);
  font-size: 14px;
  resize: vertical;
}
.comment-form input:focus-visible, .comment-form textarea:focus-visible, .comment-edit textarea:focus-visible {
  outline: 2px solid var(--huron-colors-aubergine-700);
  outline-offset: 2px;
}
.comment-form .btn-secondary { align-self: flex-start; }

/* manual add form */

.manual-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}
.manual-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--display-font);
  font-size: 14px;
  color: var(--huron-colors-aubergine-800);
}
.label-hint {
  font-family: var(--primary-font);
  font-size: 12px;
  color: var(--huron-colors-stone-400);
}
.manual-form input, .manual-form textarea {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--huron-colors-ecru-200);
  font-family: var(--primary-font);
  font-size: 14px;
  color: var(--huron-colors-stone-900);
  resize: vertical;
}
.manual-form input:focus-visible, .manual-form textarea:focus-visible {
  outline: 2px solid var(--huron-colors-aubergine-700);
  outline-offset: 2px;
}
.manual-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}
.manual-form .btn-secondary { align-self: flex-start; }

@media (max-width: 640px) {
  .manual-row { grid-template-columns: 1fr; }
}

/* remove from library */

.detail-section--danger {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--huron-colors-ecru-200);
  background: transparent;
  color: var(--huron-colors-guava-700);
  font-family: var(--primary-font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-remove:hover {
  background: rgba(214, 36, 64, 0.08);
  border-color: rgba(214, 36, 64, 0.3);
}
.btn-remove:focus-visible { outline: 2px solid var(--huron-colors-guava-700); outline-offset: 2px; }

/* confirm dialog */

/* foreword */

.foreword-overlay { z-index: 45; }

.foreword-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: min(85vh, 720px);
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(43, 38, 35, 0.25);
}

.foreword-card .eyebrow--dark { color: var(--huron-colors-aubergine-700); }

.foreword-card h2 {
  font-size: 26px;
  line-height: 1.15;
  margin: 8px 0 16px;
}

.foreword-body p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--huron-colors-stone-900);
  margin: 0 0 14px;
}

.foreword-signature {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 24px;
  padding-left: 14px;
  border-left: 3px solid var(--huron-colors-aubergine-700);
}
.foreword-signer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Placeholder autograph: a script-font rendering of the name, not a scan of
   a real signature. Swap for an approved asset before this ships. */
.foreword-autograph {
  font-family: "Snell Roundhand", "Savoye LET", "Apple Chancery", "Segoe Script", "Brush Script MT", cursive;
  font-size: 30px;
  line-height: 1.1;
  color: var(--huron-colors-aubergine-700);
  transform: rotate(-2deg);
  transform-origin: left bottom;
  margin: 2px 0 4px;
}
.avatar--lg { width: 48px; height: 48px; font-size: 17px; }
.foreword-signature strong {
  font-family: var(--display-font);
  font-size: 16px;
  color: var(--huron-colors-aubergine-800);
}
.foreword-signature span {
  font-size: 13px;
  color: var(--huron-colors-stone-600);
}

.foreword-actions { display: flex; justify-content: flex-end; }

.foreword-hint {
  font-size: 12px;
  color: var(--huron-colors-stone-400);
  margin: 16px 0 0;
  text-align: right;
}

@media (max-width: 640px) {
  .overlay.foreword-overlay { padding: 16px; align-items: center; }
  .foreword-card { padding: 24px 20px; }
}

.confirm-overlay { z-index: 50; }

.confirm-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(43, 38, 35, 0.25);
}

.confirm-card h3 {
  font-size: 20px;
  margin-bottom: 10px;
}

.confirm-text {
  font-size: 15px;
  color: var(--huron-colors-stone-900);
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.confirm-note {
  font-size: 13px;
  color: var(--huron-colors-stone-600);
  margin: 0 0 20px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--huron-colors-ecru-200);
  background: transparent;
  color: var(--huron-colors-stone-900);
  font-family: var(--primary-font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--huron-colors-ecru-100); }
.btn-ghost:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }

/* Keep the confirm card centered on mobile too (the generic .overlay
   mobile rule at the end of this file bottom-sheets the detail panel). */
@media (max-width: 640px) {
  .overlay.confirm-overlay { padding: 16px; align-items: center; }
}

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 40;
}

.toast {
  background: var(--huron-colors-aubergine-800);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(43, 38, 35, 0.25);
  cursor: pointer;
  animation: toast-in 0.25s ease;
}
.toast .toast-eyebrow {
  font-family: var(--display-font);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--huron-colors-mint-300);
  margin-bottom: 4px;
}
.toast .toast-body { font-size: 14px; }

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

/* ---------- footer ---------- */

.site-footer {
  font-size: 13px;
  color: var(--huron-colors-stone-600);
  text-align: center;
  padding: 20px;
}

.app-version {
  color: var(--huron-colors-stone-400);
  margin-left: 6px;
}

/* ---------- password gate ---------- */

.auth-body {
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(55, 0, 34, 0.96), rgba(93, 1, 58, 0.9)),
    radial-gradient(circle at 82% 18%, rgba(188, 255, 236, 0.26), transparent 28%),
    var(--huron-colors-aubergine-800);
}
.auth-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  isolation: isolate;
}
.auth-backdrop {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  opacity: 0.44;
  filter: blur(14px);
  transform: scale(1.03);
  pointer-events: none;
  z-index: -1;
}
.auth-preview {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.auth-preview-header {
  height: 160px;
  background: linear-gradient(180deg, rgba(55, 0, 34, 0.9), rgba(42, 0, 25, 0.86));
}
.auth-preview-card {
  height: 140px;
  background: rgba(255, 255, 255, 0.68);
}
.auth-preview-card-one { width: 58%; }
.auth-preview-card-two { width: 78%; justify-self: end; }
.auth-preview-card-three { width: 66%; }
.auth-panel {
  width: min(100%, 430px);
  background: rgba(247, 246, 244, 0.94);
  color: var(--huron-colors-stone-900);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: var(--radius-md);
  padding: 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}
.auth-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--huron-colors-aubergine-800);
  color: var(--huron-colors-mint-300);
  font-family: var(--display-font);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.auth-copy { margin-top: 24px; }
.auth-copy .eyebrow { color: var(--huron-colors-aubergine-700); }
.auth-copy h1 {
  margin: 8px 0 0;
  font-family: var(--display-font);
  font-size: 36px;
  line-height: 0.98;
  color: var(--huron-colors-aubergine-800);
}
.auth-copy p {
  margin: 12px 0 0;
  color: var(--huron-colors-stone-600);
  line-height: 1.5;
}
.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}
.auth-form label {
  font-size: 12px;
  font-weight: 700;
  color: var(--huron-colors-aubergine-700);
  text-transform: uppercase;
}
.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--huron-colors-ecru-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--huron-colors-stone-900);
  font: 16px var(--primary-font);
  padding: 12px 14px;
}
.auth-form input:focus {
  border-color: var(--huron-colors-aubergine-700);
  box-shadow: 0 0 0 3px rgba(93, 1, 58, 0.14);
  outline: none;
}
.auth-form .btn-primary {
  width: 100%;
}
.auth-form .btn-primary .auth-button-spinner { display: none; }
.auth-form.is-loading .btn-primary {
  display: inline-grid;
  grid-template-columns: auto 18px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: wait;
  opacity: 0.86;
}
.auth-form.is-loading .auth-button-label::after { content: "..."; }
.auth-form.is-loading .auth-button-spinner {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.8s linear infinite;
}
.auth-panel .auth-error { margin-top: 16px; }
.auth-error {
  margin: 0;
  border: 1px solid rgba(214, 36, 64, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(214, 36, 64, 0.08);
  color: var(--huron-colors-guava-700);
  padding: 10px 12px;
  font-size: 13px;
}
.auth-loading {
  margin: 0;
  border: 1px solid rgba(93, 1, 58, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(93, 1, 58, 0.08);
  color: var(--huron-colors-aubergine-700);
  padding: 10px 12px;
  font-size: 13px;
}
.auth-loading[hidden] { display: none; }
.auth-version {
  margin-top: 22px;
  color: var(--huron-colors-stone-600);
  font-size: 12px;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* ---------- mobile ---------- */

@media (max-width: 380px) {
  .site-header { padding-left: 12px; padding-right: 12px; }
  .wordmark { width: 92px; }
  .header-tools, .nav-panel { gap: 6px; }
}

@media (max-width: 640px) {
  .header-inner { flex-wrap: nowrap; }
  .brand { margin-right: 0; }
  .header-tools { order: 1; margin-left: auto; }
  .nav-toggle { display: none; }

  .auth-shell { padding: 18px; }
  .auth-backdrop { inset: 16px; filter: blur(12px); }
  .auth-panel { padding: 26px; }
  .auth-copy h1 { font-size: 31px; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
  .grid--videos { grid-template-columns: 1fr; }

  .overlay { padding: 0; align-items: flex-end; }
  .detail {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    padding: 20px;
  }
  .detail-head { flex-direction: column; }
  .detail-cover { flex: none; width: 140px; }

  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

.stats-body { background: var(--huron-colors-ecru-50, #f7f6f4); color: var(--huron-colors-stone-900); }
.stats-shell { max-width: 960px; margin: 0 auto; padding: 28px 20px 48px; }
.stats-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.stats-header .eyebrow { color: var(--huron-colors-aubergine-700); }
.stats-header h1 { margin: 8px 0 0; font-family: var(--display-font); font-size: 40px; line-height: 1; color: var(--huron-colors-aubergine-800); }
.stats-header .header-link { color: var(--huron-colors-aubergine-800); border-color: var(--huron-colors-ecru-200); }
.stats-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.stats-totals article { background: #fff; border: 1px solid var(--huron-colors-ecru-200); border-radius: var(--radius-md); padding: 16px; }
.stats-totals p { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; color: var(--huron-colors-stone-600); font-size: 13px; }
.stats-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.stats-totals .material-symbols-outlined { color: var(--huron-colors-aubergine-700); font-size: 18px; user-select: none; }
.stats-hint { color: var(--huron-colors-stone-400); font-size: 11px; flex: none; }
.stats-totals strong { display: block; margin-top: 6px; font-family: var(--display-font); font-size: 32px; color: var(--huron-colors-aubergine-800); }
.stats-block { margin-top: 28px; }
.stats-block h2 { margin: 0 0 12px; font-size: 18px; }
.stats-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stats-bars li, .stats-table { background: #fff; border: 1px solid var(--huron-colors-ecru-200); border-radius: var(--radius-md); }
.stats-bars li { display: grid; grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; }
.stats-share { display: block; height: 8px; border-radius: 999px; background: var(--huron-colors-ecru-100); overflow: hidden; }
.stats-share > span { display: block; height: 100%; border-radius: inherit; background: var(--huron-colors-aubergine-700); }
.stats-person { display: flex; align-items: center; gap: 10px; }
.stats-table { width: 100%; border-collapse: collapse; overflow: hidden; }
.stats-table th, .stats-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--huron-colors-ecru-200); }
.stats-table th { font-size: 12px; text-transform: uppercase; color: var(--huron-colors-stone-600); }
.stats-empty { color: var(--huron-colors-stone-600); }
.stats-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats-chart-card { position: relative; background: #fff; border: 1px solid var(--huron-colors-ecru-200); border-radius: var(--radius-md); padding: 14px 8px 4px; }
.stats-chart-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 8px; font-size: 18px; }
.stats-chart-note { margin: 4px 8px 0; color: var(--huron-colors-stone-600); font-size: 13px; line-height: 1.4; }
.stats-swatch { display: inline-block; width: 14px; height: 3px; border-radius: 999px; flex: none; vertical-align: middle; }
.stats-swatch--mau, .stats-swatch--people { background: var(--huron-colors-aubergine-700); }
.stats-swatch--dau { background: var(--huron-colors-mint-700); }
.stats-swatch--visits { width: 10px; height: 10px; border-radius: 2px; background: var(--huron-colors-mint-500); }
.stats-chart-note .stats-swatch { margin: 0 4px 0 8px; }
.stats-chart-note .stats-swatch:first-child { margin-left: 0; }
.stats-chart { position: relative; min-height: 200px; }
.stats-chart svg { display: block; width: 100%; overflow: visible; }
.stats-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.stats-line--mau { stroke: var(--huron-colors-aubergine-700); }
.stats-line--dau, .stats-line--people { stroke: var(--huron-colors-aubergine-700); }
.stats-bar { fill: var(--huron-colors-mint-500); opacity: 0.85; }
.stats-area { opacity: 0.14; }
.stats-area--mau { fill: var(--huron-colors-aubergine-700); }
.stats-area--dau { fill: var(--huron-colors-mint-700); }
.stats-dot--mau, .stats-dot--people { fill: #fff; stroke: var(--huron-colors-aubergine-700); stroke-width: 2; }
.stats-dot--dau { fill: #fff; stroke: var(--huron-colors-mint-700); stroke-width: 2; }
.stats-grid line, .stats-focus line { stroke: var(--huron-colors-ecru-200); }
.stats-focus line { stroke: var(--huron-colors-stone-400); }
.stats-axis text { fill: var(--huron-colors-stone-600); font-size: 11px; font-family: var(--primary-font); }
.stats-axis path, .stats-axis line { stroke: var(--huron-colors-ecru-200); }
.stats-overlay { fill: transparent; cursor: crosshair; outline: none; }
.stats-tip { position: absolute; z-index: 1; pointer-events: none; background: var(--huron-colors-aubergine-800); color: #fff; border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; line-height: 1.45; display: grid; gap: 2px; min-width: 132px; }
.stats-tip[hidden] { display: none; }
.stats-tip span { display: flex; align-items: center; gap: 6px; }
.stats-tip strong { margin-left: auto; font-weight: 500; }
@media (max-width: 640px) {
  .stats-shell { padding: 20px 16px 40px; }
  .stats-header { flex-direction: column; align-items: stretch; gap: 16px; }
  .stats-header h1 { font-size: 32px; }
  .stats-header .header-link { width: 100%; justify-content: center; }
  .stats-totals { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stats-totals article { padding: 12px; }
  .stats-totals strong { font-size: 28px; }
  .stats-totals .material-symbols-outlined { font-size: 16px; }
  .stats-charts { grid-template-columns: 1fr; }
  .stats-bars li { grid-template-columns: minmax(0, 1fr) auto; }
  .stats-platform-name { grid-column: 1; grid-row: 1; }
  .stats-bars li > strong { grid-column: 2; grid-row: 1; }
  .stats-share { grid-column: 1 / -1; grid-row: 2; }
  .stats-platform-name, .stats-person span:last-child { overflow-wrap: anywhere; }
  .stats-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .stats-table, .stats-table tbody, .stats-table tr, .stats-table td { display: block; width: auto; }
  .stats-table { overflow: visible; }
  .stats-table tr { padding: 12px 14px; border-bottom: 1px solid var(--huron-colors-ecru-200); }
  .stats-table tr:last-child { border-bottom: 0; }
  .stats-table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    overflow-wrap: anywhere;
    text-align: right;
  }
  .stats-table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--huron-colors-stone-600);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
  }
}

.stats-header-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
#knowledge { scroll-margin-top: 24px; }
.stats-lead { margin: 0 0 12px; max-width: 70ch; color: var(--huron-colors-stone-600); line-height: 1.5; }
.stats-lead code, .knowledge-endpoint-line code, .knowledge-actions + code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.knowledge-endpoint-line { margin: 0 0 16px; color: var(--huron-colors-stone-600); }
.knowledge-endpoint-line code { overflow-wrap: anywhere; }
.knowledge-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0 0 16px; }
.knowledge-form label {
  display: grid;
  gap: 6px;
  flex: 1 1 220px;
  max-width: 360px;
  font-size: 13px;
  color: var(--huron-colors-stone-600);
}
.knowledge-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--huron-colors-ecru-200);
  background: #fff;
  font-family: var(--primary-font);
  font-size: 14px;
  color: var(--huron-colors-stone-900);
}
.knowledge-form input:focus-visible { outline: 2px solid var(--huron-colors-aubergine-700); outline-offset: 2px; }
.knowledge-reveal {
  background: #fff;
  border: 1px solid var(--huron-colors-ecru-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 0 0 16px;
}
.knowledge-reveal p { margin: 0 0 10px; }
.knowledge-secret-row { display: flex; gap: 8px; align-items: center; }
.knowledge-secret-row code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--huron-colors-ecru-50, #f7f6f4);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.knowledge-by { display: block; margin-top: 4px; color: var(--huron-colors-stone-600); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
@media (min-width: 641px) {
  .knowledge-by { white-space: nowrap; overflow-wrap: normal; }
}
.knowledge-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.knowledge-actions form { margin: 0; }
.btn-compact { min-height: 36px; padding: 6px 12px; font-size: 13px; }
@media (max-width: 640px) {
  .stats-header-links { justify-content: stretch; }
  .knowledge-form { flex-direction: column; align-items: stretch; }
  .knowledge-form label { max-width: none; }
  .knowledge-secret-row { flex-direction: column; align-items: stretch; }
}
