/*
 * Copyright 2020 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

/* Design-system primitive + semantic tokens generated from Figma */
@import url('./styleguide.css');

/* Site-wide grid & spacing utility classes */
@import url('./sections.css');
/* Fractional section widths for side-by-side sections (70/30, 80/20, …) */
@import url('./section-layout.css');
/* 12-column responsive grid system (mobile-first) */
@import url('./section-grid.css');

:root {
    /* colors — using semantic tokens from styleguide.css */
    --background-color: var(--semantic-body-background-default, white);
    --light-color: var(--semantic-card-background-002, #f8f8f8);
    --dark-color: var(--semantic-body-text-default, #505050);
    --text-color: var(--semantic-body-text-default, #131313);
    --link-color: var(--semantic-link-text-default, var(--primitives-color-brand-003, #00829b));
    --link-hover-color: var(--semantic-link-text-hover, #1d3ecf);

    /* fonts */
    /* The single source of truth for the site typeface + its fallback chain.
       Change this one line to swap the font-family across every block and token. */

    --font-family-base: montserrat, montserrat-fallback, sans-serif;

    /* canary testing font-family, to be disabled and just for debugging */
    /* --font-family-base: 'Brush Script MT', cursive; */

    /* Semantic seams: body / heading / link can diverge later, but all
       currently resolve to the one base above. */
    --body-font-family: var(--font-family-base);
    --heading-font-family: var(--font-family-base);
    --link-font-family: var(--font-family-base);

    /* Font-weight scale — single source for the four weights in use.
       Reference these instead of hardcoding 400/500/600/700. */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Fixed font-size scale — single source for the fixed component type sizes
       used across blocks. (Distinct from the responsive --body/heading-font-size-*
       below, which shift at the 900px breakpoint for body copy & headings.)
       Off-scale one-offs (11/13/15/17/22/26/28px), rem, em and clamp() sizes are
       intentionally left as-is — see docs/block-font-audit.md §9. */
    --font-size-xs: 12px;
    --font-size-s: 14px;
    --font-size-m: 16px;
    --font-size-l: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    --font-size-4xl: 40px;
    --font-size-5xl: 48px;
    --font-size-6xl: 60px;

    /* body sizes */
    --body-font-size-m: 22px;
    --body-font-size-s: 19px;
    --body-font-size-xs: 17px;

    /* heading sizes */
    --heading-font-size-xxl: 55px;
    --heading-font-size-xl: 44px;
    --heading-font-size-l: 34px;
    --heading-font-size-m: 27px;
    --heading-font-size-s: 24px;
    --heading-font-size-xs: 22px;

    /* nav height */
    --nav-height: 64px;
    --breadcrumbs-height: auto;

    /* layout */
    --content-max-width: 1920px;
    --container-max-width: 1440px;
    --container-padding-x: 24px;
}

/* fallback fonts */
@font-face {
    font-family: roboto-condensed-fallback;
    size-adjust: 88.82%;
    src: local('Arial');
}

@font-face {
    font-family: roboto-fallback;
    size-adjust: 99.529%;
    src: local('Arial');
}

@font-face {
    font-family: montserrat-fallback;
    size-adjust: 105.46%;   /* Montserrat → Arial metrics compensation */
    src: local('Arial');
}

@media (width >= 900px) {
    :root {
        /* body sizes */
        --body-font-size-l: 20px;
        --body-font-size-m: 18px;
        --body-font-size-s: 16px;
        --body-font-size-xs: 14px;

        /* heading sizes */
        --heading-font-size-xxl: 45px;
        --heading-font-size-xl: 36px;
        --heading-font-size-l: 28px;
        --heading-font-size-m: 22px;
        --heading-font-size-s: 20px;
        --heading-font-size-xs: 18px;
    }
}

body {
    display: none;
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--body-font-family);
    font-size: var(--body-font-size-m);
    line-height: 1.5;
    min-height: 100vh;
}

body.appear {
    display: flex;
    flex-direction: column;
}

header {
    min-height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 500;
}

footer {
    position: relative;
    z-index: 500;
}

header .header,
footer .footer {
    visibility: hidden;
}

header .header[data-block-status="loaded"],
footer .footer[data-block-status="loaded"] {
    visibility: visible;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0.8em;
    margin-bottom: 0.25em;
    font-family: var(--heading-font-family);
    font-weight: var(--font-weight-semibold);
    line-height: 1.25;
    scroll-margin: 40px;
}

h1 { font-size: var(--heading-font-size-xxl); }
h2 { font-size: var(--heading-font-size-xl); }

/* Figma H2 for authored default content, scoped so blocks keep their own H2
   styling. Mobile: 20px / 500 / normal. */
.default-content-wrapper h2 {
    color: var(--semantic-title-text-default, #2d3338);
    font-family: var(--heading-font-family);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-medium);
    line-height: normal;
}

/* Tablet: Title/Title H2/H2 - Title-XS - Medium (24px / 500 / 36px) */
@media (width >= 600px) {
    .default-content-wrapper h2 {
        font-size: var(--page-title-XS-m-font-size);
        line-height: var(--page-title-XS-m-line-height);
    }
}

/* Desktop: Title/Title H2/H2 - Title-XXL - Medium (48px / 500 / 72px) */
@media (width >= 900px) {
    .default-content-wrapper h2 {
        font-size: var(--page-title-XL-medium-font-size);
        line-height: var(--page-title-XL-medium-line-height);
    }
}

h3 { font-size: var(--heading-font-size-l); }
h4 { font-size: var(--heading-font-size-m); }
h5 { font-size: var(--heading-font-size-s); }
h6 { font-size: var(--heading-font-size-xs); }

p,
dl,
ol,
ul,
pre,
blockquote {
    margin-top: 0.8em;
    margin-bottom: 0.25em;
}

/* Figma body lists: teal bullets 24px in, text 56px in, 12px between items.
   The li padding pushes the text away from the outside marker. */
main .default-content-wrapper ul {
    padding-left: 36px;
}

main .default-content-wrapper ul > li {
    padding-left: 20px;
}

main .default-content-wrapper ul > li + li {
    margin-top: 12px;
}

main .default-content-wrapper ul > li::marker {
    color: var(--semantic-link-text-default, #00829b);
}

code,
pre {
    font-size: var(--body-font-size-s);
}

pre {
    padding: 16px;
    border-radius: 8px;
    background-color: var(--light-color);
    overflow-x: auto;
    white-space: pre;
}

/* Reusable centred container */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: var(--container-padding-x);
    box-sizing: border-box;
}

main > div {
    /* max-width: var(--content-max-width); */
    margin: 40px 16px;
}

input,
textarea,
select,
button {
    font: inherit;
}

/* links */
a:any-link {
    color: var(--link-color);
    text-decoration: none;
    overflow-wrap: break-word;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

main img {
    max-width: 100%;
    width: auto;
    height: auto;
}

/* Images authored as default content have rounded corners in Figma (ECMS-4974) */
main .default-content-wrapper picture img {
    border-radius: 16px;
}

.icon {
    display: inline-block;
    height: 24px;
    width: 24px;
}

.icon img {
    height: 100%;
    width: 100%;
}

/* sections */
main > .section {
    margin: 40px 0;
}

/* Standard content box. border-box so the --container-max-width cap INCLUDES
   the side padding, exactly like .container, the header's .nav-inner and
   .section-width-row — otherwise the body runs 2 × --container-padding-x
   wider than the header on wide screens.
   --section-inset (default 0) lets a section that carries its own left
   padding (the collapsed left-nav rail, see left-nav.css) take that padding
   back out of the centring maths, so its content still lands at the same
   viewport x as every other page's. */
main > .section > div {
    box-sizing: border-box;
    max-width: var(--container-max-width, 1440px);
    margin-left: max(0px, calc((100% - var(--container-max-width, 1440px)) / 2 - var(--section-inset, 0px)));
    margin-right: auto;
    padding: 0 var(--container-padding-x);
}

main > .section:first-of-type {
    margin-top: 0;
}

/* section metadata */
main .section.light,
main .section.highlight {
    background-color: var(--light-color);
    margin: 0;
    padding: 40px 0;
}

