/* ── Accessibility ───────────────────────────────── */

/* Skip to main content */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 10px 10px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  -webkit-transition: top 0.15s;
          transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* Visible focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Remove outline for mouse/touch users */
:focus:not(:focus-visible) { outline: none; }

/* Pronouns pill — sits inline next to name in h1 */
.name-line {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 0.65rem;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
}

.pronouns-pill {
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  color: var(--muted);
  letter-spacing: 0.03em;
  white-space: nowrap;
  -webkit-user-select: none;
          user-select: none;
}

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

:root {
  --bg:        #0a0a0f;
  --bg-card:   #111118;
  --bg-card2:  #16161f;
  --border:    rgba(255,255,255,0.07);
  --accent:    #6c63ff;
  --accent2:   #a78bfa;
  --text:      #e8e8f0;
  --muted:     #9494b4;
  --tag-bg:    rgba(108,99,255,0.12);
  --tag-text:  #a78bfa;
  --radius:    14px;
  --glow:      rgba(108,99,255,0.25);
  --nav-h:     64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
}

/* ── Ambient background ─────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(108,99,255,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(167,139,250,0.08) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

/* ── Nav ─────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: space-between;
          justify-content: space-between;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
  height: var(--nav-h);
  background: rgba(10,10,15,0.85);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
          backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent2);
  text-decoration: none;
  letter-spacing: 0.02em;
  -webkit-tap-highlight-color: transparent;
}

.nav-links {
  display: -webkit-flex;
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  -webkit-transition: color 0.2s;
          transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active {
  color: var(--text);
  position: relative;
}
.nav-links a.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent2);
}

/* ── Layout ──────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
}

section { padding: 5rem 0 2rem; }

/* ── Hero ─────────────────────────────────────────── */
#hero {
  min-height: 100vh;
  min-height: 100svh;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
          flex-direction: column;
  -webkit-justify-content: center;
          justify-content: center;
  padding-top: var(--nav-h);
}

.hero-eyebrow {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--accent2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  opacity: 0;
  -webkit-animation: fadeUp 0.6s ease 0.2s forwards;
          animation: fadeUp 0.6s ease 0.2s forwards;
}

h1 {
  font-size: clamp(2.4rem, 7vw, 4.25rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  opacity: 0;
  -webkit-animation: fadeUp 0.6s ease 0.35s forwards;
          animation: fadeUp 0.6s ease 0.35s forwards;
  color: var(--text);
}

h1 .highlight {
  background: -webkit-linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  background:         linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
          color: transparent;
}

h1 .highlight-soft {
  color: rgba(167, 139, 250, 0.55);
  -webkit-text-fill-color: rgba(167, 139, 250, 0.55);
}

.hero-desc {
  font-size: clamp(1rem, 2.5vw, 1.175rem);
  color: var(--muted);
  max-width: 580px;
  margin-bottom: 2.5rem;
  opacity: 0;
  -webkit-animation: fadeUp 0.6s ease 0.5s forwards;
          animation: fadeUp 0.6s ease 0.5s forwards;
}

.hero-cta {
  display: -webkit-flex;
  display: flex;
  gap: 0.75rem;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  opacity: 0;
  -webkit-animation: fadeUp 0.6s ease 0.65s forwards;
          animation: fadeUp 0.6s ease 0.65s forwards;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  -webkit-transition: -webkit-transform 0.2s, box-shadow 0.2s, background 0.2s;
          transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  -webkit-transform: translateY(-2px);
          transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--glow);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card2);
  -webkit-transform: translateY(-2px);
          transform: translateY(-2px);
}

/* ── Section headings ────────────────────────────── */
.section-label {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 2.5rem;
}

/* ── About cards ──────────────────────────────────── */
.about-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  gap: 1.25rem;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  -webkit-flex: 1 1 calc(50% - 0.625rem);
          flex: 1 1 calc(50% - 0.625rem);
  min-width: 220px;
  -webkit-transition: border-color 0.2s, -webkit-transform 0.2s;
          transition: border-color 0.2s, transform 0.2s;
}
.about-card:hover {
  border-color: rgba(108,99,255,0.3);
  -webkit-transform: translateY(-3px);
          transform: translateY(-3px);
}

.about-card .icon { font-size: 1.75rem; margin-bottom: 0.9rem; }

.about-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.about-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Logo grid (experience) ─────────────────────── */
.logo-grid {
  display: -ms-grid;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.logo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem 1.5rem;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
          flex-direction: column;
  -webkit-align-items: center;
          align-items: center;
  gap: 0.75rem;
  text-align: center;
  -webkit-transition: border-color 0.2s, -webkit-transform 0.2s;
          transition: border-color 0.2s, transform 0.2s;
}
.logo-card:hover {
  border-color: rgba(108,99,255,0.3);
  -webkit-transform: translateY(-3px);
          transform: translateY(-3px);
}

.logo-img-wrap {
  width: 100%;
  height: 56px;
  border-radius: 10px;
  background: transparent;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  -webkit-justify-content: center;
          justify-content: center;
  padding: 10px 16px;
  overflow: hidden;
}

.logo-img-wrap img,
.logo-img-wrap svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Vectra logo is dark green — brighten it for dark background */
.logo-card:nth-child(4) .logo-img-wrap img {
  -webkit-filter: brightness(1.45);
          filter: brightness(1.45);
}

/* Wordmark sizing */
.logo-card:nth-child(2) .logo-img-wrap { padding: 10px 16px; }
.logo-card:nth-child(4) .logo-img-wrap { padding: 17px 16px; }

/* Taiwan Space Agency — allow name to wrap */
.logo-card:nth-child(6) .logo-name {
  white-space: normal;
  line-height: 1.25;
}

/* TASA logo — larger and brighter */
.logo-card:nth-child(6) .logo-img-wrap { padding: 0; overflow: visible; }
.logo-card:nth-child(6) .logo-img-wrap img {
  -webkit-transform: scale(1.15);
          transform: scale(1.15);
  -webkit-filter: brightness(1.3);
          filter: brightness(1.3);
}

/* Icon logos (Apple, Cloud Foundry, UC Berkeley, TASA) */
.logo-card:nth-child(1) .logo-img-wrap,
.logo-card:nth-child(3) .logo-img-wrap,
.logo-card:nth-child(5) .logo-img-wrap,
.logo-card:nth-child(6) .logo-img-wrap {
  padding: 0 10px;
}

.logo-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
}

.logo-role {
  font-size: 0.775rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ── Skills ──────────────────────────────────────── */
.skills-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  gap: 1.25rem;
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  -webkit-flex: 1 1 220px;
          flex: 1 1 220px;
  -webkit-transition: border-color 0.2s, -webkit-transform 0.2s;
          transition: border-color 0.2s, transform 0.2s;
}
.skill-group:hover {
  border-color: rgba(108,99,255,0.3);
  -webkit-transform: translateY(-3px);
          transform: translateY(-3px);
}

.skill-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.tags {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid rgba(108,99,255,0.2);
}

/* ── Projects ────────────────────────────────────── */
.projects-grid {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
          flex-direction: column;
  gap: 1.25rem;
}

.project-card {
  display: -webkit-flex;
  display: flex;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  -webkit-transition: border-color 0.2s, -webkit-transform 0.2s, box-shadow 0.2s;
          transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.project-card:hover {
  border-color: rgba(108,99,255,0.35);
  -webkit-transform: translateY(-3px);
          transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

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

.project-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-card p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.55;
}

/* ── Education ───────────────────────────────────── */
.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  -webkit-transition: border-color 0.2s;
          transition: border-color 0.2s;
}
.edu-card:hover { border-color: rgba(108,99,255,0.3); }

.edu-school { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.edu-degree { font-size: 0.875rem; color: var(--muted); }

/* ── Contact ─────────────────────────────────────── */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem clamp(1.25rem, 5vw, 2.5rem);
  text-align: center;
}

.contact-card p {
  color: var(--muted);
  font-size: 1rem;
  max-width: 420px;
  margin: 0 auto 2rem;
}

.social-links {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: center;
          justify-content: center;
  -webkit-flex-wrap: wrap;
          flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Footer ──────────────────────────────────────── */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
footer span { color: var(--accent2); }

/* ── Scroll reveal ─────────────────────────────── */
.reveal {
  opacity: 0;
  -webkit-transform: translateY(24px);
          transform: translateY(24px);
  -webkit-transition: opacity 0.55s ease, -webkit-transform 0.55s ease;
          transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; -webkit-transform: none; transform: none; }

/* ── Animations ────────────────────────────────── */
@-webkit-keyframes fadeUp {
  from { opacity: 0; -webkit-transform: translateY(20px); transform: translateY(20px); }
  to   { opacity: 1; -webkit-transform: none; transform: none; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

/* ── Easter egg terminal ──────────────────────── */
#terminal-widget {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.82rem;
}

.term-bar {
  background: #1c1c1e;
  padding: 10px 14px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  gap: 6px;
  position: relative;
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  -webkit-flex-shrink: 0;
          flex-shrink: 0;
}

.term-title {
  position: absolute;
  left: 50%;
  -webkit-transform: translateX(-50%);
          transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  pointer-events: none;
}

.term-body {
  padding: 14px 18px 8px;
  min-height: 130px;
  max-height: 260px;
  overflow-y: auto;
  color: #d0d0d8;
  line-height: 1.75;
}

.term-body::-webkit-scrollbar { width: 4px; }
.term-body::-webkit-scrollbar-track { background: transparent; }
.term-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.term-line { white-space: pre-wrap; word-break: break-all; }
.term-hl   { color: var(--accent2); }
.term-ok   { color: #30d158; }
.term-err  { color: #ff453a; }
.term-dim  { color: var(--muted); }

.term-input-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
          align-items: center;
  padding: 8px 18px 14px;
  border-top: 1px solid rgba(255,255,255,0.05);
  gap: 0;
}

.term-prompt { color: var(--accent2); white-space: nowrap; }

#term-input {
  -webkit-flex: 1;
          flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #d0d0d8;
  font-family: inherit;
  font-size: inherit;
  caret-color: var(--accent2);
  min-width: 0;
}

#term-input::-webkit-input-placeholder { color: rgba(255,255,255,0.2); }
#term-input::placeholder               { color: rgba(255,255,255,0.2); }

/* ── /easter egg terminal ─────────────────────── */

@media (max-width: 768px) {
  .nav-links { gap: 1.25rem; }
  .about-card { -webkit-flex: 1 1 100%; flex: 1 1 100%; }
}

/* ── Responsive: mobile ──────────────────────────── */
@media (max-width: 540px) {
  :root { --nav-h: 56px; }

  .nav-links { display: none; }

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

  section { padding: 4rem 0 1.5rem; }

  .timeline-item { gap: 1rem; }
  .timeline-content { padding: 1.1rem 1.25rem; }

  .timeline-header { -webkit-flex-direction: column; flex-direction: column; gap: 0.2rem; }

  .skill-group { -webkit-flex: 1 1 100%; flex: 1 1 100%; }

  .hero-cta { gap: 0.6rem; }
  .btn { font-size: 0.85rem; padding: 0.65rem 1.1rem; }

  .social-links .btn { -webkit-flex: 1 1 auto; flex: 1 1 auto; -webkit-justify-content: center; justify-content: center; }

  .contact-card { padding: 1.75rem 1.25rem; }
}

/* ── Reduced motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    -webkit-animation-duration: 0.01ms !important;
            animation-duration: 0.01ms !important;
    -webkit-transition-duration: 0.01ms !important;
            transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; -webkit-transform: none; transform: none; }
  .hero-eyebrow, h1, .hero-desc, .hero-cta { opacity: 1; }
}
