/* =========================================================
   HOMEPAGE
========================================================= */

/* =========================================================
   HERO
========================================================= */

.hero-section {
  position: relative;
  overflow: hidden;
}

.hero-row {
  width: 88%;
  max-width: 1120px;
}

.hero-row .et_pb_column {
  max-width: 680px;
}

.home-hero-copy h1 {
  margin: 0;
  padding: 0;
  color: var(--white) !important;
  font-size: clamp(36px, 4.4vw, 54px);
  line-height: 1.1;
}

.home-hero-english {
  margin: 10px 0 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.92);
  font-family: Fredoka, Georgia, serif;
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 500;
  line-height: 1.2;
}

.home-hero-tagline {
  margin: 20px 0 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 17px;
  line-height: 1.65;
}

.hero-line {
  width: 68px;
  height: 4px;
  border-radius: 4px;
  background: var(--accent);
}

.hero-line-module {
  margin-bottom: 22px !important;
}

/* =========================================================
   QUICK LINKS
========================================================= */

/*
 * flow-root prevents the row's negative margin from pulling
 * the entire white section over the hero image.
 */
.home-quick-section {
  display: flow-root;
  position: relative;
  z-index: 2;
  margin: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 48px !important;
  overflow: visible;
  background: var(--white) !important;
}

.home-quick-row {
  position: relative;
  z-index: 3;
  align-items: stretch;
  margin-top: -36px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.home-quick-row > .et_pb_column {
  display: flex;
  align-items: stretch;
}

.home-quick-card {
  width: 100%;
  min-height: 195px;
  height: 100%;
  margin: 0 !important;
}

.home-quick-card .et_pb_blurb_content {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.home-quick-card .et_pb_blurb_container {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.home-quick-card .et_pb_blurb_description {
  margin-top: auto;
}

/* =========================================================
   WELCOME SECTION
========================================================= */

.welcome-section,
.home-welcome-section {
  background: var(--background);
}

.home-welcome-section > .et_pb_row,
.welcome-row {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.welcome-row {
  align-items: stretch;
}

.welcome-card {
  padding: clamp(24px, 4vw, 42px) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.welcome-card h2 {
  margin-bottom: 12px;
  font-size: clamp(27px, 3vw, 35px);
}

.welcome-card p {
  color: var(--slate);
}

.welcome-card p:last-child {
  padding-bottom: 0;
}

/* =========================================================
   SHARED HOMEPAGE HEADINGS
========================================================= */

.section-heading,
.section-heading .et_pb_text_inner {
  max-width: 720px;
  margin-inline: auto;
}

.section-heading h2 {
  font-size: clamp(29px, 3vw, 38px);
}

.section-heading p {
  color: var(--primary);
  font-weight: 600;
}

/* =========================================================
   LATEST UPDATES
========================================================= */

.home-updates-section {
  padding-top: 64px !important;
  padding-bottom: 64px !important;
}

.home-updates-section > .et_pb_row {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.home-updates-heading-row {
  display: flex;
  align-items: flex-end;
  margin-bottom: 28px !important;
}

.home-updates-button {
  margin: 0 !important;
}

.home-updates-button .et_pb_button {
  white-space: nowrap;
  font-size: 14px !important;
}

.home-updates-content-row {
  margin-top: 0 !important;
}

/* =========================================================
   EXPLORE YSGOL MYNACH
========================================================= */

.home-explore-section > .et_pb_row {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.home-explore-section > .et_pb_row + .et_pb_row {
  margin-top: 38px !important;
}

.home-explore-section .et_pb_promo {
  overflow: hidden;
  border-radius: 18px;
}

/* =========================================================
   GALLERY
========================================================= */

.home-gallery-section {
  padding-top: 68px !important;
  padding-bottom: 68px !important;
}

.home-gallery-section > .et_pb_row {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.home-gallery-heading-row {
  margin-bottom: 36px !important;
}

.home-gallery-grid {
  margin-bottom: 34px !important;
}

.home-gallery-button-row {
  margin-top: 0 !important;
}

/* =========================================================
   HOMEPAGE FACEBOOK FEED
========================================================= */

.home-facebook-section,
.home-facebook-section * {
  box-sizing: border-box;
}

.home-facebook-row {
  display: flex;
  align-items: center;
}

.home-facebook-english {
  margin: 6px 0 20px;
  padding: 0;
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

/* Divi module containing the shortcode */
.home-facebook-feed {
  width: 100%;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible;
}

/* Remove the plugin's large outer panel */
.home-facebook-feed .esf-facebook-feed,
.home-facebook-feed .esf-facebook-feed__row,
.home-facebook-feed .esf-facebook-feed__tiles {
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Three compact posts */
.home-facebook-feed .esf-facebook-feed__row-inner,
.home-facebook-feed .esf-facebook-feed__tiles-inner {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: stretch;
  gap: 12px !important;
}

/* Individual post card */
.home-facebook-feed .esf-facebook-feed__row-cell,
.home-facebook-feed .esf-facebook-feed__tile-cell {
  width: auto !important;
  min-width: 0;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid rgba(10, 102, 93, 0.14);
  border-radius: 12px;
  background: #f2f7f6;
  box-shadow: 0 7px 18px rgba(23, 42, 42, 0.09);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* Shorter landscape presentation */
.home-facebook-feed .esf-facebook-feed__tile {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: inherit;
  background: #f2f7f6;
}

/*
 * Contain prevents posters and notices from being cropped.
 * The regular photographs are already close to 4:3.
 */
.home-facebook-feed .esf-facebook-feed__tile-img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  object-position: center;
  background: #f2f7f6;
  transition: transform 0.25s ease;
}

.home-facebook-feed .esf-facebook-feed__tile-overlay,
.home-facebook-feed .esf-facebook-feed__tile-hover-overlay {
  border-radius: inherit;
}

.home-facebook-feed .esf-facebook-feed__tile-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 11px 24px rgba(23, 42, 42, 0.13);
}

.home-facebook-feed .esf-facebook-feed__tile-cell:hover
  .esf-facebook-feed__tile-img {
  transform: scale(1.02);
}

.home-facebook-feed .esf-facebook-feed__tile:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Tablet */
@media (max-width: 980px) {
  .home-facebook-row {
    display: block;
  }

  .home-facebook-row > .et_pb_column:first-child {
    margin-bottom: 36px !important;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .home-facebook-section {
    padding-top: 50px !important;
    padding-bottom: 50px !important;
  }

  .home-facebook-feed .esf-facebook-feed__row,
  .home-facebook-feed .esf-facebook-feed__tiles {
    padding: 3px 3px 12px !important;
    overflow-x: auto !important;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .home-facebook-feed .esf-facebook-feed__row-inner,
  .home-facebook-feed .esf-facebook-feed__tiles-inner {
    width: max-content !important;
    max-width: none !important;
    grid-template-columns: repeat(3, minmax(230px, 76vw)) !important;
    gap: 12px !important;
  }

  .home-facebook-feed .esf-facebook-feed__tile-cell {
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-facebook-feed .esf-facebook-feed__tile-cell,
  .home-facebook-feed .esf-facebook-feed__tile-img {
    transition: none;
  }
}

/* =========================================================
   ESTYN
========================================================= */

.home-estyn-section {
  padding-top: 28px !important;
  padding-bottom: 28px !important;
}

.home-estyn-row {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* =========================================================
   MAP AND CONTACT DETAILS
========================================================= */

.home-contact-row {
  display: flex;
  align-items: stretch;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.home-contact-row > .et_pb_column {
  display: flex;
  flex-direction: column;
}

.home-contact-map {
  width: 100%;
  height: 100% !important;
  min-height: 420px;
  overflow: hidden;
  border-radius: 18px;
}

.home-contact-map .et_pb_map {
  width: 100%;
  height: 100% !important;
  min-height: 420px;
}

.home-contact-card {
  padding: 38px !important;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 12px 32px rgba(23, 42, 42, 0.08);
}

.home-contact-card > .et_pb_module {
  width: 100%;
  max-width: 100%;
}

body #page-container .home-contact-card .et_pb_text {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body #page-container .home-contact-card .et_pb_text_inner {
  width: 100%;
  height: auto;
  overflow: visible !important;
}

.home-contact-card p,
.home-contact-card a {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.home-contact-card p:last-child {
  padding-bottom: 0;
}

.home-contact-card .et_pb_button_module_wrapper {
  margin-top: auto !important;
  padding-top: 24px;
}

/* Vertically position the Explore card content */
.home-explore-section .et_pb_promo {
  display: flex !important;
  min-height: 350px;
  flex-direction: column;
  justify-content: flex-end;
}

.home-explore-section .et_pb_promo_description {
  padding-bottom: 20px;
}

.home-explore-section .et_pb_button_wrapper {
  margin-top: 0;
}

/* =========================================================
   LEGACY HOMEPAGE CTA CARDS
   Retained in case these classes are still used elsewhere.
========================================================= */

.cta-section {
  background: var(--background);
}

.cta-card-row {
  display: flex;
  align-items: stretch;
}

.cta-card-row > .et_pb_column {
  display: flex;
  align-items: stretch;
}

.cta-card {
  width: 100%;
  padding: 27px 20px !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: center;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.cta-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 32px rgba(23, 42, 42, 0.12);
}

.cta-card .et-pb-icon {
  color: var(--primary);
}

.cta-card .et_pb_module_header {
  margin-bottom: 6px;
  color: var(--dark-text);
  font-size: 22px;
}

.cta-card .et_pb_blurb_description,
.cta-card .et_pb_blurb_description p {
  color: var(--slate);
  font-size: 14px;
  line-height: 1.5;
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 980px) {
  .home-quick-row.et_pb_row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: -20px !important;
  }

  .home-quick-row > .et_pb_column {
    width: auto !important;
    margin: 0 !important;
  }

  .home-quick-card {
    min-height: 180px;
  }

  .home-facebook-row {
    display: block;
  }

  .home-facebook-row > .et_pb_column:first-child {
    margin-bottom: 36px !important;
  }

  .home-contact-row {
    display: block;
  }

  .home-contact-card {
    margin-top: 28px;
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 767px) {
  .home-hero-tagline {
    font-size: 15px;
  }

  .home-quick-section {
    padding-bottom: 40px !important;
  }

  .home-quick-row.et_pb_row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 0 !important;
  }

  .home-quick-row > .et_pb_column {
    width: auto !important;
    margin: 0 !important;
  }

  .home-quick-card {
    min-height: 165px;
    height: 100%;
    margin: 0 !important;
    padding: 18px 12px !important;
  }

  .home-quick-card .et_pb_module_header {
    font-size: 15px !important;
  }

  .home-updates-heading-row {
    display: block;
  }

  .home-updates-button {
    margin-top: 20px !important;
    text-align: left !important;
  }

  .home-updates-button .et_pb_button {
    white-space: normal;
  }

  .home-gallery-section {
    padding-top: 52px !important;
    padding-bottom: 52px !important;
  }

  .home-facebook-section {
    padding-top: 50px !important;
    padding-bottom: 50px !important;
  }

  .home-contact-map,
  .home-contact-map .et_pb_map {
    min-height: 340px;
  }

  .home-contact-card {
    padding: 28px !important;
  }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  .cta-card {
    transition: none;
  }
}