-
-
Notifications
You must be signed in to change notification settings - Fork 965
Expand file tree
/
Copy pathBackToTop.css
More file actions
144 lines (128 loc) · 2.97 KB
/
BackToTop.css
File metadata and controls
144 lines (128 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
.back-to-top {
position: fixed;
bottom: 3rem;
right: 2rem;
left: auto;
transform: none;
z-index: 98;
width: 56px;
height: 56px;
border-radius: 50%;
background: var(--color-brand-primary);
border: 3px solid var(--color-neutral-10);
color: var(--color-neutral-10);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
line-height: 1;
padding: 0;
box-shadow: 0 8px 24px rgba(var(--color-brand-primary-rgb), 0.35), inset 0 0 20px rgba(var(--color-neutral-10-rgb), 0.1);
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
animation: slideUpButton 0.4s ease-out;
flex-shrink: 0;
backdrop-filter: blur(10px);
}
/* Footer variant - inline button */
.back-to-top--footer {
position: static;
bottom: auto;
right: auto;
width: 52px;
height: 52px;
margin: 0 0 0 auto;
animation: none;
}
@keyframes slideUpButton {
from {
opacity: 0;
transform: translateY(40px) scale(0.8);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
.back-to-top:hover {
background: var(--color-brand-primary);
box-shadow: 0 12px 32px rgba(var(--color-brand-primary-rgb), 0.5), inset 0 0 20px rgba(var(--color-neutral-10-rgb), 0.2);
transform: translateY(-6px) scale(1.08);
border-color: var(--color-brand-primary);
}
.back-to-top--footer:hover {
transform: scale(1.08);
}
.back-to-top:active {
transform: translateY(-2px) scale(0.96);
box-shadow: 0 4px 16px rgba(var(--color-brand-primary-rgb), 0.4), inset 0 0 20px rgba(var(--color-neutral-10-rgb), 0.1);
}
/* Footer back-to-top container */
.footer-back-to-top {
margin-left: auto;
display: flex;
align-items: center;
padding: 0 1rem;
}
/* Arrow icon — perfectly centered inside the circle */
.back-to-top-icon {
width: 24px;
height: 24px;
stroke-width: 3;
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
pointer-events: none;
}
/* Home Page Specific Styles */
body.home-page .back-to-top {
background: rgba(var(--color-brand-primary-rgb), 0.95);
box-shadow: 0 6px 20px rgba(var(--color-brand-primary-rgb), 0.4);
}
body.home-page .back-to-top:hover {
background: var(--color-brand-primary);
box-shadow: 0 10px 28px rgba(var(--color-brand-primary-rgb), 0.55);
}
@media screen and (max-width: 768px) {
.back-to-top {
bottom: 2.5rem;
right: 1.5rem;
width: 52px;
height: 52px;
font-size: 1.3rem;
}
.footer-back-to-top {
padding: 0 0.5rem;
}
}
@media screen and (max-width: 480px) {
.back-to-top {
bottom: 2rem;
right: 1rem;
width: 48px;
height: 48px;
font-size: 1.1rem;
border: 2px solid var(--color-neutral-10);
}
.back-to-top--footer {
width: 48px;
height: 48px;
}
.footer-back-to-top {
padding: 0;
flex: 1;
text-align: right;
}
}
@media screen and (max-height: 700px) {
.back-to-top {
bottom: 2rem;
}
}
@media screen and (max-height: 600px) {
.back-to-top {
bottom: 1.5rem;
}
}