/**
 * Fortcoat Base Styles
 *
 * 全局基础样式:reset、排版、容器、按钮基础。
 * 各 Web Component 内部样式在 components/*.js 里 Shadow DOM 中。
 */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--fc-font-body);
  font-size: var(--fc-text-base);
  line-height: var(--fc-leading-normal);
  color: var(--fc-color-text);
  background: var(--fc-color-bg);
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

/* ============= Typography ============= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--fc-font-display);
  font-weight: var(--fc-font-bold);
  line-height: var(--fc-leading-tight);
  color: var(--fc-color-gray-900);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--fc-text-5xl); }
h2 { font-size: var(--fc-text-4xl); }
h3 { font-size: var(--fc-text-3xl); }
h4 { font-size: var(--fc-text-2xl); }
h5 { font-size: var(--fc-text-xl); }
h6 { font-size: var(--fc-text-lg); }

@media (max-width: 768px) {
  h1 { font-size: var(--fc-text-4xl); }
  h2 { font-size: var(--fc-text-3xl); }
  h3 { font-size: var(--fc-text-2xl); }
  h4 { font-size: var(--fc-text-xl); }
}

p {
  margin-bottom: var(--fc-space-4);
}

a {
  color: var(--fc-color-primary);
  text-decoration: none;
  transition: color var(--fc-transition-fast);
}

a:hover {
  color: var(--fc-color-accent);
}

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

ul, ol {
  list-style-position: inside;
}

/* ============= Container ============= */
.fc-container {
  width: 100%;
  max-width: var(--fc-container-xl);
  margin: 0 auto;
  padding: 0 var(--fc-space-6);
}

.fc-container-wide {
  max-width: var(--fc-container-2xl);
}

.fc-container-narrow {
  max-width: var(--fc-container-md);
}

/* ============= Section padding ============= */
.fc-section {
  padding: var(--fc-space-20) 0;
}

@media (max-width: 768px) {
  .fc-section {
    padding: var(--fc-space-12) 0;
  }
}

/* ============= 隐形挂载点 ============= */
/* Web Component 还没注册前,自定义元素是 inline 的,会布局错乱 */
fc-header, fc-hero, fc-product-grid, fc-product-detail,
fc-case-grid, fc-cta, fc-footer, fc-inquiry-form,
fc-spec-table, fc-product-card, fc-case-card,
fc-blog-list, fc-page-content {
  display: block;
}

/* ============= 加载占位(防 FOUC) ============= */
fc-header:not(:defined),
fc-hero:not(:defined),
fc-product-grid:not(:defined),
fc-case-grid:not(:defined),
fc-footer:not(:defined) {
  visibility: hidden;
}

fc-header:not(:defined) {
  height: 80px;
}

/* ============= 屏幕阅读器隐藏 ============= */
.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;
}

/* ============= WordPress 默认样式覆盖 ============= */
.wp-block-image img {
  border-radius: var(--fc-radius-md);
}

/* 让 WP 编辑器输出的内容有正确字体 */
.entry-content {
  font-family: var(--fc-font-body);
  line-height: var(--fc-leading-relaxed);
}

.entry-content > * + * {
  margin-top: var(--fc-space-4);
}

.entry-content h2 {
  margin-top: var(--fc-space-12);
}

.entry-content h3 {
  margin-top: var(--fc-space-8);
}

/* ============= Skip to main content (无障碍) ============= */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--fc-color-primary);
  color: white;
  padding: var(--fc-space-2) var(--fc-space-4);
  z-index: var(--fc-z-toast);
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ============= 选中文字配色 ============= */
::selection {
  background: var(--fc-color-accent);
  color: white;
}

/* ============= 默认 focus 样式 ============= */
:focus-visible {
  outline: 2px solid var(--fc-color-accent);
  outline-offset: 2px;
}
