/**
 * 拾光主题 · 基础样式
 * Reset + 排版 + 表单 + 工具类
 */

/* ============================================================
   Reset
   ============================================================ */

*, *::before, *::after{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html{
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body{
  font-family: var(--sg-font);
  font-size: var(--sg-fs-base);
  line-height: var(--sg-lh-normal);
  color: var(--sg-text);
  background: var(--sg-bg);
  min-height: 100vh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas, audio, iframe, embed, object{
  display: block;
  max-width: 100%;
}

img{ height: auto; border-style: none; }

button, input, select, textarea{
  font: inherit;
  color: inherit;
}

button{
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

a{
  color: inherit;
  text-decoration: none;
}

ul, ol{ list-style: none; }

table{ border-collapse: collapse; border-spacing: 0; }

/* ============================================================
   排版
   ============================================================ */

h1, h2, h3, h4, h5, h6{
  font-weight: 700;
  line-height: var(--sg-lh-tight);
  letter-spacing: -.02em;
  color: var(--sg-text);
}

h1{ font-size: var(--sg-fs-4xl); }
h2{ font-size: var(--sg-fs-2xl); }
h3{ font-size: var(--sg-fs-xl); }
h4{ font-size: var(--sg-fs-lg); }
h5{ font-size: var(--sg-fs-md); }
h6{ font-size: var(--sg-fs-base); }

p{ margin: 0; }

strong, b{ font-weight: 650; }

small{ font-size: var(--sg-fs-sm); }

code, kbd, samp, pre{
  font-family: var(--sg-font-mono);
  font-size: .9em;
}

::selection{
  background: var(--sg-accent-soft);
  color: var(--sg-text);
}

/* ============================================================
   表单
   ============================================================ */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="password"],
input[type="number"],
textarea{
  width: 100%;
  padding: 12px 15px;
  font-size: var(--sg-fs-base);
  color: var(--sg-text);
  background: rgba(255, 255, 255, .75);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: var(--sg-r-sm);
  outline: none;
  transition:
    background var(--sg-dur-fast) var(--sg-ease),
    border-color var(--sg-dur-fast) var(--sg-ease),
    box-shadow var(--sg-dur-fast) var(--sg-ease);
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus{
  background: #fff;
  border-color: rgba(10, 132, 255, .4);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, .08);
}

input::placeholder,
textarea::placeholder{
  color: var(--sg-text-3);
}

textarea{
  min-height: 100px;
  line-height: var(--sg-lh-relaxed);
  resize: vertical;
}

/* ============================================================
   焦点可见性（无障碍）
   ============================================================ */

:focus-visible{
  outline: 2px solid var(--sg-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   工具类
   ============================================================ */

.sg-container{
  max-width: var(--sg-container);
  margin: 0 auto;
  padding: 0 var(--sg-sp-6);
}

.sg-container-narrow{
  max-width: var(--sg-container-narrow);
  margin: 0 auto;
  padding: 0 var(--sg-sp-6);
}

.sg-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;
}

.sg-hidden{ display: none !important; }

.sg-text-center{ text-align: center; }
.sg-text-right{ text-align: right; }

/* 文字截断 */
.sg-truncate{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-line-clamp-1,
.sg-line-clamp-2,
.sg-line-clamp-3{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg-line-clamp-1{ -webkit-line-clamp: 1; }
.sg-line-clamp-2{ -webkit-line-clamp: 2; }
.sg-line-clamp-3{ -webkit-line-clamp: 3; }

/* ============================================================
   背景光晕（全站通用）
   ============================================================ */

.sg-bg-glow{
  position: fixed;
  inset: 0;
  z-index: var(--sg-z-bg);
  overflow: hidden;
  pointer-events: none;
}

.sg-bg-glow::before{
  content: '';
  position: absolute;
  top: -30%; left: -20%;
  width: 70%; height: 70%;
  background: radial-gradient(circle, rgba(10, 132, 255, .13), transparent 60%);
  filter: blur(110px);
  animation: sg-drift 28s ease-in-out infinite;
}

.sg-bg-glow::after{
  content: '';
  position: absolute;
  bottom: -30%; right: -20%;
  width: 70%; height: 70%;
  background: radial-gradient(circle, rgba(94, 92, 230, .11), transparent 60%);
  filter: blur(110px);
  animation: sg-drift 34s ease-in-out infinite reverse;
}

@keyframes sg-drift{
  0%, 100%{ transform: translate(0, 0) scale(1); }
  50%{ transform: translate(36px, -28px) scale(1.08); }
}

/* ============================================================
   减少动效偏好
   ============================================================ */

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}