/* ==========================================================================
   Fresh inner page layouts: shared structure  css/dm-layout.css

   Loads after the CT kit (dm-ct.css) when Theme Options > Styling Options > Inner Page Layout is not Classic,
   on singular pages except the front page. The body gets .dm-fresh plus .dm-layout-<name>, the classic
   .dm-service-section rules in style.css stop matching, and css/dm-layout-<name>.css adds the look.
   Plain [dm-section] content only: CT blocks (.dm-ct) keep the kit rules and follow the same tokens.
   Restyle per site with the kit tokens in the child :root block, or with --dm-pad (plain section spacing).
   ========================================================================== */

:where(:root) {
    --dm-pad: clamp(52px, 6vw, 92px);
}

/* ---------------------------------------------------------------- section + grid */
.dm-fresh .dm-service-section:not(.dm-ct) {
    padding: var(--dm-pad) 0;
    background: transparent;
    color: var(--ct-ink);
    font-family: var(--ct-font-body);
}
.dm-fresh .dm-service-section:not(.dm-ct) > .dm-container {
    max-width: var(--ct-max);
    padding: 0 var(--ct-gutter);
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex {
    gap: var(--ct-gap);
    align-items: center;
    justify-content: center;
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex:has(> :is(.dm-third, .dm-fourth, .dm-fifth, .dm-sixth, .dm-grid-item)),
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex:has(> .dm-half:nth-child(3)) { align-items: stretch; }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > br,
.dm-fresh .dm-service-section:not(.dm-ct) p:empty { display: none; }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > :is(.dm-full, .dm-half, .dm-third, .dm-fourth, .dm-fifth, .dm-sixth) {
    min-width: 0;
    max-width: 100%;
    padding: 0;
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-full   { flex: 1 1 100%; }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-half   { flex: 0 1 calc((100% - var(--ct-gap)) / 2); }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-third  { flex: 0 1 calc((100% - 2 * var(--ct-gap)) / 3); }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-fourth { flex: 0 1 calc((100% - 3 * var(--ct-gap)) / 4); }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-fifth  { flex: 0 1 calc((100% - 4 * var(--ct-gap)) / 5); }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-sixth  { flex: 0 1 calc((100% - 5 * var(--ct-gap)) / 6); }

/* [dm-grid] items: a closing link paragraph sits at the bottom, so the links of a row line up */
.dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-grid-item {
    display: flex;
    flex-direction: column;
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-grid-item > :is(img, .dm-grid-icon) { align-self: flex-start; }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-grid-icon {
    flex: none;
    width: 56px;
    height: 56px;
    margin: 0 0 22px;
    font-size: 22px;
    color: var(--ct-primary);
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-grid-icon img { width: 50%; }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-grid-item > p:last-child:has(> a:only-child) { margin-top: auto; }

/* zig-zag like Classic: every second plain section puts its first half last; grids keep their order */
@media screen and (min-width: 768px) {
    .dm-fresh .dm-service-section:not(.dm-ct):not(.dm-grid):nth-child(even of .dm-service-section:not(.dm-ct)) .dm-flex:not(:has(> .dm-half:nth-child(3))) > .dm-half:first-child { order: 2; }
}

/* ---------------------------------------------------------------- type */
.dm-fresh .dm-service-section:not(.dm-ct) :is(h2, h3, h4) {
    font-family: var(--ct-font-heading);
    font-weight: var(--ct-heading-weight);
    font-style: var(--ct-heading-style);
    letter-spacing: 0;
    text-transform: var(--ct-heading-transform);
    color: var(--ct-heading-color);
}
.dm-fresh .dm-service-section:not(.dm-ct) h2 {
    margin: 0 0 20px;
    font-size: var(--ct-h2-size);
    line-height: 1.15;
    text-wrap: balance;
}
.dm-fresh .dm-service-section:not(.dm-ct) h3 {
    margin: 30px 0 10px;
    font-size: var(--ct-h3-size);
    line-height: 1.3;
}
.dm-fresh .dm-service-section:not(.dm-ct) h4 {
    margin: 24px 0 8px;
    font-size: calc(var(--ct-text-size) + 1px);
    line-height: 1.4;
}
.dm-fresh .dm-service-section:not(.dm-ct) :is(h2, h3, h4):first-child { margin-top: 0; }
.dm-fresh .dm-service-section:not(.dm-ct) :is(p, li, td, th, dd, dt) {
    font-size: var(--ct-text-size);
    line-height: var(--ct-line-height);
    color: var(--ct-muted);
}
.dm-fresh .dm-service-section:not(.dm-ct) p { margin: 0 0 18px; }
.dm-fresh .dm-service-section:not(.dm-ct) :is(p, ul, ol, table, blockquote, figure):last-child { margin-bottom: 0; }
.dm-fresh .dm-service-section:not(.dm-ct) :is(strong, b) { color: var(--ct-ink); }
.dm-fresh .dm-service-section:not(.dm-ct) a:not(.btn):not(.dm-ct-btn):not(.inline-dm-phone) {
    font-weight: 600;
    color: var(--ct-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.dm-fresh .dm-service-section:not(.dm-ct) a:not(.btn):not(.dm-ct-btn):not(.inline-dm-phone):hover { text-decoration-thickness: 2px; }
.dm-fresh .dm-service-section:not(.dm-ct) a.inline-dm-phone {
    font-weight: 700;
    color: var(--ct-link);
    white-space: nowrap;
}

/* lists: markers come from the layout file */
.dm-fresh .dm-service-section:not(.dm-ct) :is(ul, ol):not([class]) {
    margin: 4px 0 22px;
    padding: 0;
    list-style: none;
}
.dm-fresh .dm-service-section:not(.dm-ct) :is(ul, ol):not([class]) > li {
    position: relative;
    margin: 0 0 10px;
    padding-left: 34px;
    list-style: none;
}
.dm-fresh .dm-service-section:not(.dm-ct) ol:not([class]) { counter-reset: dm-li; }
.dm-fresh .dm-service-section:not(.dm-ct) ol:not([class]) > li { counter-increment: dm-li; }
.dm-fresh .dm-service-section:not(.dm-ct) .dm-full > ul:not([class]):has(> li:nth-child(6)) {
    columns: 2;
    column-gap: 48px;
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-full > ul:not([class]):has(> li:nth-child(6)) > li { break-inside: avoid; }

/* ---------------------------------------------------------------- media, tables, quotes */
.dm-fresh .dm-service-section:not(.dm-ct) img {
    max-width: 100%;
    height: auto;
    border: 0;
    outline: 0;
}
.dm-fresh .dm-service-section:not(.dm-ct) .dm-half:not(:has(:is(h1, h2, h3, h4, h5, p, ul, ol, table))) > img {
    display: block;
    width: 100%;
}
.dm-fresh .dm-service-section:not(.dm-ct) iframe {
    max-width: 100%;
    border: 0;
}
.dm-fresh .dm-service-section:not(.dm-ct) table {
    width: 100%;
    margin: 6px 0 24px;
    border: 0;
    border-collapse: collapse;
}
.dm-fresh .dm-service-section:not(.dm-ct) thead { background: none; }
.dm-fresh .dm-service-section:not(.dm-ct) :is(th, td) {
    padding: 14px 18px;
    border: 0;
    border-bottom: 1px solid var(--ct-line);
    text-align: left;
    vertical-align: top;
}
.dm-fresh .dm-service-section:not(.dm-ct) th {
    font-weight: 700;
    color: var(--ct-ink);
}
.dm-fresh .dm-service-section:not(.dm-ct) blockquote {
    margin: 24px 0;
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--ct-primary);
    font-family: var(--ct-quote-font);
    font-style: italic;
}
.dm-fresh .dm-service-section:not(.dm-ct) hr {
    margin: 32px 0;
    border: 0;
    border-top: 1px solid var(--ct-line);
}

/* ---------------------------------------------------------------- buttons ([dm-appointments-link] is a.btn) */
.dm-fresh .dm-service-section:not(.dm-ct) p:has(> a.btn) { margin-top: 28px; }
.dm-fresh .dm-service-section:not(.dm-ct) a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 15px 28px;
    border: 2px solid var(--ct-btn-bg);
    border-radius: var(--ct-btn-radius);
    background: var(--ct-btn-bg) !important;
    box-shadow: none;
    color: var(--ct-btn-ink) !important;
    font-size: var(--ct-btn-size);
    font-weight: var(--ct-btn-weight);
    letter-spacing: var(--ct-btn-tracking);
    line-height: 1.2;
    text-transform: var(--ct-btn-transform);
    text-decoration: none !important;
    transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}
.dm-fresh .dm-service-section:not(.dm-ct) a.btn:hover {
    border-color: var(--ct-btn-hover-bg);
    background: var(--ct-btn-hover-bg) !important;
    color: var(--ct-btn-hover-ink) !important;
    transform: translateY(-2px);
}
.dm-fresh .dm-service-section:not(.dm-ct) a.btn:focus-visible {
    outline: 2px solid var(--ct-btn-bg);
    outline-offset: 3px;
}
.dm-fresh .dm-service-section:not(.dm-ct) a.btn i { padding: 0; }

/* ---------------------------------------------------------------- old FAQ accordion (.contentfaqs h4 + js/customscript.js) */
.dm-fresh .dm-service-section:not(.dm-ct) .contentfaqs h4 {
    position: relative;
    margin: 0;
    padding: 20px 64px 20px 0;
    background: none;
    cursor: pointer;
}
.dm-fresh .dm-service-section:not(.dm-ct) .contentfaqs h4 i {
    position: absolute;
    top: 50%;
    right: 0;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    font-size: 13px;
    transform: translateY(-50%);
    transition: background-color .3s ease, color .3s ease;
}
.dm-fresh .dm-service-section:not(.dm-ct) .contentfaqs .dm_faq_item {
    top: 0;
    padding: 0 0 22px;
    background: none;
}

/* ---------------------------------------------------------------- page title area (template-parts/page-header-<layout>.php) */
.dm-fresh .dm-page-head {
    color: var(--ct-ink);
    font-family: var(--ct-font-body);
}
.dm-fresh .dm-page-head-inner {
    box-sizing: border-box;
    max-width: var(--ct-max);
    margin: 0 auto;
    padding: 0 var(--ct-gutter);
}
.dm-fresh .dm-page-head h1 {
    margin: 0;
    font-family: var(--ct-font-heading);
    font-weight: var(--ct-heading-weight);
    font-style: var(--ct-heading-style);
    text-transform: none;
    color: var(--ct-heading-color);
    text-wrap: balance;
}
.dm-fresh .dm-page-crumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
}
.dm-fresh .dm-page-crumbs li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ct-muted);
}
.dm-fresh .dm-page-crumbs li + li::before {
    content: "/";
    opacity: .45;
}
.dm-fresh .dm-page-crumbs a {
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}
.dm-fresh .dm-page-crumbs a:hover { color: var(--ct-primary); }
.dm-fresh .dm-page-crumbs [aria-current] { color: var(--ct-primary); }
.dm-fresh .dm-page-head-media { margin: 0; }
.dm-fresh .dm-page-head-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------------------------------------------------------------- responsive */
@media screen and (max-width: 1100px) {
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-fourth { flex-basis: calc((100% - var(--ct-gap)) / 2); }
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > :is(.dm-fifth, .dm-sixth) { flex-basis: calc((100% - 2 * var(--ct-gap)) / 3); }
}
@media screen and (max-width: 991px) {
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-third { flex-basis: calc((100% - var(--ct-gap)) / 2); }
}
@media screen and (max-width: 767px) {
    :where(:root) { --dm-pad: 44px; }
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > :is(.dm-half, .dm-third) { flex-basis: 100%; }
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > :is(.dm-fifth, .dm-sixth) { flex-basis: calc((100% - var(--ct-gap)) / 2); }
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-full > ul:not([class]) { columns: 1; }
    .dm-fresh .dm-service-section:not(.dm-ct) table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
@media screen and (max-width: 540px) {
    .dm-fresh .dm-service-section:not(.dm-ct) .dm-flex > .dm-fourth { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .dm-fresh .dm-service-section:not(.dm-ct) *,
    .dm-fresh .dm-service-section:not(.dm-ct) *::before,
    .dm-fresh .dm-service-section:not(.dm-ct) *::after { transition: none !important; }
}
