/* reset + typography baseline */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--surface);
  transition: background var(--t-base) ease, color var(--t-base) ease;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Neural Mesh Background */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 2px 2px, var(--mesh-color) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: var(--z-below);
}

/* ─── Mobile / iOS baseline ─── */
html, body {
  /* iOS Safari 100vh 過高 bug，dvh 可準確 */
  min-height: 100dvh;
  /* 右滑/左滑不當導致整頁位移 */
  overscroll-behavior-x: none;
}
body {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, a, .sidebar-item, .row-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;         /* 移除 iOS 雙擊 zoom 延遲 */
}
/* 防止 iOS Safari 在 focus 輸入框時自動放大（需 font-size >= 16px） */
input, select, textarea {
  font-size: 16px;
}
@media (min-width: 769px) {
  /* 桌機恢復原本設計的較小字級 */
  input, select, textarea { font-size: 14px; }
}

/* Custom Scrollbar for ultra premium feel */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

h1, h2, h3, h4 {
  font-family: var(--font-headline);
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: var(--text-h2); font-weight: 800; }
h2 { font-size: var(--text-h3); font-weight: 700; }
h3 { font-size: var(--text-body); font-weight: 600; }

.hero-num {
  font-family: var(--font-headline);
  font-size: var(--text-h1);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  background: var(--hero-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(var(--hero-shadow));
}

p { margin: 0 0 8px; }

a { color: var(--accent); text-decoration: none; transition: all var(--t-fast); }
a:hover { color: var(--accent-light); text-shadow: var(--glow-accent); }

button {
  font-family: inherit; font-size: 14px;
  border: none; background: none; cursor: pointer;
  padding: 0; transition: all var(--t-fast) var(--ease-quint);
}
button:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

input, select, textarea {
  font-family: inherit; font-size: 14px;
  color: var(--on-surface);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  outline: none;
  transition: all var(--t-fast) var(--ease-quint);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(233, 193, 118, 0.15);
}
textarea { resize: vertical; min-height: 60px; }

code, pre { font-family: var(--font-mono); }
::selection { background: var(--accent); color: var(--primary-deep); }
.tabular { font-variant-numeric: tabular-nums; }

[data-theme="light"] body::before {
  background-image: radial-gradient(circle at 2px 2px, rgba(0,0,0,0.06) 1px, transparent 0);
}

/* light scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }
