/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* 8px grid */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;
  --sp-6: 48px;
  --sp-7: 56px;
  --sp-8: 64px;
  
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;
  
  --duration-fast: 140ms;
  --duration-base: 240ms;
  --duration-slow: 400ms;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  
  --max-width: 460px;
}

/* Light mode */
[data-theme="light"],
[data-theme="auto"] {
  --bg: #f5f4f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf8;
  --border: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(0, 0, 0, 0.10);
  --text-primary: #0f0f0e;
  --text-secondary: #6b6b67;
  --text-tertiary: #a8a8a3;
  --icon-color: #0f0f0e;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 3px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --glow: rgba(0, 0, 0, 0);
  --noise-opacity: 0.015;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #000000;
  --bg-card: #0b0b0b;
  --bg-card-hover: #111111;
  --border: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 255, 255, 0.09);
  --text-primary: #f0efeb;
  --text-secondary: #8a8a85;
  --text-tertiary: #555552;
  --icon-color: #f0efeb;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 3px 14px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --glow: rgba(255, 255, 255, 0.015);
  --noise-opacity: 0.02;
}

/* System dark auto-detection */
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #000000;
    --bg-card: #0b0b0b;
    --bg-card-hover: #111111;
    --border: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(255, 255, 255, 0.09);
    --text-primary: #f0efeb;
    --text-secondary: #8a8a85;
    --text-tertiary: #555552;
    --icon-color: #f0efeb;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 3px 14px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --glow: rgba(255, 255, 255, 0.015);
    --noise-opacity: 0.02;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background-color: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-6) var(--sp-2) var(--sp-5);
  padding-top: max(var(--sp-6), env(safe-area-inset-top));
  padding-bottom: max(var(--sp-5), env(safe-area-inset-bottom));
  transition: background-color var(--duration-slow) var(--ease-smooth),
    color var(--duration-slow) var(--ease-smooth);
  position: relative;
  overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: var(--noise-opacity);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ─────────────────────────────────────────────── */
.page {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  position: relative;
  z-index: 1;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
       HERO SECTION
    ============================================================ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-3);
  animation: fadeUp var(--duration-slow) var(--ease-smooth) both;
}

/* Avatar */
.avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  transition: border-color var(--duration-base);
  display: block;
  background: var(--bg-card);
}

/* Fallback avatar initials */
.avatar-initials {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 28px;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* Name & bio */
.hero-text {
  text-align: center;
}

.hero-name {
  font-family: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  font-size: clamp(28px, 7vw, 34px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.hero-bio {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.1px;
  line-height: 1.5;
}

/* ============================================================
       LINKS SECTION
    ============================================================ */
.links-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp var(--duration-slow) var(--ease-smooth) 80ms both;
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding-left: 2px;
  margin-bottom: 2px;
}

/* Link card */
.link-card {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 14px var(--sp-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition:
    background var(--duration-fast) var(--ease-smooth),
    border-color var(--duration-fast) var(--ease-smooth),
    box-shadow var(--duration-base) var(--ease-smooth),
    transform var(--duration-fast) var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow);
  opacity: 0;
  transition: opacity var(--duration-base);
  border-radius: inherit;
}

.link-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.link-card:hover::before {
  opacity: 1;
}

.link-card:active {
  transform: scale(0.985) translateY(0);
  box-shadow: var(--shadow-card);
}

.link-card:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

/* Card icon */
.card-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.card-icon-wrap .material-symbols-rounded {
  font-size: 18px;
  color: var(--icon-color);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' -25, 'opsz' 20;
}

/* Card text */
.card-text {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 450;
  color: var(--text-primary);
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* External arrow */
.card-arrow .material-symbols-rounded {
  font-size: 16px;
  color: var(--text-tertiary);
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' -25, 'opsz' 20;
  flex-shrink: 0;
  transition: color var(--duration-fast), transform var(--duration-fast) var(--ease-spring);
}

.link-card:hover .card-arrow .material-symbols-rounded {
  color: var(--text-secondary);
  transform: translate(1px, -1px);
}

/* ============================================================
       FOOTER
    ============================================================ */
footer {
  text-align: center;
  animation: fadeUp var(--duration-slow) var(--ease-smooth) 200ms both;
}

.footer-text {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

/* ============================================================
       PAGE ENTRANCE ANIMATION
    ============================================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
