/* =========================================================================
   North Essex Heritage – responsive.css: every screen-size override,
   largest screens first. Loaded after common.css, which holds the base
   styles and has no media queries of its own.

   Breakpoints used
     1700px  very wide    1400px  larger logo    1281px / 1280px  fixed header on / off
     1024px  / 1023px  tablet landscape          992px / 991px  desktop / mobile layout
     959px   hero image swap      768px   cards side by side
     599px   phone                414px   narrow phone
     Also: reduced motion (lightbox spinner) at the end.
   ========================================================================= */


/* ---- 1700px and wider ---------------------------------------------------- */

@media only screen and (min-width: 1700px) {
  /* CiviCRM page title */
  .page-id-29 h1 {font-size: 40px; line-height: 50px;}
}

/* ---- 1281px and wider: fixed header that shrinks on scroll --------------- */

@media only screen and (min-width: 1281px) {
  #page-header {position: fixed; top: 0; left: 0; width: 100%; z-index: 5;}
  /* Room for the fixed header, so the page starts where the header ends. The
     header's height depends on the logo, which is 20% of the page width: about
     254px up to 1399px and 279px from 1400px (with a one-line Latest bar).
     scripts/site.js measures the real height (no Latest message, or one on two
     lines) into --neh-header-height. These used to be one 289px, which left a
     white bar under the header: 35px up to 1399px, 10px above. Rounded down,
     so the header overlaps the page by under a pixel rather than leave a
     hairline gap. */
  .white-back {padding-top: var(--neh-header-height, 254px); transition: padding-top 0.2s ease;}
  body.header-not-at-top .white-back {padding-top: 197px; transition: padding-top 0.2s ease;}
  .header-not-at-top .logo a {display: inline-block; width: 180px; min-width: 180px;}
  .header-not-at-top .logo a img {display: block; width: 100%; height: auto; transition: width 0.2s ease;}

  /* Links to a part of a page (/about-us/#trustees) land below the fixed header */
  .jumplink {padding-top: 300px; margin-top: -300px;}
  .page-id-38 .jumplink {padding-top: 240px; margin-top: -240px;}

  /* Skip link: <main> already starts just below the header when the page is
     at the top, so the margin keeps the page there (scrolling would shrink
     the header and slide the content under it) */
  #main {scroll-margin-top: var(--neh-header-height, 254px);}
}

/* ---- 1400px and wider: the larger logo ----------------------------------- */

@media only screen and (min-width: 1400px) {
  .white-back {padding-top: var(--neh-header-height, 279px);}
  #main {scroll-margin-top: var(--neh-header-height, 279px);}
}

/* ---- 1280px and narrower: header scrolls away ---------------------------- */

@media only screen and (max-width: 1280px) {
  .logo a {width: 150px; min-width: 150px;}
  #page-header .topbar {margin: 0 0 -50px 0;}
  .jumplink {padding-top: 200px; margin-top: -200px;}
  .page-id-38 .jumplink {padding-top: 190px; margin-top: -190px;}
  body.header-not-at-top .white-back {padding-top: 50px; transition: padding-top 0.2s ease;}
  body.header-not-at-top #page-header .topbar {background-color: #fff; color: #000; padding: 10px 0; line-height: 2rem; margin: 0 0 -50px 0; position: fixed; z-index: 10; width: 100%; top: 0; left: 0;}
}

/* ---- 1024px and wider ---------------------------------------------------- */

@media only screen and (min-width: 1024px) {
  .background-tint {background-color: #F7F5F4;}
}

/* ---- 1023px and narrower ------------------------------------------------- */

@media only screen and (max-width: 1023px) {
  /* CiviCRM forms */
  html .select2-container.crm-select2.crm-form-select[style="width: 720px;"] {max-width: 100% !important;}
  .messages.status.no-popup.crm-not-you-message,
  .messages.status.no-popup.crm-not-you-message a {overflow-wrap: break-word; word-wrap: break-word;}

  .page-template-page-template-contact .grey-back a {overflow-wrap: break-word; word-wrap: break-word;}
}

/* ---- 992px and wider: desktop layout ------------------------------------- */

@media only screen and (min-width: 992px) {
  /* Title squares beside the hero image (colours and type: common.css,
     TITLE SQUARES) */
  .page-template-page-template-about h1,
  .page-template-page-template-donate h1,
  .page-template-page-template-downloads h1,
  .page-template-default h1,
  .page-template-page-template-standard h1,
  .page-template-page-template-contact h1,
  .page-details,
  .single .post-type p {padding: 50px; aspect-ratio: 1 / 1;}
  .single .mobile-sidebar {display: none;}

  /* Projects and News: the grey title box and the hero image beside it are
     the same height. The box takes the image's height (it was a square, a few
     pixels off the image); where its title and text need more room, the image
     fills the taller column instead, trimmed slightly at the sides. */
  .page-details {aspect-ratio: auto; height: 100%;}
  .page-template-page-template-events .hero-panel .hero-image,
  .page-template-page-template-events .hero-panel .desktop-image,
  .page-template-page-template-news .hero-panel .hero-image,
  .page-template-page-template-news .hero-panel .desktop-image {height: 100%;}
  .page-template-page-template-events .hero-panel .hero-image img,
  .page-template-page-template-news .hero-panel .hero-image img {height: 100%; object-fit: cover;}

  /* Home: text panels as tall as the image or panel beside them (Donate, and
     Get Involved / Keep Updated). Was done in JavaScript after the page
     loaded; the columns in a row already stretch, so the panels fill them. */
  .page-template-page-template-home .donate .row > [class*="col-"] > .content-block,
  .page-template-page-template-home .home-ctas .get-involved,
  .page-template-page-template-home .home-ctas .keep-updated {height: 100%;}
}

/* ---- 992px to 1199px: long titles fit their square ---------------------- */

@media only screen and (min-width: 992px) and (max-width: 1199px) {
  /* The square is narrow here, so a long word ("Declaration") overran it.
     Smaller type and padding keep titles inside; hyphens are the last resort. */
  .page-template-page-template-about h1,
  .page-template-page-template-donate h1,
  .page-template-page-template-downloads h1,
  .page-template-default h1,
  .page-template-page-template-standard h1,
  .page-template-page-template-contact h1 {padding: 30px; font-size: clamp(3.6rem, 3.9vw, 5rem); line-height: 1.15; hyphens: auto; overflow-wrap: break-word;}
  /* Projects and News: the same smaller title and padding in the grey box */
  .page-details {padding: 30px;}
  .page-details h1 {margin: 0 0 15px 0; font-size: clamp(3.6rem, 3.9vw, 5rem); line-height: 1.15; hyphens: auto; overflow-wrap: break-word;}
}

/* ---- 767px and narrower: form columns stack -------------------------------- */

@media only screen and (max-width: 767px) {
  /* FormBuilder first/last name pairs stack, as the Contact Form 7 ones do */
  .crm-container af-form .af-layout-cols {flex-wrap: wrap;}
  .crm-container af-form .af-layout-cols > af-field {flex: 1 1 100%;}
}

/* ---- 991px and narrower: mobile layout ----------------------------------- */

@media (max-width: 991px) {
  /* Title squares become a bar above the image */
  .page-template-page-template-about h1,
  .page-template-page-template-donate h1,
  .page-template-page-template-downloads h1,
  .page-template-default h1,
  .page-template-page-template-standard h1,
  .page-template-page-template-contact h1,
  .single .post-type p {padding: 20px 50px; margin: 0 0 30px 0;}
  .page-details {padding: 20px 50px;}

  .single-post .sidebar {display: none;}
  .single-post .mobile-sidebar {display: block; position: relative; z-index: 2; margin: 0; padding: 0 50px 50px 50px;}
  .single-post .mobile-sidebar .news-article-link {background-color: transparent; display: block; font-weight: 300;}
}

/* ---- 959px and narrower: phone version of the home hero image ------------ */

@media only screen and (max-width: 959px) {
  .desktop-image {display: none;}
  .mobile-image {display: block;}
}

/* ---- 768px and wider: cards side by side --------------------------------- */

@media only screen and (min-width: 768px) {
  /* The title band over a card's image is at least two lines tall, so the
     bands match for titles of one or two lines (news cards also have a date) */
  article > .event-article-link .image-panel .overlay h3,
  article > .news-article-link .image-panel .overlay h3 {min-height: 8rem;}
  .search-results article > .event-article-link .image-panel .overlay {min-height: calc(2.5rem + 8rem + 40px);}
}

/* ---- 599px and narrower: phones ------------------------------------------ */

@media only screen and (max-width: 599px) {
  section {padding: 0 0 30px 0; background-color: #fff;}

  .hero-text {position: static; padding: 30px;}
  .home .content-block {padding: 30px !important;}
  .home .testimonial .content-block blockquote {font-size: 2.5rem; line-height: 3.2rem;}
  .get-involved,
  .keep-updated,
  .grey-back {padding: 30px;}
  .get-involved a,
  .page-template-page-template-home .donate .content-block a,
  .page-template-page-template-standard .grey-back a,
  .page-template-default .grey-back a {overflow-wrap: break-word; word-wrap: break-word;}

  #page-footer {padding: 50px 12.5px;}
  #page-footer .col-12 {padding-bottom: 30px;}

  .page-details {padding: 20px 30px;}
  .project-link-outer-holder {line-height: 0 !important; margin-top: 0;}
  .project-link-holder {line-height: 2.75rem !important;}
  .single-post .mobile-sidebar {padding: 0 30px 50px 30px;}

  .page-template-page-template-donate h1,
  .page-template-page-template-contact h1,
  .page-template-page-template-about h1,
  .page-template-page-template-downloads h1,
  .single .post-type p,
  .page-template-default h1,
  .page-template-page-template-standard h1,
  h1.title-block {padding: 20px 30px;}

  /* Pager: arrows only for Previous/Next and slightly smaller buttons, so
     "« 1 2 3 4 »" fits on one line down to 320px wide */
  .pager ul.page-numbers {gap: 6px;}
  .pager a.page-numbers,
  .pager span.page-numbers {min-width: 40px; padding: 8px 10px;}
  .pager .pager-label {position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;}

  .search-again {padding: 30px;}
}

/* ---- 414px and narrower -------------------------------------------------- */

@media (max-width: 414px) {
  section {padding: 0 10px 30px 10px; background-color: #fff;}
  .menu-open {position: relative; margin-right: 10px;}
  #page-header .blackbar .col-12 div {padding: 0 10px;}
  h1 {font-size: 4rem; line-height: 5rem;}
  .page-template-page-template-about .intro,
  .page-template-page-template-donate .intro,
  .single-post.projects .intro,
  .page-template-page-template-contact .intro,
  .page-template-page-template-standard .intro {font-size: 2.3rem; line-height: 2.9rem;}
}

/* ---- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  /* Lightbox */
  dialog.lightbox.is-loading::after {animation-duration: 3s;}
}
