Repository navigation
Expand file tree
/
Copy pathnanobox.css
More file actions
222 lines (212 loc) · 4.48 KB
/
Copy pathnanobox.css
File metadata and controls
222 lines (212 loc) · 4.48 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/*!
* NanoBox v1.0.0 — nanobox.css
*/
:root {
--nb-z: 9999;
--nb-dur: 280ms;
--nb-ease: cubic-bezier(0.4, 0, 0.2, 1);
--nb-r: 8px;
--nb-shadow: 0 16px 60px rgba(0, 0, 0, 0.8);
--nb-overlay: rgba(6, 6, 10, 0.92);
}
/* overlay */
.nb-overlay {
position: fixed;
inset: 0;
z-index: var(--nb-z);
background: var(--nb-overlay);
opacity: 0;
pointer-events: none;
transition: opacity var(--nb-dur) var(--nb-ease);
}
.nb-overlay.nb-on {
opacity: 1;
pointer-events: auto;
}
/*
WRAP — centering layer
─────────────────────
overflow-y:auto collapses the flex container height to its content.
min-height:100vh restores the full viewport height so that
align-items:center + justify-content:center can actually centre
the child in both axes.
*/
.nb-wrap {
position: fixed;
inset: 0;
z-index: calc(var(--nb-z) + 1);
display: flex;
align-items: center;
justify-content: center;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
min-height: 100vh;
padding: 20px;
outline: none;
opacity: 0;
pointer-events: none;
transform: scale(0.96) translateY(8px);
transition:
opacity var(--nb-dur) var(--nb-ease),
transform var(--nb-dur) var(--nb-ease);
}
.nb-wrap.nb-on {
opacity: 1;
pointer-events: auto;
transform: none;
}
/* box — no fixed dimensions; sized by its content or by JS */
.nb-box {
position: relative;
flex-shrink: 0;
max-width: calc(100vw - 40px);
}
/* close button */
.nb-close {
position: absolute;
top: -13px;
right: -13px;
z-index: 2;
width: 36px;
height: 36px;
padding: 0;
border: none;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.15);
color: #fff;
cursor: pointer;
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
outline: none;
transition:
background var(--nb-dur),
transform var(--nb-dur);
}
.nb-close:hover {
background: rgba(255, 255, 255, 0.3);
transform: rotate(90deg);
}
.nb-close:focus-visible {
outline: 2px solid rgba(255, 255, 255, 0.6);
outline-offset: 2px;
}
/* spinner */
.nb-spin {
display: none;
position: absolute;
inset: 0;
align-items: center;
justify-content: center;
min-width: 160px;
min-height: 120px;
pointer-events: none;
z-index: 1;
}
.nb-spin.on {
display: flex;
}
.nb-ring {
width: 34px;
height: 34px;
border-radius: 50%;
border: 3px solid rgba(255, 255, 255, 0.15);
border-top-color: #fff;
animation: nb-spin 0.65s linear infinite;
}
@keyframes nb-spin {
to {
transform: rotate(360deg);
}
}
/*
IMAGE
─────
Plain <img> appended directly to .nb-box — no wrapper, no iframe.
JS sets explicit px width + height after onload so the box
hugs the image exactly and flex centering works correctly.
max-* are safety fallbacks only.
*/
.nb-img {
display: block;
/* width + height set by JS after onload */
max-width: min(900px, calc(100vw - 40px));
max-height: calc(100vh - 40px);
border-radius: var(--nb-r);
box-shadow: var(--nb-shadow);
user-select: none;
-webkit-user-select: none;
}
/*
VIDEO / IFRAME (the "youtube style")
──────────────
Fixed width + 16:9 padding-bottom ratio wrapper.
The image now matches this centering behaviour.
*/
.nb-vid-wrap {
width: min(900px, calc(100vw - 40px));
border-radius: var(--nb-r);
overflow: hidden;
box-shadow: var(--nb-shadow);
background: #000;
}
.nb-ratio {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
}
.nb-ratio iframe {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
border: none;
display: block;
}
/* INLINE */
.nb-inline-wrap {
width: min(580px, calc(100vw - 40px));
max-height: 80vh;
overflow-y: auto;
border-radius: var(--nb-r);
background: #fff;
color: #111;
padding: 32px 36px;
box-shadow: var(--nb-shadow);
font-family: system-ui, sans-serif;
font-size: 1rem;
line-height: 1.65;
}
/* error */
.nb-error {
padding: 24px 32px;
margin: 0;
color: #ff6b6b;
background: rgba(255, 255, 255, 0.06);
border-radius: var(--nb-r);
font-family: system-ui, sans-serif;
font-size: 0.95rem;
}
@media (max-width: 600px) {
.nb-close {
width: 30px;
height: 30px;
top: -10px;
right: -8px;
}
.nb-inline-wrap {
padding: 20px 18px;
}
}
@media (prefers-reduced-motion: reduce) {
.nb-overlay,
.nb-wrap {
transition-duration: 1ms !important;
}
.nb-ring {
animation-duration: 1.5s;
}
}