/*
 * Basecoat UI（shadcn/ui の変数）を、STAU の色に合わせるテーマ。
 * 色は stau.jp の /about と同じ緑灰。#b0c2bc を 70% で白に重ねた #c8d4d0 を地にする。
 * サイトと Chrome 拡張で同じものを使う。正本は public/assets/theme.css で、npm run vendor が extension/vendor/ へ写す。
 *
 * shadcn の既定の値は、WCAG 2.2 AA に届かないことがある。次を調整している。
 * - 入力欄の枠（--input）は、地に対して 3:1 以上（1.4.11）
 * - 補足の文字（--muted-foreground）は、地と muted の上で 4.5:1 以上（1.4.3）
 * - フォーカスは、半透明の輪ではなく不透明な線で示す（2.4.7、2.4.13）
 */

:root {
  color-scheme: light;
  --radius: 0.375rem;
  /* 和文が読みやすい書体を優先する。Basecoat の既定の Geist は使わない。 */
  --font-sans: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;

  --background: #c8d4d0;
  --foreground: #121212;
  --card: #d6dfdc;
  --card-foreground: #121212;
  --popover: #e4eae8;
  --popover-foreground: #121212;
  --primary: #121212;
  --primary-foreground: #e4eae8;
  --secondary: #b9c4c1;
  --secondary-foreground: #121212;
  --muted: #d6dfdc;
  /* 地（#c8d4d0）の上で 7.7:1、muted の上で 8.6:1 */
  --muted-foreground: #363938;
  --accent: #b9c4c1;
  --accent-foreground: #121212;
  /* 地の上で 5.9:1、カードの上で 6.6:1 */
  --destructive: #8f1d14;
  /* 有効を示すアイコンの色。地とカードの上で 3:1 以上 */
  --success: #2b6e4f;
  /* 区切り線。stau.jp と同じく #121212 を 50% で重ねた色。地に対して 3.18:1 */
  --border: #6d7371;
  /* 入力欄の枠。地に対して 5.3:1。shadcn の既定（薄い灰）は 3:1 に届かない */
  --input: #4b5250;
  --ring: #121212;

  /* フォーカスの線。不透明にする */
  --focus: #121212;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --background: #121212;
    --foreground: #e3e9e7;
    --card: #1a1e1d;
    --card-foreground: #e3e9e7;
    --popover: #1d2120;
    --popover-foreground: #e3e9e7;
    /* stau.jp の緑灰を強調に使う */
    --primary: #b0c2bc;
    --primary-foreground: #121212;
    --secondary: #2a302e;
    --secondary-foreground: #e3e9e7;
    --muted: #1d2120;
    --muted-foreground: #b9c3bf;
    --accent: #2a302e;
    --accent-foreground: #e3e9e7;
    --destructive: #ff9b8f;
    --success: #6fcf9f;
    /* 区切り線と、枠だけのボタンの枠。地とカードの上で 3.5:1 以上 */
    --border: #6e7876;
    --input: #8c9693;
    --ring: #b0c2bc;
    --focus: #b0c2bc;
  }
}

/* フォーカスは不透明な線で示す。Basecoat の半透明の輪は、地によっては見えにくいため。 */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* スクリプトで読み上げのために移したフォーカスには、枠を出さない。操作する部品ではないため。 */
:where([tabindex="-1"]):focus {
  outline: none;
}

/* 見た目だけ隠し、読み上げには残す。 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 開閉できることがわかるよう、見出しに下線を付ける。Basecoat は開閉の印を消すため。 */
summary {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* hidden 属性は必ず効かせる。.btn などの display の指定が、ブラウザ標準の hidden の扱いを上書きするため。 */
[hidden] {
  display: none !important;
}

/* 開閉の動きは付けない。開いた直後に中身の位置が定まらず、押そうとした所がずれるため。 */
details::details-content {
  transition: none;
}

/* 動きを減らす設定のときは、部品の動きを止める。 */
@media (prefers-reduced-motion: reduce) {
  /* Basecoat は滑らかなスクロールを指定する。スキップリンクなどの移動も、すぐに行う。 */
  html {
    scroll-behavior: auto !important;
  }

  *,
  ::before,
  ::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}
