/* ==========================================================================
   components.css — link cards, project cards, theme toggle, skeletons
   --------------------------------------------------------------------------
   Every colour-changing element carries a `transition` that includes
   background-color / border-color / color / box-shadow as appropriate. This is
   what makes toggling `data-theme` cross-fade the whole page smoothly and
   reliably every single time.
   ========================================================================== */

/* Link cards ------------------------------------------------------------- */
.link-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.875rem;
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  text-decoration: none;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition:
    background-color var(--theme-duration) var(--theme-easing),
    border-color var(--interact-duration) var(--theme-easing),
    color var(--theme-duration) var(--theme-easing),
    transform var(--interact-duration) var(--theme-easing),
    box-shadow var(--interact-duration) var(--theme-easing);
}

.link-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--interact-duration) var(--theme-easing);
}

.link-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.2);
}

.link-card:hover::before {
  opacity: 1;
}

.link-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform var(--interact-duration) var(--theme-easing);
}

.link-card:hover .link-icon {
  transform: scale(1.1);
}

/* Project cards ---------------------------------------------------------- */
.project-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    background-color var(--theme-duration) var(--theme-easing),
    border-color var(--interact-duration) var(--theme-easing),
    transform var(--interact-duration) var(--theme-easing),
    box-shadow var(--interact-duration) var(--theme-easing);
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--interact-duration) var(--theme-easing);
}

.project-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.2);
}

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

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
  z-index: 1;
}

.project-name {
  font-size: 1.0625rem;
  font-weight: 600;
  transition: color var(--theme-duration) var(--theme-easing);
}

.project-description {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  line-height: 1.5;
  position: relative;
  z-index: 1;
  transition: color var(--theme-duration) var(--theme-easing);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  position: relative;
  z-index: 1;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color var(--theme-duration) var(--theme-easing);
}

.meta-item svg {
  width: 14px;
  height: 14px;
}

.star-icon {
  color: var(--star);
  transition: color var(--theme-duration) var(--theme-easing);
}

.language-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
}

.external-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition:
    color var(--interact-duration) var(--theme-easing),
    transform var(--interact-duration) var(--theme-easing);
}

.project-card:hover .external-icon,
.link-card:hover .external-icon {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* Project card as a link (keyboard accessible) --------------------------- */
.project-card[role="link"] {
  cursor: pointer;
}

/* Theme toggle ----------------------------------------------------------- */
.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition:
    background-color var(--theme-duration) var(--theme-easing),
    border-color var(--theme-duration) var(--theme-easing),
    color var(--theme-duration) var(--theme-easing),
    transform var(--interact-duration) var(--theme-easing),
    box-shadow var(--interact-duration) var(--theme-easing);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--glow);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  position: absolute;
  transition:
    opacity 0.3s var(--theme-easing),
    transform 0.3s var(--theme-easing);
}

.icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="light"] .icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

[data-theme="light"] .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* Skeleton loading state ------------------------------------------------- */
.skeleton .skeleton-text {
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--bg-card-hover) 20%,
    var(--bg-card-hover) 40%,
    var(--border) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
  color: transparent;
}

.project-card.loaded {
  animation: cardLoad 0.4s ease-out;
}
