/*
Theme Name:   Janet Moriarty JP
Theme URI:    https://www.janetmoriartyjp.com
Description:  Child theme of Hello Elementor for Janet Moriarty, NH Justice of the Peace. Content is edited in Elementor; colors, fonts and the header are in Elementor > Site Settings.
Author:       Alex Gagnon
Template:     hello-elementor
Version:      1.0.0
Text Domain:  janet-moriarty
*/

/* ---------- Site-wide ---------- */
html { scroll-behavior: smooth; }
[id="home"], [id="about"], [id="services"], [id="contact"] { scroll-margin-top: 70px; }

/* Header: colors, fonts and layout are set in Elementor > Site Settings > Hello Theme Header.
   Only things Site Settings can't do live here. */
.site-header.dynamic-header { position: sticky; top: 0; z-index: 999; }
body.admin-bar .site-header.dynamic-header { top: var(--wp-admin--admin-bar--height, 32px); }
.site-header .site-navigation-dropdown ul.menu li a { background: #4C382D; color: #FFFFFF; }
.site-header .site-navigation-dropdown ul.menu li a:hover { background: #5d463a; }
@media (max-width: 782px) { body.admin-bar .site-header.dynamic-header { top: 0; } }

/* Galleries with the "jm-gallery" class get square tiles (kept in case Janet adds a WordPress gallery) */
.jm-gallery .gallery-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.jm-gallery .gallery-item { padding: 0 !important; }
.elementor-widget-text-editor a { color: inherit; }

/* ---------- Design 3: Modern New England (the Home page). Scoped to .jm-design-c ---------- */
.jm-design-c[id], .jm-design-c [id] { scroll-margin-top: 84px; }
.jm-design-c.jmc-header { position: sticky; top: 0; z-index: 50; }
.jm-design-c .jmc-nav .elementor-icon-list-icon { display: none; }
.jm-design-c .jmc-nav .elementor-icon-list-item a { transition: color .2s; }
.jm-design-c .elementor-widget-image img { display: block; }
.jm-design-c .elementor-button { transition: background-color .2s, color .2s, border-color .2s; }
.jm-design-c .elementor-widget-text-editor p:last-child { margin-bottom: 0; }
@media (max-width: 767px) {
  .jm-design-c.jmc-header { position: relative; }
}

/* About Me: soft offset frame on the photo */
.jm-design-c .jm-about-photo img { box-shadow: 18px 18px 0 #E6DACB; border-radius: 2px; }
@media (max-width: 767px) { .jm-design-c .jm-about-photo img { box-shadow: 10px 10px 0 #E6DACB; } }

/* ---------- Design C: Province Lake intro + photo gallery (Nov 15) ---------- */
/* Intro: the lake photo is the section's background image (set in Elementor, so it can be swapped there).
   A linen wash on the left keeps the headline readable; the right side shows the lake. */
.jm-design-c.jmc-lake { position: relative; min-height: 560px; background-size: cover; background-position: center 35%; }
.jm-design-c.jmc-lake::before {
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(247,243,237,.95) 0%, rgba(247,243,237,.88) 32%, rgba(247,243,237,.35) 58%, rgba(247,243,237,0) 75%);
}
.jm-design-c.jmc-lake > .e-con { position: relative; z-index: 1; }
@media (max-width: 767px) {
  /* Phones: the lake is a clear band across the top; the text starts below it on linen */
  .jm-design-c.jmc-lake { min-height: 0; padding-top: 190px !important; flex-direction: column !important; justify-content: flex-start !important;
    background-size: auto 330px !important; background-position: 70% 0 !important; background-repeat: no-repeat !important; }
  .jm-design-c.jmc-lake > .e-con { flex-shrink: 0; }
  .jm-design-c.jmc-lake::before { background: linear-gradient(180deg, rgba(247,243,237,0) 0, rgba(247,243,237,0) 160px, rgba(247,243,237,.94) 235px, #F7F3ED 330px); }
}

/* Gallery: equal square tiles, cropped (never stretched). 3 across, 2 on tablets and phones. */
.jm-design-c .jmc-gallery-grid { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.jm-design-c .jmc-gallery-grid > .elementor-widget-image { width: 100% !important; max-width: none; margin: 0 !important; }
.jm-design-c .jmc-gallery-grid img { width: 100% !important; height: auto !important; aspect-ratio: 1 / 1; object-fit: cover; object-position: center 35%; border-radius: 2px; }
@media (max-width: 1024px) { .jm-design-c .jmc-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
@media (max-width: 767px) { .jm-design-c .jmc-gallery-grid { gap: 8px; } }

/* Footer credit: "Alex Gagnon" links to alex-gagnon.com (nofollow, new tab); same color as the footer text */
.jm-credit a { color: inherit !important; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.jm-credit a:hover, .jm-credit a:focus-visible { text-decoration-thickness: 2px; }

/* Option 3 gallery paging (gallery-pager.js, Nov 16): one page at a time, 3 x 2 on desktop, 2 x 2 on tablets/phones.
   Extra photos flow onto the next page; swipe/scroll sideways or use the arrows and dots. No JS = the plain grid above. */
.jm-design-c .jmc-gallery-grid.jm-paged {
  --jm-gap: 16px;
  --jm-col-w: calc((100% - (var(--jm-cols, 3) - 1) * var(--jm-gap)) / var(--jm-cols, 3));
  grid-template-columns: repeat(var(--jm-total-cols, 3), var(--jm-col-w)); grid-template-rows: repeat(2, auto); grid-auto-flow: column;
  grid-auto-columns: var(--jm-col-w);
  gap: var(--jm-gap); flex-wrap: nowrap !important; padding: 0 !important;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.jm-design-c .jmc-gallery-grid.jm-paged::-webkit-scrollbar { display: none; }
.jm-design-c .jmc-gallery-grid.jm-paged > .jm-page-start { scroll-snap-align: start; scroll-snap-stop: always; }
.jm-design-c .jmc-gallery-grid.jm-paged.jm-single-page { overflow-x: hidden; }
.jm-design-c .jmc-gallery-grid.jm-paged:focus-visible { outline: 2px solid #33443A; outline-offset: 4px; }
@media (max-width: 1024px) { .jm-design-c .jmc-gallery-grid.jm-paged { --jm-gap: 12px; } }
@media (max-width: 767px) { .jm-design-c .jmc-gallery-grid.jm-paged { --jm-gap: 8px; } }

.jm-pager-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.jm-pager-nav[hidden] { display: none; }
/* Buttons: "button.jm-pager-*" outranks Hello Elementor's pink button:hover/:focus reset */
button.jm-pager-btn, button.jm-pager-btn:focus, button.jm-pager-btn:disabled {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; border: 1px solid #E6DACB; background-color: #FFFFFF; color: #33443A;
  box-shadow: 0 1px 3px rgba(42,46,43,.08); transition: background-color .2s, color .2s, border-color .2s, opacity .2s;
}
button.jm-pager-btn:hover:not(:disabled), button.jm-pager-btn:focus-visible { background-color: #33443A; border-color: #33443A; color: #FFFFFF; }
button.jm-pager-btn:focus-visible { outline: 2px solid #33443A; outline-offset: 3px; box-shadow: none; }
button.jm-pager-btn:disabled { opacity: .35; cursor: default; }
.jm-pager-dots { display: flex; align-items: center; gap: 4px; }
button.jm-pager-dot, button.jm-pager-dot:hover, button.jm-pager-dot:focus {
  width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background-color: transparent; position: relative;
}
.jm-pager-dot::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; border-radius: 4px;
  transform: translate(-50%, -50%); background: #B9AC9B; transition: width .25s, background-color .25s;
}
.jm-pager-dot:hover::before { background: #8C7F6E; }
.jm-pager-dot[aria-current="true"]::before { width: 22px; background: #B4644A; }
button.jm-pager-dot:focus-visible { outline: 2px solid #33443A; outline-offset: 1px; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .jm-pager-btn, .jm-pager-dot::before { transition: none; } }

/* Design 3 header on tablets (768-1024px): the 26% / 52% / 22% columns plus the gaps add up to more than
   100%, so the phone button got squeezed and cut off on the right. Let the columns size to their content,
   give the menu the leftover room, and slim the button a little. Desktop and phones are unchanged. */
@media (min-width: 768px) and (max-width: 1024px) {
  .jm-design-c.jmc-header { --padding-left: 24px !important; --padding-right: 24px !important; }
  .jm-design-c.jmc-header > .e-con { --width: auto !important; --padding-left: 0px; --padding-right: 0px; }
  .jm-design-c.jmc-header > .e-con:first-child { flex: 0 1 auto; min-width: 0; }
  .jm-design-c.jmc-header > .e-con:nth-child(2) { flex: 1 0 auto; }
  .jm-design-c.jmc-header .jmc-nav .elementor-icon-list-item { white-space: nowrap; margin-inline: 8px !important; }
  .jm-design-c.jmc-header > .e-con:last-child { flex: 0 0 auto; }
  .jm-design-c.jmc-header .jmc-nav .elementor-icon-list-items { flex-wrap: nowrap; }
  .jm-design-c.jmc-header .elementor-button { padding: 12px 18px !important; white-space: nowrap; }
}

/* Larger text for easier reading (Nov 17, 2026): the bigger name, menu and phone button need a bit more room.
   Tablets (768-1024): the block above also drops the 10px side padding inside the three header columns and
   tightens the menu spacing so everything stays on one line at 768px.
   Small laptops (1025-1279): the fixed 26% / 52% / 22% columns were too narrow for the bigger text (the
   tagline and phone button wrapped), so let the columns size to their content here too. */
@media (min-width: 1025px) and (max-width: 1279px) {
  .jm-design-c.jmc-header > .e-con { --width: auto !important; }
  .jm-design-c.jmc-header > .e-con:first-child { flex: 0 1 auto; min-width: 0; }
  .jm-design-c.jmc-header > .e-con:nth-child(2) { flex: 1 0 auto; }
  .jm-design-c.jmc-header > .e-con:last-child { flex: 0 0 auto; }
  .jm-design-c.jmc-header .elementor-button { white-space: nowrap; }
}
/* Service cards, 768-1199px: show them two by two. Each card is set to 50% wide in Elementor, but two 50% cards
   plus the 18px gap don't fit on one line, so they were stacking one per row at half width. Also covers small
   laptops (1025-1199), where four cards in a row got very narrow with the bigger text. */
@media (min-width: 768px) and (max-width: 1199px) {
  #services.jm-design-c > .e-con-inner > .e-con:last-child { --flex-wrap: wrap; }
  #services.jm-design-c > .e-con-inner > .e-con:last-child > .e-con { --width: calc(50% - 9px); }
}
/* Contact list on phones: with the bigger text the YouTube address (one long word) ran past the edge, so drop the
   extra 10px side padding inside the Contact columns (the section keeps its 20px), and let a very long line wrap
   rather than overflow on the narrowest phones. */
@media (max-width: 767px) {
  #contact.jm-design-c .e-con { --padding-left: 0px; --padding-right: 0px; }
  #contact.jm-design-c .elementor-icon-list-text { overflow-wrap: anywhere; }
}

/* About Me text: a full blank line's worth of space between paragraphs (Nov 19) */
.jm-design-c .elementor-element-282ee83 p { margin-bottom: 1em; }
.jm-design-c .elementor-element-282ee83 p:last-child { margin-bottom: 0; }
