/* ============================================================
   COMPONENTS.CSS
   Sidebar, hero, experience tabs, project cards, skills,
   education, contact, footer, buttons, tags
   ============================================================ */

/* ── AVATAR ──────────────────────────────────────────────────── */
.avatar-wrapper { flex-shrink: 0; }

.avatar-initials,
.avatar-img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--accent-border);
  box-shadow: 0 0 0 5px var(--accent-dim), 0 0 20px var(--accent-dim);
  transition: var(--transition-md);
}

.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.avatar-img {
  object-fit: cover;
  display: block;
}

.avatar-wrapper:hover .avatar-initials,
.avatar-wrapper:hover .avatar-img {
  box-shadow: 0 0 0 5px var(--accent-mid), 0 0 32px var(--accent-mid);
}

/* ── BRAND MARKS ─────────────────────────────────────────────── */
/* Each logo is used as a mask and filled with currentColor, so all four
   render as one monochrome system and pick up hover/active colour from the
   row they sit in. Works identically for the SVG and PNG sources. */
.logo-mark {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
  opacity: 0.85;
  transition: opacity 0.2s var(--ease);
}

/* Paths belong here rather than in an inline style: url() inside a custom
   property resolves against the stylesheet that consumes var(), so a
   document-relative path would resolve against assets/css/ and 404. */
/* miHoYo's own asset is a wordmark, unreadable at 16px and redundant beside
   the label. This is the HoYoverse ring - the same company's global brand -
   which is a true standalone glyph. */
.logo-mihoyo  { --logo: url('../img/logos/mihoyo.png'); }
.logo-vicino  { --logo: url('../img/logos/vicino.png'); }
.logo-tiktok  { --logo: url('../img/logos/tiktok.svg'); }
.logo-alibaba { --logo: url('../img/logos/alibabadotcom.svg'); }
.logo-ucsd    { --logo: url('../img/logos/ucsd.png'); }

.exp-tab.active .logo-mark,
.ledger-row:hover .logo-mark { opacity: 1; }

/* ── IDENTITY ────────────────────────────────────────────────── */
.identity { display: flex; flex-direction: column; gap: 2px; }

.identity-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.site-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

/* Blinking cursor after name */
.cursor-blink {
  display: inline-block;
  color: var(--accent);
  margin-left: 1px;
  animation: blink 1.1s step-end infinite;
  font-weight: 300;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.site-role {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  margin-top: 5px;
  letter-spacing: 0.02em;
}

.site-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
  margin-top: 1px;
}

.site-open { margin-top: 8px; }
.site-open a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(var(--accent-rgb), 0.3); }
.site-open a:hover { border-bottom-color: var(--accent); }

.at-sign { color: var(--secondary); }

/* ── SIDEBAR NAV ─────────────────────────────────────────────── */
.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
  transition: var(--transition);
  border-left: 2px solid transparent;
  position: relative;
}

.nav-link:hover {
  color: var(--text-2);
  background: var(--accent-dim);
  border-left-color: var(--text-3);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.nav-num {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-3);
  flex-shrink: 0;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.nav-link:hover .nav-num  { color: var(--text-2); }
.nav-link.active .nav-num { color: var(--accent); opacity: 0.8; }

.nav-label { transition: color 0.2s; }

/* ── SOCIAL LINKS ────────────────────────────────────────────── */
.social-links {
  display: flex;
  gap: 7px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  color: var(--text-3);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
  transform: translateY(-2px);
}

/* ── THEME TOGGLE ────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: var(--transition);
  align-self: flex-start;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

/* Show sun in dark mode, moon in light mode */
.icon-sun  { display: block; }
.icon-moon { display: none; }

[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.theme-label { font-family: var(--font-mono); }

/* ── HERO / ABOUT ────────────────────────────────────────────── */
.section-about {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 60px;
}

/* Ambient gradient behind hero content.
   Deliberately unclipped and bled past the section box on every side: the
   gradient reaches full transparency well inside its own edges, so nothing
   shows a boundary. The left bleed runs under the opaque sidebar, which is
   what makes the visible edge of the glow sit flush with the sidebar border. */
.section-about::before {
  content: '';
  position: absolute;
  top: -12%;
  left: -30%;
  width: 105%;
  height: 118%;
  background: radial-gradient(ellipse 58% 52% at 34% 44%,
    rgba(var(--accent-rgb), 0.055) 0%,
    rgba(var(--secondary-rgb), 0.032) 42%,
    transparent 72%
  );
  pointer-events: none;
  animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(1);   opacity: 0.6; }
  50%       { transform: scale(1.1); opacity: 1;   }
}

/* Hero splits into bio + career ledger once there is room for both */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}

.hero-main { min-width: 0; }

/* ── HERO CAREER LEDGER ──────────────────────────────────────── */
.hero-ledger { display: none; }

@media (min-width: 1100px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(228px, 292px);
    gap: 72px;
  }

  .hero-ledger {
    display: block;
    border-left: 1px solid var(--border);
    padding-left: 28px;
  }
}

.ledger-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 10px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s var(--ease);
}

.ledger-row:last-child { border-bottom: none; }
.ledger-row:hover { border-bottom-color: var(--accent-border); }
.ledger-row:hover .ledger-company { color: var(--accent); }

.ledger-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.ledger-company {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-1);
  transition: color 0.2s var(--ease);
}

.ledger-year {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ledger-role {
  grid-column: 2 / -1;
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 2px;
}

.hero-greeting {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 14px;
}

.name-paren { color: var(--text-3); font-weight: 600; }

.hero-tagline {
  text-wrap: balance;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.5vw, 2.2rem);
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 30px;
}

.hero-bio {
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-width: 520px;
  margin-bottom: 38px;
}

.hero-bio p {
  font-size: 0.95rem;
  line-height: 1.78;
  color: var(--text-2);
}

.inline-link {
  color: var(--accent);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.3);
  transition: border-color 0.2s;
}

.inline-link:hover { border-bottom-color: var(--accent); }

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.btn-primary:hover {
  background: var(--accent-mid);
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.15);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text-1);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.btn-large {
  padding: 15px 36px;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
}

/* ── EXPERIENCE ──────────────────────────────────────────────── */
.exp-container {
  display: grid;
  grid-template-columns: minmax(128px, 168px) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* Tab list — vertical on desktop */
.exp-tabs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 130px;
  flex-shrink: 0;
  border-left: 2px solid var(--border);
}

.exp-tab {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px 9px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-3);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  border-left: 2px solid transparent;
  margin-left: -2px;
  letter-spacing: 0.03em;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  background: none;
}

.exp-tab:hover {
  color: var(--text-2);
  background: var(--accent-dim);
}

.exp-tab.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

/* Tab panels */
.exp-panels { min-width: 0; }

.exp-panel {
  display: none;
}

/* Bullets on the left at a readable measure, facts + tags on a right rail */
.exp-panel.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 34px;
  align-items: start;
  animation: panelIn 0.22s var(--ease) both;
}

@media (min-width: 1080px) {
  .exp-panel.active {
    grid-template-columns: minmax(0, 1fr) minmax(168px, 208px);
    gap: 44px;
  }
}

.exp-body {
  min-width: 0;
  max-width: var(--measure);
}

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

.exp-role-line {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 20px;
  line-height: 1.3;
}

.exp-company { color: var(--accent); }

.exp-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.exp-facts {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.exp-fact dt {
  font-size: 0.7rem;
  color: var(--text-3);
  line-height: 1.4;
}

.exp-fact dd {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.45;
  margin-top: 1px;
}

/* Below the two-column breakpoint the rail sits under the bullets */
@media (max-width: 1079px) {
  .exp-facts {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 28px;
  }
}

.exp-bullets {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.exp-bullet {
  display: flex;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.68;
}

.exp-bullet-arrow {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 3px;
  font-size: 0.7rem;
  line-height: 1.68;
  user-select: none;
}

.exp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* ── PROJECT CARDS ───────────────────────────────────────────── */
/* Featured projects sit full-width on top; the rest flow as a masonry so
   cards of different heights pack together without gaps. */
.projects-masonry {
  columns: 3 290px;
  column-gap: 18px;
}

.project-card-featured {
  margin-bottom: 18px;
}

/* On wide screens the featured card lays its bullets out in two columns
   so it does not become one tall block of text. */
@media (min-width: 900px) {
  .project-card-featured .project-bullets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 28px;
  }
  .project-card-featured .project-name {
    font-size: 1.15rem;
  }
}

.project-card {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin-bottom: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition-md);
  position: relative;
  overflow: hidden;
}

/* Accent top-border reveal on hover */
.project-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.38s var(--ease);
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  background: var(--bg-elevated);
}

.project-card:hover::after {
  transform: scaleX(1);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-folder {
  color: var(--accent);
  opacity: 0.8;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.project-card:hover .project-folder { opacity: 1; }

.project-card-links {
  display: flex;
  gap: 8px;
  align-items: center;
}

.project-link {
  color: var(--text-3);
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
}

.project-link:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.project-name {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-1);
  transition: color 0.2s;
  line-height: 1.25;
}

.project-card:hover .project-name { color: var(--accent); }

.project-period {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.03em;
}

.project-publication {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--secondary);
  background: var(--secondary-dim);
  border: 1px solid var(--secondary-border);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.project-bullets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-bullet {
  display: flex;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.62;
}

.project-bullet-arrow {
  color: var(--accent);
  flex-shrink: 0;
  font-size: 0.7rem;
  margin-top: 3px;
  user-select: none;
}

@media (max-width: 580px) {
  .projects-masonry {
    columns: 1;
  }
}

/* ── TAGS ────────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.03em;
  transition: var(--transition);
  user-select: none;
}

.tag:hover {
  background: var(--accent-mid);
}

/* ── SKILLS ──────────────────────────────────────────────────── */
.skills-groups {
  display: flex;
  flex-direction: column;
}

.skill-group {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.skill-group:first-child {
  border-top: none;
  padding-top: 0;
}

.skill-category {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-3);
  letter-spacing: 0.01em;
  padding-top: 5px;
}

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.skill-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-2);
  padding: 4px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: var(--transition);
  letter-spacing: 0.01em;
  cursor: default;
}

.skill-pill:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
  transform: translateY(-1px);
}

@media (max-width: 580px) {
  .skill-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .skill-category { padding-top: 0; }
}

/* ── EDUCATION ───────────────────────────────────────────────── */
.edu-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.edu-item {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: var(--transition-md);
}

.edu-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}

.edu-badge {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--secondary-dim);
  border: 1px solid var(--secondary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.edu-body { flex: 1; min-width: 0; }

.edu-degree {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 3px;
}

.edu-school {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 5px;
}

.edu-school .logo-mark {
  width: 15px;
  height: 15px;
  opacity: 0.75;
}

.edu-item:hover .logo-mark { opacity: 1; }

.edu-period {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* ── CONTACT ─────────────────────────────────────────────────── */
.section-contact {
  text-align: center;
  padding: 100px 0 80px;
}

.contact-inner {
  margin: 0 auto;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-overline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.contact-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}

.contact-body {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.78;
  margin-bottom: 36px;
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.footer {
  padding: 36px 0 40px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.footer p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
}

.footer-sub a { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; }
.footer-sub a:hover { color: var(--accent); }

.footer-sub {
  font-size: 0.68rem !important;
  opacity: 0.55;
}

.accent-text { color: var(--accent); }

/* ── EXPERIENCE — STACKED TABS ───────────────────────────────── */
/* Collapse the vertical company rail well before phone width: keeping it
   until 560px squeezed the bullet column to ~295px on small tablets. */
@media (max-width: 760px) {
  .exp-container {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .exp-tabs {
    flex-direction: row;
    overflow-x: auto;
    border-left: none;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    min-width: unset;
    scrollbar-width: none;
  }

  .exp-tabs::-webkit-scrollbar { display: none; }

  .exp-tab {
    border-left: none;
    border-bottom: 2px solid transparent;
    margin-left: 0;
    margin-bottom: -2px;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    padding: 8px 14px;
    white-space: nowrap;
  }

  .exp-tab.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
}
