/**
 * Frontend styles for page text output containers.
 * Lists, headings H1–H6, tables, images, video embeds + scroll box (600px).
 */

.ap-text-output:not(.ap-text-output--full) {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 8px;
}

.ap-text-output:not(.ap-text-output--full)::-webkit-scrollbar {
    width: 8px;
}

.ap-text-output:not(.ap-text-output--full)::-webkit-scrollbar-thumb {
    background: rgb(59 72 94 / 35%);
    border-radius: 8px;
}

.ap-text-output:not(.ap-text-output--full)::-webkit-scrollbar-track {
    background: rgb(59 72 94 / 8%);
    border-radius: 8px;
}

/* Typography */
.ap-text-output,
.seotext.entry-content,
.ap-text-output.entry-content {
    color: var(--e-global-color-text, #575757);
    font-size: 16px;
    line-height: 1.65;
    word-wrap: break-word;
}

.ap-text-output h1,
.ap-text-output h2,
.ap-text-output h3,
.ap-text-output h4,
.ap-text-output h5,
.ap-text-output h6,
.seotext h1,
.seotext h2,
.seotext h3,
.seotext h4,
.seotext h5,
.seotext h6,
.ap-text-output .wp-block-heading {
    color: #282828;
    font-weight: 700;
    line-height: 1.25;
    margin: 1.25em 0 0.65em;
}

.ap-text-output h1,
.ap-text-output .wp-block-heading.has-h1-font-size {
    font-size: clamp(32px, 4.5vw, 48px);
    font-weight: 700;
}

.ap-text-output h2 {
    font-size: clamp(24px, 3.2vw, 32px);
}

.ap-text-output h3 {
    font-size: clamp(20px, 2.6vw, 26px);
}

.ap-text-output h4 {
    font-size: 20px;
}

.ap-text-output h5 {
    font-size: 18px;
}

.ap-text-output h6 {
    font-size: 16px;
}

.ap-text-output p,
.ap-text-output .wp-block-paragraph {
    margin: 0 0 1em;
}

.ap-text-output ul,
.ap-text-output ol,
.ap-text-output .wp-block-list {
    margin: 0 0 1.25em 1.4em;
    padding: 0;
}

.ap-text-output ul {
    list-style: disc;
}

.ap-text-output ol {
    list-style: decimal;
}

.ap-text-output li {
    margin: 0.35em 0;
}

.ap-text-output li > ul,
.ap-text-output li > ol {
    margin-top: 0.35em;
    margin-bottom: 0.35em;
}

.ap-text-output strong,
.ap-text-output b {
    font-weight: 700;
    color: var(--e-global-color-primary, #282828);
}

.ap-text-output a {
    color: var(--e-global-color-accent, #3b485e);
    text-decoration: underline;
}

.ap-text-output a:hover {
    color: var(--e-global-color-primary, #282828);
}

/* Tables */
.ap-text-output table,
.ap-text-output .wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.5em;
    font-size: 15px;
}

.ap-text-output th,
.ap-text-output td,
.ap-text-output .wp-block-table th,
.ap-text-output .wp-block-table td {
    border: 1px solid rgb(40 40 40 / 15%);
    padding: 12px 14px;
    vertical-align: top;
    text-align: left;
}

.ap-text-output th,
.ap-text-output .wp-block-table th {
    background: var(--e-global-color-accent, #3b485e);
    color: var(--e-global-color-white, #fff);
    font-weight: 700;
}

.ap-text-output tr:nth-child(even) td {
    background: rgb(59 72 94 / 4%);
}

/* Images — stacked (photo, then caption), never side-by-side */
.ap-text-output img,
.ap-text-output .wp-block-image img,
.seotext img,
.entry-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.ap-text-output figure,
.ap-text-output .wp-block-image,
.ap-text-output .wp-caption,
.ap-text-output dl.wp-caption,
.seotext figure,
.seotext .wp-caption,
.seotext dl.wp-caption,
.entry-content figure,
.entry-content .wp-caption,
.entry-content dl.wp-caption,
.ap-rich-text figure,
.ap-rich-text .wp-caption,
.ap-rich-text dl.wp-caption {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    float: none;
    max-width: 100%;
    text-align: center;
    margin: 1.25em auto;
}

.ap-text-output .wp-caption.alignright,
.seotext .wp-caption.alignright,
.entry-content .wp-caption.alignright,
.ap-rich-text .wp-caption.alignright,
.ap-text-output img.alignright,
.seotext img.alignright,
.ap-text-output .wp-caption.alignleft,
.seotext .wp-caption.alignleft,
.entry-content .wp-caption.alignleft,
.ap-rich-text .wp-caption.alignleft,
.ap-text-output img.alignleft,
.seotext img.alignleft,
.ap-text-output .wp-caption.aligncenter,
.seotext .wp-caption.aligncenter,
.entry-content .wp-caption.aligncenter,
.ap-rich-text .wp-caption.aligncenter {
    float: none;
    margin: 1.25em auto;
}

.ap-text-output figure img,
.ap-text-output .wp-caption img,
.seotext figure img,
.seotext .wp-caption img,
.entry-content .wp-caption img,
.ap-text-output img.aligncenter,
.seotext img.aligncenter,
.entry-content img.aligncenter {
    display: block;
    float: none;
    margin-left: auto;
    margin-right: auto;
    height: auto;
    max-width: 100%;
}

.ap-text-output .wp-caption-dt,
.seotext .wp-caption-dt,
.entry-content .wp-caption-dt,
.ap-rich-text .wp-caption-dt {
    display: block;
    float: none;
    margin: 0;
    width: 100%;
    order: 1;
}

.ap-text-output figcaption,
.ap-text-output .wp-block-image figcaption,
.ap-text-output .wp-caption-text,
.ap-text-output .wp-caption-dd,
.seotext figcaption,
.seotext .wp-caption-text,
.seotext .wp-caption-dd,
.entry-content figcaption,
.entry-content .wp-caption-text,
.entry-content .wp-caption-dd,
.ap-rich-text figcaption,
.ap-rich-text .wp-caption-text,
.ap-rich-text .wp-caption-dd {
    display: block;
    float: none;
    width: 100%;
    order: 2;
    font-size: 14px;
    color: rgb(87 87 87 / 85%);
    margin: 0.5em 0 0;
    text-align: center;
}

/* Video / embeds */
.ap-text-output iframe,
.ap-text-output video,
.ap-text-output .wp-block-embed iframe,
.ap-text-output .wp-block-video video {
    max-width: 100%;
}

.ap-text-output .wp-block-embed,
.ap-text-output .wp-block-video {
    margin: 0 0 1.5em;
}

.ap-text-output .wp-block-embed__wrapper {
    position: relative;
}

.ap-text-output .wp-block-embed-youtube .wp-block-embed__wrapper iframe,
.ap-text-output .wp-block-embed-vimeo .wp-block-embed__wrapper iframe {
    width: 100%;
    min-height: 320px;
    border: 0;
    border-radius: 8px;
}

/* Quotes, code */
.ap-text-output blockquote,
.ap-text-output .wp-block-quote {
    margin: 0 0 1.25em;
    padding: 16px 20px;
    border-left: 4px solid var(--e-global-color-accent, #3b485e);
    background: rgb(59 72 94 / 8%);
}

.ap-text-output pre,
.ap-text-output code {
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
}

.ap-text-output pre {
    overflow-x: auto;
    padding: 14px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 1.25em;
}

/* Gutenberg align */
.ap-text-output .alignwide,
.ap-text-output .alignfull {
    max-width: 100%;
}

.ap-text-output > *:first-child {
    margin-top: 0;
}

.ap-text-output > *:last-child {
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .ap-text-output:not(.ap-text-output--full) {
        max-height: 480px;
    }
}

/* Service single — child list */
.ap-service-children-list {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgb(40 40 40 / 12%);
}

.ap-service-children-list h2 {
    font-size: clamp(22px, 3vw, 28px);
    margin-bottom: 1rem;
    color: #282828;
}

.ap-service-children-list .service-hub-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ap-service-children-list .service-hub-list li {
    margin: 0.5rem 0;
}

.ap-service-children-list .service-hub-list a {
    text-decoration: none;
    font-weight: 600;
    color: var(--e-global-color-accent, #3b485e);
}

.ap-service-children-list .service-hub-list a:hover {
    text-decoration: underline;
}

/* Services hub — nested tree */
.services-all-hub .services-nested-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
    border-left: 2px solid rgb(59 72 94 / 15%);
}

.services-all-hub .services-nested-list a {
    display: inline-block;
    padding: 0.25rem 0;
    text-decoration: none;
    color: var(--e-global-color-text, #575757);
}

.services-all-hub .services-nested-list a:hover {
    color: var(--e-global-color-accent, #3b485e);
    text-decoration: underline;
}

/* Rich text from Redux TinyMCE (FAQ, intro, cards) — same hierarchy as SEO blocks */
.ap-rich-text h1,
.ap-rich-text h2,
.ap-rich-text h3,
.ap-rich-text h4,
.ap-rich-text h5,
.ap-rich-text h6 {
    color: #282828;
    font-weight: 700;
    line-height: 1.25;
    margin: 1.25em 0 0.65em;
}
.ap-rich-text h1 { font-size: clamp(32px, 4.5vw, 48px); font-weight: 700; }
.ap-rich-text a {
    color: var(--e-global-color-accent, #3b485e);
    text-decoration: underline;
    font-weight: 600;
}
.ap-rich-text a:hover {
    color: var(--e-global-color-primary, #282828);
}
.ap-rich-text h2 { font-size: clamp(24px, 3.2vw, 32px); }
.ap-rich-text h3 { font-size: clamp(20px, 2.6vw, 26px); }
.ap-rich-text h4 { font-size: 20px; }
.ap-rich-text h5 { font-size: 18px; }
.ap-rich-text h6 { font-size: 16px; }
.ap-text-output u,
.ap-rich-text u { text-decoration: underline; }
.ap-text-output s,
.ap-text-output strike,
.ap-text-output del,
.ap-rich-text s,
.ap-rich-text strike,
.ap-rich-text del { text-decoration: line-through; }
.ap-rich-text ul,
.ap-rich-text ol {
    margin: 0 0 1.25em 1.4em;
    padding: 0;
}
.ap-rich-text ul { list-style: disc; }
.ap-rich-text ol { list-style: decimal; }
.ap-rich-text li { margin: 0.35em 0; }
.ap-rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1.5em;
    font-size: 15px;
}
.ap-rich-text th,
.ap-rich-text td {
    border: 1px solid rgb(40 40 40 / 15%);
    padding: 12px 14px;
    vertical-align: top;
    text-align: left;
}
.ap-rich-text th {
    background: var(--e-global-color-accent, #3b485e);
    color: #fff;
    font-weight: 700;
}
.ap-rich-text figure,
.ap-rich-text .wp-caption,
.ap-rich-text dl.wp-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    float: none;
    margin: 1.25em auto;
    max-width: 100%;
    text-align: center;
}
.ap-rich-text img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}
.ap-rich-text iframe,
.ap-rich-text video {
    max-width: 100%;
}

