/**
 * ベースリセットと要素デフォルト
 *
 * Sibloo は Bootstrap 4.1.3 を強制的に読み込み、その Reboot がリセットの多くを
 * 担う。ここでは Reboot と同じ値を自前でも宣言し、Bootstrap の有無に関わらず
 * 同じ結果になるようにする。
 */

:root {
  /* アンカーで飛んだときに上へ空ける量。固定ヘッダーを置く案件では
   * その高さに合わせる。ベースの .header は position: relative で高さを
   * 持たないため、ここでは余白としての既定値だけを持つ。 */
  --scroll-offset: 3.75rem;

  /* テキスト選択時の色 */
  --selection-bg: var(--ink);
  --selection-fg: var(--snow);

  /* hr の罫線 */
  --hr-color: var(--light-gray);
}

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-fg);
}

*,
*::before,
*::after {
  /* Reboot 依存のうち最も影響が大きい。padding / sizes ユーティリティは
   * すべて border-box を前提にしている。 */
  box-sizing: border-box;
  min-width: 0px;
  min-height: 0px;
}

html {
  /* iOS の横向きで文字が自動拡大されるのを止める */
  -webkit-text-size-adjust: 100%;
  /* タップ時のハイライトを消す */
  -webkit-tap-highlight-color: transparent;

  /* 最小値13pxを保証し、1200px未満では最大22pxまでフォントサイズが流動する */
  font-size: clamp(13px, var(--font-size-base), 22px);

  @media screen and (min-width: 1200px) {
    font-size: clamp(0.1rem, var(--font-size-base), 24px);
  }
}

/**
 * ページ内リンクのスムーススクロール。
 *
 * ネイティブのハッシュ遷移に任せる。位置のオフセットは [id] の
 * scroll-margin-top が受け持つ。
 *
 * 「動きを減らす」設定の環境では即座にジャンプする。
 *
 * フォームのあるページでは 01_FormScript.js がこれを切る。validationEngine が
 * エラー箇所へ移動するときに使う jQuery の animate({ scrollTop }) と噛み合わない
 * ため。理由はそちらのコメントにある。
 */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  line-height: 1.5;
  /* 長い URL や英単語がはみ出して横スクロールを作るのを防ぐ。
   * 収まらないときだけ働くため、通常の行分割には影響しない。 */
  overflow-wrap: break-word;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink);
  background-color: var(--snow);
  background-image: var(--paper);
}

#root {
  margin: 0 auto;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: inherit;
  line-height: inherit;
}

/**
 * リスト・図・引用の margin リセット。
 *
 * 余白はユーティリティで与える方針に揃える。padding-left と list-style は
 * 既定のまま残すため、箇条書きの体裁自体は変わらない。
 */
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

/* Bootstrap の hr は margin 1rem と rgba(0,0,0,.1) の罫線を持つ。
 * 余白はユーティリティで与える方針に揃え、色は変数にする。 */
hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--hr-color);
}

img,
iframe,
video {
  max-width: 100%;
}

/* inline 由来の下端の隙間を防ぐ */
img,
svg {
  vertical-align: middle;
}

table {
  border-collapse: collapse;
}

iframe {
  border: none;
  box-shadow: none;
}

a,
a:hover {
  color: var(--ink);
}
/* Reboot と同値。ホバー時の下線を残すかは別途判断する */
a {
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

[id] {
  scroll-margin-top: var(--scroll-offset);
}

/* ユーティリティより後に読む必要があるためここに置いている。
 * 04_padding などへ先を越されると .p-16 のような指定に負けて、
 * 視覚的に隠しきれなくなる。 */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* フォーム要素はフォント関連を継承しない */
button,
input,
optgroup,
select,
textarea {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}
textarea {
  resize: vertical;
}

button {
  position: relative;
  appearance: none;
  cursor: pointer;
  box-shadow: none;
  border: 0;
  background: none;
  padding: 0;
}

/**
 * フォーカスリングはキーボード操作でだけ出す。
 *
 * Bootstrap 4.1.3 は button:focus に独自のリングを当てており、詳細度が
 * (0,1,1) あるため素の button { outline: none } では打ち消せない。
 * :not(:focus-visible) を重ねて (0,2,1) にし、ポインタ操作のときだけ消す。
 *
 * Bootstrap が外れた場合も :focus-visible 側が効くため、インジケータは
 * 失われない。
 */
button:focus:not(:focus-visible) {
  outline: none;
}
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* CMS が箇条書きを <p> で出力するため、それを list-item として見せるための
 * アダプタ。ブログ固有ではないのでここに置いている。 */
.list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 1.5rem;
  list-style: disc outside none;

  & > p {
    margin: 0;
    display: list-item;
  }
}

/**
 * 印刷
 *
 * Bootstrap 4.1.3 は @page { size: a3 } と、body および .container への
 * min-width: 992px !important を当てており、そのままだと A3 用紙・デスクトップ幅で
 * 印刷される。これらは対になっていて、一部だけ戻すと用紙からはみ出す。
 *
 * ここでは全部戻し、画面と同じレスポンシブな見た目で印刷されるようにする。
 * デスクトップ幅で刷りたい案件は、これらを案件側で戻す。
 *
 * .container は自前では定義していない Bootstrap のクラスだが、案件が使っている
 * 場合に同じ問題が起きるため打ち消しておく。
 */
@media print {
  @page {
    size: auto;
  }

  body,
  .container {
    min-width: 0 !important;
  }
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.stars canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.footer {
  z-index: 20;
}
.footer .stars-wrapper {
  transform: translateZ(0);
}

.section-title {
  line-height: 1.25;
  font-weight: 700;
  font-size: 1rem;
  
  & .section-title__en {
    filter: drop-shadow(0 0 0.5rem hsla(from var(--st-color) h s l / 40%));
    color: var(--st-color);
    font-size: 1em;
    --tracking: 0.16em;
  }
  & .section-title__ja {
    margin-top: 0.4em;
    font-size: 1.666666em;
  }
  &.section-title--small .section-title__ja {
    font-size: 1.333333em;
  }
  
  @media (min-width: 768px) {
    font-size: 1.25rem;
  }
  @media (min-width: 1024px) {
    font-size: 1.5rem;
  }
  
  &.section-title--blueberry {
    --st-color: var(--blueberry);
  }
  &.section-title--green {
    --st-color: var(--green);
  }
  &.section-title--yellow {
    --st-color: var(--yellow);
  }
}


.button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: var(--tracking);
  border-bottom: 2px solid var(--ink);
  
  &:hover {
    opacity: 0.85;
    text-decoration: none;
  }
  
  &::after {
    content: "";
    display: block;
    width: 1.5rem;
    height: 1.5rem;
    background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M14.293%207.29289C14.6835%206.90237%2015.3165%206.90237%2015.707%207.29289L19.707%2011.2929C20.0976%2011.6834%2020.0976%2012.3164%2019.707%2012.707L15.707%2016.707C15.3165%2017.0975%2014.6835%2017.0975%2014.293%2016.707C13.9024%2016.3164%2013.9024%2015.6834%2014.293%2015.2929L16.5859%2012.9999H13C12.4477%2012.9999%2012%2012.5522%2012%2011.9999C12%2011.4476%2012.4477%2010.9999%2013%2010.9999H16.5859L14.293%208.70696C13.9024%208.31643%2013.9024%207.68342%2014.293%207.29289ZM5.5%2010.9999C6.05228%2010.9999%206.5%2011.4476%206.5%2011.9999C6.5%2012.5522%206.05228%2012.9999%205.5%2012.9999H5C4.44772%2012.9999%204%2012.5522%204%2011.9999C4%2011.4476%204.44772%2010.9999%205%2010.9999H5.5ZM10%2010.9999C10.5523%2010.9999%2011%2011.4476%2011%2011.9999C11%2012.5522%2010.5523%2012.9999%2010%2012.9999H8.5C7.94772%2012.9999%207.5%2012.5522%207.5%2011.9999C7.5%2011.4476%207.94772%2010.9999%208.5%2010.9999H10Z%22%20fill%3D%22%23333333%22%2F%3E%0A%3C%2Fsvg%3E%0A");
    background-repeat: no-repeat;
    background-size: contain;
  }
  
  &.button--snow {
    color: var(--snow);
    border-bottom: 2px solid var(--snow);
    &::after {
      background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%3Cpath%20d%3D%22M16.8663%207.35148C17.3544%206.88284%2018.1457%206.88284%2018.6339%207.35148L23.6339%2012.1515C24.122%2012.6202%2024.122%2013.3798%2023.6339%2013.8485L18.6339%2018.6485C18.1457%2019.1172%2017.3544%2019.1172%2016.8663%2018.6485C16.3781%2018.1799%2016.3781%2017.4203%2016.8663%2016.9516L19.7325%2014.2H15.2501C14.5597%2014.2%2014%2013.6628%2014%2013C14%2012.3372%2014.5597%2011.8%2015.2501%2011.8H19.7325L16.8663%209.04838C16.3781%208.57974%2016.3781%207.82011%2016.8663%207.35148ZM5.87501%2011.8C6.56537%2011.8%207.12501%2012.3372%207.12501%2013C7.12501%2013.6628%206.56537%2014.2%205.87501%2014.2H5.25001C4.55965%2014.2%204%2013.6628%204%2013C4%2012.3372%204.55965%2011.8%205.25001%2011.8H5.87501ZM11.5%2011.8C12.1904%2011.8%2012.75%2012.3372%2012.75%2013C12.75%2013.6628%2012.1904%2014.2%2011.5%2014.2H9.62503C8.93467%2014.2%208.37502%2013.6628%208.37502%2013C8.37502%2012.3372%208.93467%2011.8%209.62503%2011.8H11.5Z%22%20fill%3D%22white%22%2F%3E%0A%3C%2Fsvg%3E%0A");
    }
  }
}

.glowing-text {
  text-shadow: 0 0 1rem rgba(255, 255, 255, 0.50);
  mix-blend-mode: overlay;
}

.glowing-yellow {
  filter: drop-shadow(0 0 0.5rem rgba(233, 163, 49, 0.40));
}

.swiper {
  &:not(.swiper-initialized) {
    & .swiper-wrapper {
      display: flex;
      overflow-x: auto;
    }
    & .swiper-slide {
      width: 100%;
      min-width: 100%;
    }
  }
}
.home-gallery .swiper-wrapper {
  transition-timing-function: linear;
}
.home-gallery .swiper:not(.swiper-initialized) .swiper-slide {
  min-width: 20rem;
  width: 20rem;
}
.home-products .swiper-wrapper {
  transition-timing-function: linear;
}
.home-products .swiper:not(.swiper-initialized) .swiper-slide {
  min-width: 20rem;
  width: 20rem;
}

.elevation-1 {
  filter: drop-shadow(0 16px 48px rgba(0, 0, 0, 0.12)) drop-shadow(0 8px 24px rgba(0, 0, 0, 0.08)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.04)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.02));
}

.home-hero-slider {
  aspect-ratio: 3 / 2;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -35%);
  width: 85%;
  
  & .swiper, & .swiper-wrapper, & .swiper-slide {
    height: 100%;
  }
  
  & img {
    aspect-ratio: 3 / 2;
    object-fit: cover;
  }
  
  @media (min-width: 768px) {
    width: 55%;
    transform: translate(-50%, -75%);
  }
  @media (min-width: 1200px) {
    width: 50%;
    transform: translate(-50%, -75%);
  }
}
