/* ══════════════════════════════════════════════
   Base — Reset, Typography, Body
   ตาม spec §6.7
   ══════════════════════════════════════════════ */

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

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

body {
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: 72px; /* nav-bottom space */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text-link);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* ─── Typography ─── */
h1 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1.2;
}

h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: 1.3;
}

h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  line-height: 1.4;
}

small {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ─── Utility ─── */
.text-secondary {
  color: var(--text-secondary);
}

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

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

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-bold {
  font-weight: var(--weight-bold);
}

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.hidden {
  display: none !important;
}

/* ─── Page container ─── */
.page {
  padding: var(--space-md);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-md);
}

/* ─── Section ─── */
.section {
  margin-bottom: var(--space-lg);
}

.section-header {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-section-header);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-sm) 0;
}

/* ─── Divider ─── */
.divider {
  height: 1px;
  background: var(--divider);
  margin: var(--space-md) 0;
}

/* ─── Scrollbar (minimal) ─── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

/* ─── Loading spinner ─── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  margin-right: var(--space-sm);
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
