/* ============================================
   Ava Hu Portfolio — Redesigned
   Clean, tab-based layout
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ---------- Custom Properties ---------- */
:root {
  --color-bg: #f9f8f6;
  --color-surface: #ffffff;
  --color-hero-bg: #1a1a2e;
  --color-hero-bg-2: #16213e;
  --color-accent: #e07a5f;
  --color-accent-hover: #c9694f;
  --color-accent-light: rgba(224, 122, 95, 0.08);
  --color-text: #222;
  --color-text-light: #666;
  --color-text-muted: #aaa;
  --color-text-hero: #fff;
  --color-text-hero-sub: rgba(255, 255, 255, 0.75);
  --color-border: rgba(0, 0, 0, 0.06);
  --color-divider: #e8e4df;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --transition: 0.25s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ---------- Layout ---------- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- Hero / Bio ---------- */
.hero {
  background: linear-gradient(135deg, var(--color-hero-bg) 0%, var(--color-hero-bg-2) 50%, #0f3460 100%);
  padding: 48px 0 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(224,122,95,0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.hero .container {
  display: flex;
  align-items: center;
  gap: 36px;
  position: relative;
  z-index: 1;
}

.hero-photo {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}

.hero-content { flex: 1; }

.hero-name {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-text-hero);
  line-height: 1.15;
  margin-bottom: 6px;
}

.hero-bio {
  font-size: 0.9rem;
  color: var(--color-text-hero-sub);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 12px;
}

.hero-bio .highlight {
  color: var(--color-accent);
  font-weight: 500;
}

.hero-bio a.highlight:hover {
  text-decoration: underline;
}

.hero-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-links a {
  color: var(--color-text-hero-sub);
  font-size: 1.15rem;
  transition: color var(--transition);
}

.hero-links a:hover {
  color: var(--color-accent);
}

.hero-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.skill-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: 14px;
  letter-spacing: 0.02em;
}

/* ---------- Tab Navigation ---------- */
.tab-nav {
  background: rgba(249, 248, 246, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.tab-nav .container {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.tab-btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: none;
  border: none;
  padding: 18px 24px;
  cursor: pointer;
  position: relative;
  transition: color var(--transition);
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 24px;
  right: 24px;
  height: 2.5px;
  background: var(--color-accent);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform var(--transition);
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-text);
  font-weight: 600;
}

.tab-btn.active::after {
  transform: scaleX(1);
}

/* ---------- Tab Panels ---------- */
.tab-content {
  padding: 32px 0 48px;
  min-height: 400px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Section Title ---------- */
.section-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ---------- Awards — Horizontal Rows ---------- */
.awards-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.award-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--color-divider);
  transition: background var(--transition);
  text-decoration: none;
  color: inherit;
}

.award-row:first-child {
  padding-top: 0;
}

.award-row:last-child {
  border-bottom: none;
}

.award-row:hover {
  background: var(--color-accent-light);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: var(--radius-md);
}

.award-thumb {
  width: 120px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-bg);
}

.award-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.award-thumb--icon {
  background: linear-gradient(135deg, var(--color-hero-bg) 0%, var(--color-hero-bg-2) 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.award-detail {
  flex: 1;
  min-width: 0;
}

.award-year {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.award-detail h3 {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
  transition: color var(--transition);
}

.award-row:hover .award-detail h3 {
  color: var(--color-accent);
}

.award-detail p {
  font-size: 0.8rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* ---------- Writing — Publication Groups ---------- */
.pub-group {
  margin-bottom: 24px;
}

.pub-group:last-child { margin-bottom: 0; }

.pub-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-divider);
}

.pub-logo {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
}

.pub-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-accent-light);
  padding: 2px 8px;
  border-radius: 10px;
}

.articles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.article-row:hover {
  background: var(--color-surface);
}

.article-category {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
  flex-shrink: 0;
}

.cat-immigrants { background: #3d85c6; }
.cat-climate { background: #6aa84f; }
.cat-data { background: #e07a5f; }
.cat-law { background: #8e7cc3; }
.cat-tech { background: #45818e; }
.cat-election { background: #cc4125; }
.cat-game { background: #f1c232; color: #333; }
.cat-china { background: #c27ba0; }
.cat-audio { background: #76a5af; }
.cat-policy { background: #3d85c6; }

.article-title {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
  transition: color var(--transition);
  flex: 1;
}

.article-row:hover .article-title {
  color: var(--color-accent);
}

.article-date {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ---------- Writing Cards — Publication Badge ---------- */
.pub-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(26, 26, 46, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 2;
  white-space: nowrap;
}

.writing-card .project-info {
  padding: 12px 16px 14px;
}

.writing-card .article-date {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* ---------- Project Grid (Data Projects / Viz) ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.project-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.project-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.thumbnail-wrapper {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--color-bg);
  position: relative;
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-item:hover .thumbnail-wrapper img {
  transform: scale(1.03);
}

/* Flourish iframe thumbnail */
.thumbnail-wrapper--iframe {
  position: relative;
  overflow: hidden;
}

.thumbnail-wrapper--iframe .flourish-embed,
.thumbnail-wrapper--iframe iframe {
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
}

.project-item:hover .thumbnail-wrapper--iframe .flourish-embed,
.project-item:hover .thumbnail-wrapper--iframe iframe {
  pointer-events: auto;
}

/* Emoji placeholder thumbnail (for awards without photos) */
.thumbnail-wrapper--accent {
  background: linear-gradient(135deg, var(--color-hero-bg) 0%, var(--color-hero-bg-2) 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-emoji {
  font-size: 2.8rem;
  line-height: 1;
}

.project-info {
  padding: 14px 16px 16px;
}

.project-title {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
  transition: color var(--transition);
}

.project-item:hover .project-title {
  color: var(--color-accent);
}

.project-desc {
  font-size: 0.8rem;
  color: var(--color-text-light);
  line-height: 1.5;
  margin-bottom: 10px;
}

.project-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tool-tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-light);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

/* ---------- Video Grid ---------- */
.video-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 28px;
}

.video-grid--landscape {
  grid-template-columns: repeat(2, 1fr);
}

.video-grid--vertical {
  grid-template-columns: repeat(3, 1fr);
}

.video-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.video-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.video-wrapper--landscape {
  padding-bottom: 56.25%; /* 16:9 */
}

.video-wrapper--vertical {
  padding-bottom: 177.78%; /* 9:16 */
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 28px 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-divider);
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .hero .container {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .hero-bio { margin-left: auto; margin-right: auto; }
  .hero-links { justify-content: center; }
  .hero-skills { justify-content: center; }

  .tab-btn {
    font-size: 0.72rem;
    padding: 12px 14px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .article-row {
    flex-wrap: wrap;
  }
  .article-date {
    width: 100%;
    margin-top: 2px;
  }

  .container {
    padding: 0 16px;
  }

  .video-grid--landscape {
    grid-template-columns: 1fr;
  }
  .video-grid--vertical {
    grid-template-columns: repeat(2, 1fr);
  }

  .award-thumb {
    width: 80px;
    height: 56px;
  }

  .tab-nav .container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
