/* ============================================================
   AiPsyLab — additions for the CMS on top of styles.css
   (the design system). Everything here is what the engine
   renders and the static design never had: WYSIWYG content
   (Redactix), covers, pagination, tags, author profiles,
   error pages, the admin preview banner.
============================================================ */

/* ---------- Admin preview banner ---------- */

.preview-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  padding: 10px 20px;
  background: #FFF3C4;
  color: #6B4E00;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
}

/* ---------- Content (Redactix HTML) ----------
   .prose is the design's reading column; .content-body is what the
   engine's templates wrap WYSIWYG output in. Both get the same rules. */

.content-body {
  max-width: 720px;
  margin-inline: auto;
}

.content-body h2 { margin-top: 1.6em; font-size: 1.5rem; }
.content-body h3 { margin-top: 1.4em; }
.content-body h2:first-child,
.content-body h3:first-child { margin-top: 0; }

.content-body blockquote {
  margin: 1.5em 0;
  padding: 16px 24px;
  border-left: 4px solid var(--blue);
  background: var(--light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-weight: 600;
}

.content-body blockquote p:last-child { margin-bottom: 0; }

.content-body ul,
.content-body ol { padding-left: 1.2em; }

.content-body li { margin-bottom: 0.4em; }

.content-body hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.content-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.content-body figure {
  margin: 1.6em 0;
}

.content-body figcaption {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.content-body a { text-decoration: underline; text-underline-offset: 3px; }

.content-body table {
  width: 100%;
  margin: 1.5em 0;
  border-collapse: collapse;
  font-size: 0.97rem;
}

.content-body th,
.content-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.content-body th { background: var(--light); font-weight: 700; }

.content-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--light);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.content-body pre {
  margin: 1.5em 0;
  padding: 18px 20px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: var(--dark);
  color: var(--white);
}

.content-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.9rem;
}

.content-body mark {
  padding: 0 4px;
  border-radius: 4px;
  background: #FFF3C4;
}

.content-body sub,
.content-body sup { font-size: 0.75em; }

/* Spoiler: hidden until hovered/focused or revealed by the editor class */
.content-body .spoiler {
  background: var(--dark);
  color: transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.content-body .spoiler:hover,
.content-body .spoiler:focus,
.content-body .spoiler.is-revealed {
  background: var(--light);
  color: inherit;
}

/* Callouts */
.content-body aside {
  position: relative;
  margin: 1.6em 0;
  padding: 18px 22px;
  border-radius: var(--radius-sm);
  background: var(--light);
  border-left: 4px solid var(--blue);
}

.content-body aside > :last-child { margin-bottom: 0; }
.content-body aside[data-emoji] { padding-left: 56px; }
.content-body aside[data-emoji]::before {
  content: attr(data-emoji);
  position: absolute;
  left: 18px;
  top: 16px;
  font-size: 1.4rem;
  line-height: 1;
}

.content-body aside.warning { background: #FFF6DB; border-left-color: #D99A00; }
.content-body aside.danger  { background: #FFE9E6; border-left-color: #D64545; }
.content-body aside.success { background: #E6F6EC; border-left-color: #2E9E5B; }
.content-body aside.information { background: var(--light); border-left-color: var(--blue); }

/* Quote card */
.content-body figure.quote-card {
  padding: 24px 28px;
  border-radius: var(--radius);
  background: var(--light);
}

.content-body figure.quote-card blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1.1rem;
}

.content-body figure.quote-card.big blockquote {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 700;
}

.content-body figure.quote-card figcaption {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  text-align: right;
}

.content-body figure.quote-card figcaption img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

/* Gallery */
.content-body .redactix-gallery-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.content-body .redactix-gallery-grid a { display: block; overflow: hidden; border-radius: var(--radius-sm); }
.content-body .redactix-gallery-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform var(--transition);
}
.content-body .redactix-gallery-grid a:hover img { transform: scale(1.04); }

/* Embeds and video */
.content-body .redactix-embed-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--dark);
  aspect-ratio: 16 / 9;
}

.content-body figure.redactix-embed[data-aspect="4:3"] .redactix-embed-frame { aspect-ratio: 4 / 3; }
.content-body figure.redactix-embed[data-aspect="1:1"] .redactix-embed-frame { aspect-ratio: 1 / 1; }
.content-body figure.redactix-embed[data-aspect="9:16"] .redactix-embed-frame { aspect-ratio: 9 / 16; max-width: 420px; margin-inline: auto; }
.content-body figure.redactix-embed[data-aspect="auto"] .redactix-embed-frame { aspect-ratio: auto; }

.content-body .redactix-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.content-body .redactix-video video {
  width: 100%;
  border-radius: var(--radius-sm);
  background: var(--dark);
}

/* ---------- Hero cover (shared partial) ---------- */

.cover {
  --cover-ratio: 16 / 9;
  --cover-focus: center;
  margin: 0 0 32px;
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: var(--cover-ratio);
  background: var(--light);
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--cover-focus);
}

.cover-caption {
  margin: -20px 0 32px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Pagination ---------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.pagination__item,
.pagination__gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 700;
}

.pagination__item {
  border: 2px solid var(--border);
  color: var(--blue);
  transition: border-color var(--transition), background var(--transition);
}

.pagination__item:hover { border-color: var(--blue); }

.pagination__item.is-current {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}

.pagination__gap { color: var(--muted); }

/* ---------- Tags ---------- */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--light);
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 700;
}

.tag-pill:hover { background: var(--border); }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  color: var(--muted);
}

/* ---------- Cards: image thumbs, empty states ---------- */

.thumb--img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.thumb--img::after { content: none; }

.person-card__text--clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.person-card__text p:last-child { margin-bottom: 0; }

.person-card__name a { color: inherit; }
.person-card__name a:hover { color: var(--blue); }

.person-card__photo--empty {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-soft));
}

.no-results {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

/* ---------- Author profile ---------- */

.author-hero__inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 768px) {
  .author-hero__inner {
    flex-direction: row;
    align-items: center;
    gap: 40px;
  }
}

.author-hero__photo {
  flex-shrink: 0;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 25%;
  background: var(--border);
  box-shadow: var(--shadow-card);
}

.author-hero__photo--empty {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue-soft));
}

.author-hero__role {
  margin: 0;
  font-weight: 700;
  color: var(--blue);
}

.author-hero .page-hero__lead { margin-top: 12px; }

.author-hero .person-card__socials { margin-top: 20px; }

.author-bio { max-width: 720px; margin-inline: auto; }

.author-materials + .author-materials { margin-top: 56px; }

/* ---------- News single ---------- */

.news-neighbours {
  max-width: 860px;
  margin-inline: auto;
}

.news-item__more { justify-self: end; }

/* ---------- Error pages ---------- */

.error-page {
  max-width: 560px;
  margin-inline: auto;
  text-align: center;
}

.error-page__code {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 1;
  color: var(--blue);
}

.error-page .section__footer { margin-top: 28px; }

/* ---------- Site forms (forms package) ---------- */

/* Honeypot: off-screen for people, still in the DOM for bots. Not
   .visually-hidden — screen readers would read that one out. */
.form__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* A field the server rejected (main.js sets aria-invalid). */
.form input[aria-invalid="true"],
.form select[aria-invalid="true"],
.form textarea[aria-invalid="true"] {
  border-color: #D93636;
}

/* The reply above/below the form when sending failed — the same card as the
   success message, readable on light and on accent sections alike. */
.form__message.form__message--error,
:is(.section--blue, .section--cta--accent, .section--cta--ink) .form__message.form__message--error {
  margin-top: 16px;
  background: #FFE8E8;
  color: #9B1C1C;
}

/* While forms.js sends, the submit button is disabled. */
.form button[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* Consent to the privacy policy (partials/form_consent.php): a small line
   under the fields; takes the text colour of its section. */
.form__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}

.form__consent input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

:is(.section--blue, .section--cta--accent, .section--cta--ink) .form__consent input {
  accent-color: var(--white);
}

.form__consent a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form--inline .form__consent {
  margin-top: 12px;
}

.form.is-sent .form__consent {
  display: none;
}

/* Partners (home page): real logos are links in a solid card that hugs
   the logo (fixed logo height, width follows its proportions); the cards
   are centred in a wrapping row. */
.partners-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.partner-logo--image {
  min-height: 0;
  padding: 14px 20px;
  border-style: solid;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.partner-logo--image:hover {
  border-color: var(--blue-soft);
  box-shadow: var(--shadow-card);
}

.partner-logo--image img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 64px;
  object-fit: contain;
}
