/* ============================================
   Components — Nav, Buttons, Cards, Timeline,
   Tags, Videos, Courses, Resume, Footer
   ============================================ */

/* ---- Navigation ---- */

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 1100;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--overlay-active);
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
}

/* Light mode (default): show moon icon, hide sun */
.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }

/* Dark mode: show sun icon, hide moon */
.dark .theme-toggle__sun { display: block; }
.dark .theme-toggle__moon { display: none; }

.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding: 12px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.nav__bar {
  position: relative;
  background: var(--nav-bar-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 6px 6px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav__bar::-webkit-scrollbar {
  display: none;
}

.nav__list {
  display: flex;
  gap: 2px;
  align-items: center;
  width: max-content;
}

.nav__link {
  display: block;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--t-fast), background var(--t-fast);
  white-space: nowrap;
}

.nav__link:hover {
  color: var(--text-primary);
  background: var(--overlay-hover);
}

.nav__link--active {
  color: var(--text-primary);
  background: var(--overlay-active);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--r-pill);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
  border: none;
  text-decoration: none;
}

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

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

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

.btn--ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--overlay-subtle);
}

.btn--sm {
  padding: 7px 16px;
  font-size: 0.82rem;
}

/* Social icon inside button */
.btn .social-icon {
  width: 18px;
  height: 18px;
  filter: var(--icon-invert) opacity(0.8);
  transition: filter var(--t-fast);
}

.btn:hover .social-icon {
  filter: var(--icon-invert);
}

/* ---- Tags / Tech Pills ---- */
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ---- Project Cards ---- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
  display: flex;
  flex-direction: column;
  break-inside: avoid;
  margin-bottom: 20px;
}

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

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 16px;
  color: var(--accent);
}

.card__icon svg {
  width: 100%;
  height: 100%;
}

.card__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card__meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.card__body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

.card__body li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
}

.card__body li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.card__footer {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card__links {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* ---- Timeline (Experience) ---- */
.timeline {
  position: relative;
  padding-left: 36px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) 0%, var(--border) 100%);
  border-radius: 2px;
}

.timeline__item {
  position: relative;
  padding-bottom: 48px;
}

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

.timeline__dot {
  position: absolute;
  left: -36px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--accent);
  z-index: 1;
}

.timeline__item:first-child .timeline__dot {
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline__company {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.timeline__role {
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 2px;
}

.timeline__period {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.timeline__card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 24px;
}

.timeline__card .tags {
  margin-bottom: 14px;
}

.card .tags {
  margin-bottom: 14px;
}

.game-card .tags {
  margin-bottom: 14px;
}

.course__content .tags {
  margin-bottom: 16px;
}

.timeline__card ul {
  padding: 0;
}

.timeline__card li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
}

.timeline__card li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ---- Game Cards ---- */
.game-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-base);
}

.game-card:hover {
  border-color: var(--border-hover);
}

.game-card__body {
  padding: 28px;
}

.game-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 16px;
  flex-wrap: wrap;
}

.game-card__title {
  font-size: 1.3rem;
  font-weight: 700;
}

.game-card__tech {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.game-card__list {
  margin-bottom: 8px;
}

.game-card__list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

.game-card__list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ---- Video Grid ---- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.video-item {
  text-align: center;
}

.video-container {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 10;
  cursor: pointer;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn:hover {
  background: var(--accent);
  border-color: transparent;
  transform: translate(-50%, -50%) scale(1.1);
}

.video-container.playing .play-btn {
  opacity: 0;
  pointer-events: none;
}

.video-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* ---- Game Frame (Asteroids) ---- */
.game-frame-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
  margin-top: 20px;
  border: 1px solid var(--border);
}

.game-frame {
  width: 100%;
  height: 100%;
  border: none;
}

/* ---- Course Accordion ---- */
.courses {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.course {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.course:hover {
  border-color: var(--border-hover);
}

.course__toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--t-fast);
  text-align: left;
}

.course__toggle:hover {
  background: var(--bg-elevated);
}

.course__arrow {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform var(--t-fast) var(--ease);
  flex-shrink: 0;
}

.course--open .course__arrow {
  transform: rotate(180deg);
}

.course__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-base) var(--ease);
}

.course--open .course__body {
  grid-template-rows: 1fr;
}

.course__body-inner {
  overflow: hidden;
}

.course__content {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}

.course__tech {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.course__project {
  margin-bottom: 16px;
}

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

.course__project h4 {
  color: var(--text-primary);
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.course__project li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

.course__project li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ---- Resume ---- */
.resume-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}

.resume-frame {
  width: 100%;
  height: 80vh;
  border: none;
  border-radius: var(--r-md);
  background: #fff;
}

/* ---- Scroll Reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-group > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-group > .reveal:nth-child(2) { transition-delay: 80ms; }
.reveal-group > .reveal:nth-child(3) { transition-delay: 160ms; }
.reveal-group > .reveal:nth-child(4) { transition-delay: 240ms; }
.reveal-group > .reveal:nth-child(5) { transition-delay: 320ms; }
.reveal-group > .reveal:nth-child(6) { transition-delay: 400ms; }

/* ---- Skills ---- */
.skills-grid {
  columns: 2;
  column-gap: 12px;
}

.skills-category {
  break-inside: avoid;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-secondary);
  overflow: hidden;
  transition: border-color var(--t-fast);
}

.skills-category:hover {
  border-color: var(--border-hover);
}

.skills-category__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
  color: var(--text-muted);
}

.skills-category__header svg {
  flex-shrink: 0;
}

.skills-category__title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.skills-category__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.35s ease, background 0.35s ease, color 0.35s ease;
  white-space: nowrap;
}

.skill-chip:hover {
  border-color: var(--border-hover);
  background: var(--overlay-hover);
  color: var(--text-primary);
}

.skill-chip--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.skill-chip__count {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--overlay-subtle);
  padding: 1px 5px;
  border-radius: 100px;
  line-height: 1.3;
  transition: background 0.35s ease, color 0.35s ease;
}

.skill-chip--active .skill-chip__count {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Expandable detail panel */
.skills-category__detail {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.skills-category__detail--open {
  grid-template-rows: 1fr;
}

.skills-category__detail-inner {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s ease, height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.skills-category__detail-inner.skill-detail--visible {
  opacity: 1;
}

.skill-detail__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 4px;
  border-top: 1px solid var(--border);
}

.skill-detail__name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.skill-detail__used {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.skill-detail__refs {
  padding: 2px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.skill-detail__refs li {
  list-style: none;
}

.skill__ref-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}

.ref-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.skill__ref-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---- Highlight Pulse (when navigating from skill links) ---- */
@keyframes highlightPulse {
  0%   { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
  100% { border-color: var(--border); box-shadow: 0 0 0 transparent; }
}

.highlight-pulse {
  animation: highlightPulse 3s ease-out;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 40px var(--container-pad);
  border-top: 1px solid var(--border);
}

.footer p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer a {
  color: var(--text-secondary);
}

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

