/* ============================================================
   WordPress adaptations. Loaded after styles.css, which is generated from the showcase site
   (site/src/css/styles.css). Everything WordPress-specific lives here: core block resets, the
   button block, the navigation block, the facts rows, the gallery, forms and events.
   Rule of thumb: change the look in site/src/css/styles.css and rebuild; change how a core
   block is dressed up here.
   ============================================================ */

/* ---------- core resets ---------- */
.wp-site-blocks { padding: 0; }
.wp-block-image { margin: 0; }
.wp-block-group { margin-block: 0; } /* never margin-inline: .wrap centers itself with auto margins */

/* WordPress resets child margins with :root :where(.is-layout-flow) > * (specificity 0,1,0), which would beat these
   equal-specificity rules from styles.css depending on stylesheet order. :root lifts them above it. */
:root .stack > * + * { margin-top: var(--gap, 14px); }
:root .facts { margin-top: 14px; }

/* The accent word: yellow on black bands, red on cream. A palette color can't follow its section, so resolve it here. */
mark.has-inline-color.has-accent-color { color: var(--accent-word) !important; background: none; }
.wp-block-post-content { margin: 0; }
.wp-block-image img { vertical-align: top; }
main.site-main { display: block; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tes-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- sticky header (the template part is the sticky element) ---------- */
.wp-site-blocks > header.wp-block-template-part { position: sticky; top: 0; z-index: 50; }
.admin-bar .wp-site-blocks > header.wp-block-template-part { top: 32px; }
@media (max-width: 782px) { .admin-bar .wp-site-blocks > header.wp-block-template-part { top: 46px; } }

/* ---------- block styles ---------- */
.is-style-tile-left { --r: -3deg; }
.is-style-tile-right { --r: 3deg; }
.wp-block-image.tile { margin: 0; }
.ar-43 { --ar: 4 / 3; }
.ar-1610 { --ar: 16 / 10; }
.ar-34 { --ar: 3 / 4; }

/* ---------- buttons (core Button block) ---------- */
.wp-block-buttons.btn-row { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.wp-block-buttons .wp-block-button { margin: 0; }
@media (min-width: 700px) {
  .wp-block-buttons.btn-row { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .wp-block-buttons.btn-row--stack { flex-direction: column; align-items: stretch; width: fit-content; max-width: 100%; }
  .btn-row .wp-block-button .wp-block-button__link { min-width: 220px; }
}
.wp-block-button.btn-sm { --btn-h: 44px; --btn-px: 16px; --btn-fs: 13px; }
.wp-block-button.btn-lg { --btn-h: 64px; --btn-px: 32px; --btn-fs: 18px; }
.wp-block-buttons .wp-block-button .wp-block-button__link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--btn-h); padding: 0 var(--btn-px);
  font-family: var(--font-display); font-size: var(--btn-fs); font-weight: 400; line-height: 1.6; letter-spacing: 0.02em;
  text-transform: uppercase; text-decoration: none; text-align: center; white-space: nowrap;
  border: 2px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); box-shadow: none; cursor: pointer;
  transition: transform 0.12s, background-color 0.12s, border-color 0.12s, color 0.12s, filter 0.12s;
}
.wp-block-button.is-style-primary .wp-block-button__link { background: var(--btn1-bg); color: var(--btn1-fg); border-color: var(--btn1-bg); }
.wp-block-button.is-style-primary .wp-block-button__link:hover { background: var(--btn1-hover); border-color: var(--btn1-hover); color: var(--btn1-fg); }
.wp-block-button.is-style-secondary .wp-block-button__link { background: transparent; border-color: var(--btn2); color: var(--btn2); }
.wp-block-button.is-style-secondary .wp-block-button__link:hover { background: var(--btn2); color: var(--btn2-on); }
.wp-block-button.is-style-accent .wp-block-button__link { background: var(--yellow); color: var(--ink); border-color: var(--btn-acc-border); }
.wp-block-button.is-style-accent .wp-block-button__link:hover { filter: brightness(1.08); color: var(--ink); }
.wp-block-button .wp-block-button__link:active { transform: translateY(1px); filter: brightness(0.88); }
.wp-block-button.btn-block, .wp-block-button.btn-block .wp-block-button__link { width: 100%; }
@media (min-width: 700px) { .wp-block-button.btn-block, .wp-block-button.btn-block .wp-block-button__link { width: auto; } }
.card .wp-block-button .wp-block-button__link { min-width: 0; }
button.wp-block-button__link { font-family: var(--font-display); }

/* ---------- header ---------- */
.topbar__inner .wp-block-image { margin: 0; flex: none; }
.brand { position: relative; }
.brand .wp-block-image img { width: 40px; height: 40px; }
.brand__word { margin: 0; }
:root .brand__word a, :root .brand__word a:hover { color: inherit; text-decoration: none; }
.brand__word a::after { content: ""; position: absolute; inset: 0; } /* the whole logo + name is one link */
.topbar__cta { display: flex; align-items: center; gap: 8px; }
.topbar__cta .btn-donate { display: none; }
.topbar__cta .wp-block-button .wp-block-button__link { min-width: 0; }
@media (min-width: 1024px) {
  .brand .wp-block-image img { width: 48px; height: 48px; }
  .topbar__cta { gap: 10px; margin-left: 8px; }
  .topbar__cta .btn-donate { display: block; }
}

/* ---------- navigation block: inline from 1024px, a menu button below ---------- */
.tes-nav { color: var(--sand); }
.tes-nav .wp-block-navigation-item__content { color: var(--sand); text-decoration: none; }
@media (max-width: 1023px) {
  .tes-nav .wp-block-navigation__responsive-container:not(.is-menu-open) { display: none; }
  .tes-nav .wp-block-navigation__responsive-container-open:not(.always-shown) { display: flex; }
}
@media (min-width: 1024px) {
  .tes-nav .wp-block-navigation__responsive-container-open:not(.always-shown) { display: none; }
  .tes-nav .wp-block-navigation__responsive-container:not(.is-menu-open) { display: block; position: static; width: auto; background: none; }
  .tes-nav .wp-block-navigation__container { gap: 2px; flex-wrap: nowrap; }
  .tes-nav .wp-block-navigation-item__content {
    font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 10px 9px; border-bottom: 3px solid transparent; transition: border-color 0.12s, opacity 0.12s;
  }
  .tes-nav .wp-block-navigation-item__content:hover { border-bottom-color: var(--yellow); }
  .tes-nav .wp-block-navigation-item__content:active { opacity: 0.65; }
  .tes-nav .current-menu-item > .wp-block-navigation-item__content, .tes-nav .wp-block-navigation-item__content[aria-current="page"] { border-bottom-color: var(--sand); }
  .tes-nav .nav__donate { display: none; } /* Donate is a button here */
}
.tes-nav .wp-block-navigation__responsive-container-open { color: var(--sand); width: 44px; height: 44px; justify-content: center; }
.tes-nav .wp-block-navigation__responsive-container-open:hover { background: var(--tint); }
/* the open menu */
.tes-nav .wp-block-navigation__responsive-container.is-menu-open { background: var(--ink); color: var(--sand); padding: 0; }
.tes-nav .is-menu-open .wp-block-navigation__responsive-container-content { padding: 72px 0 0; }
.tes-nav .is-menu-open .wp-block-navigation__container { width: 100%; gap: 0; align-items: stretch; }
.tes-nav .is-menu-open .wp-block-navigation-item { width: 100%; }
.tes-nav .is-menu-open .wp-block-navigation-item__content.wp-block-navigation-item__content {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 var(--pad);
  font-family: var(--font-display); font-size: 20px; letter-spacing: -0.01em; text-transform: uppercase;
  border-top: 1.5px solid var(--ink-soft); transition: background-color 0.12s;
}
.tes-nav .is-menu-open .wp-block-navigation-item__content:hover { background: var(--tint); }
.tes-nav .is-menu-open .current-menu-item > .wp-block-navigation-item__content, .tes-nav .is-menu-open .wp-block-navigation-item__content[aria-current="page"] { background: var(--yellow); color: var(--ink); }
.tes-nav .is-menu-open .nav__donate .wp-block-navigation-item__content { color: var(--yellow); }
.tes-nav .is-menu-open .nav__donate.current-menu-item .wp-block-navigation-item__content { color: var(--ink); }
.tes-nav .is-menu-open .wp-block-navigation__responsive-container-close { color: var(--sand); top: 8px; right: 8px; }

/* ---------- mobile action bar ---------- */
.actionbar .wp-block-buttons { width: 100%; }
.actionbar .wp-block-button .wp-block-button__link { border-color: var(--yellow); }
body.page-slug-join .actionbar, body.page-slug-book .actionbar, body.page-slug-contact .actionbar { display: none; }

/* ---------- facts (When / Where / Who rows in cards) ---------- */
.facts { display: grid; gap: 0; }
.facts__row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 9px 0; border-top: 1.5px solid var(--ink); font-size: 16px; line-height: 1.45; }
.facts__label { font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--clay-text); padding-top: 3px; }
.facts__value { font-weight: 500; }

/* ---------- lists: the second line in a row is italic text in WordPress ---------- */
.rows li em { display: block; font-style: normal; font-weight: 400; font-size: 15px; opacity: 0.85; margin-top: 2px; }
.rows li em a { font-weight: 400; }
.is-style-rows li, .is-style-rows-steps li { list-style: none; }
.is-style-rows, .is-style-rows-steps { padding-left: 0; }

/* ---------- gallery (Image blocks; the viewer is assets/js/gallery.js) ---------- */
.gallery .wp-block-image { margin: 0; border: 2px solid var(--ink); background: var(--sand-deep); overflow: hidden; }
.gallery .wp-block-image img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; transition: transform 0.25s; }
.gallery .wp-block-image { cursor: zoom-in; }
.gallery .wp-block-image:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.gallery .wp-block-image:hover img { transform: scale(1.04); }
.gallery .wp-block-image:active img { transform: scale(1.01); filter: brightness(0.85); }

/* ---------- video placeholder and the YouTube embed block ---------- */
.video { overflow: hidden; }
.video .wp-block-image { margin: 0; }
.video .wp-block-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; filter: brightness(0.8); }
.video .video__play {
  position: absolute; inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 72px; height: 72px; margin: 0; padding-left: 4px; border-radius: 50%;
  background: var(--yellow); border: 2.5px solid var(--ink); color: var(--ink); font-size: 26px; line-height: 1;
}
.video .video__cap { margin: 0; line-height: 1.6; }
.wp-block-embed { margin: 0; }
.wp-block-embed.video, .wp-block-embed-youtube { border: 2.5px solid var(--ink); background: var(--ink); }

/* ---------- quote ---------- */
.wp-block-quote.quote { border: 0; margin: 0; padding: 22px 20px; }
.wp-block-quote.quote p { margin: 0; }

/* ---------- placeholder portrait (a paragraph here) ---------- */
p.placeholder { margin: 0; }

/* ---------- forms ---------- */
.form .wp-block-buttons { margin-top: 4px; }
.form button.wp-block-button__link { width: auto; }
.form-error { background: var(--red); color: #fff; padding: 14px 16px; border: 2px solid var(--ink); font-weight: 500; margin: 0; }
.form-success { margin: 0; }
.form .wp-block-button.is-style-accent .wp-block-button__link, .form .wp-block-button.is-style-primary .wp-block-button__link { min-width: 220px; }

/* ---------- events ---------- */
.events-empty { margin: 0; }

/* ---------- chip paragraph and misc ---------- */
.wp-block-details { margin: 0; }
.wp-block-details summary { margin: 0; }
.wp-block-details > p { margin-top: 0; }

/* ---------- footer: strip on most pages, a narrow solid band on pages with one short section ---------- */
.footer-divider { display: none; }
body.page-slug-contact .footer-strip, body.page-slug-donate .footer-strip { display: none; }
body.page-slug-contact .footer-divider, body.page-slug-donate .footer-divider { display: block; }
.footer .wp-block-image { margin: 0; flex: none; }
.footer__brand .wp-block-image img { width: 96px; height: 96px; }
.footer__links { list-style: none; padding: 0; margin: 0; }
.footer__links li { list-style: none; }

/* ---------- core Details block inside FAQ ---------- */
.faq .wp-block-details { border-top: 1.5px solid var(--ink); }
.faq .wp-block-details:last-child { border-bottom: 1.5px solid var(--ink); }
.faq .wp-block-details summary { border: 0; }

/* ---------- gallery photo viewer (assets/js/gallery.js) ---------- */
html:has(dialog.tes-viewer[open]) { overflow: hidden; }
dialog.tes-viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: transparent; color: var(--sand); overflow: hidden; }
dialog.tes-viewer::backdrop { background: rgba(21, 19, 15, 0.98); }
.tes-viewer__stage { position: absolute; inset: 0; display: grid; place-items: center; padding: 72px 16px 56px; cursor: zoom-out; }
.tes-viewer__fig { margin: 0; display: grid; gap: 12px; justify-items: center; cursor: default; }
dialog.tes-viewer img { display: block; width: auto; height: auto; margin: 0; max-width: min(94vw, 1200px); max-height: calc(100dvh - 150px); object-fit: contain; border: 3px solid var(--sand); background: var(--ink); }
.tes-viewer__count { margin: 0; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--sand); }
dialog.tes-viewer button { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); cursor: pointer; box-shadow: 0 0 0 2px var(--sand); }
dialog.tes-viewer button:focus-visible { outline: 3px solid var(--sand); outline-offset: 4px; }
dialog.tes-viewer .tes-viewer__close { top: 12px; right: 12px; }
dialog.tes-viewer .tes-viewer__nav { top: 50%; transform: translateY(-50%); }
dialog.tes-viewer .tes-viewer__prev { left: 12px; right: auto; }
dialog.tes-viewer .tes-viewer__next { right: 12px; left: auto; }
dialog.tes-viewer button[hidden] { display: none; }
@media (max-width: 700px) {
  dialog.tes-viewer .tes-viewer__nav { top: auto; bottom: 8px; transform: none; }
}

/* ---------- editor fidelity (these only matter inside the block editor) ---------- */
/* The editor makes every block position: relative, which collapsed the hero's pattern panel on wide screens. */
@media (min-width: 900px) {
  .hero > .hero__field.hero__field { position: absolute; }
}
/* Full-width bands run edge to edge in the editor too, as they do on the site. */
.editor-styles-wrapper .is-root-container > :is(.section, .banner, .page-head, .hero, .fieldstrip, .divider) { max-width: none; margin-inline: 0; }

/* The page title field is editor-only (it feeds the menu, browser tab and search results, and is not printed on the page).
   Shown as a quiet, labelled strip above the page so it reads as admin info, not as page content. */
.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper { max-width: none; margin: 0; padding: 12px 24px 14px; background: var(--sand-deep); border-bottom: 2px dashed rgba(21, 19, 15, 0.35); }
.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper::before { content: "Page title \00b7  used for the menu, browser tab and search results \00b7  not shown on the page"; display: block; margin-bottom: 4px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(21, 19, 15, 0.6); }
.editor-styles-wrapper .edit-post-visual-editor__post-title-wrapper .wp-block-post-title { max-width: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 16px; font-weight: 500; line-height: 1.4; letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
