/* ===============================================
   Ryan Chan — Personal Site v2
   Editorial-minimal, single-page, sub-second load.
   System fonts. No frameworks. No external deps.
   =============================================== */

:root {
  --bg: #fafaf7;
  --bg-elev: #ffffff;
  --ink: #0c0f1a;
  --ink-soft: #2d3142;
  --muted: #6b7080;
  --rule: #e6e3da;
  --accent: #e94560;
  --accent-soft: #fbe6ea;
  --accent-ink: #b3334a;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 760px;
  --pad-x: clamp(20px, 5vw, 32px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f17;
    --bg-elev: #161823;
    --ink: #f5f3ed;
    --ink-soft: #d3d1ca;
    --muted: #8b8e9a;
    --rule: #262838;
    --accent: #ff6b8a;
    --accent-soft: #2a1820;
    --accent-ink: #ffb2c2;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "calt";
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover { color: var(--accent); border-bottom-color: var(--accent); }

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

/* ============ HEADER ============ */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px var(--pad-x) 0;
}

.logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  border-bottom: none;
}
.logo:hover { color: var(--ink); }
.logo-dot { color: var(--accent); margin: 0 2px; }

.site-header nav {
  display: flex;
  gap: 22px;
}
.site-header nav a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: none;
  letter-spacing: 0.01em;
}
.site-header nav a:hover { color: var(--accent); }

/* ============ LAYOUT ============ */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

section {
  padding: clamp(56px, 12vh, 96px) 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: none; }

/* ============ HERO ============ */
.hero { padding-top: clamp(64px, 14vh, 120px); }

.kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 18px 0;
}

h1 {
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 24px 0;
  color: var(--ink);
}
.accent {
  color: var(--accent);
  position: relative;
}

.lede {
  font-size: clamp(17px, 2.3vw, 21px);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 32px 0;
  max-width: 640px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 36px 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 50px;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.3;
}
.chip strong {
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: none;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

.btn-lg {
  padding: 16px 28px;
  font-size: 16px;
  border-radius: 14px;
}

/* ============ ABOUT ============ */
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px 0;
}

h2 {
  font-size: clamp(28px, 4.5vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.018em;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 28px 0;
  max-width: 600px;
}

.prose p {
  margin: 0 0 18px 0;
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.7;
}
.prose strong { color: var(--ink); font-weight: 600; }
.prose p:last-child { margin-bottom: 0; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.link-arrow:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}
.link-arrow span { transition: transform 0.2s ease; }
.link-arrow:hover span { transform: translateX(4px); }

/* ============ CONTACT ============ */
.contact { text-align: left; }

.contact-lede {
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 0 32px 0;
  max-width: 580px;
}

.contact-fallback {
  margin: 22px 0 0 0;
  font-size: 14.5px;
  color: var(--muted);
}
.contact-fallback a {
  color: var(--ink-soft);
  border-bottom-color: var(--rule);
}
.contact-fallback a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.sep {
  color: var(--muted);
  margin: 0 8px;
  opacity: 0.6;
}

/* ============ FOOTER ============ */
.site-footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px var(--pad-x) 48px;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.site-footer p { margin: 0 0 8px 0; }
.site-footer .links a {
  color: var(--muted);
  border-bottom: none;
  margin: 0 2px;
}
.site-footer .links a:hover { color: var(--accent); }

/* ============ MOBILE ============ */
@media (max-width: 560px) {
  .site-header { padding-top: 20px; }
  .site-header nav { gap: 16px; }
  h1 br { display: none; }
  .chips { gap: 8px; }
  .chip { font-size: 12.5px; padding: 6px 12px; }
  .cta-row { flex-direction: column; }
  .cta-row .btn { width: 100%; justify-content: center; }
}

/* ============ ACCESSIBILITY ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
