/* ============================================================
   ContentPage — page chrome, article typography, tables,
   and the reusable StreamField layout blocks
   (Hero, OneColumn, TwoColumn, ThreeColumn, RotatingImages).

   Loaded by: pages/content_page.html, feedback_form_page.html.
   MainPage has its own copy of the layout-block styles in
   main_page.css — changes here do not affect the homepage.
   ============================================================ */

.template-contentpage main {
    text-align: start;
}

/* The hero title band is the shared .page-hero component in mysite.css,
   rendered via includes/page_hero.html (body class `has-page-hero`). */

/* ============================================================
   2. ARTICLE CANVAS — open editorial layout. Text-like blocks
      are capped at a comfortable reading measure; media and
      layout blocks span the full container.
   ============================================================ */
.cp-article {
    max-width: 1240px;
    margin: 0 auto;
    padding: 44px 24px 80px;
}

.cp-block { min-width: 0; }
.cp-block + .cp-block { margin-top: 36px; }
.cp-block > :first-child { margin-top: 0; }
.cp-block > :last-child { margin-bottom: 0; }

/* reading measure for text-like blocks. Tables are excluded: their width is
   editor-controlled (StyledTableBlock full-width toggle / column widths), so
   they may span the full content area (.cp-article, ~1240px). */
.cp-block--rich_text,
.cp-block--link_list { max-width: 880px; }

/* wide imported HTML may contain fixed-width tables — let it scroll
   instead of breaking the viewport */
.cp-block--raw_html { overflow-x: auto; }

/* layout blocks manage their own inner width; drop their built-in
   inline padding so they align flush with the article container */
.cp-block .layout-one-col,
.cp-block .layout-two-col,
.cp-block .layout-three-col { padding-block: 8px; }
.cp-block .layout-two-col,
.cp-block .layout-three-col { padding-inline: 0; }
.cp-block .layout-one-col__inner { padding-inline: 0; }

/* ============================================================
   3. RICH-TEXT TYPOGRAPHY (applies at any depth so rich-text
      nested inside layout columns is styled the same).
   ============================================================ */
.content-page__body {
    color: var(--clr-text);
    font-size: 1.0625rem;          /* 17px — comfortable article body */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.content-page__body h2,
.content-page__body h3,
.content-page__body h4,
.content-page__body h5,
.content-page__body h6 {
    color: var(--clr-primary-dark);
    font-weight: var(--fw-bold);
    line-height: 1.35;
    margin: 1.9em 0 .75em;
}
.content-page__body h2 {
    font-size: clamp(1.3rem, 1.15rem + .6vw, 1.55rem);
}
.content-page__body h3 { font-size: var(--fs-h3); }
.content-page__body h4 { font-size: var(--fs-h4); font-weight: 600; }
.content-page__body h5 { font-size: var(--fs-body); font-weight: 600; }

.content-page__body p {
    margin: 0 0 1em;
    line-height: 1.85;
}

.content-page__body ol,
.content-page__body ul {
    margin: .8em 0 1.1em;
    padding-inline-start: 1.7em;   /* room for markers so they don't clip in RTL */
    line-height: 1.85;
}
.content-page__body ol li,
.content-page__body ul li {
    margin: .35em 0;
    padding-inline-start: .3em;
}
.content-page__body ul li::marker { color: var(--clr-primary); }
.content-page__body ol li::marker {
    color: var(--clr-primary);
    font-weight: var(--fw-bold);
}

.content-page__body a {
    color: var(--clr-primary);
    text-decoration: underline;
    text-decoration-color: rgba(1, 85, 153, .32);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    transition: color .15s ease, text-decoration-color .15s ease;
}
.content-page__body a:hover {
    color: var(--clr-primary-dark);
    text-decoration-color: currentColor;
}

.content-page__body hr {
    border: 0;
    height: 1px;
    margin: 2.2em 0;
    background: var(--clr-border-light);
}

.content-page__body blockquote {
    margin: 1.4em 0;
    padding: 14px 22px;
    border-inline-start: 4px solid var(--clr-accent);
    background: var(--clr-bg-alt);
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-start-end-radius: var(--radius);
    border-end-end-radius: var(--radius);
}
.content-page__body blockquote p:last-child { margin-bottom: 0; }

.content-page__body img { max-width: 100%; height: auto; }
/* rounded corners only on top-level rich-text images — raw_html
   imports stay pixel-faithful */
.cp-block--rich_text img { border-radius: var(--radius); }

/* ============================================================
   4. TABLES — scoped to the TableBlock so imported raw_html
      tables keep their own inlined SharePoint styling.
   ============================================================ */
.cp-block--table table {
    width: 100%;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: .4em 0;
    background: var(--clr-bg-card);
    border: 1px solid var(--clr-border-light);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    font-size: .95em;
}
/* wrapper allows a fixed-layout table to scroll if its columns are wider
   than the container instead of overflowing the page */
.cp-block--table .cp-table-wrap { overflow-x: auto; }
.cp-block--table th,
.cp-block--table td {
    padding: 13px 18px;
    border: 0;
    text-align: start;
    vertical-align: top;
    line-height: 1.7;
    overflow-wrap: break-word;   /* wrap long words inside fixed-width columns */
}
.cp-block--table thead th {
    background: linear-gradient(135deg, var(--clr-primary-dark), var(--clr-primary-mid));
    color: #fff;
    font-weight: var(--fw-bold);
    font-size: .94em;
    letter-spacing: .2px;
}
.cp-block--table tbody tr + tr th,
.cp-block--table tbody tr + tr td {
    border-block-start: 1px solid var(--clr-border-light);
}
.cp-block--table tbody tr:nth-child(even) { background: var(--clr-bg-alt); }
.cp-block--table tbody tr:hover { background: var(--clr-primary-faint); }
.cp-block--table table caption {
    caption-side: top;
    text-align: start;
    color: var(--clr-text-mid);
    font-size: var(--fs-small);
    padding-bottom: 8px;
}

/* ============================================================
   5. PER-BLOCK ALIGNMENT MODIFIER (used by OneColumn/TwoColumn/
      ThreeColumn, CTA, Newsletter, AppPromo, Services, Partners —
      any block that emits `tp-align-{left|center|right}` on its
      root element). Physical alignment: "Left" = visually left,
      "Right" = visually right regardless of document direction,
      matching Word / Google Docs behaviour.
   ============================================================ */
.tp-align-left  { text-align: left; }
.tp-align-right { text-align: right; }
.tp-align-center { text-align: center; }
/* Wagtail renders RichText images as display:block with `margin: 0 auto`,
   which centers them regardless of parent text-align. Override per alignment
   so block-level images follow the same physical side as the text. */
.tp-align-left  img { margin-left: 0;    margin-right: auto; }
.tp-align-right img { margin-left: auto; margin-right: 0;    }
.tp-align-center img { margin-left: auto; margin-right: auto; }

/* ============================================================
   6. FLEXIBLE LAYOUT BLOCKS (StreamField)
   ============================================================ */

/* Hero block */
.layout-hero {
    position: relative; overflow: hidden;
    min-height: 360px; padding: 80px 24px;
    color: #fff; background: var(--clr-primary-dark);
    display: flex; align-items: center;
    border-radius: var(--radius-lg);
}
.layout-hero__bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    z-index: 0;
}
.layout-hero__bg::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.55));
}
.layout-hero__inner {
    position: relative; z-index: 1;
    max-width: 900px; margin: 0 auto; width: 100%;
}
.layout-hero--left   .layout-hero__inner { text-align: start; }
.layout-hero--right  .layout-hero__inner { text-align: end; }
.layout-hero--center .layout-hero__inner { text-align: center; }
.layout-hero__title { font-size: 2.4rem; font-weight: 800; margin: 0 0 14px; line-height: 1.3; }
.layout-hero__subtitle { font-size: 1.15rem; opacity: .92; margin: 0 0 24px; line-height: 1.7; }
.layout-hero__cta {
    display: inline-block; padding: 12px 28px;
    background: var(--clr-accent); color: #fff; font-weight: 700;
    border-radius: var(--radius); text-decoration: none;
    transition: transform .2s, box-shadow .2s;
}
.layout-hero__cta:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: #fff; }

/* One-column block */
.layout-one-col { padding: 40px 0; }
.layout-one-col__inner { margin: 0 auto; padding: 0 24px; }
.layout-one-col--full   .layout-one-col__inner { max-width: 100%; padding: 0; }
.layout-one-col--wide   .layout-one-col__inner { max-width: 1200px; }
.layout-one-col--narrow .layout-one-col__inner { max-width: 800px; }

/* Two-column block — CSS Grid respects the document `dir`.
   First grid child is the "start" column (visually left in LTR, right in RTL). */
.layout-two-col {
    display: grid; gap: 32px;
    max-width: 1200px; margin: 0 auto; padding: 40px 24px;
}
.layout-two-col--ratio-1-1 { grid-template-columns: 1fr 1fr; }
.layout-two-col--ratio-2-1 { grid-template-columns: 2fr 1fr; }
.layout-two-col--ratio-1-2 { grid-template-columns: 1fr 2fr; }
.layout-two-col__col { min-width: 0; }

/* Three-column block */
.layout-three-col {
    display: grid; gap: 24px;
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px; margin: 0 auto; padding: 40px 24px;
}
.layout-three-col__col { min-width: 0; }

/* Images inside any column should scale to fit */
.layout-two-col__col img,
.layout-three-col__col img,
.layout-one-col__inner img { max-width: 100%; height: auto; }

/* ============================================================
   7. ROTATING IMAGES BLOCK
   ============================================================ */
.ri {
    position: relative;
    margin: 24px 0;
}
.ri--full_width {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    border-radius: 0;
}
.ri__viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    background: #f2f2f2;
    border-radius: 8px;
}
.ri--full_width .ri__viewport { border-radius: 0; }
.ri--ar-21-9 .ri__viewport { aspect-ratio: 21 / 9; }
.ri--ar-16-9 .ri__viewport { aspect-ratio: 16 / 9; }
.ri--ar-4-3  .ri__viewport { aspect-ratio: 4 / 3; }
.ri--ar-1-1  .ri__viewport { aspect-ratio: 1 / 1; }

/* Auto aspect-ratio: viewport sizes to current/tallest slide; slides stack via grid */
.ri--ar-auto .ri__viewport {
    aspect-ratio: auto;
    display: grid;
    grid-template-areas: "stack";
    background: transparent;
}

.ri__slide {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
}
.ri--ar-auto .ri__slide {
    position: relative;
    inset: auto;
    grid-area: stack;
}
.ri__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}
/* Contain: full image visible, letterboxed if ratios differ */
.ri--fit-contain .ri__slide img {
    object-fit: contain;
    background: #fff;
}
/* Auto: image keeps natural ratio, width fills, height intrinsic */
.ri--ar-auto .ri__slide img {
    width: 100%;
    height: auto;
    object-fit: initial;
    background: transparent;
}

/* Fade variant */
.ri--fade .ri__slide {
    opacity: 0;
    transition: opacity .6s ease-in-out;
    pointer-events: none;
    z-index: 0;
}
.ri--fade .ri__slide.is-active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1;
}

/* Slide variant — LTR enters from right, leaves to left */
.ri--slide .ri__slide {
    transform: translateX(100%);
    transition: transform .6s ease;
    pointer-events: none;
    z-index: 0;
}
.ri--slide .ri__slide.is-active {
    transform: translateX(0);
    pointer-events: auto;
    z-index: 1;
}
.ri--slide .ri__slide.is-leaving {
    transform: translateX(-100%);
    z-index: 0;
}
/* RTL flips the slide direction */
[dir="rtl"] .ri--slide .ri__slide { transform: translateX(-100%); }
[dir="rtl"] .ri--slide .ri__slide.is-active { transform: translateX(0); }
[dir="rtl"] .ri--slide .ri__slide.is-leaving { transform: translateX(100%); }

/* Dots */
.ri__dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px 0 4px;
}
.ri__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--clr-primary, #0d8a4a);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}
.ri__dot.is-active {
    background: var(--clr-primary, #0d8a4a);
    transform: scale(1.15);
}
.ri__dot:focus-visible {
    outline: 2px solid var(--clr-accent, #c9a23a);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .ri__slide { transition: none !important; }
}

/* ============================================================
   8. RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .layout-three-col { grid-template-columns: repeat(2, 1fr); }
    .layout-hero__title { font-size: 2rem; }
}

@media (max-width: 768px) {
    .cp-article { padding: 28px 16px 56px; }
    .cp-block + .cp-block { margin-top: 28px; }

    .content-page__body { font-size: 1rem; }
    .content-page__body h2 { padding-inline-start: 15px; }

    /* tables scroll horizontally instead of crushing columns */
    .cp-block--table table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cp-block--table th,
    .cp-block--table td {
        min-width: 130px;
        padding: 11px 14px;
    }

    .layout-two-col,
    .layout-two-col--ratio-1-1,
    .layout-two-col--ratio-2-1,
    .layout-two-col--ratio-1-2 { grid-template-columns: 1fr; }
    .layout-three-col { grid-template-columns: 1fr; }
    .layout-hero { min-height: 280px; padding: 56px 20px; }
    .layout-hero__title { font-size: 1.65rem; }
    .layout-hero__subtitle { font-size: 1rem; }

    /* legacy — still used by the feedback form page */
    .content-page__title { font-size: 1.5rem; }
}

@media (max-width: 768px) {
    .ri { margin: 16px 0; }
    .ri__viewport { border-radius: 6px; }
    .ri__dots { gap: 8px; padding: 10px 0 2px; }
    .ri__dot { width: 8px; height: 8px; border-width: 1.25px; }
}
@media (max-width: 480px) {
    .ri { margin: 12px 0; }
    /* On phones, force 16:9 to behave a touch shorter for readability when cover is used */
    .ri--ar-21-9 .ri__viewport { aspect-ratio: 16 / 9; }
}
