/*
 * Shared Color Theme
 * Based on the WebP Converter template palette.
 * Color definitions only: no layout, spacing, typography, or components.
 */

:root {
  color-scheme: light;

  /* Raw palette from the template */
  --theme-white: #ffffff;
  --theme-black: #000000;

  --theme-text: #202124;
  --theme-text-secondary: #5f6368;
  --theme-text-tertiary: #80868b;
  --theme-text-disabled: #9aa0a6;

  --theme-primary: #1a73e8;
  --theme-primary-hover: #1669d8;
  --theme-primary-pressed: #1557b0;
  --theme-primary-soft: #f8fbff;

  --theme-border: #dadce0;
  --theme-border-subtle: #e3e5e7;
  --theme-border-divider: #eceff1;
  --theme-border-hover: #c7c7c7;

  --theme-surface: #f8f8f9;
  --theme-surface-page: #ffffff;
  --theme-surface-muted: #f8fbff;

  /* Status palette */
  --theme-success: #188038;
  --theme-error: #d93025;

  /* Material Web / Material 3 system color roles */
  --md-sys-color-primary: var(--theme-primary);
  --md-sys-color-on-primary: var(--theme-white);
  --md-sys-color-primary-container: var(--theme-primary-soft);
  --md-sys-color-on-primary-container: var(--theme-primary);

  --md-sys-color-secondary: var(--theme-text-secondary);
  --md-sys-color-on-secondary: var(--theme-white);
  --md-sys-color-secondary-container: #f1f3f4;
  --md-sys-color-on-secondary-container: var(--theme-text);

  --md-sys-color-tertiary: var(--theme-text-tertiary);
  --md-sys-color-on-tertiary: var(--theme-white);
  --md-sys-color-tertiary-container: #f1f3f4;
  --md-sys-color-on-tertiary-container: var(--theme-text);

  --md-sys-color-error: var(--theme-error);
  --md-sys-color-on-error: var(--theme-white);
  --md-sys-color-error-container: #fce8e6;
  --md-sys-color-on-error-container: var(--theme-error);

  --md-sys-color-background: var(--theme-surface-page);
  --md-sys-color-on-background: var(--theme-text);
  --md-sys-color-surface: var(--theme-surface);
  --md-sys-color-on-surface: var(--theme-text);
  --md-sys-color-surface-variant: #f1f3f4;
  --md-sys-color-on-surface-variant: var(--theme-text-secondary);
  --md-sys-color-outline: var(--theme-border);
  --md-sys-color-outline-variant: var(--theme-border-subtle);

  --md-sys-color-shadow: var(--theme-black);
  --md-sys-color-scrim: var(--theme-black);
  --md-sys-color-inverse-surface: #3c4043;
  --md-sys-color-inverse-on-surface: var(--theme-white);
  --md-sys-color-inverse-primary: #8ab4f8;

  /* Material 3 fixed roles */
  --md-sys-color-primary-fixed: #e8f0fe;
  --md-sys-color-on-primary-fixed: #0d47a1;
  --md-sys-color-primary-fixed-dim: #d2e3fc;
  --md-sys-color-on-primary-fixed-variant: var(--theme-primary);

  --md-sys-color-secondary-fixed: #f1f3f4;
  --md-sys-color-on-secondary-fixed: var(--theme-text);
  --md-sys-color-secondary-fixed-dim: #e3e5e7;
  --md-sys-color-on-secondary-fixed-variant: var(--theme-text-secondary);

  --md-sys-color-tertiary-fixed: #f1f3f4;
  --md-sys-color-on-tertiary-fixed: var(--theme-text);
  --md-sys-color-tertiary-fixed-dim: #e3e5e7;
  --md-sys-color-on-tertiary-fixed-variant: var(--theme-text-tertiary);

  --md-sys-color-surface-dim: #eceff1;
  --md-sys-color-surface-bright: var(--theme-white);
  --md-sys-color-surface-container-lowest: var(--theme-white);
  --md-sys-color-surface-container-low: #f8f9fa;
  --md-sys-color-surface-container: #f1f3f4;
  --md-sys-color-surface-container-high: #e8eaed;
  --md-sys-color-surface-container-highest: #e3e5e7;

  /* Shared semantic aliases */
  --color-bg: var(--md-sys-color-surface);
  --color-surface: var(--theme-surface);
  --color-surface-muted: var(--theme-surface-muted);
  --color-text: var(--theme-text);
  --color-text-secondary: var(--theme-text-secondary);
  --color-text-tertiary: var(--theme-text-tertiary);
  --color-text-disabled: var(--theme-text-disabled);
  --color-primary: var(--theme-primary);
  --color-primary-hover: var(--theme-primary-hover);
  --color-primary-pressed: var(--theme-primary-pressed);
  --color-primary-soft: var(--theme-primary-soft);
  --color-border: var(--theme-border);
  --color-border-subtle: var(--theme-border-subtle);
  --color-border-divider: var(--theme-border-divider);
  --color-border-hover: var(--theme-border-hover);
  --color-success: var(--theme-success);
  --color-error: var(--theme-error);

  /* Common interaction colors */
  --state-hover: rgb(26 115 232 / 0.06);
  --state-focus: rgb(26 115 232 / 0.12);
  --state-pressed: rgb(26 115 232 / 0.16);
  --state-disabled: rgb(32 33 36 / 0.38);

  
--md-list-container-color:var(--theme-white);
}

/* Optional body-level defaults. Remove this block when the theme is used as a variables-only file. */
:where(html, body) {
  color: var(--color-text);
  background: var(--color-bg);
}
/* ==========================================================
 * Dark theme
 * 1. OS 設定が dark のとき（data-theme="light" で無効化可能）
 * 2. <html data-theme="dark"> で手動指定したとき
 * 両方とも同じトークン値を定義しています。
 * ========================================================== */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    /* Raw palette */
    /* --theme-white はダークでは背景色として使われるため、暗い色に置き換えます */
    --theme-white: #202124;
    --theme-black: #000000;

    --theme-text: #e8eaed;
    --theme-text-secondary: #bdc1c6;
    --theme-text-tertiary: #9aa0a6;
    --theme-text-disabled: #5f6368;

    --theme-primary: #8ab4f8;
    --theme-primary-hover: #aecbfa;
    --theme-primary-pressed: #d2e3fc;
    --theme-primary-soft: #1e2a3d;

    --theme-border: #5f6368;
    --theme-border-subtle: #3c4043;
    --theme-border-divider: #303134;
    --theme-border-hover: #80868b;

    --theme-surface: #1b1c1e;
    --theme-surface-page: #202124;
    --theme-surface-muted: #1d2433;

    --theme-success: #81c995;
    --theme-error: #f28b82;

    /* Material 3 roles that use hard-coded values in light mode */
    --md-sys-color-secondary-container: #3c4043;
    --md-sys-color-tertiary-container: #3c4043;
    --md-sys-color-error-container: #5c2b29;
    --md-sys-color-surface-variant: #3c4043;

    --md-sys-color-inverse-surface: #e8eaed;
    --md-sys-color-inverse-primary: #1a73e8;

    --md-sys-color-primary-fixed: #1e3a5f;
    --md-sys-color-on-primary-fixed: #d2e3fc;
    --md-sys-color-primary-fixed-dim: #2a4d7a;

    --md-sys-color-secondary-fixed: #3c4043;
    --md-sys-color-secondary-fixed-dim: #4a4d51;
    --md-sys-color-tertiary-fixed: #3c4043;
    --md-sys-color-tertiary-fixed-dim: #4a4d51;

    --md-sys-color-surface-dim: #151617;
    --md-sys-color-surface-bright: #37393b;
    --md-sys-color-surface-container-lowest: #171819;
    --md-sys-color-surface-container-low: #1d1e20;
    --md-sys-color-surface-container: #26282b;
    --md-sys-color-surface-container-high: #303134;
    --md-sys-color-surface-container-highest: #3c4043;

    /* Interaction states (light blue overlay for dark backgrounds) */
    --state-hover: rgb(138 180 248 / 0.08);
    --state-focus: rgb(138 180 248 / 0.16);
    --state-pressed: rgb(138 180 248 / 0.24);
    --state-disabled: rgb(232 234 237 / 0.38);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* Raw palette */
  /* --theme-white はダークでは背景色として使われるため、暗い色に置き換えます */
  --theme-white: #202124;
  --theme-black: #000000;

  --theme-text: #e8eaed;
  --theme-text-secondary: #bdc1c6;
  --theme-text-tertiary: #9aa0a6;
  --theme-text-disabled: #5f6368;

  --theme-primary: #8ab4f8;
  --theme-primary-hover: #aecbfa;
  --theme-primary-pressed: #d2e3fc;
  --theme-primary-soft: #1e2a3d;

  --theme-border: #5f6368;
  --theme-border-subtle: #3c4043;
  --theme-border-divider: #303134;
  --theme-border-hover: #80868b;

  --theme-surface: #1b1c1e;
  --theme-surface-page: #202124;
  --theme-surface-muted: #1d2433;

  --theme-success: #81c995;
  --theme-error: #f28b82;

  /* Material 3 roles that use hard-coded values in light mode */
  --md-sys-color-secondary-container: #3c4043;
  --md-sys-color-tertiary-container: #3c4043;
  --md-sys-color-error-container: #5c2b29;
  --md-sys-color-surface-variant: #3c4043;

  --md-sys-color-inverse-surface: #e8eaed;
  --md-sys-color-inverse-primary: #1a73e8;

  --md-sys-color-primary-fixed: #1e3a5f;
  --md-sys-color-on-primary-fixed: #d2e3fc;
  --md-sys-color-primary-fixed-dim: #2a4d7a;

  --md-sys-color-secondary-fixed: #3c4043;
  --md-sys-color-secondary-fixed-dim: #4a4d51;
  --md-sys-color-tertiary-fixed: #3c4043;
  --md-sys-color-tertiary-fixed-dim: #4a4d51;

  --md-sys-color-surface-dim: #151617;
  --md-sys-color-surface-bright: #37393b;
  --md-sys-color-surface-container-lowest: #171819;
  --md-sys-color-surface-container-low: #1d1e20;
  --md-sys-color-surface-container: #26282b;
  --md-sys-color-surface-container-high: #303134;
  --md-sys-color-surface-container-highest: #3c4043;

  /* Interaction states (light blue overlay for dark backgrounds) */
  --state-hover: rgb(138 180 248 / 0.08);
  --state-focus: rgb(138 180 248 / 0.16);
  --state-pressed: rgb(138 180 248 / 0.24);
  --state-disabled: rgb(232 234 237 / 0.38);
}