aboutsummaryrefslogtreecommitdiff
path: root/anki-card-template/card.css
blob: 2c5309a2865c3c88df7523f59eda0df4cb9f8881 (plain)
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
/* body margin */
body {
	margin: 0;
	width: 100vw;
	height: 100vh;
}

/* vertical center card in body */
body {
	display: flex;
	flex-direction: column;
	justify-content: center;
}

/* default font sizes (mobile) */
.mobile #card .foreign { font-size: 1.75rem; }
.mobile #card .native { font-size: 1.25rem; }

/* default font sizes (desktop) */
#card .foreign { font-size: 1.5rem; }
#card .native { font-size: 1.0rem; }

/* default text alignment and layout */
#card { text-align: center; }
#card > * > span { display: block; }

/* separator defaults */
#separator {
	border: none;
	opacity: 20%;
	margin: 0;
}

/* separator color */
#separator { background-color: black; }
.nightMode #separator,
.night_mode #separator { background-color: white; }

/* separator size */
#card.horizontal-layout #separator { height: 10px; }
#card.vertical-layout #separator { width: 10px; }

/* hide answer and separator on card front */
#card.front #back,
#card.front hr,
#card.front ruby rt.hidden {
	display: none !important;
}

/* extra space above complete translated sentence */
#card #back #sentence-translation { margin-top: 2em; }

/* blur spoiler */
.spoiler {
	transition: filter 300ms;
	cursor: pointer;
}
.spoiler.hidden { filter: blur(0.3rem); }
.spoiler.visible { filter: blur(0rem); }

/* fill display horizontally or vertically */
#card.horizontal-layout { width: 100vw; }
#card.vertical-layout { height: 100vh; }

/* grid column layout for vertical card layout */
#card.vertical-layout > * { grid-row: 1; }
#card.vertical-layout {
	display: grid;
	grid-auto-columns: 1fr auto auto;
}
#card.vertical-layout #back { flex-direction: column; }
#card.vertical-layout #back,
#card.vertical-layout #front {
	display: flex;
	justify-content: center;
}

/* grid column settings */
#card.vertical-layout #back { grid-column: 1; }
#card.vertical-layout #separator { grid-column: 2; }
#card.vertical-layout #front { grid-column: 3; }

/* default text element spacing */
#card.horizontal-layout > * > span,
#card.vertical-layout > #back > span {
	padding: 0 1em;
	margin: 0.5em auto;
}
#card.vertical-layout #sentence {
	padding: 1em 0;
	margin: auto 0.5em;
}

/* vertical japanese text only in sentence */
#card.vertical-layout #sentence { writing-mode: vertical-rl; }

/* max text column width (~30 characters in japanese, ~50 in latin) */
#card.vertical-layout #sentence { max-height: 30em; }
#card.horizontal-layout span,
#card.vertical-layout #back span {
	max-width: 30em;
	margin-left: auto;
	margin-right: auto;
}

/* display kana reading below kanji in vertical layout */
#card.vertical-layout #target-word-reading .reading { display: block; }

/* tag container */
#card #back #tags {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	margin: 2em 0.5em 0.5em 0.5em;
	max-width: unset;
	padding: 10px;
}

/* tag style */
#card #back #tags .tag { background-color: hsl(calc(1deg * var(--tag-hue)), 70%, 75%); }
.nightMode #card #back #tags .tag,
.night_mode #card #back #tags .tag { background-color: hsl(calc(1deg * var(--tag-hue)), 65%, 80%); }
#card #back #tags .tag {
	--tag-hue: 0;
	padding: 4px;
	border-radius: 999px;
	margin: 0;
	transition-property: padding, grid-template-rows, grid-template-columns;
	transition-duration: 0.3s;
	overflow: hidden;
	position: relative;
	display: grid;
	grid-template-rows: 0fr;
	grid-template-columns: 0fr;
}
#card #back #tags .tag .inner {
	position: relative;
	opacity: 0;
	transform: translate(-50%, -50%);
	transition-duration: 0.3s;
	transition-property: opacity, transform;
	white-space: nowrap;
	color: black;
	min-height: 0;
	min-width: 0;
	user-select: none;
	cursor: default;
}

/* tag hover/hold expand */
#card #back #tags:active .tag .inner,
#card #back #tags:hover .tag .inner {
	transform: translate(0%, 0%);
	opacity: 1;
}
#card #back #tags:active .tag,
#card #back #tags:hover .tag {
	grid-template-rows: 1fr;
	grid-template-columns: 1fr;
	padding: 4px 12px;
}

/* display tags vertically on mobile */
.mobile #card.vertical-layout #back #tags { flex-direction: column; }
.mobile #card.vertical-layout #back #tags .tag { max-width: max-content; }

.parse.empty { display: none !important; }