/*
 * 主样式
 * 作用：定义主题变量、基础排版、导航、首屏、转换器卡片、结果卡片、功能特性与页脚
 */

/* ========== 主题变量 ========== */
:root {
  /* 画布与文字：取自 GitHub Primer 亮色主题 */
  --bg: #f6f8fa;
  --bg-soft: #eaeef2;
  --surface: #ffffff;
  --surface-muted: #f6f8fa;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-faint: #8c959f;
  --border: #d0d7de;
  --border-strong: #afb8c1;

  /* 主色：GitHub 蓝色强调色，用于链接、选中态与聚焦边框 */
  --brand: #0969da;
  --brand-strong: #0550ae;
  --brand-deep: #0550ae;
  --brand-soft: rgba(9, 105, 218, 0.1);
  --brand-glow: rgba(9, 105, 218, 0.26);

  /* 主操作色：GitHub 蓝色主按钮 */
  --cta: #0969da;
  --cta-deep: #0550ae;
  --cta-glow: rgba(9, 105, 218, 0.3);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(31, 35, 40, 0.05);
  --shadow-sm: 0 2px 8px rgba(31, 35, 40, 0.06);
  --shadow-md: 0 12px 32px rgba(31, 35, 40, 0.08);
  --shadow-brand: 0 10px 24px var(--brand-glow);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  /* 画布与文字：取自 GitHub Primer 暗色主题 */
  --bg: #0d1117;
  --bg-soft: #21262d;
  --surface: #161b22;
  --surface-muted: #21262d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-faint: #6e7681;
  --border: #30363d;
  --border-strong: #484f58;

  /* 暗色下改用更亮的蓝色，保证在浅底软色块上可读 */
  --brand: #2f81f7;
  --brand-strong: #58a6ff;
  --brand-deep: #79c0ff;
  --brand-soft: rgba(56, 139, 253, 0.15);
  --brand-glow: rgba(47, 129, 247, 0.3);

  /* 暗色主操作色：GitHub 暗色主题的蓝色主按钮 */
  --cta: #1f6feb;
  --cta-deep: #1158c7;
  --cta-glow: rgba(31, 111, 235, 0.4);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* ========== 基础排版 ========== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

code {
  font-family: var(--font-mono);
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

[hidden] {
  display: none !important;
}

/* ========== 顶部导航 ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: var(--shadow-xs);
}

.brand-name {
  font-size: 15.5px;
  letter-spacing: 0.2px;
}

.brand-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  flex: 1;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.nav-link.is-active {
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  color: var(--brand-strong);
  border-color: var(--brand);
}

.icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: block;
}

/* ========== 首屏标题区 ========== */
.hero {
  position: relative;
  padding: 72px 0 34px;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -80px 0 auto;
  height: 420px;
  background:
    radial-gradient(560px 240px at 50% 0%, var(--brand-soft), transparent 70%),
    radial-gradient(420px 200px at 82% 12%, rgba(9, 105, 218, 0.08), transparent 72%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 600;
}

[data-theme="dark"] .hero-badge {
  color: #79c0ff;
}

.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 0 var(--brand-glow);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--brand-glow); }
  70% { box-shadow: 0 0 0 8px rgba(9, 105, 218, 0); }
  100% { box-shadow: 0 0 0 0 rgba(9, 105, 218, 0); }
}

.hero-title {
  margin: 22px 0 0;
  font-size: clamp(30px, 5.2vw, 52px);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero-title-line {
  display: block;
}

.hero-title-line.accent {
  background: linear-gradient(96deg, #218bff 0%, var(--brand) 55%, var(--brand-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-desc {
  max-width: 660px;
  margin: 20px auto 0;
  color: var(--text-muted);
  font-size: 16px;
}

/* ========== 转换器卡片 ========== */
.converter {
  padding: 8px 0 40px;
}

.converter-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.tab {
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.16s ease;
}

.tab:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  box-shadow: var(--shadow-brand);
}

.docs-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 8px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, transparent);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13.5px;
  font-weight: 600;
}

[data-theme="dark"] .docs-link {
  color: #79c0ff;
}

.docs-link:hover {
  border-color: var(--brand);
}

.input-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.url-input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 46px 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-input::placeholder {
  color: var(--text-faint);
  font-family: var(--font-sans);
}

.url-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.clear-btn {
  position: absolute;
  left: calc(100% - 190px);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-muted);
}

.clear-btn:hover {
  color: var(--text);
}

.convert-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 26px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cta) 0%, var(--cta-deep) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 24px var(--cta-glow);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.convert-btn:hover {
  filter: brightness(1.05);
}

.convert-btn:active {
  transform: translateY(1px);
}

.hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}

.hints-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 600;
}

.chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.15s ease;
}

.chip:hover {
  color: var(--brand-deep);
  border-color: var(--brand);
  background: var(--brand-soft);
}

/* ========== 转换结果卡片 ========== */
.result-card {
  margin-top: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.result-kind {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12.5px;
  font-weight: 700;
}

[data-theme="dark"] .result-kind {
  color: #79c0ff;
}

.ghost-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 8px;
}

.ghost-btn:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}

.result-row + .result-row {
  border-top: 1px dashed var(--border);
}

.result-label {
  flex: 0 0 68px;
  padding-top: 3px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.result-output {
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.result-value {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  word-break: break-all;
  white-space: pre-wrap;
}

.result-row.is-output .result-value {
  color: var(--brand-deep);
  font-weight: 600;
}

[data-theme="dark"] .result-row.is-output .result-value {
  color: #79c0ff;
}

.copy-btn {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid var(--brand);
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 600;
}

.copy-btn:hover {
  background: var(--brand);
  color: #fff;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ========== 提示条 ========== */
.alert {
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, #bf8700 40%, transparent);
  border-radius: var(--radius);
  background: rgba(191, 135, 0, 0.1);
  color: #9a6700;
  font-size: 13.5px;
}

[data-theme="dark"] .alert {
  color: #d29922;
}

/* ========== 功能特性 ========== */
.features {
  padding: 48px 0 60px;
}

.section-title {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 800;
  text-align: center;
}

.section-desc {
  margin: 12px auto 0;
  max-width: 620px;
  color: var(--text-muted);
  text-align: center;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}

.feature-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

[data-theme="dark"] .feature-icon {
  color: #79c0ff;
}

.feature-card h3 {
  margin: 12px 0 6px;
  font-size: 16px;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ========== 页脚 ========== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 26px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-note {
  margin: 0;
  max-width: 620px;
  color: var(--text-faint);
  font-size: 13px;
}

.footer-links {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--brand-strong);
}

/* ========== 轻提示 ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(31, 35, 40, 0.92);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .site-nav {
    display: none;
  }

  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 48px 0 26px;
  }

  .converter-card {
    padding: 16px;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .clear-btn {
    left: auto;
    right: 14px;
    top: 13px;
  }

  .convert-btn {
    justify-content: center;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .result-label {
    flex-basis: 100%;
  }

  .result-row {
    flex-direction: column;
    gap: 4px;
  }
}