/* =========================================
   Global styles, CSS variables, reset
   ========================================= */

/* Keep unmodified HarmonyOS Latin fonts. Chinese uses system fallbacks;
   the full CJK TTF remains bundled for server-side PDF only. */
@font-face {
  font-family: "HarmonyOS Sans";
  src: url("../assets/fonts/harmonyos-sans/HarmonyOS_Sans.ttf?v=72d5adb60242fae6") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-024F;
}

@font-face {
  font-family: "HarmonyOS Sans";
  src: url("../assets/fonts/harmonyos-sans/HarmonyOS_Sans_Italic.ttf?v=64234302c0e063fe") format("truetype");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-024F;
}

:root {
  /* Colors */
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #666666;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-border-strong: #d1d5db;
  --color-accent: #f36b21;
  --color-accent-dark: #a83e00;
  --color-accent-action: #a83e00;
  --color-accent-light: #fff4eb;
  --color-success: #10b981;
  --color-danger: #ef4444;

  /* Typography */
  --font-sans: "HarmonyOS Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radii */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);

  /* Layout */
  --header-height: 64px;
  --max-width: 1440px;
  --summary-width: 380px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
}

select { color: var(--color-text); background-color: var(--color-surface); }

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #fff;
  background: #111827;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid #111827;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #fff;
}

#main-content:focus { outline: 0; box-shadow: none; }

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-muted {
  color: var(--color-text-muted);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
.language-switcher { display:inline-flex; align-items:center; gap:3px; padding:3px; border:1px solid var(--color-border); border-radius:var(--radius-md); background:var(--color-surface); }
.language-switcher button { min-height:32px; padding:0 10px; border:0; border-radius:var(--radius-sm); color:var(--color-text-secondary); background:transparent; font:inherit; font-size:13px; font-weight:700; cursor:pointer; transition:color var(--transition-fast), background-color var(--transition-fast); }
.language-switcher button:hover { color:var(--color-text); background:var(--color-bg); }
.language-switcher button.active { color:#fff; background:var(--color-text); }

@media (max-width: 899px) {
  .language-switcher {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
    overflow: hidden;
  }

  .language-switcher button { display: none; }

  .language-switcher button.active {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0;
  }

  .language-switcher button.active::after {
    content: "";
    width: 22px;
    height: 22px;
    background-color: currentColor;
    mask: url("../assets/icons/translate.svg") center / contain no-repeat;
    -webkit-mask: url("../assets/icons/translate.svg") center / contain no-repeat;
  }
}

#language-switcher { display: inline-flex; flex: none; width: auto; height: auto; padding: 0; border: 0; background: transparent; overflow: visible; }
#language-switcher button { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 0; padding: 0; border: 1px solid var(--color-border); border-radius: 50%; color: var(--color-text); background: var(--color-surface); cursor: pointer; }
#language-switcher button:hover { background: var(--color-bg); }
#language-switcher button::after { content: ""; width: 22px; height: 22px; background-color: currentColor; mask: url("../assets/icons/translate.svg") center / contain no-repeat; -webkit-mask: url("../assets/icons/translate.svg") center / contain no-repeat; }
