/* ===== Reset / Base ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

h1,
h2,
h3,
h4,
h5,
p,
ul,
ol,
dl {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-base);
  &:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  &:focus-visible {
    outline: 3px solid var(--c-sun-base);
    outline-offset: 3px;
  }
}

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

button {
  font-family: inherit;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-jp);
  color: var(--text-primary);
  background: var(--bg-base);
  font-weight: var(--weight-medium);
  line-height: 1.7;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[lang="en"] {
  body {
    line-height: 1.3;
  }
}

/* ===== Shared language menu ===== */

.c-language {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  color: var(--text-primary);
}

.c-language__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-sm);
  background: var(--bg-base);
  color: inherit;
  font-size: var(--fs-xs);
  font-weight: var(--weight-bold);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  &:hover,
  &:focus-visible {
    border-color: var(--c-mint-base);
    color: var(--c-mint-ink);
  }
}

.c-language--open {
  .c-language__button {
    border-color: var(--c-mint-base);
    color: var(--c-mint-ink);
  }
}

.c-language__globe {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.c-language__chevron {
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  transition: transform 0.2s ease;
}

.c-language--open {
  .c-language__chevron {
    transform: rotate(180deg);
  }
}

.c-language__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: flex;
  min-width: 200px;
  padding: 8px;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  background: var(--bg-base);
  &[hidden] {
    display: none;
  }
}

.c-language__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 40px;
  padding: 8px;
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-weight: var(--weight-bold);
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  &:hover,
  &:focus-visible,
  &[aria-checked="true"] {
    background: rgba(114, 219, 199, 0.16);
    color: var(--c-mint-ink);
    text-decoration: none;
  }
}

.c-language__check {
  display: block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex: 0 0 auto;
  color: var(--c-mint-base);
}

.c-language--mobile {
  width: 100%;
  margin-top: 16px;
  .c-language__button {
    width: 100%;
    justify-content: space-between;
  }
  .c-language__menu {
    position: static;
    width: 100%;
    margin-top: 8px;
  }
}

.c-language--footer {
  .c-language__menu {
    top: auto;
    bottom: calc(100% + 8px);
  }
}

/* ===== Shared breadcrumbs ===== */

.global-breadcrumb {
  position: relative;
  z-index: 2;
  width: min(100% - 32px, var(--container-max));
  margin: 16px auto 0;
}

.global-breadcrumb__list {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  &::-webkit-scrollbar {
    display: none;
  }
}

.global-breadcrumb__item {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--weight-bold);
  line-height: 1.5;
  gap: 8px;
  & + .global-breadcrumb__item::before {
    width: 6px;
    height: 6px;
    margin: 0;
    border-top: 2px solid var(--text-muted);
    border-right: 2px solid var(--text-muted);
    content: "";
    transform: rotate(45deg);
  }
}

.global-breadcrumb__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  &:hover {
    color: var(--text-muted);
    text-decoration: none;
  }
}

.global-breadcrumb__home-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--text-secondary);
}

.global-breadcrumb__current {
  display: block;
  max-width: min(48vw, 520px);
  overflow: hidden;
  color: var(--text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .global-breadcrumb {
    margin-top: 8px;
  }
  .global-breadcrumb__list {
    min-height: 32px;
    padding: 0 8px;
  }
  .global-breadcrumb__current {
    max-width: 48vw;
  }
  .global-breadcrumb {
    & + main [class$="-page-head"],
    & + .global-blog-index .global-blog-index__head,
    & + main.global-complete {
      padding-top: 24px;
    }
  }
}
