/* ================= 基础重置 ================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
h1,
h2,
h3,
p,
ul,
li {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

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

/* ================= 主题变量 ================= */
/* 亮色：GitHub Light 基准 */
:root {
  color-scheme: light;

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 8px;
  --radius-lg: 12px;
  --content-w: 1080px;

  --bg-app: #f6f8fa;
  --bg-canvas: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.82);
  --bg-card: #ffffff;
  --bg-card-hover: #f6f8fa;
  --bg-btn-hover: #eaeef2;
  --bg-mark: #0969da;
  --bg-icon: rgba(9, 105, 218, 0.12);

  --border: #d0d7de;
  --border-strong: #afb8c1;

  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --text-on-accent: #ffffff;
  --focus-ring: rgba(9, 105, 218, 0.3);

  --shadow-card: 0 1px 3px rgba(31, 35, 40, 0.08);
  --shadow-card-hover: 0 8px 24px rgba(140, 149, 159, 0.2);
}

/* 暗色：GitHub Dark 基准 */
html[data-waywise-theme="dark"] {
  color-scheme: dark;

  --bg-app: #010409;
  --bg-canvas: #0d1117;
  --bg-header: rgba(13, 17, 23, 0.82);
  --bg-card: #161b22;
  --bg-card-hover: #1c2128;
  --bg-btn-hover: #30363d;
  --bg-mark: #2f81f7;
  --bg-icon: rgba(47, 129, 247, 0.16);

  --border: #30363d;
  --border-strong: #484f58;

  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #2f81f7;
  --text-on-accent: #ffffff;
  --focus-ring: rgba(47, 129, 247, 0.3);

  --shadow-card: 0 1px 3px rgba(1, 4, 9, 0.6);
  --shadow-card-hover: 0 8px 24px rgba(1, 4, 9, 0.6);
}

/* ================= 页面布局 ================= */
html {
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  color: var(--text);
  font: normal 14px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

/* ================= 页头 ================= */
.waywise-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

.waywise-header-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.waywise-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border-radius: var(--radius);
  outline: 0 none;
}

.waywise-brand:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.waywise-brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--bg-mark);
  align-self: center;
}

.waywise-brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.waywise-brand-en {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================= 主题切换按钮 ================= */
.waywise-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.waywise-theme-btn:hover {
  background: var(--bg-btn-hover);
  border-color: var(--border);
  color: var(--text);
}

.waywise-theme-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.waywise-theme-icon {
  display: none;
}

.waywise-theme-btn[data-mode="light"] .waywise-theme-icon-light,
.waywise-theme-btn[data-mode="dark"] .waywise-theme-icon-dark,
.waywise-theme-btn[data-mode="system"] .waywise-theme-icon-system {
  display: block;
}

.waywise-theme-icon-light circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.waywise-theme-icon-light g {
  stroke: currentColor;
  stroke-width: 1.3;
}

.waywise-theme-icon-dark path {
  fill: currentColor;
  stroke: none;
}

.waywise-theme-icon-system g {
  stroke: currentColor;
}

/* ================= 主体 ================= */
.waywise-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 24px 64px;
}

.waywise-hero {
  padding: 64px 0 40px;
  text-align: center;
}

.waywise-hero-title {
  font-size: 32px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.waywise-hero-desc {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-muted);
}

/* ================= 工具列表 ================= */
.waywise-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.waywise-tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.waywise-tool-card {
  display: block;
  height: 100%;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  outline: 0 none;
}

.waywise-tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.waywise-tool-card:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.waywise-tool-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.waywise-tool-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--bg-icon);
  position: relative;
}

.waywise-tool-icon::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-mark);
  border-radius: 3px;
}

.waywise-tool-name {
  font-size: 16px;
  font-weight: 600;
}

.waywise-tool-desc {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.waywise-tool-url {
  margin-top: 12px;
  font: normal 12px var(--font-mono);
  color: var(--accent);
  word-break: break-all;
}

/* ================= 页脚 ================= */
.waywise-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
}

.waywise-footer-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================= 响应式 ================= */
@media (max-width: 640px) {
  .waywise-header-inner {
    padding: 0 16px;
    height: 52px;
  }

  .waywise-main {
    padding: 0 16px 48px;
  }

  .waywise-hero {
    padding: 40px 0 28px;
  }

  .waywise-hero-title {
    font-size: 24px;
  }

  .waywise-hero-desc {
    font-size: 14px;
  }

  .waywise-tool-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .waywise-tool-card {
    transition: none;
  }

  .waywise-tool-card:hover {
    transform: none;
  }
}
