/*
 * 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.
 */
@import url('./typography.css');
@import url('./spacing.css');
@import url('./colors.css');
@import url('./icons.css');
@import url('./grid.css');
@import url('../blocks/button/button.css');
@import url('../components/skip-link/skip-link.css');


:root {
    /* colors */
    --background-color: white;
    --light-color: #f8f8f8;
    --dark-color: #505050;
    --text-color: #131313;
    --link-color: #3b63fb;
    --link-hover-color: #1d3ecf;
    --font-en: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-jp: "Noto Sans JP", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
    --font-sc: "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    --body-font-family: var(--font-en);
}

html[lang|="en"],
html[lang=""] {
    --body-font-family: var(--font-en);

    font-family: var(--font-en);

}

/* Japanese */
html[lang|="ja"] {
    --body-font-family: var(--font-jp);

    font-family: var(--font-jp);
    font-feature-settings: 'palt' on;
}

/* Chinese (simplified/traditional catch-all) */
html[lang|="zh"] {
  --body-font-family: var(--font-sc);

  font-family: var(--font-sc);
  }


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);
    font-weight: 400;
    line-height: var(--body-line-tight-m);
    overflow-x: hidden;
    height: 100%;
}

body.appear {
    display: block;
}

header {
    height: var(--nav-height);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: var(--z-index-fixed);
}

/* Hide header and footer when showHeaderFooter is false */
body.hide-header-footer  header,
body.hide-header-footer  footer {
    display: none;
}

body:has(.skip-link:focus) header,
body:has(.skip-link:focus-visible) header {
  top: var(--skiplink-height);
}

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

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

p,
dl,
ol,
ul,
pre,
blockquote {
  margin:0;
  padding:0;
}

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;
}

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

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

main picture{
    display: flex;
}

figcaption {
  font-size: var(--body-font-size-s);
  line-height: var(--body-line-normal-s);
  color: var(--text-primary);
  text-align: left;
  margin-top: var(--gap-vertical-2xs);
  word-wrap: break-word;
  width: 100%;
}

main > .section[data-backgroundcolor="navy-gradation"] figcaption {
  color: var(--text-on-dark);
}

main > .section[data-imagecaption="false"] figcaption {
  display: none;
}

/* ===========================================================
   MAIN CONTENT AREA
   =========================================================== */

/* sections */

main {
  margin-top: calc(var(--nav-height));
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  min-height: calc(100% - var(--nav-height));
}

body.hide-header-footer  main {
    margin-top: 0;
    min-height: 100vh;
}

/* Add skiplink height only when skip-link-nav element exists */
body:has(.skip-link:focus) main {
  margin-top: calc(var(--nav-height) + var(--skiplink-height));
}

@media (width > 768px) {
    main {
        padding: 0;
    }
}


/* main>div {
    margin: 40px 0;
} */

/* ===========================================================
   SECTION (page-level block)
   =========================================================== */

main>.section {
  margin-top: 0;
  gap: 10px;
  height: auto;
  width: 100%;
  margin-bottom: var(--section-margin-bottom-mobile);

  &[data-bottomspacing="false"]{
    margin-bottom: 0;
  }

  &[data-backgroundcolor="white"],
  &:not([data-background]){
     background: var(--background-color);
     padding-top: 0;
     padding-bottom: 0;
  }

  &[data-backgroundcolor="light-blue"] {
    background: var(--surface-secondary);
  }

  &[data-backgroundcolor="light-gray"] {
    background: var(--surface-quinary);
  }

  &[data-backgroundcolor="navy-gradation"] {
    background: var(--section-gradient-color);
  }

  &[data-backgroundcolor="light-blue"],
  &[data-backgroundcolor="light-gray"],
  &[data-backgroundcolor="navy-gradation"]{
    padding-top: var(--gap-horizontal-6xl);
    padding-bottom: var(--gap-horizontal-6xl);
  }

  &[data-border="true"] {
    border: 1px solid var(--border-primary);
  }

  &[data-width="content-width"] {
    padding: var(--section-padding-top-bottom-mobile) var(--section-padding-left-right-mobile);
    border-radius: var(--border-radius-m);
    max-width: var(--content-width);
    box-sizing: border-box;
    margin-left: var(--section-margin-left-right-mobile);
    margin-right: var(--section-margin-left-right-mobile);
    width: calc(100% - 40px);
  }

  &[data-width="full"]>div{
    max-width: var(--full-width);
    box-sizing: border-box;
    margin-left: var(--section-margin-left-right-mobile);
    margin-right: var(--section-margin-left-right-mobile);
  }
}


/* Desktop section spacing */
@media (width > 767px) {
  main>.section {
    width: 100%;
    margin-bottom: var(--section-margin-bottom-desktop);

    &[data-width="content-width"]{
      padding: var(--section-padding-top-bottom-desktop) var(--section-padding-left-right-desktop);
    }
  }

  main> .section[data-width="full"] >div {
    margin-left: var(--section-margin-left-right-desktop);
    margin-right: var(--section-margin-left-right-desktop);
  }
}

@media (width > 767px) and (width < 1280px) {
  main > .section[data-width="content-width"] {
    margin-left: var(--section-margin-left-right-desktop);
    margin-right: var(--section-margin-left-right-desktop);
    width: calc(100% - 80px);
  }
}

@media (width >= 1280px) {
  main > .section[data-width="content-width"] {
    max-width: var(--content-width, 1200px);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  main> .section >div,
  main> .section[data-width="full"] >div {
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: var(--content-width, 1200px);
  }
}

  main figure {
    display: flex;
    flex-direction: column;
    margin: var(--gap-horizontal-xl) 0;
  }


/* --- LEFT Position */
main > .section[data-imageposition="left"] figure,
main > .section[data-imageposition="left"] picture{
    justify-content: flex-start;
    text-align: left;
    justify-self: flex-start;

}

main > .section[data-imageposition="center"] figure,
main > .section[data-imageposition="center"] picture {
    justify-content: center;
    text-align: center;
    justify-self: center;
}

main > .section[data-imageposition="right"] figure,
main > .section[data-imageposition="right"] picture {
justify-content: flex-end;
    text-align: left;
    justify-self: flex-end;
}

/* --- LEFT Position */
main > .section[data-buttonposition="left"] .button-container{
    display: flex;
    justify-content: flex-start;
    justify-self: flex-start;
    text-align: left;
}

main > .section[data-buttonposition="center"] .button-container {
    display: flex;
    justify-content: center;
    text-align: center;
    justify-self: center;
}

main > .section[data-buttonposition="right"] .button-container {
    display: flex;
    justify-content: flex-end;
    text-align: left;
    justify-self: flex-end;
}

/* Desktop padding inside sections */


/* ===========================================================
   LIGHT + HIGHLIGHT SECTIONS
   (full width background sections)
   =========================================================== */

main .section.light,
main .section.highlight {
    background-color: var(--light-color);
    padding-top: 40px;
    padding-bottom: 40px;

    /* These sections ignore default margins */
    margin-top: 0;
    margin-bottom: 0;
}

main>.section :is(p, ul, ol, a) {
    font-size: var(--body-font-size-m);
    line-height: var(--body-line-relaxed-m);
    color: var(--text-primary);
    margin-top: var(--gap-horizontal-m);
}

/* =========================
  margin-top: 0 (first)
  ========================= */
.section > :first-child > .block,
.section > :first-child:is(.default-content-wrapper) > :first-child:not(div),
.section > :first-child:is(.default-content-wrapper) > :first-child :is(figure),
.section > :first-child:is(.default-content-wrapper) > :first-child:is(div) > :first-child {
  margin-top: 0;
}

/* =========================
  margin-bottom: 0 (last)
  ========================= */
.section > :last-child > .block,
.section > :last-child:is(.default-content-wrapper) > :last-child:not(div),
.section > :last-child:is(.default-content-wrapper) > :last-child :is(figure),
.section > :last-child:is(.default-content-wrapper) > :last-child:is(div) > :last-child {
  margin-bottom: 0;
}


main>.section :is(ul, ol) {
    list-style: none;
    display: flex;
    flex-direction: column;
    row-gap: var(--gap-vertical-3xs);

    p {
        margin: 0;
    }

    li {
        position: relative;
        padding-left: var(--gap-horizontal-sub-list);
        display: block;
    }

    li :is(ol,ul){
      margin-top: var(--gap-vertical-3xs);
    }

    li::before {
        position: absolute;
        left: 0;
        width: 24px;
        text-align: center;
        padding-right: var(--gap-horizontal-list-item);
        box-sizing: border-box;
        overflow-wrap: normal;
    }
}

main>.section ol {
    counter-reset: item;

    >li::before {
        counter-increment: item;
        content: counter(item) ".";
    }
}

main>.section ul>li::before {
    content: "•";
}

main>.section a {
    text-decoration: underline;
    margin: 0;

    .button-text-wrapper {
        display: inline;
    }

    @supports (-webkit-line-clamp: 2) {
        .button-text-wrapper {
            display: inline;
        }
    }
}

main>.section :is(h1, h2, h3, h4, h5, h6) a {
    font: inherit;
    color: inherit;
}

main>.section a:hover {
    color: var(--text-hover);
    text-decoration: none;
}

main>.section h1 a:hover {
    color: var(--text-accent-hover01);
}

main>.section[data-backgroundcolor="navy-gradation"] :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li, a) {
    color: var(--text-on-dark);
}

main>.section[data-backgroundcolor="navy-gradation"] a:hover {
    color: var(--text-accent-hover02);
}

html {
  scroll-padding-top: var(--nav-height);
  scroll-behavior: smooth;
}

/* Superscripts & Subscripts */
sup {
  line-height: 0;
  vertical-align: super;
}

.sup-en,
.sup-ja {
  font-size: inherit;
  margin-left: 0.08rem;
}

.icon-wrapper {
  margin-left: var(--scale-spacing-vertical-2xs);
  display: inline-block;
}

.button .icon-wrapper {
  display: inline-flex;
}
