/*
Theme Name: Healing Waters
Theme URI: https://healingwaters.example
Author: Atrium
Description: Trilingual (CZ/EN/PL) theme for the Healing Waters project, supported by Visegrad Fund. Includes the home page and Events, Photo, Audio and Video page templates.
Version: 2.0
License: GNU General Public License v2 or later
Text Domain: healing-waters
*/

:root {
  --hw-teal: #1d4e5f;
  --hw-teal-dark: #17404f;
  --hw-ink: #17313d;
  --hw-row: #5f9aa8;
  --hw-serif: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: var(--hw-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

.hw-wrap { max-width: 1150px; margin: 0 auto; padding: 56px 24px 72px; }
.hw-wrap--wide { max-width: 1200px; padding: 56px 24px; }

/* Visegrad mark */
.hw-mark {
  border: 2px solid var(--hw-ink);
  color: var(--hw-ink);
  padding: 14px 22px;
  display: inline-block;
  text-align: left;
  line-height: 1.2;
  text-decoration: none;
}
.hw-mark--light { border-color: #fff; color: #fff; }
.hw-mark .hw-mark-dots { display: block; font-size: 10px; }
.hw-mark .hw-mark-name { font-family: var(--hw-serif); font-size: 22px; font-weight: 600; }
.hw-mark .hw-mark-name span { margin-right: 8px; }

/* Hero */
.hw-hero {
  position: relative;
  min-height: 78vh;
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 120px;
}
.hw-hero h1 {
  font-family: var(--hw-serif);
  color: #fff;
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 500;
  margin: 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.hw-nav { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-top: 90px; }
.hw-nav a {
  font-family: var(--hw-serif);
  color: #fff;
  background: rgba(29, 78, 95, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.9);
  padding: 8px 34px;
  font-size: 22px;
  letter-spacing: 2px;
  text-decoration: none;
  transition: background 0.2s ease;
}
.hw-nav a:hover { background: rgba(29, 78, 95, 1); }
.hw-hero-foot {
  position: absolute;
  bottom: 24px; left: 24px; right: 24px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.hw-hero-foot p { font-family: var(--hw-serif); color: #fff; font-size: 22px; margin: 0; }

/* Subpage banner */
.hw-banner {
  position: relative;
  height: 340px;
  background-size: cover;
  background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.hw-banner .hw-mark { position: absolute; top: 20px; left: 24px; }
.hw-banner h1 {
  font-family: var(--hw-serif);
  color: #fff;
  font-size: clamp(44px, 8vw, 80px);
  font-weight: 500;
  margin: 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}

/* Three column text */
.hw-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 36px; }
.hw-cols > div + div { border-left: 1px solid #9fb6bd; padding-left: 36px; }
.hw-cols h2 { font-family: var(--hw-serif); font-size: 52px; font-weight: 500; margin: 0 0 18px; }
.hw-cols p { font-size: 14px; line-height: 1.55; text-align: justify; }
.hw-center { text-align: center; }
.hw-right { text-align: right; }

/* Bands */
.hw-band { background: var(--hw-teal); color: #fff; padding: 34px 24px; }
.hw-band--dark { background: var(--hw-teal-dark); padding: 28px 24px; }
.hw-band-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px;
}
.hw-band-grid p { font-family: var(--hw-serif); font-size: 20px; text-align: center; margin: 0; }
.hw-band-grid > *:not(:first-child) { border-left: 1px solid rgba(255, 255, 255, 0.35); padding-left: 24px; }
.hw-support { max-width: 1000px; margin: 0 auto; display: flex; align-items: center; gap: 32px; flex-wrap: wrap; justify-content: center; }
.hw-support div { font-family: var(--hw-serif); font-size: 21px; line-height: 1.5; }
.hw-support p { margin: 0; }

.hw-strip { width: 100%; height: 220px; object-fit: cover; display: block; }
.hw-strip--short { height: 180px; }

/* Creators */
.hw-creators { max-width: 1100px; margin: 0 auto; padding: 64px 24px; text-align: center; }
.hw-creators h2 { font-family: var(--hw-serif); font-size: clamp(34px, 6vw, 64px); font-weight: 500; margin: 0; }
.hw-creators .hw-credits { margin-top: 36px; font-size: 15px; line-height: 1.7; text-align: left; }

/* Partners */
.hw-partners { text-align: center; padding: 64px 24px; }
.hw-partners h2 { font-family: var(--hw-serif); font-size: 34px; font-weight: 600; margin: 0 0 32px; }
.hw-partners h3 { font-family: var(--hw-serif); font-size: 30px; font-weight: 600; margin: 56px 0 32px; }
.hw-partner-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; align-items: start;
}
.hw-partner-grid img { max-width: 160px; height: auto; margin: 0 auto 16px; display: block; }
.hw-partner-grid .hw-atrium-logo { width: 132px; height: 132px; object-fit: contain; margin-bottom: 10px; }
.hw-partner-grid .hw-arteweda-logo { width: 150px; height: 132px; object-fit: contain; margin-bottom: 10px; }
.hw-partner-name { font-family: var(--hw-serif); font-size: 22px; margin: 0 0 4px; }
.hw-partner-role { font-size: 15px; margin: 0; }
.hw-logo-circle {
  width: 110px; height: 110px; margin: 0 auto 16px;
  border: 2px solid var(--hw-ink); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hw-serif); font-size: 15px; letter-spacing: 2px;
}
.hw-logo-text { font-family: var(--hw-serif); font-size: 26px; font-weight: 600; margin: 24px 0 40px; }
.hw-partner-grid a.hw-logo-text { color: var(--hw-ink); text-decoration: underline; display: inline-block; }

/* Footer */
.hw-footer { background: var(--hw-teal); color: #fff; padding: 36px 24px 24px; }
.hw-footer a { color: #fff; }
.hw-footer .hw-band-grid { text-align: center; }
.hw-footer h2 { font-family: var(--hw-serif); font-size: 22px; margin: 0 0 10px; font-weight: 500; }
.hw-footer p { font-size: 13px; margin: 0 0 4px; }
.hw-footer-meta { text-align: center; margin-top: 28px; font-size: 13px; }
.hw-footer-credit { text-align: right; font-size: 12px; margin: 16px 0 0; opacity: 0.8; }

/* Events table */
.hw-table { display: grid; grid-template-columns: 1fr 1.6fr 1.6fr; border: 2px solid var(--hw-ink); }
.hw-table > div {
  font-family: var(--hw-serif);
  text-align: center;
  padding: 22px 12px;
  border-right: 2px solid var(--hw-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.hw-table .hw-th { font-size: clamp(17px, 2.4vw, 26px); font-weight: 600; padding: 18px 10px; }
.hw-table .hw-td { border-top: 2px solid var(--hw-ink); font-size: clamp(15px, 2vw, 22px); }
.hw-table .hw-td--alt { background: var(--hw-row); }
.hw-table .hw-td--name { font-size: clamp(17px, 2.4vw, 26px); font-weight: 600; }
.hw-table .hw-td--name small { font-size: clamp(14px, 1.8vw, 19px); font-weight: 500; }

/* Two column subpage layout */
.hw-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 48px; }
.hw-two p { font-size: 19px; line-height: 1.6; }
.hw-sub-h2 { font-family: var(--hw-serif); font-size: 26px; font-weight: 600; margin: 0 0 28px; }

/* Audio */
.hw-tracks { display: flex; flex-direction: column; gap: 24px; }
.hw-track {
  border: 2px solid var(--hw-ink);
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hw-track span { font-family: var(--hw-serif); font-size: clamp(22px, 3vw, 30px); font-weight: 600; color: var(--hw-teal-dark); }
.hw-track audio { max-width: 220px; }

/* Video / gallery */
.hw-video-thumb { position: relative; margin-top: 28px; }
.hw-video-thumb img { width: 100%; display: block; }
.hw-video-thumb span {
  font-family: var(--hw-serif); position: absolute; top: 16px; left: 24px;
  color: #fff; font-size: 28px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.hw-gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 190px; gap: 12px; }
.hw-gallery-item { position: relative; grid-column: span 4; grid-row: span 2; overflow: hidden; border: 0; padding: 0; background: var(--hw-ink); cursor: zoom-in; }
.hw-gallery-item--1, .hw-gallery-item--5 { grid-column: span 8; }
.hw-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 500ms ease; }
.hw-gallery-item:hover img, .hw-gallery-item:focus-visible img { transform: scale(1.035); }
.hw-gallery-item > span { position: absolute; inset: auto 0 0; display: flex; align-items: baseline; gap: 12px; padding: 38px 18px 16px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.72)); font-family: var(--hw-serif); font-size: 19px; text-align: left; }
.hw-gallery-item > span strong { font-family: monospace; font-size: 11px; font-weight: 500; opacity: .75; }
.hw-gallery-item:focus-visible { outline: 3px solid var(--hw-teal); outline-offset: 3px; }
.hw-lightbox { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; padding: 48px 20px 24px; background: rgba(5,18,23,.96); color: #fff; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }
.hw-lightbox[open] { display: grid; }
.hw-lightbox::backdrop { background: rgba(5,18,23,.96); }
.hw-lightbox figure { grid-column: 2; margin: 0; min-width: 0; }
.hw-lightbox figure img { display: block; width: 100%; height: min(76vh, 850px); object-fit: contain; }
.hw-lightbox figcaption { display: flex; justify-content: center; gap: 16px; margin-top: 14px; font-family: var(--hw-serif); font-size: 20px; }
.hw-lightbox figcaption span:first-child { opacity: .6; font-family: monospace; font-size: 12px; }
.hw-lightbox button { border: 0; background: transparent; color: #fff; font-size: 44px; cursor: pointer; }
.hw-lightbox-close { position: absolute; top: 14px; right: 20px; }
.hw-lightbox-prev { grid-column: 1; }
.hw-lightbox-next { grid-column: 3; }

@media (max-width: 640px) {
  .hw-cols > div + div { border-left: 0; padding-left: 0; }
  .hw-band-grid > *:not(:first-child) { border-left: 0; padding-left: 0; }
  .hw-table { grid-template-columns: 1fr; }
  .hw-gallery { grid-template-columns: 1fr; grid-auto-rows: 260px; }
  .hw-gallery-item, .hw-gallery-item--1, .hw-gallery-item--5 { grid-column: 1; grid-row: span 1; }
  .hw-lightbox { grid-template-columns: 44px minmax(0, 1fr) 44px; padding-inline: 4px; }
  .hw-lightbox figure img { height: 70vh; }
}

/* Editable text blocks */
.hw-flush > p:first-child { margin-top: 0; }
.hw-page-content img { max-width: 100%; height: auto; }

/* ==========================================================================
   Page content written as WordPress blocks (the page editor)
   ========================================================================== */

.hw-content::after { content: ""; display: table; clear: both; }
.hw-content > *:not(.alignfull):not([class*="hw-"]) { max-width: 1150px; margin-left: auto; margin-right: auto; padding-left: 24px; padding-right: 24px; }
.hw-content--plain { padding: 56px 0 72px; }
.hw-content img { max-width: 100%; height: auto; }
.hw-content .alignfull { margin-left: 0; margin-right: 0; max-width: none; width: 100%; }
.wp-block-group.hw-wrap, .wp-block-group.hw-creators { margin-left: auto; margin-right: auto; }

/* Visegrad stamp as a paragraph block */
p.hw-mark { margin: 0; font-family: var(--hw-serif); font-size: 22px; font-weight: 600; width: fit-content; }
p.hw-mark a { color: inherit; text-decoration: none; }
p.hw-mark::before { content: "•"; display: block; font-size: 10px; font-family: system-ui, sans-serif; font-weight: 400; }
p.hw-mark::after { content: "•\00a0\00a0\00a0•"; display: block; font-size: 10px; font-family: system-ui, sans-serif; font-weight: 400; }
p.hw-mark a::before, p.hw-mark:not(:has(a))::first-letter { margin-right: 8px; }
p.hw-mark a::before { content: "•"; }

/* Hero and banners as Cover blocks */
.wp-block-cover.hw-hero, .wp-block-cover.hw-banner { padding: 0; min-height: 0; display: block; margin-top: 0; margin-bottom: 0; }
.wp-block-cover.hw-hero .wp-block-cover__inner-container {
  position: relative; z-index: 1; width: 100%; max-width: none; min-height: min(78vh, 900px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 16px 120px; color: #fff;
}
.wp-block-cover.hw-banner .wp-block-cover__inner-container {
  position: relative; z-index: 1; width: 100%; max-width: none; min-height: 340px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.wp-block-cover.hw-banner p.hw-mark { position: absolute; top: 20px; left: 24px; }
.hw-hero .wp-block-buttons.hw-nav { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin-top: 90px; }
.hw-nav .wp-block-button { margin: 0; }
.hw-nav .wp-block-button__link {
  font-family: var(--hw-serif); color: #fff; background: rgba(29, 78, 95, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.9); border-radius: 0; padding: 8px 34px;
  font-size: 22px; letter-spacing: 2px; text-decoration: none; transition: background 0.2s ease;
}
.hw-nav .wp-block-button__link:hover { background: rgba(29, 78, 95, 1); }
.hw-hero-foot .hw-mark { flex: none; }
.wp-block-cover.hw-hero .wp-block-group.hw-hero-foot { position: absolute; bottom: 24px; left: 24px; right: 24px; margin: 0; }

/* Columns blocks that use the theme grids */
.wp-block-columns.hw-cols, .wp-block-columns.hw-band-grid, .wp-block-columns.hw-partner-grid, .wp-block-columns.hw-two { display: grid; margin-bottom: 0; }
.wp-block-columns.hw-cols { gap: 36px; }
.wp-block-columns.hw-band-grid { gap: 24px; }
.wp-block-columns.hw-partner-grid { gap: 32px; }
.wp-block-columns.hw-two { gap: 48px; }
.hw-cols > .wp-block-column, .hw-band-grid > .wp-block-column, .hw-partner-grid > .wp-block-column, .hw-two > .wp-block-column { min-width: 0; margin: 0; }
.hw-cols h2:first-child, .hw-two > .wp-block-column > :first-child { margin-top: 0; }

/* Bands */
.wp-block-group.hw-band { margin-top: 0; margin-bottom: 0; }
.hw-support .hw-support-text { font-family: var(--hw-serif); font-size: 21px; line-height: 1.5; }
.hw-support .hw-support-text p { margin: 0; }

/* Image strips */
.wp-block-image.hw-strip { margin: 0; height: auto; }
.wp-block-image.hw-strip img { width: 100%; height: 220px; object-fit: cover; display: block; }
.wp-block-image.hw-strip--short img { height: 180px; }

/* Creators and partners */
.hw-creators p { margin: 36px 0 0; font-size: 15px; line-height: 1.7; text-align: left; }
.hw-creators p + p { margin-top: 24px; }
.hw-partners .hw-mark { margin: 0 auto; }
.hw-partner-grid .wp-block-image { margin: 0 0 10px; }
.hw-partner-grid .wp-block-image img { width: 150px; height: 132px; max-width: 150px; object-fit: contain; margin: 0 auto; display: block; }
.hw-partner-grid p.hw-logo-text { margin: 24px 0 40px; }
.hw-partner-grid p.hw-logo-text a { color: inherit; }
.hw-partner-grid p.hw-logo-text--underline a { text-decoration: underline; }
.hw-partner-grid p.hw-logo-text--blue { font-size: 38px; margin: 18px 0 34px; color: #1d4ed8; }
.hw-partner-grid p.hw-logo-text--blue a { text-decoration: none; }

/* Events as a Table block */
.wp-block-table.hw-events { margin: 0; overflow: visible; }
.wp-block-table.hw-events table { width: 100%; border-collapse: collapse; border: 2px solid var(--hw-ink); table-layout: fixed; }
.wp-block-table.hw-events th, .wp-block-table.hw-events td {
  font-family: var(--hw-serif); text-align: center; vertical-align: middle;
  padding: 22px 12px; border: 2px solid var(--hw-ink); color: var(--hw-ink);
}
.wp-block-table.hw-events thead { border-bottom: 0; }
.wp-block-table.hw-events th { font-size: clamp(17px, 2.4vw, 26px); font-weight: 600; padding: 18px 10px; }
.wp-block-table.hw-events td { font-size: clamp(15px, 2vw, 22px); line-height: 1.25; }
.wp-block-table.hw-events tbody tr:nth-child(odd) td { background: var(--hw-row); }
.wp-block-table.hw-events td:nth-child(2) { font-size: clamp(14px, 1.8vw, 19px); font-weight: 500; }
.wp-block-table.hw-events td:nth-child(2) strong { font-size: clamp(17px, 2.4vw, 26px); font-weight: 600; }
.wp-block-table.hw-events th:first-child, .wp-block-table.hw-events td:first-child { width: 24%; }

/* Audio tracks as Group blocks */
.wp-block-group.hw-tracks { display: flex; flex-direction: column; gap: 24px; }
.wp-block-group.hw-track, .hw-tracks--remote .hw-track { flex-wrap: wrap; margin: 0; }
.hw-track p { margin: 0; font-size: 16px; }
.hw-track p.hw-track-title { font-family: var(--hw-serif); font-size: clamp(22px, 3vw, 30px); line-height: 1.2; font-weight: 600; color: var(--hw-teal-dark); }
.hw-track .wp-block-audio { margin: 0; flex: 1 1 220px; }
.hw-track .wp-block-audio audio, .hw-track > audio { width: 100%; max-width: none; min-width: 0; }
.hw-track:not(:has(audio))::after {
  content: ""; flex: none; width: 52px; height: 52px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 52 52'%3E%3Ccircle cx='26' cy='26' r='23' fill='none' stroke='%2317313d' stroke-width='3'/%3E%3Cpath d='M21 16 L38 26 L21 36 Z' fill='%2317313d'/%3E%3C/svg%3E");
}
.hw-tracks--remote { margin-top: 24px; }

/* Video */
.wp-block-image.hw-video-thumb { position: relative; margin: 28px 0 0; }
.wp-block-image.hw-video-thumb img { width: 100%; display: block; }
.wp-block-image.hw-video-thumb figcaption {
  position: absolute; top: 16px; left: 24px; margin: 0; padding: 0; background: none; text-align: left;
  font-family: var(--hw-serif); color: #fff; font-size: 28px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.hw-two .wp-block-video, .hw-two .wp-block-embed { margin: 28px 0 0; }
.hw-remote-video { margin: 28px 0 0; }
.hw-remote-video video { width: 100%; display: block; }
.hw-remote-video figcaption { margin-top: 8px; }

/* Photo gallery as a Gallery block */
.wp-block-gallery.hw-gallery.has-nested-images, .hw-gallery--remote {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 190px; gap: 12px; margin: 0;
}
.hw-gallery--remote { margin-top: 12px; }
.wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image, .hw-gallery--remote figure.wp-block-image {
  position: relative; width: 100% !important; height: 100%; max-width: none; margin: 0; grid-column: span 4; grid-row: span 2;
  overflow: hidden; background: var(--hw-ink); cursor: zoom-in; display: block;
}
.wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image:nth-child(4n+1),
.wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image:nth-child(4n),
.hw-gallery--remote figure.wp-block-image:nth-child(4n+1),
.hw-gallery--remote figure.wp-block-image:nth-child(4n) { grid-column: span 8; }
.wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image img, .hw-gallery--remote figure.wp-block-image img {
  width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; transition: transform 500ms ease;
}
.hw-gallery figure.wp-block-image:hover img { transform: scale(1.035); }
.wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image figcaption, .hw-gallery--remote figure.wp-block-image figcaption {
  position: absolute; inset: auto 0 0; margin: 0; max-height: none; padding: 38px 18px 16px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .72)); font-family: var(--hw-serif); font-size: 19px; text-align: left;
}
.wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image::before { display: none; }

@media (max-width: 640px) {
  .wp-block-columns.hw-cols, .wp-block-columns.hw-band-grid, .wp-block-columns.hw-partner-grid, .wp-block-columns.hw-two { grid-template-columns: 1fr; }
  .wp-block-cover.hw-hero .wp-block-cover__inner-container { padding-bottom: 190px; }
  .hw-hero .wp-block-buttons.hw-nav { margin-top: 48px; }
  .wp-block-table.hw-events th, .wp-block-table.hw-events td { padding: 12px 6px; }
  .wp-block-gallery.hw-gallery.has-nested-images, .hw-gallery--remote { grid-template-columns: 1fr; grid-auto-rows: 260px; }
  .wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image, .hw-gallery--remote figure.wp-block-image,
  .wp-block-gallery.hw-gallery.has-nested-images figure.wp-block-image:nth-child(n), .hw-gallery--remote figure.wp-block-image:nth-child(n) { grid-column: 1; grid-row: span 1; }
}
