/* =========================================================
   FAPBS CMS — additions to the prototype stylesheet.
   assets/css/style.css is synced from site/ and must not be edited here;
   everything the dynamic site needs on top of it lives in this file.
   ========================================================= */

/* Honeypot field of the public forms (hidden from people, filled by bots) */
.hp-field { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Form messages */
.form-msg--error { background: #fdecea; color: #a12622; }
.field [aria-invalid="true"] { border-color: #c62828 !important; box-shadow: 0 0 0 3px rgba(198, 40, 40, .15); }
.form-card + .form-card { margin-top: 2rem; }
.cms-wa-btn { margin-top: .8rem; background: #1f8f4e; color: #fff; }
.cms-wa-btn:hover { background: #17733e; color: #fff; }
.cms-nl-msg { font-size: .8rem; color: #c9d8ea; margin: .5rem 0 0; display: none; }
.cms-nl-msg.is-visible { display: block; }
.cms-nl-msg.is-error { color: #ffb4a8; }
button[aria-busy="true"] { opacity: .7; cursor: progress; }

/* Floating WhatsApp button (opposite side of "back to top") */
.wa-float {
  position: fixed; bottom: 1.2rem; inset-inline-start: 1.2rem; z-index: 40;
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: #1f8f4e; color: #fff; font-size: 1.7rem; box-shadow: var(--shadow-lg);
  transition: transform var(--t), background var(--t);
}
.wa-float:hover, .wa-float:focus-visible { background: #17733e; color: #fff; transform: scale(1.06); }
@media print { .wa-float { display: none !important; } }

/* Category chips rendered as links (server-side filter) */
.chips a {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px;
  padding: .3rem 1rem; font-size: .84rem; display: inline-block;
}
.chips a[aria-current="page"], .chips a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.photo-count { margin: 0; }

.cms-empty { text-align: center; color: var(--muted); padding: 2rem 1rem; background: var(--bg-soft); border-radius: var(--radius); }
.pagination span[aria-hidden="true"] { border: 0; background: none; }

/* Documents without a file yet */
.doc--soon { opacity: .75; }
.doc--soon > i:last-child { background: var(--bg-soft); color: var(--muted); }

/* Avatars with a photo */
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.cms-signature { margin-top: 1rem; }

/* More than 4 centers on the map */
.region-map__svg path[data-center="5"] { fill: #0f8a8a; }
.region-map__svg path[data-center="6"] { fill: #b0802a; }
.region-map__svg path[data-center="7"] { fill: #9c3d6e; }
.region-map__svg path[data-center="8"] { fill: #4a6b2a; }
.region-map__legend li[data-center="5"] { --lc: #0f7a7a; }
.region-map__legend li[data-center="6"] { --lc: #8f6620; }
.region-map__legend li[data-center="7"] { --lc: #9c3d6e; }
.region-map__legend li[data-center="8"] { --lc: #4a6b2a; }

/* Google Maps embed */
.map-embed { aspect-ratio: 21 / 9; background: var(--bg-soft); }
.map-embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-ph a { color: inherit; }
@media (max-width: 640px) { .map-embed { aspect-ratio: 4 / 3; } }

/* Rich text written in the dashboard editor */
.cms-article-body > :first-child { margin-top: 0; }
.prose blockquote { margin: 1.2rem 0; padding: .9rem 1.2rem; background: var(--bg-soft); border-inline-start: 4px solid var(--accent); border-radius: var(--radius-sm); color: var(--ink); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .88rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: .5rem .7rem; text-align: start; vertical-align: top; }
.prose th { background: var(--primary-light); color: var(--primary-dark); }
.prose figure { margin: 1.2rem 0; }
.prose figure img { margin: 0; }
.prose figcaption { font-size: .8rem; color: var(--muted); text-align: center; margin-top: .4rem; }
.prose iframe { width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); margin: 1rem 0; display: block; }
.prose img { height: auto; }
.prose a:not(.btn):not(.doc) { text-decoration: underline; text-underline-offset: 3px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0; }
.prose [style*="float: left"], .prose [style*="float:left"] { margin-inline-end: 1rem; }
.cms-tags { margin-top: 1.4rem; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cms-tags span { background: var(--primary-light); color: var(--primary); border-radius: 999px; padding: .1rem .8rem; }

/* Video album page */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.video--card { flex-direction: column; align-items: stretch; background: #fff; box-shadow: var(--shadow); padding: 0; overflow: hidden; border-radius: var(--radius); }
.video--card .video__thumb { width: 100%; border-radius: 0; }
.video--card > span:last-child { padding: .8rem 1rem 1rem; }
.video--card:hover { background: #fff; transform: translateY(-3px); }

/* Maintenance page */
.cms-maintenance { min-height: 100vh; display: grid; place-items: center; background: var(--bg-soft); text-align: center; padding: 2rem 1rem; }
.cms-maintenance main { max-width: 560px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 2.4rem 1.6rem; }
.cms-maintenance img { margin: 0 auto 1.4rem; width: min(320px, 100%); height: auto; }
.cms-maintenance h1 { color: var(--primary); font-size: 1.4rem; }
.cms-maint-note { background: #fdecea; color: #8a1c1c; border-color: #f5c2bd; }

/* Accessibility panel on the other side of the screen (Settings > features) */
.a11y-widget--flip { inset-inline-start: auto; inset-inline-end: 0; flex-direction: row-reverse; }
.a11y-widget--flip .a11y-widget__toggle { border-radius: 0; border-start-start-radius: 12px; border-end-start-radius: 12px; }
.a11y-widget--flip .a11y-widget__panel { inset-inline-start: auto; inset-inline-end: 62px; }

/* Tifinagh text */
[lang="zgh"] { font-family: "Noto Sans Tifinagh", sans-serif; }

/* Column charts with a scale other than 400 */
.colchart[style*="--max"] .col__bar { height: calc(var(--v) / var(--max) * 100%); }

/* Videos: inline player, play badge on gallery items, the video dialog (static/site/cms.js) */
.cms-video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius, 12px); overflow: hidden; }
.cms-video video, .cms-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.photo-grid__video { position: relative; }
.photo-grid__video .cms-play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 2.6rem; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.55); pointer-events: none; }
.lightbox--video .lightbox__inner { padding: 3.5rem 1.2rem 2rem; align-content: center; }
.lightbox__video { width: min(1100px, 100%); aspect-ratio: 16 / 9; max-height: calc(100vh - 9rem); background: #000; border-radius: 10px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox__video video, .lightbox__video iframe { display: block; width: 100%; height: 100%; border: 0; }
.lightbox__title { color: #e3ecf6; text-align: center; margin: .8rem 0 0; font-size: .95rem; }
.lightbox--video .lightbox__close:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.center__video { margin: .8rem 0 0; }
.center__badge small { font-size: .7em; font-weight: 600; }
