/* Hanyang Tang — shared site styles (static / Cloudflare Pages) */
:root {
  color-scheme: light;
  --bg0: #f0f4ff;
  --bg1: #e8f4f8;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #475569;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --cyan: #0891b2;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 20px rgba(15, 23, 42, 0.06);
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg0: #0b1020;
    --bg1: #0f172a;
    --surface: rgba(30, 41, 59, 0.65);
    --surface-solid: #1e293b;
    --border: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(148, 163, 184, 0.2);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.15);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body.site-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg0);
  background-image:
    radial-gradient(ellipse 100% 80% at 0% -20%, rgba(79, 70, 229, 0.16), transparent 55%),
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(8, 145, 178, 0.14), transparent 50%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(99, 102, 241, 0.08), transparent 45%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.site-header-inner {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 640px) {
  .site-header-inner {
    padding: 0 1.5rem;
  }
}

.site-logo {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

.site-logo:hover {
  color: var(--accent);
}

.site-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.site-nav-toggle:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

@media (min-width: 768px) {
  .site-nav-toggle {
    display: none;
  }
}

.site-nav {
  display: none;
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem;
  margin: 0;
  list-style: none;
  background: var(--surface-solid);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.site-nav.is-open {
  display: flex;
}

@media (min-width: 768px) {
  .site-nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
}

.site-nav a {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
}

@media (min-width: 768px) {
  .site-nav a {
    padding: 0.5rem 0.875rem;
    min-height: auto;
  }
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  background: var(--accent-soft);
  outline: none;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.site-main {
  padding-top: var(--header-h);
}

.hero-shell {
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem 4rem;
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.content-wide {
  width: 100%;
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
  padding: 2.5rem 1rem 3rem;
}

@media (min-width: 640px) {
  .content-wide {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.page-title {
  font-size: clamp(1.875rem, 4vw + 1rem, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0 0 2rem;
}

.card-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0;
  text-align: center;
  color: var(--text);
}

/* Typography helpers */
.heading-display {
  font-size: clamp(2.25rem, 6vw + 1rem, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 0;
}

.heading-display .gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (prefers-color-scheme: dark) {
  .heading-display .gradient-text {
    background: linear-gradient(120deg, #a5b4fc, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.lead {
  font-size: clamp(1rem, 1.5vw + 0.85rem, 1.25rem);
  color: var(--muted);
  max-width: 38rem;
  margin: 0 auto;
}

/* Cards & panels */
.surface-panel {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.project-card {
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.project-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

/* Buttons & links */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.surface-panel .card-title + .lead {
  margin-top: 1rem;
}

.surface-panel > .btn-primary {
  margin-top: 1.75rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.125rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.prompt-prefix {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  width: 2rem;
}

/* Form */
.site-input,
.site-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.site-input:focus,
.site-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.site-textarea {
  min-height: 140px;
  resize: vertical;
}

/* Footer */
.site-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 2rem 1rem 2.5rem;
}

.site-footer time {
  font-style: normal;
  opacity: 0.85;
}

/* CV sections */
.cv-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--border-strong);
  color: var(--text);
}

.cv-section-title:first-of-type {
  margin-top: 0;
}

.centered-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
}

.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;
}
