:root {
  --bg: #0a1428;
  --bg-elev: #0f1d3a;
  --text: #e6ecff;
  --muted: #b6c2e2;
  --primary: #2f6fff;
  --primary-600: #2a5bdd;
  --border: #1f2b4d;
  --chip-bg: #13244a;
  --container-padding: 4%;
}

* {
  box-sizing: border-box;
}

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

html,
body {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, #112154 0%, var(--bg) 55%),
    radial-gradient(1200px 600px at 20% -10%, #112154 0%, var(--bg) 55%);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  word-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  position: relative;
}

/* Improve readability on mobile */
p,
li,
.chip,
.time-range {
  line-height: 1.5;
}

/* Better touch targets for mobile */
a,
button,
.chip {
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
}

/* Prevent horizontal overflow */
img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

/* Better spacing for mobile */
section {
  margin-bottom: 1.5rem;
}

/* Improve form elements on mobile */
input,
select,
textarea,
button {
  font-size: 16px;
  /* Prevent zoom on focus in iOS */
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 4%;
  box-sizing: border-box;
  position: relative;
}

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-wrapper {
  position: relative;
  padding: 80px 32px;
  border-radius: 28px;
  background: color-mix(in oklab, var(--bg-elev) 95%, transparent);
  border: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  backdrop-filter: blur(18px);
  max-width: 520px;
  margin: 32px;
  box-shadow: 0 30px 80px rgba(5, 11, 24, 0.6);
  overflow: hidden;
}

.error-aura {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(47, 111, 255, 0.35), transparent 55%);
  z-index: 0;
  opacity: 0.8;
}

.error-wrapper>* {
  position: relative;
  z-index: 1;
}

.error-badge {
  display: inline-flex;
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.error-wrapper h1 {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  margin: 0 0 12px;
  letter-spacing: -0.03em;
}

.error-copy {
  margin: 0 auto 32px;
  max-width: 400px;
  color: var(--muted);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.error-actions .btn {
  min-width: 150px;
}

.error-actions .btn:hover {
  color: var(--text) !important;
}

@media (max-width: 600px) {
  .error-wrapper {
    padding: 60px 24px;
    margin: 24px;
  }
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: color-mix(in oklab, var(--bg) 97%, transparent);
  border-bottom: 1px solid var(--border);
  z-index: 20;
  height: 70px;
  /* Fixed height for the header */
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0 4%;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--text);
  background: var(--chip-bg);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg-elev) 85%, transparent);
  color: var(--text);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: color-mix(in oklab, var(--bg-elev) 60%, transparent);
  transform: translateY(-1px);
  outline: none;
}

.nav-toggle-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle-icon span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 15px;
  position: relative;
  gap: 10px;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animation classes that will be added by JavaScript */
.timeline li.animate {
  animation: slideInFromLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Initially hide the timeline items */
.timeline li {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Staggered animation for each timeline item */



.hero .avatar {
  margin: 0 auto 10px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  animation: fadeInScale 0.8s ease-out forwards;
  opacity: 0;
  /* Start invisible, animation will make it visible */
  transform-origin: center center;
  transition: all 0.3s ease;
}

.hero .avatar.animated {
  animation: fadeInScale 0.8s ease-out forwards;
}

.hero .avatar:hover {
  transform: scale(1.05) !important;
  box-shadow: 0px 0px 30px rgba(47, 111, 255, 0.5);
}

.hero .hero-text {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.hero h1 {
  animation: fadeInUp 0.6s ease-out 0.3s both;
  opacity: 0;
}

.hero .subtitle {
  animation: fadeInUp 0.6s ease-out 0.5s both;
  opacity: 0;
}

.contact {
  animation: fadeInUp 0.6s ease-out 0.7s both;
  opacity: 0;
}

/* Animate each contact chip with a slight delay */
.chip {
  opacity: 0;
  animation: fadeInUp 0.5s ease-out forwards;
  animation-delay: calc(0.7s + (var(--i, 0) * 0.1s));
}

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 30px 0;
  }

  .hero .avatar {
    margin: 0 auto;
  }
}

/* Avatar styles moved to .hero .avatar */
.hero h1 {
  margin: 5px 0 2px;
  font-size: 32px;
  line-height: 1.2;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 5px;
  font-size: 1.1em;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 15px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {
  .contact {
    justify-content: center;
  }

  .chip {
    padding: 8px 12px;
    font-size: 15px;
  }
}

/* Single column layout for sections */
.section {
  margin-bottom: 40px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 768px) {

  html,
  body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }

  .container {
    padding: 0 16px;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(5, 11, 24, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9;
  }

  .nav-toggle {
    display: inline-flex;
    width: 50px;
    height: 50px;
    border-radius: 12px;
  }

  .site-header {
    height: 60px;
    /* Slightly smaller header on mobile */
  }

  .filters {
    top: 0;
  }

  .header-inner {
    width: 100%;
    justify-content: space-between;
    padding: 0 16px;
    /* Consistent padding on mobile */
    min-height: 48px;
    /* Slightly reduce min-height for mobile */
  }

  .nav {
    position: absolute;
    top: 100%;
    /* Remove extra spacing */
    right: 0;
    margin-top: 4px;
    /* Small gap between header and menu */
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
    background: color-mix(in oklab, var(--bg-elev) 92%, transparent);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: min(260px, calc(100vw - 32px));
    box-shadow: 0 20px 40px rgba(8, 15, 32, 0.45);
    z-index: 10;
  }

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

  .nav-link,
  .nav .btn {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-link {
    padding: 12px 14px;
  }

  .nav .btn {
    padding: 12px 14px;
  }

  .section {
    padding: 0;
    margin-bottom: 30px;
  }

  .timeline {
    margin: 15px 0 0 0;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px;
    margin: 0 0 12px 0;
  }

  .time-range {
    margin-bottom: 4px;
    font-size: 13px;
  }

  .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }
}

h2 {
  margin-top: 28px;
  margin-bottom: 10px;
  font-size: 20px;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 20px 0 0 0;
  display: grid;
  gap: 14px;
}

.timeline li {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 16px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  will-change: transform, box-shadow;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.timeline li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(47, 111, 255, 0.02) 0%, rgba(47, 111, 255, 0) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  border-radius: 12px;
}

.timeline li:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border-color: rgba(47, 111, 255, 0.3);
}

.timeline li:hover::before {
  opacity: 1;
}

/* Add a subtle shine effect on hover */
.timeline li::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.02) 50%,
      rgba(255, 255, 255, 0) 100%);
  transition: 0.5s;
  z-index: 1;
}

.timeline li:hover::after {
  left: 100%;
}

@media (max-width: 480px) {
  .timeline li {
    padding: 14px 12px;
  }
}

/* Date column styling */
.date-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 16px;
  position: relative;
  margin-right: 16px;
  min-width: 100px;
}

/* Time range styling */
.time-range {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  font-feature-settings: 'tnum' on, 'lnum' on;
  line-height: 1.3;
}

.time-range .end-date {
  font-weight: 600;
  color: var(--text);
}

.time-range .start-date {
  opacity: 0.9;
}

/* Keep month and year on the same line */
.time-range .end-date,
.time-range .start-date {
  white-space: nowrap;
}

.time-range .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin: 0px 0;
  font-size: 20px;
}

.time-range .arrow svg {
  width: 12px;
  height: 2px;
  fill: currentColor;
}

/* Hover-only sliding arrow animation */
@keyframes arrow-slide {
  0% {
    transform: translate(-50%, 4px);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -4px);
    opacity: 0;
  }
}

/* Prepare container for pseudo-element */
.time-range .arrow {
  position: relative;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 12px;
  margin: 0px 0;
}

/* Style for the arrow SVG */
.time-range .arrow svg {
  width: 12px;
  height: 12px;
  stroke: var(--primary);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

/* Run animation only on hover */
.timeline li:hover .time-range .arrow svg {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  animation: arrow-slide 0.9s ease-in-out infinite;
  stroke: currentColor;
}

/* Staggered duplicate arrow following the first */
.timeline li:hover .time-range .arrow::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='%235d8cff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
  transform: translate(-50%, 6px);
  pointer-events: none;
  animation: arrow-slide 0.9s ease-in-out infinite;
  animation-delay: 0.45s;
  /* half-cycle delay */
  opacity: 0;
  /* Start invisible, animation will handle opacity */
}

/* Add a subtle color on hover */
.timeline li:hover .time-range {
  color: #a0b1d4;
}

@media (max-width: 768px) {

  /* Constant animation on mobile */
  .timeline li .time-range .arrow svg {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    animation: arrow-slide 0.9s ease-in-out infinite;
    stroke: currentColor;
  }

  .timeline li .time-range .arrow::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 12px;
    height: 12px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' stroke='%235d8cff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center;
    background-size: contain;
    transform: translate(-50%, 6px);
    pointer-events: none;
    animation: arrow-slide 0.9s ease-in-out infinite;
    animation-delay: 0.45s;
    opacity: 0;
  }
}

.item-body h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  line-height: 1.3;
  color: var(--text);
}

.item-body h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  opacity: 0.9;
}

.company-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-logo-container {
  width: 60px;
  height: 60px;
  padding: 0px;
  margin: 0 auto 8px;
  border-radius: 0px;
  background: transparent;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-logo {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.company-logo-container:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Adjust spacing for mobile */
@media (max-width: 768px) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .time-range {
    margin-top: 4px;
    text-align: left;
  }

  .company-logo {
    width: 40px;
    height: 40px;
    margin: 0 0 4px;
  }

  .timeline>li>div:first-child {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .timeline>li>div:first-child .company-logo {
    width: 60px;
    height: 60px;
    margin-top: 16px;
  }
}

.item-body p {
  margin: 0 0 10px 0;
  color: var(--muted);
  padding-left: 0;
  white-space: pre-line;
  line-height: 1.2;
  font-size: 14px;
}

/* Style for bullet points */
.item-body p {
  position: relative;
  padding-left: 1.5em;
  margin: 0 0 8px 0;
  line-height: 1.6;
}

/* Add bullet points */
.item-body p::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* Add some spacing between bullet points */
.item-body p:not(:last-child) {
  margin-bottom: 8px;
}

/* Style for links in content */
a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  font-weight: 500;
}

a:hover {
  color: #5d8cff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.contact a:hover {
  text-decoration: none;
}

a::after {
  font-size: 0.8em;
  margin-left: 2px;
  opacity: 0.8;
  display: inline-block;
  transition: transform 0.2s ease;
}

a:hover::after {
  transform: translate(2px, -2px);
}

/* Style for links in the education section */
#education-list a {
  color: #7aa2ff;
  border-bottom: 1px solid rgba(122, 162, 255, 0.3);
  padding-bottom: 1px;
  text-decoration: none;
}

#education-list a:hover {
  color: #a0bdff;
  border-bottom-color: rgba(160, 189, 255, 0.6);
  text-decoration: none;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  background: var(--chip-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  transition: all 0.2s ease;
  min-height: 44px;
  /* Better touch target */
}

@media (max-width: 480px) {
  .btn {
    width: 100%;
    padding: 14px 20px;
  }
}

.btn:hover {
  transform: translateY(-1px);
  transition: transform .15s ease;
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  box-shadow: 0 10px 25px rgba(47, 111, 255, .25);
  color: var(--text);
}

.btn-primary:hover {
  color: var(--text) !important;
}

.btn-outline {
  border-color: var(--border);
  background: transparent;
}

.cta {
  display: flex;
  gap: 16px;
  padding: 0px 0 20px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 600px) {
  .cta {
    flex-direction: row;
    gap: 10px;
    justify-content: center;
  }

  .cta .btn {
    margin: 0 !important;
    width: auto !important;
    flex: 0 1 auto;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.site-footer p {
  color: var(--muted);
  text-align: center;
  padding: 16px 0 28px;
  margin: 0;
}

/* Portfolio */
.filters {
  position: relative;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  z-index: 10;
  /* Below header but above main content */
  backdrop-filter: blur(8px);
}

.filters .controls {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

@media (max-width: 1100px) {
  .filters .controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .filters .controls {
    grid-template-columns: 1fr;
  }
}

.input,
.select {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}

.filter-group {
  position: relative;
  min-width: 0;
}

.filter-group.open {
  z-index: 60;
}

.filter-dropdown {
  position: relative;
}

.filter-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.filter-trigger:hover,
.filter-trigger:focus-visible {
  border-color: color-mix(in oklab, var(--primary) 60%, var(--border));
  color: var(--primary);
  outline: none;
}

.filter-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 12px;
}

.filter-trigger svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.filter-trigger[aria-expanded="true"] svg {
  transform: rotate(-180deg);
  color: var(--primary);
}

.filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 25px 45px rgba(6, 8, 20, 0.55);
  padding: 12px;
  z-index: 80;
  display: none;
}

.filter-group.open .filter-panel {
  display: block;
}

.filter-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 6px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  transition: background 0.2s ease;
}

.filter-option:hover {
  background: color-mix(in oklab, var(--bg-elev) 80%, transparent);
}

.filter-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.filter-option label {
  flex: 1;
  cursor: pointer;
}

.filter-list::-webkit-scrollbar {
  width: 8px;
}

.filter-list::-webkit-scrollbar-track {
  background: color-mix(in oklab, var(--bg) 75%, black);
  border-radius: 999px;
}

.filter-list::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--primary) 40%, var(--border));
  border-radius: 999px;
}

.filter-list::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklab, var(--primary) 55%, var(--border));
}

.filter-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.filter-actions button {
  flex: 1;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-actions button:hover {
  border-color: color-mix(in oklab, var(--primary) 60%, var(--border));
  color: var(--primary);
}

.grid.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 22px 0 36px;
}

@media (max-width: 1000px) {
  .grid.cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid.cards {
    grid-template-columns: 1fr;
  }
}

.portfolio-loader {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
  color: var(--muted);
  font-size: 15px;
}

.portfolio-loader[hidden] {
  display: none !important;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid color-mix(in oklab, var(--muted) 50%, transparent);
  border-top-color: var(--primary);
  animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card.card-pending {
  opacity: 0;
  transform: translateY(12px);
}

.card.card-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.35s ease, transform 0.35s ease;
  transition-delay: calc(var(--card-stagger, 0) * 40ms);
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0f20;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-media img,
.card-media iframe,
.card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}

.card-media iframe,
.card-media video {
  display: block;
}

.card-media.video iframe,
.card-media.video video {
  object-fit: cover;
}

.card-media.video {
  position: relative;
}

.card-media.video.loading {
  background-color: #0a0f20;
  background-size: cover;
  background-position: center;
}

.card-media.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.card-media.placeholder {
  color: var(--muted);
  font-size: 14px;
}

.card-media.placeholder span {
  padding: 16px;
  text-align: center;
}

.card-body {
  padding: 12px;
  display: grid;
  gap: 6px;
}

.card h3 {
  margin: 0;
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.card .actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
}

.no-results {
  color: var(--muted);
  text-align: center;
  padding: 28px 0;
}

/* Popup Styles */
/* Popup Styles */
body.popup-open {
  overflow: hidden;
}

.project-popup-overlay {
  position: fixed !important;
  inset: 0;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 11, 24, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  /* Safari support */
  z-index: 2000000000 !important;
  /* High z-index but allows tooltip (max int) above it */
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
  transform: translateZ(0);
  /* Force GPU layer */
  isolation: isolate;
  /* Create new stacking context */
}

.project-popup-overlay[hidden] {
  display: none !important;
}

.project-popup-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 50px 100px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbar for Popup */
.project-popup-content::-webkit-scrollbar {
  width: 8px;
}

.project-popup-content::-webkit-scrollbar-track {
  background: var(--bg-elev);
  border-radius: 0 20px 20px 0;
}

.project-popup-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.project-popup-content::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.popup-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 0;
}

.popup-close-btn:hover {
  background: var(--primary);
  transform: rotate(90deg);
}

.popup-close-btn svg {
  width: 20px;
  height: 20px;
}

.popup-media-container {
  width: 100%;
  background: #000;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}

.popup-media-container iframe,
.popup-media-container video,
.popup-media-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.popup-details {
  padding: 30px;
}

.popup-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.popup-year {
  color: var(--muted);
  font-size: 14px;
}

.popup-title {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.2;
}

.popup-description {
  color: var(--muted);
  line-height: 1.6;
  font-size: 16px;
  white-space: pre-wrap;
  /* Preserves newlines */
}

.popup-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}

@media (max-width: 768px) {
  .project-popup-overlay {
    padding: 0;
  }

  .project-popup-content {
    border-radius: 0;
    max-height: 100%;
    height: 100%;
  }

  .popup-close-btn {
    top: 10px;
    right: 10px;
  }

  .popup-details {
    padding: 20px;
  }

  .popup-title {
    font-size: 24px;
  }
}

/* Updated Card Styles for Click Interaction & Consistency */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Ensure full height in grid */
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-8px) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border-color: rgba(47, 111, 255, 0.3);
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0f20;
  display: flex;
  /* Flex alignment for placeholders */
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  overflow: hidden;
  /* Ensure content doesn't bleed */
}

.card-media img,
.card-media iframe,
.card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Strict cover for uniformity */
  border: 0;
  border-radius: 0;
  display: block;
}

/* Fallback for failed images */
.card-media.media-failed img {
  opacity: 0;
}

.card-media.media-failed {
  background: linear-gradient(135deg, #1f2b4d 0%, #0a0f20 100%);
}

.card-media.media-failed::before {
  content: 'Preview Unavailable';
  color: var(--muted);
  font-size: 12px;
  position: absolute;
  z-index: 1;
}

.card-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover .card-media::after {
  opacity: 1;
}

.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  /* allow body to grow */
}

.card h3 {
  margin: 0;
  font-size: 18px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

/* Truncate description for consistent card height */
.description-preview {
  display: block;
  overflow: visible;
  height: auto;
}

.card .actions {
  margin-top: auto;
  /* Push actions to bottom */
  display: flex;
  gap: 8px;
}

.no-results {
  color: var(--muted);
  text-align: center;
  padding: 28px 0;
}

/* Play Icon Overlay */
.play-icon-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 48px;
  height: 48px;
  background: rgba(47, 111, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.card:hover .play-icon-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.play-icon-overlay svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
  /* Visual centering adjustment */
  fill: currentColor;
}

/* Custom Tooltip */
.custom-tooltip {
  position: fixed;
  z-index: 2147483647;
  /* Top layer */
  background: rgba(13, 12, 12, 0.95);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
}

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