1
+ : root {
2
+ --card-height : 300px ;
3
+ --card-width : calc (var (--card-height ) / 1.5 );
4
+ }
5
+ * {
6
+ box-sizing : border-box;
7
+ }
8
+ body {
9
+ width : 100vw ;
10
+ height : 100vh ;
11
+ margin : 0 ;
12
+ display : flex;
13
+ justify-content : center;
14
+ align-items : center;
15
+ background : # 191c29 ;
16
+ }
17
+ .card {
18
+ width : var (--card-width );
19
+ height : var (--card-height );
20
+ position : relative;
21
+ display : flex;
22
+ justify-content : center;
23
+ align-items : flex-end;
24
+ padding : 0 36px ;
25
+ perspective : 2500px ;
26
+ margin : 0 50px ;
27
+ }
28
+
29
+ .cover-image {
30
+ width : 100% ;
31
+ height : 100% ;
32
+ object-fit : cover;
33
+ }
34
+
35
+ .wrapper {
36
+ transition : all 0.5s ;
37
+ position : absolute;
38
+ width : 100% ;
39
+ z-index : -1 ;
40
+ }
41
+
42
+ .card : hover .wrapper {
43
+ transform : perspective (900px ) translateY (-5% ) rotateX (25deg ) translateZ (0 );
44
+ box-shadow : 2px 35px 32px -8px rgba (0 , 0 , 0 , 0.75 );
45
+ -webkit-box-shadow : 2px 35px 32px -8px rgba (0 , 0 , 0 , 0.75 );
46
+ -moz-box-shadow : 2px 35px 32px -8px rgba (0 , 0 , 0 , 0.75 );
47
+ }
48
+
49
+ .wrapper ::before ,
50
+ .wrapper ::after {
51
+ content : "" ;
52
+ opacity : 0 ;
53
+ width : 100% ;
54
+ height : 80px ;
55
+ transition : all 0.5s ;
56
+ position : absolute;
57
+ left : 0 ;
58
+ }
59
+ .wrapper ::before {
60
+ top : 0 ;
61
+ height : 100% ;
62
+ background-image : linear-gradient (
63
+ to top,
64
+ transparent 46% ,
65
+ rgba (12 , 13 , 19 , 0.5 ) 68% ,
66
+ rgba (12 , 13 , 19 ) 97%
67
+ );
68
+ }
69
+ .wrapper ::after {
70
+ bottom : 0 ;
71
+ opacity : 1 ;
72
+ background-image : linear-gradient (
73
+ to bottom,
74
+ transparent 46% ,
75
+ rgba (12 , 13 , 19 , 0.5 ) 68% ,
76
+ rgba (12 , 13 , 19 ) 97%
77
+ );
78
+ }
79
+
80
+ .card : hover .wrapper ::before ,
81
+ .wrapper ::after {
82
+ opacity : 1 ;
83
+ }
84
+
85
+ .card : hover .wrapper ::after {
86
+ height : 120px ;
87
+ }
88
+ .title {
89
+ width : 100% ;
90
+ transition : transform 0.5s ;
91
+ }
92
+ .card : hover .title {
93
+ transform : translate3d (0% , -50px , 100px );
94
+ }
95
+
96
+ .character {
97
+ width : 100% ;
98
+ opacity : 0 ;
99
+ transition : all 0.5s ;
100
+ position : absolute;
101
+ z-index : -1 ;
102
+ }
103
+
104
+ .card : hover .character {
105
+ opacity : 1 ;
106
+ transform : translate3d (0% , -30% , 100px );
107
+ }
0 commit comments