/*
  This file defines the content formatting rules inside the .cms-page-content tag,
  i.e. the content pulled from WordPress. Modify variables and properties below
  to adjust spacing, colors, and clip effects.
*/

/* Ensure the main element and the CMS content fill the available height */
main,
.cms-page-content {
}

/* Style the main container:
   - Set top padding and background color.
   - Define several custom CSS variables (used later for padding, margins, and clip paths).
   Adjust these variables to modify spacing or the clipping effects on corners.
*/
main {
    padding: 0;

    --edmund-topper-padding: 2rem var(--hook-horiz-margin); /* Padding for top elements (e.g. headings) */
    --edmund-topper-antipadding: -2rem -5rem -2rem -5rem; /* Negative padding if needed for overlap */
    --edmund-topper-margin: 0;
    --cms-horiz-margin: 2rem; /* Horizontal margin for most content blocks */
    --cms-horiz-inset: -2rem; /* Corresponding inset for pseudo-elements */
    --hook-horiz-margin: 2rem; /* Horizontal margin for .hook elements */
    --hook-horiz-inset: -6rem; /* Horizontal margin for .hook elements */
    --edmund-topper-padding: 2rem var(--hook-horiz-margin); /* Padding for top elements (e.g. headings) */

    background-color: var(--edmund-light-grey);
    /* Clip-path variables used for creating rounded or diagonal edges on elements */
    --edmund-all-corners-clipped: polygon(
        0 1rem,
        1rem 0,
        calc(100% - 1rem) 0,
        100% 1rem,
        100% calc(100% - 1rem),
        calc(100% - 1rem) 100%,
        1rem 100%,
        0 calc(100% - 1rem)
    );
    --edmund-top-corners-clipped: polygon(
        0 1rem,
        1rem 0,
        calc(100% - 1rem) 0,
        100% 1rem,
        100% 100%,
        0 100%
    );
    --edmund-bottom-corners-clipped: polygon(
        0 0,
        100% 0,
        100% calc(100% - 1rem),
        calc(100% - 1rem) 100%,
        1rem 100%,
        0 calc(100% - 1rem)
    );
    --edmund-diagonal-clipped: polygon(
        0 0,
        calc(100% - 1rem) 0,
        100% 1rem,
        100% 100%,
        1rem 100%,
        0 calc(100% - 1rem)
    );
}

/*
  Heading styles inside main.
  Adjust font-sizes, weights, and spacing by changing these properties or the variables.
*/

/* h1: Main title styling using custom padding and margin variables */
main h1:first-of-type {
    font-size: 2.2rem;
    font-weight: 800;
    padding: 0;
    margin: 0;
    background-color: var(--edmund-white);
    position: relative;
    z-index: 2;
}
main h1:first-of-type::before {
    content: '';
    position: absolute;
    inset: -1rem -4rem -2rem -4rem;
    background-color: var(--edmund-white);
    z-index: -1;
}

main h1:not(:first-of-type) {
    font-size: 36px;
    font-weight: 700;
    padding: 2rem;
    position: relative;
    z-index: 1;
    color: var(--edmund-black);
}

/* h2: Secondary headings with specific padding and margin.
   Relative positioning is used so that pseudo-elements (background effects) can be placed underneath. */
main h2 {
    font-size: 36px;
    font-weight: 700;
    padding: 2rem;
    margin: 1rem var(--cms-horiz-margin) 1rem var(--cms-horiz-margin);
    position: relative;
    z-index: 1;
}
main h2::before {
    content: '';
    position: absolute;
    inset: -1rem -12rem -1rem -2rem;
    background-color: var(--edmund-light-grey);
    z-index: -2;
}
main h2::after {
    position: absolute;
    content: '';
    background-color: var(--edmund-grey) !important;
    clip-path: polygon(100% 1px, 80% 100%, 0 100%, 0% 0);
    inset: 0;
    z-index: -1;
}

/* h3 to h6: Styles for additional heading levels.
   Modify font-size and font-weight to emphasize hierarchy. */
main h3 {
    font-size: 1.6rem;
    font-weight: 600;
}

main h4 {
    font-size: 1.4rem;
    font-weight: 600;
}

main h5 {
    font-size: 1.2rem;
    font-weight: 600;
}

main h6 {
    font-size: 1rem;
    font-style: italic;
    font-weight: 600;
}

/* Basic text styling for paragraphs, ordered lists, and unordered lists.
   Change line-height or word-spacing if you need different text density. */
main p,
main ol,
main ul {
    font-size: 1rem;
    font-weight: normal;
    line-height: 1.5em;
    word-spacing: 0.16em;
}

/* Style for blockquotes to give them an italicized, semi-bold look */
main blockquote,
main blockquote p {
    font-style: italic;
    font-weight: 500;
}

/*
  "Blocking" section: Applies consistent padding and margin to direct children of .cms-page-content
  except for elements with the class .hook and specific headings.
  Modify these values to change the overall spacing of content blocks.
*/
main .cms-page-content > *:not(.hook, h1, h2, .header-two-container) {
    /* padding: 1rem 2rem; */
    position: relative;
    z-index: 1;
}
.cms-page-content {
    margin: 0 var(--cms-horiz-margin) 1rem var(--cms-horiz-margin);
    background-color: white;
    padding: 1rem 2rem;
}

/*
  Adjust spacing for elements immediately following an h1 or .hook (excluding h2),
  so that the first block after these headers has distinct padding and margin.
*/
main .cms-page-content > h1 + *:not(h2, .header-two-container, .hook),
main .cms-page-content > .hook + *:not(h2, .header-two-container) {
    margin-top: 4rem;
    z-index: 1;
}
main
    .cms-page-content
    > h1
    + *:not(h2, .header-two-container, .hook, .header-two-container)::before,
main
    .cms-page-content
    > .hook
    + *:not(h2, .header-two-container, .header-two-container)::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: -4rem;
    right: -4rem;
    height: 1rem;
    width: calc(100% + 8rem);
    background-color: var(--edmund-light-grey);
    z-index: -1;
}

main .cms-page-content > h2 {
    padding: 1rem 10rem 1rem 2rem;
    margin: 2rem 10rem 2rem 0;
    position: relative;
    z-index: 1;
}

.hook {
    margin: 1rem var(--hook-horiz-margin) 2rem var(--hook-horiz-margin);
    padding: 3rem 6% 2rem 6%;
    font-weight: 600;
    position: relative;
    z-index: 1;
    background: var(--edmund-grey);
}

/* Disable pseudo-elements for .hook to avoid interference with its custom style */
.hook::after {
    position: absolute;
    content: '';
    background-color: var(--edmund-light-grey);
    inset: 0;
    top: -1px;
    z-index: -1;
    clip-path: polygon(100% 0, 95% 100%, 0 100%, 5% 0);
}
.hook::before {
    content: '';
    position: absolute;
    inset: -1rem var(--hook-horiz-inset) -2rem var(--hook-horiz-inset);
    background-color: var(--edmund-white);
    z-index: -2;
}
/*
  Style for strong elements inside paragraphs:
  Uses a medium font weight rather than the default bold.
*/
main p strong {
    font-weight: 600;
}

/*
  List styles:
  Customize markers for ordered lists and remove default bullet styles.
*/

/* Style ordered list markers: bold with the primary color */
main ol > ::marker {
    font-weight: 600;
    color: var(--edmund-color-primary);
}

/*
  Set basic font and background properties for lists.
  Removes any extra background or styling from default list settings.
*/
main ul,
main ol,
main ul li {
    font-size: 1rem;
    line-height: 2em;
    word-spacing: 0.16em;
}

/* Remove default bullet styles from unordered lists */
main ul,
main ul li {
    list-style: none;
}

/* Remove left padding from ordered lists */
main ol {
    padding-left: 0;
}

/* Apply uniform padding to all lists */
main ol,
main ul {
    padding: 0 1.5rem;
}

/*
  Reset spacing for nested lists so they do not inherit additional padding/margin
  (often called "undoing the boxing").
*/
main li > ul,
main li > ol {
    padding-left: 0;
    padding-top: unset;
    padding-bottom: unset;
    margin: unset;
    position: unset;
    z-index: unset;
}

/*
  Add left padding to list items so the custom bullet image has space to appear.
  'list-style-position: inside' places the marker inside the element.
*/
main li {
    padding: 0 0 0 1.5em;
    list-style-position: inside;
}

/*
  Custom bullet image for first-level unordered list items.
  Change the URL, background-size, or position values to update the bullet appearance.
*/
main ul li {
    background-image: url('../images/components/ComponentBulletSquare.svg');
    background-repeat: no-repeat;
    background-position: left 0.6em;
    background-size: 0.8em 0.8em;
}

/*
  Nested unordered lists:
  Each level uses a different bullet image.
  To change the icons, update the URL for each level.
*/

/* Level 1 (an alternate version is provided below, but commented out) */

/* .cms-page-content ul li { */

/*   background-image: url("../images/components/ComponentBulletSquare.svg"); */

/* } */

/* Level 2: Use a diamond bullet */
main ul li ul li {
    background-image: url('../images/components/ComponentBulletDiamond.svg');
}

/* Level 3: Use a triangle bullet */
main ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletTriangleOne.svg');
}

/* Level 4: Use a second triangle style */
main ul li ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletTriangleTwo.svg');
}

/* Level 5: Cycle back to square bullet */
main ul li ul li ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletSquare.svg');
}

/* Level 6: Diamond bullet */
main ul li ul li ul li ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletDiamond.svg');
}

/* Level 7: Triangle One bullet */
main ul li ul li ul li ul li ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletTriangleOne.svg');
}

/* Level 8: Triangle Two bullet */
main ul li ul li ul li ul li ul li ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletTriangleTwo.svg');
}

/* Level 9: Square bullet */
main ul li ul li ul li ul li ul li ul li ul li ul li ul li {
    background-image: url('../images/components/ComponentBulletSquare.svg');
}

/*
  Styling for nested ordered lists:
  The numbering style changes with each nesting level.
  Change the list-style-type values if you want different numbering formats.
*/

/* Level 2: Lowercase alphabet */
main ol li ol li {
    list-style-type: lower-alpha;
}

/* Level 3: Lowercase roman numerals */
main ol li ol li ol li {
    list-style-type: lower-roman;
}

/* Level 4: Decimal numbering */
main ol li ol li ol li ol li {
    list-style-type: decimal;
}

/* Level 5: Lowercase alphabet again */
main ol li ol li ol li ol li ol li {
    list-style-type: lower-alpha;
}

/* Level 6: Lowercase roman numerals */
main ol li ol li ol li ol li ol li ol li {
    list-style-type: lower-roman;
}

/* Level 7: Decimal numbering */
main ol li ol li ol li ol li ol li ol li ol li {
    list-style-type: decimal;
}

/* Level 8: Lowercase alphabet */
main ol li ol li ol li ol li ol li ol li ol li ol li {
    list-style-type: lower-alpha;
}

/* Level 9: Lowercase roman numerals */
main ol li ol li ol li ol li ol li ol li ol li ol li ol li {
    list-style-type: lower-roman;
}

/*
NOTE THIS STYLING IS BEING IMPLEMENTED DESKTOP FIRST Media queries: These are
 placeholders for responsive design. Add specific CSS rules within these blocks
 to adjust styling for different screen widths.
*/

@media only screen and (width <= 1240px) {
    /* Styles for larger screens can be added here */
    main .cms-page-content > h2 {
        padding-right: 2rem;
        margin-right: 2rem;
        padding-left: 2rem;
    }
    main h2::before {
        inset: -1rem -4rem -1rem -2rem;
    }
}

@media only screen and (width <= 940px) {
    /* Styles for medium screens can be added here */
}

@media only screen and (width <= 600px) {
    /* Styles for small screens can be added here */
    main {
        --cms-horiz-margin: 1.5rem; /* Horizontal margin for most content blocks */
        --cms-horiz-inset: -1.5rem; /* Corresponding inset for pseudo-elements */
        --hook-horiz-margin: 2.5rem; /* Horizontal margin for .hook elements */
    }
}

@media only screen and (width <= 450px) {
    :root {
        font-size: 16px;
    }

    .cms-page-content {
        margin-bottom: 0;
    }
    /* Styles for very small screens can be added here */
    main {
        --cms-horiz-margin: 0.5rem; /* Horizontal margin for most content blocks */
        --cms-horiz-inset: -0.5rem; /* Corresponding inset for pseudo-elements */
        --hook-horiz-margin: 0.5rem; /* Horizontal margin for .hook elements */
        background-color: white;
        margin: 0;
        padding: 0;
    }
    .cms-page-content {
        padding: 0;
        margin: 0;
    }

    main h1:first-of-type {
        font-size: 24px;
        padding: 1rem 6%;
        background-color: var(--edmund-white);
    }

    main h2 {
        font-size: 20px;
    }

    main h3,
    main h4,
    main h5,
    main h6 {
        font-size: 18px;
    }

    .hook {
        clip-path: unset;
        margin: 0;
    }

    .hook::before,
    main .cms-page-content > *::before,
    main .cms-page-content > *::after,
    .hook::after,
    main
        .cms-page-content
        > h1
        + *:not(h2, .header-two-container, .hook)::before,
    main
        .cms-page-content
        > h1
        + *:not(h2, .header-two-container, .hook)::after,
    main .cms-page-content > .hook + *:not(h2, .header-two-container)::before,
    main .cms-page-content > .hook + *:not(h2, .header-two-container)::after {
        content: unset !important;
    }

    main .cms-page-content > *:not(h1, .hook),
    main .cms-page-content > h1 + *:not(h2, .header-two-container, .hook),
    main .cms-page-content > .hook + *:not(h2, .header-two-container) {
        margin: 0.5rem;
        padding: 1rem;
        background-color: var(--edmund-white);
    }

    main .cms-page-content > p:not(.hook),
    main .cms-page-content > ol,
    main .cms-page-content > ul {
        /* border: 0.25rem solid rgba(0, 0, 0, 0.2); */
        margin-bottom: 0 !important;
        margin-top: 1rem;
    }

    main .cms-page-content > *:not(h1, .hook) + *:not(h1, .hook) {
        margin-top: 0;
        margin-bottom: 0;
    }

    main h2 {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
        padding-right: 20% !important;
    }
}
