/* Eric Sun — personal site */
:root {
  --bg: #0a0c10;
  --bg-elevated: #12151c;
  --bg-soft: #181c26;
  --text: #e9ecf1;
  --text-muted: #9aa3b2;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #6eb8ff;
  --accent-dim: rgba(110, 184, 255, 0.15);
  --warm: #d4a574;
  --warm-dim: rgba(212, 165, 116, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --max: 1120px;
  --narrow: 720px;
  --header-h: 64px;
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #9fd0ff;
}

code {
  font-size: 0.9em;
  padding: 0.12em 0.35em;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  border-radius: var(--radius-sm);
  z-index: 100;
}

.skip-link:focus {
  left: 8px;
}

.container {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

.narrow {
  max-width: var(--narrow);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Art gallery (top carousel) */
.art-gallery {
  padding: 1rem 0 0;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}

.art-gallery__intro {
  margin-bottom: 0.65rem;
}

.art-gallery__heading {
  font-family: var(--font-sans);
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.art-gallery__hint {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.art-gallery__wrap {
  position: relative;
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

.art-gallery__viewport {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  gap: 0;
  -webkit-overflow-scrolling: touch;
  outline: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050608;
}

@media (prefers-reduced-motion: reduce) {
  .art-gallery__viewport {
    scroll-behavior: auto;
  }
}

.art-gallery__viewport:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.art-gallery__viewport::-webkit-scrollbar {
  height: 6px;
}

.art-gallery__viewport::-webkit-scrollbar-track {
  background: var(--bg-soft);
}

.art-gallery__viewport::-webkit-scrollbar-thumb {
  background: rgba(110, 184, 255, 0.35);
  border-radius: 3px;
}

.art-gallery__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.art-gallery__img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center;
  flex-shrink: 0;
}

.art-gallery__caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 0.85rem 1.25rem 1.1rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--line);
}

.art-gallery__cap-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.art-gallery__cap-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.art-gallery__btn {
  position: absolute;
  top: calc(50% - 1.75rem);
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 12, 16, 0.72);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.art-gallery__btn:hover {
  background: rgba(110, 184, 255, 0.2);
  border-color: rgba(110, 184, 255, 0.45);
  color: var(--accent);
}

.art-gallery__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.art-gallery__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.art-gallery__btn--prev {
  left: 0.75rem;
}

.art-gallery__btn--next {
  right: 0.75rem;
}

@media (max-width: 600px) {
  .art-gallery__btn {
    width: 38px;
    height: 38px;
    font-size: 1.35rem;
  }

  .art-gallery__btn--prev {
    left: 0.4rem;
  }

  .art-gallery__btn--next {
    right: 0.4rem;
  }
}

.art-gallery__dots-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0 0.5rem;
}

.art-gallery__dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.art-gallery__dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.art-gallery__dot:hover {
  background: rgba(110, 184, 255, 0.55);
}

.art-gallery__dot.is-active {
  background: var(--accent);
  transform: scale(1.2);
}

.art-gallery__dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.art-gallery__status {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 12, 16, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

.nav__brand {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.nav__links a:hover {
  color: var(--text);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.nav__toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin-inline: auto;
  border-radius: 2px;
}

@media (max-width: 860px) {
  .nav__toggle {
    display: flex;
  }

  .nav__links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 1rem 1.25rem 1.25rem;
    background: rgba(10, 12, 16, 0.96);
    border-bottom: 1px solid var(--line);
    display: none;
  }

  .nav__links.is-open {
    display: flex;
  }

  .nav__links li {
    width: 100%;
  }

  .nav__links a {
    display: block;
    padding: 0.65rem 0;
  }
}

/* Hero */
.hero {
  position: relative;
  padding: clamp(3.5rem, 10vw, 6.5rem) 0 clamp(4rem, 12vw, 7rem);
  overflow: hidden;
}

.art-gallery + .hero {
  padding-top: clamp(1rem, 2.5vw, 1.75rem);
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(110, 184, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 30%, rgba(212, 165, 116, 0.1), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
}

.hero__eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--warm);
  margin: 0 0 0.75rem;
}

.hero__title {
  font-family: var(--font-sans);
  font-size: clamp(2.75rem, 7vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 1rem;
}

.hero__tagline {
  font-size: clamp(1.05rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 34rem;
  margin: 0 0 1.75rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover {
  background: #8bc5ff;
  color: var(--bg);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--warm-dim);
}

.hero__meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hero__meta li {
  position: relative;
}

.hero__meta li:not(:last-child)::after {
  content: "·";
  position: absolute;
  right: -0.85rem;
  opacity: 0.45;
}

@media (max-width: 520px) {
  .hero__meta li:not(:last-child)::after {
    display: none;
  }

  .hero__meta {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* Sections */
.section {
  padding: clamp(3.5rem, 8vw, 5rem) 0;
}

.section--alt {
  background: var(--bg-elevated);
  border-block: 1px solid var(--line);
}

.section__title {
  font-family: var(--font-sans);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
}

.lead {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0;
}

.subsection-title {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
}

.subsection-title:first-child {
  margin-top: 0;
}

.muted {
  color: var(--text-muted);
  font-weight: 400;
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--warm));
  opacity: 0.35;
  border-radius: 2px;
}

.timeline__item {
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 1.25rem;
}

.timeline__item:last-child {
  margin-bottom: 0;
}

.timeline__marker {
  position: absolute;
  left: 0;
  top: 1.15rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow);
}

.card__title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
}

.card__org {
  font-weight: 500;
  color: var(--accent);
  margin: 0;
  font-size: 0.9375rem;
}

.card__meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0.85rem;
}

.card__body {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Project feature */
.project-feature {
  display: grid;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 900px) {
  .project-feature {
    grid-template-columns: 1.1fr 1fr;
    gap: 3rem;
  }

  .project-feature--reverse .project-feature__media {
    order: 2;
  }

  .project-feature--reverse .project-feature__text {
    order: 1;
  }
}

.projects-stack .project-feature + .project-feature {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line);
}

/* Project card: swipe between photo and YouTube */
.project-media-gallery {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.project-media-gallery__wrap {
  position: relative;
}

.project-media-gallery__btn {
  position: absolute;
  top: calc(50% - 1.25rem);
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 12, 16, 0.78);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.project-media-gallery__btn:hover {
  background: rgba(110, 184, 255, 0.2);
  border-color: rgba(110, 184, 255, 0.45);
  color: var(--accent);
}

.project-media-gallery__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.project-media-gallery__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.project-media-gallery__btn--prev {
  left: 0.5rem;
}

.project-media-gallery__btn--next {
  right: 0.5rem;
}

@media (max-width: 600px) {
  .project-media-gallery__btn {
    width: 34px;
    height: 34px;
    font-size: 1.2rem;
  }

  .project-media-gallery__btn--prev {
    left: 0.35rem;
  }

  .project-media-gallery__btn--next {
    right: 0.35rem;
  }
}

.project-media-gallery__viewport {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .project-media-gallery__viewport {
    scroll-behavior: auto;
  }
}

.project-media-gallery__viewport:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.project-media-gallery__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.project-media-gallery__visual {
  background: #050608;
}

.project-media-gallery__img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.project-media-gallery__visual--video .embed {
  border-radius: 0;
  border: none;
}

.project-media-gallery__cap {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
  background: var(--bg-elevated);
}

.project-media-gallery__dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.project-media-gallery__dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.project-media-gallery__dot:hover {
  background: rgba(110, 184, 255, 0.55);
}

.project-media-gallery__dot.is-active {
  background: var(--accent);
  transform: scale(1.2);
}

.project-media-gallery__dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warm);
  margin: 0 0 0.5rem;
}

.project-feature__title {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.project-feature__text p {
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.link-list a {
  font-weight: 600;
}

.media-frame {
  margin: 0;
}

.media-frame--hero {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.media-frame__img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.media-frame__img.is-placeholder {
  min-height: 220px;
  background:
    linear-gradient(135deg, rgba(110, 184, 255, 0.12), rgba(212, 165, 116, 0.08)),
    var(--bg-soft);
}

.media-frame__caption {
  padding: 0.85rem 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}

.plain-list li {
  margin-bottom: 0.5rem;
}

.embed {
  position: relative;
  width: 100%;
  background: #050608;
}

.embed--16x9 {
  aspect-ratio: 16 / 9;
}

.embed__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Footer */
.site-footer {
  padding: 2.5rem 0 2rem;
  border-top: 1px solid var(--line);
}

.footer__inner {
  text-align: center;
}

.footer__name {
  font-family: var(--font-sans);
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.footer__fine {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer__social {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.footer__social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.footer__social-link:hover {
  color: #9fd0ff;
}

.footer__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
  border-radius: 3px;
  object-fit: contain;
}

.footer__copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
