/*
Theme Name:     ID8
Theme URI:      https://id8.co.nz/
Description:    ID8 child theme for Divi
Author:         Stephen Canning
Author URI:     https://id8.co.nz/
Template:       Divi
Version:        1.0.0
*/

/*
IMPORTANT
- Do not use @import to load the parent theme. Enqueue Divi in functions.php instead.
- Keeping this file always as the single source for site CSS (including reCAPTCHA badge rule).
*/


/* =========================================================
   Sitewide links
   ========================================================= */

a {
  /*color: #cfe0e1;*/
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  color: #000;
}

/* =========================================================
   Project intro: medium desktop
   Full-width gallery with two-column text below
   ========================================================= */

@media (min-width: 981px) and (max-width: 1600px) {

  /* Stack the gallery and text areas */
  body.single-project #main-content
  .et_pb_row:has(.modula-gallery) {
    display: block !important;
  }

  /* Make both Divi columns full width */
  body.single-project #main-content
  .et_pb_row:has(.modula-gallery) > .et_pb_column {
    float: none !important;
    width: 100% !important;
    max-width: none !important;
    margin-right: 0 !important;
  }

  /* Space below the gallery */
  body.single-project #main-content
  .et_pb_row:has(.modula-gallery) > .et_pb_column:first-child {
    margin-bottom: 2.5rem !important;
  }

  /* Flow the complete text-module contents into two columns */
  body.single-project #main-content
  .et_pb_row:has(.modula-gallery) > .et_pb_column:last-child
  .et_pb_text_inner {
    column-count: 2;
    column-gap: clamp(2rem, 4vw, 4rem);
    column-fill: balance;
  }
  
  /* Consistent space below the title for column view */
  body.single-project #main-content
.et_pb_row:has(.modula-gallery) > .et_pb_column:last-child
> .et_pb_post_title {
  margin-bottom: 30px !important;
}

  /* Keep headings and subtitles across the full width */
  body.single-project #main-content
  .et_pb_row:has(.modula-gallery) > .et_pb_column:last-child
  .et_pb_text_inner :is(
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    .sub-title
  ) {
    column-span: all;
  }
}

/* =========================================================
   Blurb paragraph
   ========================================================= */

.sub-title {
  margin: 0 0 1.2em;
  padding: 0;
  font-weight: 600;
  line-height: 1.4;
}

.attribution {
  margin: 1.2em 0 0;
  font-size: 11px;
  font-weight: 400;
  color: #808080;
}

/* =========================================================
   Sticky footer layout
   Keeps footer at bottom on short pages without hacks
   ========================================================= */

html, body {
  height: 100%;
}

#page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#et-boc,
#et-main-area {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

#main-content {
  flex: 1 0 auto;
}


/* =========================================================
   Portfolio grid tiles (Divi Portfolio module)
   Class required on the module, row, or section: cg-portfolio-grid

   Goals:
   - Square tiles with cropped images
   - Title appears on hover, text stays fully opaque
   - Background tint is separate from the text (no opacity on text)
   - Divi's native overlay is disabled to prevent double overlays
   ========================================================= */

/* Base tile container */
.cg-portfolio-grid .et_pb_portfolio_item {
  position: relative;
  overflow: hidden;
}

/* Force square tiles */
.cg-portfolio-grid img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

/* Disable Divi’s built-in overlay and its hover icon */
.cg-portfolio-grid .et_overlay,
.cg-portfolio-grid .et_overlay:before {
  display: none !important;
}

/* Title overlay container (holds the text) */
.cg-portfolio-grid .et_pb_portfolio_item h2.et_pb_module_header {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0 1em;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  color: #fff !important;
  background: none !important;     /* tint lives on ::before */
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
  pointer-events: none;

  /* Optional: slight vertical nudge (keep if you still want it) */
  transform: translateY(-12px);
}

/* Descriptive category line inside portfolio overlay */
.cg-portfolio-grid .et_pb_portfolio_item p.post-meta {
  position: absolute;
  top: 50%;
  left: 1em;
  right: 1em;

  margin: 0;
  padding: 0;

  transform: translateY(14px);

  color: rgba(255, 255, 255, 0.82) !important;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  text-align: center;

  opacity: 0;
  transition: opacity 0.3s ease;

  z-index: 4;
  pointer-events: none;
}

.cg-portfolio-grid .et_pb_portfolio_item p.post-meta a {
  color: inherit !important;
  font-weight: inherit;
  pointer-events: none;
}

/* Show category with title on hover */
.cg-portfolio-grid .et_pb_portfolio_item:hover p.post-meta {
  opacity: 1;
}

/* Tint layer behind the title text */
.cg-portfolio-grid .et_pb_portfolio_item h2.et_pb_module_header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15); /* adjust to taste */
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

/* Show title + tint on hover */
.cg-portfolio-grid .et_pb_portfolio_item:hover h2.et_pb_module_header,
.cg-portfolio-grid .et_pb_portfolio_item:hover h2.et_pb_module_header::before {
  opacity: 1;
}

/* =========================================================
   Portfolio tiles - touch devices
   Phones + tablets: overlay always visible, no hover preview
   ========================================================= */

@media (max-width: 980px) {

  /* Lock overlay and title on */
  .cg-portfolio-grid .et_pb_portfolio_item h2.et_pb_module_header,
  .cg-portfolio-grid .et_pb_portfolio_item h2.et_pb_module_header::before {
    opacity: 1 !important;
  }

  /* Remove transitions so nothing "previews" */
  .cg-portfolio-grid .et_pb_portfolio_item h2.et_pb_module_header,
  .cg-portfolio-grid .et_pb_portfolio_item h2.et_pb_module_header::before {
    transition: none !important;
  }

  .cg-portfolio-grid .et_pb_portfolio_item p.post-meta {
    opacity: 1 !important;
    transition: none !important;
  }
}

/* =========================================================
   Modula gallery hover attribution
   ========================================================= */

body.single-project
.modula .modula-item .figc {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  padding: 0 !important;
}

/* Caption container: don't use it for positioning */
body.single-project
.modula .modula-item .figc .figc-inner {
  position: static !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
}

/* Attribution */
body.single-project
.modula .modula-item .figc .jtg-description {
  position: absolute !important;

  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: 20px !important;

  width: max-content !important;
  max-width: calc(100% - 24px) !important;

  margin: 0 !important;
  padding: 0 !important;

  transform: translateX(-50%) !important;

  color: rgba(255,255,255,0.9) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 1.3 !important;
  text-align: center !important;
}

/* =========================================================
   Single project pages
   ========================================================= */

/* Remove extra blank paragraph spacing above Modula galleries */
body.single-project .et_pb_text_inner p:empty {
  margin: 0 !important;
  padding: 0 !important;
}


/* =========================================================
   Contact Form 7 styling
   Matches site look
   ========================================================= */

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 input[type="url"],
.wpcf7 input[type="number"],
.wpcf7 input[type="date"],
.wpcf7 textarea {
  width: 100%;
  border-radius: 5px;
  font-size: 1em;
  padding: 12px;
  box-sizing: border-box;
  margin-bottom: 10px;
  font-family: 'Kumbh Sans', Helvetica, Arial, sans-serif;
}

.wpcf7 textarea {
  min-height: 180px;
  resize: vertical;
}

.wpcf7 input[type="submit"],
.wpcf7 .wpcf7-submit {
  background: #3e5057;
  color: #ffffff;
  border: 2px solid #ffffff;
  border-radius: 30px;
  padding: 10px 28px;
  margin-top: 15px;
  font-size: 1.1em;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-block;
}

.wpcf7 input[type="submit"]:hover,
.wpcf7 .wpcf7-submit:hover {
  background: #d67e5c;
}

/* Hide CF7 inline validation tip text */
span.wpcf7-not-valid-tip {
  display: none !important;
}

/* Response message */
div.wpcf7-response-output {
  border: none !important;
  color: #FFEA78;
  padding: 0;
  margin-top: 15px;
  font-style: italic;
  font-size: 15px;
}


/* =========================================================
   Footer layout tweaks
   ========================================================= */

.et-l--footer .et_pb_column {
  margin-bottom: 0 !important;
}


/* =========================================================
   SEO helper (visually hidden, still accessible to screen readers)
   ========================================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
   RANDOM PROJECTS – FOOTER
   ========================================================= */

.dv8-random-projects {
    --tile-size: 200px;   /* CHANGE THIS for image size */
    --tile-gap: 32px;     /* CHANGE THIS for space between images */

    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: var(--tile-gap);
    margin: 0 auto;
}


/* Individual project tile */
.dv8-random-project {
    position: relative;
    display: block;
    flex: 0 0 var(--tile-size);
    width: var(--tile-size);
    height: var(--tile-size);
    overflow: hidden;
    text-decoration: none;
}


/* Featured image – always square */
.dv8-random-project img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* Title overlay */
.dv8-random-project-title {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 15px;
    text-align: center;

    font-size: 18px;
    font-weight: 300;
    line-height: 1.3;
    color: #fff;

    background: rgba(0, 0, 0, 0.45);

    opacity: 0;
    transition: opacity 0.25s ease;
}


/* Desktop hover */
.dv8-random-project:hover .dv8-random-project-title {
    opacity: 1;
}


/* TWO PROJECTS */

@media (max-width: 1000px) {

    .dv8-random-project:nth-child(n+3) {
        display: none;
    }
}


/* TOUCH / MOBILE – show title permanently */

@media (max-width: 980px) {

    .dv8-random-project-title {
        opacity: 1;
    }
}


/* NARROW PHONE – stack the two projects */

@media (max-width: 520px) {

    .dv8-random-projects {
        flex-direction: column;
        align-items: center;
    }
}

/* =========================================================
   reCAPTCHA badge
  keep this here, not scattered elsewhere
   ========================================================= */

.grecaptcha-badge {
  visibility: hidden !important;
}

