/* ============================================================
   Base styles — reset, typography, focus, body
   ============================================================ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--surface);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

h1 {
  font-size: var(--text-5xl);
  font-weight: 600;
  line-height: 1.18;
}
h1 em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  color: var(--sage);
  display: block;
  font-size: 1.08em;
  letter-spacing: 0.01em;
}

h2 {
  font-size: var(--text-3xl);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: 0.01em;
}
h2 em {
  font-style: italic;
  font-weight: 300;
  color: var(--sage);
}

h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-xl);
  line-height: 1.35;
  letter-spacing: 0;
}

h4 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-secondary);
}

p {
  line-height: var(--leading-relaxed);
}

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

/* Links */
a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--ink);
}

/* Lists — reset default */
ul, ol {
  list-style: none;
}

/* Media */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Forms */
input, textarea, select, button {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: none;
  text-align: inherit;
}
input, textarea, select {
  width: 100%;
}

/* Focus — visible only on keyboard, not mouse */
:focus {
  outline: none;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}

/* Selection */
::selection {
  background: var(--gold);
  color: var(--washi);
}

/* Scrollbar (subtle) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--cream);
}
::-webkit-scrollbar-thumb {
  background: var(--mist);
  border-radius: var(--r-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--stone);
}

/* Accessibility utilities */
.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;
}

/* Skip link — same dead-simple technique index.html already uses
   inline (which never had the bar): push the element 9999px off to
   the left. No dimensions to clip, no top: -40px to leak, no
   transform contexts to mis-paint. The earlier clip-based pattern
   STILL painted on tester's mobile + iPad — Chrome iPad in
   particular ignores clip on focusable elements in some
   navigation scenarios. The 'left:-9999px' approach is bulletproof.
   On :focus the link snaps into the top-left corner. */
.skip-link {
  position: absolute !important;
  left: -9999px !important;
  top: 0;
  background: var(--ink);
  color: var(--washi);
  padding: 0.5rem 1rem;
  z-index: var(--z-max);
}
.skip-link:focus {
  left: 0 !important;
}

/* Prevent text overflow */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide content but keep for screen readers */
[hidden] {
  display: none !important;
}

/* ============================================================
   SEMANTIC TYPE CLASSES — from the v3 Design System handoff.
   Use these for new surfaces. Existing h1/h2/h3 rules above
   remain authoritative for legacy panels.
   ============================================================ */

.h-display {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-5xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
}
.h-display em { font-style: italic; font-weight: 300; color: var(--sage); }

.h1-ds {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-4xl);
  line-height: 1.2;
  letter-spacing: var(--tracking-tight);
  color: var(--fg-1);
}
.h1-ds em { font-style: italic; font-weight: 300; color: var(--sage); }

.h2-ds {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-3xl);
  line-height: 1.25;
  color: var(--fg-1);
}
.h2-ds em { font-style: italic; font-weight: 300; color: var(--sage); }

.h3-ds {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-2xl);
  line-height: 1.3;
  color: var(--fg-1);
}

.h4-ds {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-xl);
  line-height: 1.35;
  color: var(--fg-1);
}

.h-zh {
  font-family: var(--font-kaiti);
  font-size: var(--text-2xl);
  letter-spacing: 0.12em;
  line-height: 1.4;
  color: var(--fg-1);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow .font-kaiti {
  font-family: var(--font-kaiti);
  text-transform: none;
  letter-spacing: 0.1em;
  color: var(--ink);
  margin-right: 0.4em;
}

.body-text {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--fg-1);
}
.body-lg {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--fg-1);
}
.body-zh {
  font-family: var(--font-zh);
  font-size: var(--text-base);
  line-height: 1.9;
  color: var(--fg-1);
}

.caption {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--fg-2);
}

.micro-label {
  font-family: var(--font-body);
  font-size: 0.75rem; /* 12px */
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--stone);
}

.link-ds {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold-soft);
  transition: color .15s ease, border-color .15s ease;
}
.link-ds:hover { color: var(--ink); border-bottom-color: var(--ink); }
