/* ==========================================================================
   Post Design Template (page template)
   Mirrors the single blog post layout. All rules are scoped under
   .post-design-template so other pages are unaffected.
   ========================================================================== */

/* ---------- Layout ---------- */

.post-design-template__main,
.post-design-template__sidebar {
    min-width: 0;
}

.post-design-template__article {
    width: 100%;
}

/* ---------- Featured image ---------- */

/* Same as the blog post: figure 1rem + the theme's 20px image margin. */
.post-design-template .featured-media {
    margin: 0 0 1rem;
}

.post-design-template .featured-media img {
    display: block;
    max-width: 100%;
    height: auto;
}

.post-design-template .featured-media .wp-caption-text {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--txt-light, #6D7783);
}

/* ---------- Title ---------- */

/* Matches the .post-inner.mt-4 gap used on blog posts. */
.post-design-template .entry-header {
    margin: 0 0 1.5rem;
}

.post-design-template h1.entry-title {
    margin: 0;
    overflow-wrap: break-word;
}

/* ---------- Editor content: base ---------- */

.post-design-template .post-inner {
    margin-top: 0;
}

/* Text colour is inherited from body, exactly like the blog post. */
.post-design-template .entry-content {
    font-size: 18px;
    line-height: 30px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.post-design-template .entry-content::after {
    content: "";
    display: table;
    clear: both;
}

.post-design-template .entry-content > :first-child {
    margin-top: 0;
}

.post-design-template .entry-content > :last-child {
    margin-bottom: 0;
}

/* ---------- Headings ---------- */

/* Sizes/margins mirror h2/h3.has-medium-font-size as rendered on blog posts. */
.post-design-template .entry-content h2,
.post-design-template .entry-content h3,
.post-design-template .entry-content h4,
.post-design-template .entry-content h5,
.post-design-template .entry-content h6 {
    margin: 0 0 0.5rem;
    overflow-wrap: break-word;
}

.post-design-template .entry-content h2 {
    font-size: 34px;
    line-height: 50px;
}

.post-design-template .entry-content h3 {
    margin-bottom: 1rem;
    font-size: 28px;
    line-height: 40px;
}

.post-design-template .entry-content h4 {
    font-size: 24px;
    line-height: 34px;
}

.post-design-template .entry-content h5 {
    font-size: 20px;
    line-height: 30px;
}

.post-design-template .entry-content h6 {
    font-size: 18px;
    line-height: 28px;
}

/* ---------- Paragraphs, lists, links ---------- */

.post-design-template .entry-content p {
    margin: 0 0 1rem;
}

.post-design-template .entry-content ul,
.post-design-template .entry-content ol {
    margin: 0 0 1rem;
    padding-left: 2rem;
}

.post-design-template .entry-content li {
    font-size: 18px;
    line-height: 30px;
}

.post-design-template .entry-content li > ul,
.post-design-template .entry-content li > ol {
    margin: 0;
}

.post-design-template .entry-content a:not(.wp-block-button__link) {
    color: var(--primary-bg, #1778BE);
    text-decoration: none;
}

.post-design-template .entry-content a:not(.wp-block-button__link):hover,
.post-design-template .entry-content a:not(.wp-block-button__link):focus {
    color: var(--orange-clr, #FF8D54);
}

.post-design-template .entry-content hr,
.post-design-template .entry-content .wp-block-separator {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid #cde4f1;
    opacity: 1;
}

/* ---------- Quotes ---------- */

.post-design-template .entry-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--primary-bg, #1778BE);
    background: #F6F9FF;
    border-radius: 0 var(--border-rounded, 10px) var(--border-rounded, 10px) 0;
}

.post-design-template .entry-content blockquote p {
    margin-bottom: 0.75rem;
}

.post-design-template .entry-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-design-template .entry-content blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    font-style: normal;
    color: var(--txt-light, #6D7783);
}

.post-design-template .entry-content .wp-block-pullquote {
    margin: 1.5rem 0;
    padding: 1.5rem;
    border-top: 2px solid #cde4f1;
    border-bottom: 2px solid #cde4f1;
    text-align: center;
}

.post-design-template .entry-content .wp-block-pullquote blockquote {
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 0;
}

/* ---------- Images & figures ---------- */

.post-design-template .entry-content img {
    max-width: 100%;
    height: auto;
}

.post-design-template .entry-content figure,
.post-design-template .entry-content figure.wp-block-image {
    max-width: 100%;
    margin: 0 0 1.5rem;
}

.post-design-template .entry-content figure.wp-block-image img {
    display: block;
    margin: 0 auto;
}

.post-design-template .entry-content figcaption {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--txt-light, #6D7783);
    text-align: center;
}

.post-design-template .entry-content .alignleft {
    float: left;
    margin: 0.25rem 1.5rem 1rem 0;
}

.post-design-template .entry-content .alignright {
    float: right;
    margin: 0.25rem 0 1rem 1.5rem;
}

.post-design-template .entry-content .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.post-design-template .entry-content .alignwide,
.post-design-template .entry-content .alignfull {
    width: auto;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* ---------- Video & embeds (16:9) ---------- */

.post-design-template .entry-content iframe,
.post-design-template .entry-content embed,
.post-design-template .entry-content object,
.post-design-template .entry-content video {
    max-width: 100%;
}

.post-design-template .entry-content video {
    display: block;
    width: 100%;
    height: auto;
}

.post-design-template .entry-content iframe[src*="youtube.com"],
.post-design-template .entry-content iframe[src*="youtube-nocookie.com"],
.post-design-template .entry-content iframe[src*="youtu.be"],
.post-design-template .entry-content iframe[src*="vimeo.com"],
.post-design-template .entry-content iframe[src*="dailymotion.com"],
.post-design-template .entry-content .wp-block-embed.is-type-video iframe {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}

.post-design-template .entry-content .wp-block-embed {
    max-width: 100%;
    margin: 0 0 1.5rem;
}

.post-design-template .entry-content .wp-block-embed__wrapper {
    position: relative;
    max-width: 100%;
}

/* WordPress core already makes aspect-ratio embeds responsive; keep its absolute-fill behaviour. */
.post-design-template .entry-content .wp-has-aspect-ratio .wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
}

/* ---------- Tables ---------- */

.post-design-template .entry-content .wp-block-table,
.post-design-template .entry-content .table-responsive {
    max-width: 100%;
    margin: 0 0 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.post-design-template .entry-content table {
    width: 100%;
    max-width: 100%;
    margin: 0 0 1.5rem;
    border-collapse: collapse;
    font-size: 1rem;
    line-height: 1.5;
}

.post-design-template .entry-content > table {
    display: block;
    overflow-x: auto;
}

.post-design-template .entry-content .wp-block-table table {
    margin-bottom: 0;
}

.post-design-template .entry-content th,
.post-design-template .entry-content td {
    padding: 0.75rem 1rem;
    border: 1px solid #cde4f1;
    text-align: left;
    vertical-align: top;
}

.post-design-template .entry-content th {
    background: #F6F9FF;
    font-weight: 700;
}

/* ---------- Code ---------- */

.post-design-template .entry-content pre,
.post-design-template .entry-content .wp-block-code {
    max-width: 100%;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    white-space: pre;
    background: #F6F9FF;
    border: 1px solid #cde4f1;
    border-radius: var(--border-rounded, 10px);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.post-design-template .entry-content code {
    font-size: 0.9375em;
    word-break: break-word;
}

.post-design-template .entry-content pre code {
    word-break: normal;
}

/* ---------- Buttons (Gutenberg) ---------- */

.post-design-template .entry-content .wp-block-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
}

.post-design-template .entry-content .wp-block-button__link {
    display: inline-block;
    padding: 10px 30px;
    background: var(--primary-bg, #1778BE);
    color: #fff;
    font-size: 1.125rem;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 0;
    border-radius: 0;
    transition: all 0.2s linear;
}

.post-design-template .entry-content .wp-block-button__link:hover,
.post-design-template .entry-content .wp-block-button__link:focus {
    background: var(--orange-clr, #FF8D54);
    color: #fff;
    box-shadow: 6px 8px 1px #000;
}

/* ---------- Page links (wp_link_pages) ---------- */

.post-design-template__pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
}

.post-design-template__pagination span {
    display: inline-block;
    min-width: 2.25rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #cde4f1;
    line-height: 1.4;
    text-align: center;
}

.post-design-template__pagination a span {
    color: var(--primary-bg, #1778BE);
}

.post-design-template__pagination a:hover span {
    border-color: var(--primary-bg, #1778BE);
}

.post-design-template__pagination > span {
    background: var(--primary-bg, #1778BE);
    border-color: var(--primary-bg, #1778BE);
    color: #fff;
}

/* ---------- Right sidebar (search + CTA form) ---------- */

.post-design-template .blog-sidebar #searchform {
    margin-top: 0;
    margin-bottom: 1.5rem !important;
}

.post-design-template .cta-sticky-block {
    position: sticky;
    top: var(--pdt-header-offset, 110px);
}

/* No "Recent Post" block above it here, so it sits level with the title. */
.post-design-template .cta-form {
    margin-top: 0;
    border-radius: 14px;
}

/* ==========================================================================
   Table of contents (left column)
   Markup is generated by js/post-design-template.js from the H2 headings.
   ========================================================================== */

.post-design-template {
    /* Updated at runtime to the real sticky-header height + breathing room. */
    --pdt-header-offset: 110px;
    --pdt-toc-accent: var(--primary-bg, #1778BE);
    --pdt-toc-accent-soft: #E8F3FB;
    --pdt-toc-border: #E3ECF3;
    --pdt-toc-text: #3A4556;
    --pdt-toc-muted: #7B8794;
}

/* Headings land just below the sticky header when linked to. */
.post-design-template .entry-content h2[id] {
    scroll-margin-top: var(--pdt-header-offset, 110px);
}

.post-design-template__toc {
    min-width: 0;
}

.post-design-template__toc.is-empty {
    display: none;
}

/* When there are no H2s, give the content the TOC's width back. */
.post-design-template__row.pdt-no-toc .post-design-template__main {
    flex: 0 0 auto;
    width: 75%;
}

.pdt-toc {
    position: sticky;
    top: var(--pdt-header-offset, 110px);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--pdt-header-offset, 110px) - 1.5rem);
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--pdt-toc-border);
    border-radius: 14px;
    box-shadow: 0 10px 30px -18px rgba(23, 120, 190, 0.35);
}

/* Reading progress (scaled by JS) */
.pdt-toc__progress {
    position: relative;
    flex: 0 0 auto;
    height: 4px;
    background: var(--pdt-toc-accent-soft);
}

.pdt-toc__progress-bar {
    position: absolute;
    inset: 0;
    clip-path: inset(0 100% 0 0);
    background: linear-gradient(90deg, var(--pdt-toc-accent), var(--orange-clr, #FF8D54));
    transition: clip-path 0.15s linear;
    will-change: clip-path;
}

/* Header / toggle */
.pdt-toc__header {
    flex: 0 0 auto;
    border-bottom: 1px solid var(--pdt-toc-border);
}

.pdt-toc__toggle {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    width: 100%;
    margin: 0;
    padding: 1rem 1.25rem 0.9rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    text-align: left;
    color: #1B2430;
    cursor: default;
    box-shadow: none !important;
}

.pdt-toc__toggle:focus-visible {
    outline: 2px solid var(--pdt-toc-accent);
    outline-offset: -2px;
    border-radius: 12px 12px 0 0;
}

.pdt-toc__eyebrow {
    grid-column: 1;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pdt-toc-accent);
    line-height: 1.2;
}

.pdt-toc__title {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-family: var(--header-font-medium, inherit);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
}

.pdt-toc__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--pdt-toc-accent-soft);
    color: var(--pdt-toc-accent);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.pdt-toc__chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    display: none;
    color: var(--pdt-toc-muted);
    transition: transform 0.25s ease;
}

/* Body (scrolls independently if the list is taller than the viewport) */
.pdt-toc__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #C9D6E2 transparent;
}

.pdt-toc__body::-webkit-scrollbar {
    width: 6px;
}

.pdt-toc__body::-webkit-scrollbar-thumb {
    background: #C9D6E2;
    border-radius: 999px;
}

.pdt-toc__list {
    position: relative;
    margin: 0;
    padding: 0.75rem 0.75rem 0.5rem;
    list-style: none;
    counter-reset: none;
}

/* Vertical rail connecting the numbers */
.pdt-toc__list::before {
    content: "";
    position: absolute;
    top: 1.5rem;
    bottom: 1.25rem;
    left: calc(0.75rem + 0.6rem + 13px);
    width: 2px;
    background: var(--pdt-toc-border);
    border-radius: 2px;
}

.pdt-toc__item {
    position: relative;
    margin: 0;
    padding: 0;
    font-size: inherit;
    line-height: inherit;
}

.pdt-toc__link {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    color: var(--pdt-toc-text);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.45;
    text-decoration: none !important;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.pdt-toc__num {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-top: 0.05rem;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--pdt-toc-border);
    color: var(--pdt-toc-muted);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.pdt-toc__text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.pdt-toc__link:hover,
.pdt-toc__link:focus-visible {
    background: #F6F9FC;
    color: var(--pdt-toc-accent);
    outline: none;
}

.pdt-toc__link:focus-visible {
    box-shadow: 0 0 0 2px var(--pdt-toc-accent) inset;
}

.pdt-toc__link:hover .pdt-toc__num,
.pdt-toc__link:focus-visible .pdt-toc__num {
    border-color: var(--pdt-toc-accent);
    color: var(--pdt-toc-accent);
}

.pdt-toc__link.is-active {
    background: var(--pdt-toc-accent-soft);
    color: var(--pdt-toc-accent);
    font-weight: 700;
}

.pdt-toc__link.is-active .pdt-toc__num {
    background: var(--pdt-toc-accent);
    border-color: var(--pdt-toc-accent);
    color: #fff;
    transform: scale(1.08);
}

/* Footer */
.pdt-toc__footer {
    padding: 0.5rem 1.25rem 1rem;
    border-top: 1px dashed var(--pdt-toc-border);
    margin: 0 0.75rem;
}

.pdt-toc__top {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding-top: 0.5rem;
    color: var(--pdt-toc-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: color 0.18s ease;
}

.pdt-toc__top:hover,
.pdt-toc__top:focus-visible {
    color: var(--pdt-toc-accent);
}

/* Collapsed state (used on tablet/mobile) */
.pdt-toc.is-collapsed .pdt-toc__body {
    display: none;
}

.pdt-toc.is-collapsed .pdt-toc__header {
    border-bottom: 0;
}

.pdt-toc.is-collapsed .pdt-toc__chevron {
    transform: rotate(-90deg);
}

@media (prefers-reduced-motion: reduce) {
    .pdt-toc__progress-bar,
    .pdt-toc__link,
    .pdt-toc__num,
    .pdt-toc__chevron {
        transition: none;
    }
}

/* ---------- Bottom CTA ---------- */

.post-design-template .blog-callaction {
    clear: both;
}

.post-design-template .blog-callaction img {
    max-width: 100%;
    height: auto;
}

/* ---------- Responsive ---------- */

/* 1200px–1399px: three columns on a 1140px container, so tighten the type a touch. */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .post-design-template .entry-content h2 {
        font-size: 30px;
        line-height: 42px;
    }

    .post-design-template .entry-content h3 {
        font-size: 25px;
        line-height: 36px;
    }

    .pdt-toc__link {
        font-size: 0.875rem;
    }
}

/* 992px–1199px: TOC + content side by side; the CTA sidebar drops below, centred. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .post-design-template__sidebar {
        margin-top: 2.5rem;
    }

    .post-design-template .cta-sticky-block {
        position: static;
    }

    .post-design-template .blog-sidebar #searchform,
    .post-design-template .cta-form {
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }

    .pdt-toc__toggle {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .pdt-toc__title {
        font-size: 1rem;
    }

    .pdt-toc__link {
        font-size: 0.875rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Below 992px: TOC becomes a collapsible panel above the content. */
@media (max-width: 991.98px) {
    .post-design-template__row {
        margin-top: 2rem !important;
    }

    .post-design-template__sidebar {
        margin-top: 2.5rem;
    }

    .post-design-template .cta-sticky-block {
        position: static;
    }

    .post-design-template__toc {
        margin-bottom: 1.75rem;
    }

    .pdt-toc {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .pdt-toc__toggle {
        cursor: pointer;
        padding: 0.9rem 1.1rem;
    }

    .pdt-toc__chevron {
        display: block;
    }

    .pdt-toc__body {
        max-height: 60vh;
    }

    .pdt-toc__footer {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .post-design-template .featured-media {
        margin-bottom: 1.25rem;
    }

    .post-design-template .entry-header {
        margin-bottom: 1rem;
    }

    .post-design-template .entry-content .alignleft,
    .post-design-template .entry-content .alignright {
        float: none;
        display: block;
        margin: 0 auto 1.25rem;
    }

    .post-design-template .entry-content th,
    .post-design-template .entry-content td {
        padding: 0.5rem 0.75rem;
    }

    .post-design-template__sidebar {
        margin-top: 2rem;
    }

    .pdt-toc__link {
        font-size: 0.9375rem;
    }
}
