/* phase5.css — Phase 5 components: calendar, media cards, search, docs filter,
   parents sidebar, detail pages. Loaded after components.css. */

/* ---- View toggle (list / month) ---- */
.view-toggle {
  display: inline-flex; gap: var(--sp-2); margin-bottom: var(--sp-5);
  background: var(--surface); border-radius: var(--radius); padding: 4px;
}
.view-toggle a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 var(--sp-4);
  border-radius: calc(var(--radius) - 4px);
  font-weight: 500; color: var(--gray-600); text-decoration: none;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.view-toggle a:hover { color: var(--navy); }
.view-toggle a.is-active {
  background: var(--navy); color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---- Month calendar ---- */
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.cal-head a {
  min-height: 44px; display: inline-flex; align-items: center;
  padding: 0 var(--sp-3); border-radius: var(--radius);
  border: 1px solid var(--gray-300); color: var(--ink); text-decoration: none;
  font-weight: 500;
}
.cal-head a:hover { border-color: var(--navy); color: var(--navy); }
.cal-month-label {
  font-family: var(--font-serif); font-size: var(--fs-06); color: var(--navy);
  margin: 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
}
.cal-head-cell {
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  font-weight: 600; font-size: 0.8rem; color: var(--gray-600);
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
}
.cal-cell {
  min-height: 96px;
  padding: var(--sp-2);
  border-right: 1px solid var(--gray-100, var(--gray-200));
  border-bottom: 1px solid var(--gray-100, var(--gray-200));
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell-empty {
  background: var(--surface);
}
.cal-day {
  font-size: 0.8rem; font-weight: 600; color: var(--gray-600);
  margin-bottom: 2px;
}
.cal-cell.has-events .cal-day { color: var(--blue); }
.cal-event {
  display: block;
  font-size: 0.78rem; font-weight: 500; color: var(--ink);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2, var(--surface));
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event:hover { background: var(--surface-2, var(--surface)); color: var(--blue); }
.cal-more { font-size: 0.72rem; color: var(--gray-500); padding-left: 6px; }

/* Media query: smaller cells on mobile */
@media (max-width: 768px) {
  .cal-cell { min-height: 64px; }
  .cal-event { font-size: 0.7rem; padding: 1px 4px; }
  .cal-day { font-size: 0.72rem; }
  .cal-head-cell { font-size: 0.72rem; padding: var(--sp-2) var(--sp-1); }
}
@media (max-width: 480px) {
  .cal-cell { min-height: 52px; }
  .cal-event { display: none; } /* hide event text on smallest screens */
  .cal-cell.has-events { background: #EFF6FF; }
}

/* ---- Media: video + album cards ---- */
.video-card, .album-card { display: flex; flex-direction: column; gap: var(--sp-3); }
.video-card-link, .album-card-link {
  display: flex; gap: var(--sp-4); align-items: center;
  padding: var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.video-card-link:hover, .album-card-link:hover {
  border-color: var(--navy); box-shadow: var(--shadow-sm);
}
.video-card-thumb, .album-card-thumb {
  flex-shrink: 0;
  width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--navy);
  border-radius: var(--radius-sm);
}
.video-card-body, .album-card-body { flex: 1; min-width: 0; }
.video-card-body h3, .album-card-body h3 {
  margin: 0 0 4px; font-size: 1rem; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-card-cta, .album-card-cta {
  font-size: 0.85rem; color: var(--red); font-weight: 500;
}

/* ---- Search page ---- */
.search-form {
  display: flex; gap: var(--sp-3); margin-bottom: var(--sp-5);
  align-items: center; flex-wrap: wrap;
}
.search-form input[type="search"] {
  flex: 1; min-width: 200px;
  min-height: 48px; padding: 0 var(--sp-4);
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font: inherit; background: var(--paper);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.search-form input[type="search"]:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11,37,69,0.12);
}
.search-empty { color: var(--gray-600); padding: var(--sp-6) 0; text-align: center; }
.search-count { color: var(--gray-600); font-size: 0.95rem; margin: 0 0 var(--sp-4); }
.search-results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.search-item {
  padding: var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}
.search-item h3 { margin: 6px 0 4px; font-size: 1rem; }
.search-item h3 a { color: var(--navy); text-decoration: none; }
.search-item h3 a:hover { color: var(--red); }
.search-snippet { color: var(--gray-600); font-size: 0.9rem; margin: 0; line-height: 1.5; }
.search-kind { margin-bottom: 4px; }

/* ---- Documents filter bar ---- */
.docs-filter { margin-bottom: var(--sp-5); }
.docs-filter-cats {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.docs-filter-cats a {
  display: inline-flex; align-items: center;
  min-height: 40px; padding: 0 var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--gray-300);
  font-size: 0.9rem; font-weight: 500; color: var(--gray-600); text-decoration: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.docs-filter-cats a:hover { border-color: var(--navy); color: var(--navy); }
.docs-filter-cats a.is-active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
.docs-filter-cats .count { font-size: 0.8rem; opacity: 0.7; margin-left: 4px; }
.docs-filter-search {
  display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
}
.docs-filter-search input[type="search"] {
  flex: 1; min-width: 180px;
  min-height: 44px; padding: 0 var(--sp-3);
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font: inherit; background: var(--paper);
}
.docs-filter-search input[type="search"]:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11,37,69,0.12);
}
.docs-count { color: var(--gray-600); font-size: 0.9rem; margin: 0 0 var(--sp-3); }

/* ---- Detail pages ---- */
.detail-body {
  font-size: var(--fs-09); line-height: var(--lh-relaxed, 1.7); color: var(--ink);
}
.detail-body h1, .detail-body h2, .detail-body h3 { color: var(--navy); }
.detail-body ul, .detail-body ol { padding-left: 1.5em; margin: 0 0 var(--sp-4); }
.detail-body a { color: var(--red); }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  margin-bottom: var(--sp-5); color: var(--gray-500); font-size: 0.9rem;
}
.detail-meta time, .detail-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* Related items */
.related-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.related-item {
  padding: var(--sp-3);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.related-item h4 { margin: 0 0 2px; font-size: 0.95rem; }
.related-item h4 a { color: var(--navy); text-decoration: none; }
.related-item h4 a:hover { color: var(--red); }
.related-item time { color: var(--gray-500); font-size: 0.85rem; }

/* ---- Parents sidebar ---- */
.sidebar-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: var(--sp-5);
}
.sidebar-title {
  font-family: var(--font-serif); font-size: var(--fs-08); color: var(--navy);
  margin: 0 0 var(--sp-3);
}
.sidebar-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.sidebar-list a {
  display: block; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-weight: 500;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.sidebar-list a:hover { background: var(--surface-2, var(--surface)); color: var(--navy); }
.sidebar-list a.is-active { background: var(--navy); color: #fff; }

/* ---- Misc ---- */
.ann-empty {
  padding: var(--sp-6);
  text-align: center; color: var(--gray-600);
  background: var(--surface); border-radius: var(--radius);
}
.doc-missing {
  color: var(--gray-500); font-style: italic;
  font-size: 0.9rem; padding: var(--sp-4);
  background: var(--surface); border-radius: var(--radius);
}
.container-narrow { max-width: 780px; margin: 0 auto; }

/* news-list (reuses announcement-item styling; just ensure spacing) */
.news-list { gap: var(--sp-3); }

/* hero thumbnail strip on /media */
.hero-thumb-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.hero-thumb {
  display: block;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}
.hero-thumb img {
  width: 100%; height: 100px; object-fit: cover; display: block;
}
.hero-thumb:hover { transform: translateY(-2px); }
.hero-thumb.is-active { border-color: var(--red, #B3112A); }
.hero-thumb:focus-visible { outline: 3px solid var(--red, #B3112A); outline-offset: 2px; }

/* Phase 8b — photo archive (/media/archive) + archive link on /media */
.archive-link { margin: 0 0 var(--sp-4, 20px); }
.archive-group { margin-bottom: var(--sp-6, 40px); }
.archive-group-title {
  font-size: 1.15rem; font-weight: 700; margin: 0 0 var(--sp-3, 14px);
  display: flex; align-items: baseline; gap: 10px;
}
.archive-group-count {
  font-size: .85rem; font-weight: 500; color: var(--text-soft, #666);
  background: var(--bg-soft, #f3f3f3); border-radius: 999px; padding: 2px 10px;
}
.gallery-grid-archive a { aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; }
.gallery-grid-archive img { width: 100%; height: 100%; object-fit: cover; }
.empty-note { color: var(--text-soft, #666); font-style: italic; }

/* ---- Volunteer page ---- */
.volunteer-hero-img {
  display: none;
  margin-bottom: var(--sp-5, 20px);
}
.volunteer-hero-img img {
  width: 100%;
  height: auto;
  border-radius: var(--radius, 8px);
}
.volunteer-gallery {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: var(--sp-2, 8px);
  margin-bottom: var(--sp-6, 28px);
}
.volunteer-gallery figure {
  margin: 0;
}
.volunteer-gallery img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}
.volunteer-intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-6, 28px);
  margin-bottom: var(--sp-6, 28px);
}
.volunteer-intro p {
  margin: 0 0 var(--sp-3, 14px);
  line-height: 1.7;
}
.volunteer-intro p:last-child {
  margin-bottom: 0;
}
.volunteer-signup {
  text-align: center;
  margin-bottom: var(--sp-6, 28px);
}
.volunteer-signup img {
  max-width: 100%;
  height: auto;
}
.volunteer-jobs-title {
  font-size: 1.25rem;
  margin: 0 0 var(--sp-4, 18px);
}
.volunteer-jobs-title a {
  color: var(--navy, #1a365d);
  text-decoration: none;
}
.volunteer-jobs-title a:hover {
  text-decoration: underline;
}
.volunteer-jobs-content p {
  margin: 0 0 var(--sp-3, 14px);
  line-height: 1.7;
}

@media (max-width: 768px) {
  .volunteer-hero-img {
    display: block;
  }
  .volunteer-gallery {
    display: none;
  }
  .volunteer-intro {
    grid-template-columns: 1fr;
  }
}
