/*
 Theme Name:   Somerset Youth Theatre
 Theme URI:    https://somersetyt.co.uk/
 Description:  Child theme for SYT
 Author:       Rob Wick
 Author URI:   https://technovore.co.uk
 Template:     Divi
 Version:      1.0.3
*/

/* Add your custom CSS below */

/* Force each post to a fixed width & equal height */
.my-custom-blog .et_pb_post {
  flex: 1 1 calc(33.333% - 30px);
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 20px;
  min-height: 400px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
}

/* =====================================
   TYPOGRAPHY + BASE STYLING (Divi 4)
   ===================================== */

/* Correct OpenDyslexic font loading */
@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://somersetyt.co.uk/wp-content/uploads/2024/09/OpenDyslexic-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://somersetyt.co.uk/wp-content/uploads/2024/09/OpenDyslexic-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
}

/* ---- Body ---- */
body {
  font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 300;
  
  /* NEW: Responsive font scaling (16px → 18px) */
  font-size: clamp(1rem, 1.2vw, 1.125rem);

  line-height: 1.6;
  letter-spacing: 0.03em;
  word-spacing: 0.12em;
  color: #272727;
  background-color: #f4f1e9;
  text-align: left;
  text-transform: none;
}

p { margin-bottom: 1.2em; }

/* ---- Headings ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'OpenDyslexic', sans-serif;
  font-weight: 700;
  color: #272727;
  line-height: 1.25;
  margin: 1.4em 0 0.6em;
  overflow-wrap: break-word;
}

/* Improved responsive clamp values */
h1 { font-size: clamp(28px, 5vw, 46px); }
h2 { font-size: clamp(24px, 4vw, 40px); }
h3 { font-size: clamp(20px, 3.5vw, 32px); }
h4 { font-size: clamp(18px, 3vw, 28px); }
h5 { font-size: clamp(16px, 2.5vw, 22px); }
h6 { font-size: clamp(14px, 2vw, 18px); }

@media (max-width:600px){
  h1,h2,h3,h4,h5,h6{overflow-wrap:anywhere;}
}

/* ---- Emphasis ---- */
em,i{font-style:normal;font-weight:bold;}
strong{font-weight:700;}

/* ---- Links ---- */
a {
  color: #ffffff !important;
  text-decoration: underline !important;
  transition: color .2s ease;
}

a:hover,
a:focus {
  color: #000000 !important;
  text-decoration: underline !important;
}


/* ---- Utilities ---- */
.primary-color{color:#D6AD60;}
.secondary-color{color:#188b92;}
.accent-color{color:#036781;}
.bg-light{background:#bfdde5;}
.bg-primary{background:#D6AD60;}
.bg-secondary{background:#188b92;}
.bg-dark{background:#272727;color:#bfdde5;}
*:focus{outline:2px solid #036781;outline-offset:2px;}


/* =====================================
   GLOBAL BUTTON STYLES
   ===================================== */
button,
input[type="button"],
input[type="submit"],
.et_pb_button,
.et_pb_promo_button,
.et_pb_contact_submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
  background:#000;
  color:#fff !important;
  border:none !important;
  border-radius:8px !important;
  padding:0.75em 1.5em !important;
  font-family:'Open Sans',sans-serif;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
  box-sizing:border-box;
  transition:box-shadow .2s ease,color .2s ease;
  line-height:1.2 !important;
  position:relative;
  overflow:hidden;
}

/* Disable Divi button icons & transitions */
.et_pb_button:after,
.et_pb_button:before,
.et_pb_button_wrapper .et_pb_button:after,
.et_pb_button_wrapper .et_pb_button:before {
  display:none !important;
}

/* Hover effect */
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
.et_pb_button:hover,
.et_pb_promo_button:hover,
.et_pb_contact_submit:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
  background:#000;
  color:#fff !important;
  box-shadow:0 0 0 2px #fff inset;
}

/* =====================================
   FLOATING BOX
   ===================================== */
.floating-box {
  position: fixed;
  top: 250px;
  right: 60px;
  background: #000;
  color: #fff !important;
  padding: 12px 12px;
  text-align: center;
  text-decoration: none;
  z-index: 1000;
  transform: rotate(-90deg);
  transform-origin: top right;
  max-width: 210px;
  white-space: nowrap;
  border-radius: 8px;
}

.floating-box h2 {
  font-size: 1rem;
  margin: 0;
  text-transform: uppercase;
  font-weight: 700;
  color: #fff !important;
}

.floating-box:hover {
  background: #333;
  color: #fff !important;
}

/* =====================================
   FLUENT FORMS
   ===================================== */

/* Fix Fluent Forms text (labels, descriptions, help text) */
div.fluentform,
div.fluentform .ff-el-group label,
div.fluentform .ff-el-group .ff-el-help-text,
div.fluentform .ff-el-group .ff-el-input--label,
div.fluentform .ff-el-group .ff-el-form-description {
    font-family: 'OpenDyslexic', sans-serif !important;
    color: #ffffff !important;
}

/* =====================================
   PORTFOLIO GRID
   ===================================== */
@media (min-width:981px){
  .three-columns .et_pb_portfolio_items{
    display:flex !important;
    flex-wrap:wrap !important;
    justify-content:flex-start;
  }
  .three-columns .et_pb_portfolio_item{
    flex:0 0 33.333% !important;
    max-width:33.333% !important;
    margin:0 0 30px 0 !important;
  }
}

/* =====================================
   DIVI MODULE HEADING FIX
   ===================================== */
.et_pb_slider h1,
.et_pb_fullwidth_slider h1,
.et_pb_blurb h1,
.et_pb_testimonial h1,
.et_pb_promo h1{
  font-size:1.6em !important;
  font-weight:600;
}

/* =====================================
   DIVI BLOG HEIGHT FIX
   ===================================== */
.et_pb_blog_grid .post-content {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.5em;
}

.et_pb_blog_grid article {
  min-height: 450px;
}

/* Equalized columns */
.et_pb_row.et_pb_equal_columns .et_pb_column {
  display: flex;
  flex-direction: column;
}

.et_pb_row.et_pb_equal_columns .et_pb_column .et_pb_promo {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Fluent Forms Overrides (unchanged) */
:root {
  --ff-primary-color: #000 !important;
  --ff-primary-hover-color: #000 !important;
  --ff-button-color: #fff !important;
  --ff-button-hover-color: #fff !important;
  --ff-border-radius: 8px !important;
  --ff-font-family: 'Open Sans', sans-serif !important;
  --ff-button-font-family: 'Open Sans', sans-serif !important;
}

div.fluentform .ff-btn,
div.fluentform .ff_submit_btn,
div.fluentform button.ff-btn {
  background-color:#000 !important;
  color:#fff !important;
  border:none !important;
  border-radius:8px !important;
  padding:0.75em 1.5em !important;
  font-family:'Open Sans',sans-serif !important;
  font-weight:600 !important;
  text-transform:uppercase !important;
  letter-spacing:0.05em !important;
  transition:box-shadow 0.2s ease, color 0.2s ease !important;
  line-height:1.2 !important;
}

div.fluentform input,
div.fluentform select,
div.fluentform textarea,
div.fluentform label {
  font-family:'Open Sans',sans-serif !important;
}

/* Header shrinking */
.pa-header .et_pb_row,
.pa-fixed-header .et_pb_row,
.pa-header .et_pb_menu__logo img,
.pa-fixed-header .et_pb_menu__logo img {
  transition:all .5s ease;
}

.pa-fixed-header .et_pb_menu__logo img {
  max-width:50%;
}

.pa-fixed-header {
  position:fixed;
  top:0;
  left:0;
  width:100%;
  z-index:9999;
}

#main-content {
  padding-top:120px;
}

/* Square blog & portfolio images */
.et_pb_post .et_pb_image_container img,
.et_pb_blog_grid .et_pb_image_container img {
    width:100%;
    aspect-ratio:1/1;
    object-fit:cover;
}

/* Person module centering */
.et_pb_team_member_image img {
  display:inline-block !important;
  margin:0 auto !important;
}

/* Uncropped blog override */
.uncropped-blog .et_pb_image_container,
.uncropped-blog .et_pb_image_container img {
    aspect-ratio:auto !important;
    object-fit:contain !important;
}

/* Remove tooltips and image titles from across the site*/
img[title] {
  cursor: default !important;
}

img[title]::after {
  content: "" !important;
}


/* ============================================================= */
/* ================ RESPONSIVE OVERRIDES ADDED ================= */
/* ============================================================= */

/* --- Blog grid responsiveness --- */
@media (max-width: 981px) {
  .my-custom-blog .et_pb_post {
    flex: 1 1 calc(50% - 20px);
  }
}
@media (max-width: 600px) {
  .my-custom-blog .et_pb_post {
    flex: 1 1 100%;
    min-height: auto;
  }
}

/* --- Portfolio responsiveness --- */
@media (max-width: 981px) {
  .three-columns .et_pb_portfolio_item {
    flex:0 0 50% !important;
    max-width:50% !important;
  }
}
@media (max-width: 600px) {
  .three-columns .et_pb_portfolio_item {
    flex:0 0 100% !important;
    max-width:100% !important;
  }
}

/* --- Fixed header padding adjustment --- */
@media (max-width: 768px) {
  #main-content { padding-top: 80px; }
}
@media (max-width: 480px) {
  #main-content { padding-top: 60px; }
}

/* --- Buttons shrink on mobile --- */
@media (max-width: 480px) {
  button,
  .et_pb_button {
    padding: 0.6em 1.1em !important;
    font-size: 0.9em !important;
  }
}

/* --- Hide floating box on mobile --- */
@media (max-width: 768px) {
  .floating-box {
    display: none !important;
  }
}
/* =====================================
   LOCATION CARD IMAGE FIX
   ===================================== */
/* LOCATION CARDS FIX — Images & Spacing */
.location-cards .et_pb_image_container img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: left top !important;
}

/* Remove extra bottom spacing */
.location-cards .et_pb_promo_description {
    margin-bottom: 0 !important;
}

.location-cards .et_pb_button_wrapper {
    margin-top: 0 !important;
    margin-bottom: 10px !important;
}

/* Stop flexbox from stretching card height */
.location-cards .et_pb_column,
.location-cards .et_pb_promo {
    display: block !important;
}



/* --------------------------------------------------------------
   FIX WHITE BAR BEFORE SCROLL (SAFE VERSION FOR STICKY HEADER)
-------------------------------------------------------------- */

/* Only remove spacing when the header is NOT sticky */
body:not(.et_pb_sticky_header) #main-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

body:not(.et_pb_sticky_header) #main-content .et_pb_section:first-of-type {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Stop sticky header from sliding sideways */
.pa-header .et_pb_row,
.pa-fixed-header .et_pb_row {
    transition: padding 0.3s ease !important; /* ONLY animate padding */
}

/* Prevent Divi sticky transform from animating sideways */
.pa-fixed-header,
.pa-fixed-header .et_pb_row,
.pa-fixed-header .et_pb_menu {
    transform: none !important;
}

.et_pb_sticky--top {
    transform: none !important;
}

/* ============================================
   LOCATION CARDS — FULL-WIDTH, UNCROPPED IMAGES
   ============================================ */

/* Remove Divi’s default aspect ratio box */
.location-cards .et_pb_image_container::before,
.location-cards .et_pb_image_wrap::before {
    display: none !important;
    content: none !important;
}

/* Image container should take full width */
.location-cards .et_pb_image_container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    display: block !important;
}

/* Wrap element MUST be forced to full width */
.location-cards .et_pb_image_wrap {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    padding: 0 !important;
    display: block !important;
}

/* The actual image */
.location-cards .et_pb_image_container img {
    width: 100% !important;          /* full card width */
    height: auto !important;         /* natural proportional height */
    object-fit: contain !important;  /* no cropping */
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
}
/* ============================================
   REMOVE UNDERLINES FROM MENUS, BUTTONS,
   SOCIAL ICONS, AND HEADER LINKS
   ============================================ */

/* Menu links (desktop + mobile) */
.et_pb_menu a,
.et_mobile_menu a {
    text-decoration: none !important;
}

/* Divi buttons */
button,
.et_pb_button,
.et_pb_promo_button,
.et_pb_contact_submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
    text-decoration: none !important;
}

/* Social media follow icons (Divi Social Follow module) */
.et_pb_social_icon a,
.et_pb_social_media_follow a,
.et_pb_social_media_follow li a {
    text-decoration: none !important;
}

/* Remove underline from Divi Post Slider navigation */
.et-pb-slider-arrows a,
.et-pb-arrow-prev,
.et-pb-arrow-next,
.et-pb-controllers a,
.et-pb-controllers li a {
    text-decoration: none !important;
}

/* Footer menu, widget menus, utility menus */
footer a,
.et_pb_widget a,
.nav a {
    text-decoration: none !important;
}

/* Show submenus when opened via keyboard (et-show-dropdown class) */
.et-menu li.et-show-dropdown > ul.sub-menu,
#top-menu li.et-show-dropdown > ul.sub-menu,
.et_pb_menu .et_pb_menu__menu li.et-show-dropdown > ul.sub-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}
