/*
 * PureCSS.com
 * https://purecss.com/vertical-text/
 * Vertical text with writing-mode: a label down a card edge, book spines and table headers, plus upright letters and vertical Japanese.
 */

.demo-vertical-text .vt-trio {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
	align-items: end;
	gap: 2rem 1.5rem;
	width: 100%;
	max-width: 48rem;
}

.demo-vertical-text .vt-item {
	display: grid;
	justify-items: center;
	gap: .7rem;
	margin: 0;
}

.demo-vertical-text .vt-item figcaption {
	font-family: var(--font-mono);
	font-size: .75rem;
	color: var(--text-muted);
}

/* 1. a section label down the edge of a card, read bottom to top */
.demo-vertical-text .vt-card {
	display: flex;
	width: 100%;
	max-width: 15rem;
	height: 11rem;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface-2);
}

/* the fallback: top to bottom, then turned over so it reads upward */
.demo-vertical-text .vt-edge {
	writing-mode: vertical-rl;
	rotate: 180deg;
	padding: .9rem .5rem;
	font-size: .72rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: #0c0c0d;
	background: #57d9a3;
}

.demo-vertical-text .vt-body {
	padding: 1rem 1.1rem;
}

.demo-vertical-text .vt-body-title {
	margin: 0 0 .4rem;
	font-weight: 700;
	color: var(--text);
}

.demo-vertical-text .vt-body-text {
	margin: 0;
	font-size: .85rem;
	line-height: 1.55;
	color: var(--text-muted);
}

/* 2. a shelf of spines, read top to bottom like a book on its shelf */
.demo-vertical-text .vt-shelf {
	display: flex;
	align-items: flex-end;
	gap: 3px;
	height: 11rem;
	padding: 0 .6rem;
	border-bottom: 8px solid #8a5a3c;
	border-radius: 0 0 4px 4px;
}

.demo-vertical-text .vt-spine {
	writing-mode: vertical-rl;
	box-sizing: border-box;
	height: var(--vt-h, 85%);
	padding: .8rem var(--vt-pad, .5rem);
	border-radius: 3px 3px 0 0;
	font-size: .8rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	color: #0c0c0d;
	background: var(--vt-c, #38bdf8);
	box-shadow: inset 0 .45rem 0 rgba(0, 0, 0, .16), inset 0 -.45rem 0 rgba(0, 0, 0, .16);
}

.demo-vertical-text .vt-spine:nth-child(1) { --vt-h: 86%; --vt-c: #38bdf8; }
.demo-vertical-text .vt-spine:nth-child(2) { --vt-h: 72%; --vt-c: #ffd444; --vt-pad: .7rem; }
.demo-vertical-text .vt-spine:nth-child(3) { --vt-h: 94%; --vt-c: #f472b6; }
.demo-vertical-text .vt-spine:nth-child(4) { --vt-h: 66%; --vt-c: #57d9a3; --vt-pad: .4rem; }
.demo-vertical-text .vt-spine:nth-child(5) { --vt-h: 82%; --vt-c: #c084fc; --vt-pad: .65rem; }
.demo-vertical-text .vt-spine:nth-child(6) { --vt-h: 78%; --vt-c: #ff9040; }

/* 3. table headers that run upward, so narrow number columns stay narrow */
.demo-vertical-text .vt-table {
	border-collapse: collapse;
	font-size: .85rem;
	color: var(--text);
}

.demo-vertical-text .vt-table th,
.demo-vertical-text .vt-table td {
	padding: .4rem .55rem;
	border: 1px solid var(--border);
}

.demo-vertical-text .vt-table thead th {
	vertical-align: bottom;
	font-weight: 600;
	text-align: left;
}

.demo-vertical-text .vt-table thead th + th {
	writing-mode: vertical-rl;
	rotate: 180deg;
	padding: .55rem .4rem;
}

.demo-vertical-text .vt-table td {
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.demo-vertical-text .vt-table tbody th {
	font-weight: 600;
	text-align: left;
}

/* the home card: the shelf alone */
.card-preview .demo-vertical-text .vt-shelf {
	height: 150px;
}

/* where sideways-lr exists it reads upward on its own, with no turn */
@supports (writing-mode: sideways-lr) {
	.demo-vertical-text .vt-edge,
	.demo-vertical-text .vt-table thead th + th {
		writing-mode: sideways-lr;
		rotate: none;
	}
}

/* ── Variant: writing-mode versus rotate ── */

.demo-vertical-text .vt-compare {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 1.5rem;
	width: 100%;
	max-width: 40rem;
}

.demo-vertical-text .vt-case {
	display: grid;
	gap: .6rem;
	margin: 0;
}

.demo-vertical-text .vt-case figcaption {
	font-family: var(--font-mono);
	font-size: .75rem;
	color: var(--text-muted);
}

/* a row with something after the label, so the space it takes is plain */
.demo-vertical-text .vt-row {
	display: flex;
	align-items: center;
	gap: .5rem;
	height: 11rem;
	padding: 0 .75rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface-2);
}

/* the dashed box is the space the label holds in the layout. grid, so every
   engine wraps it round a vertical child: as a plain block WebKit measured it
   narrower than the label inside it */
.demo-vertical-text .vt-slot {
	display: grid;
	flex: none;
	outline: 1px dashed var(--coral);
	outline-offset: 2px;
}

.demo-vertical-text .vt-tab {
	display: block;
	padding: .5rem .7rem;
	border-radius: 6px;
	font-weight: 700;
	white-space: nowrap;
	color: #0c0c0d;
	background: #c084fc;
}

.demo-vertical-text .vt-rotated {
	transform: rotate(-90deg);
}

.demo-vertical-text .vt-turned {
	writing-mode: vertical-rl;
	rotate: 180deg;
}

.demo-vertical-text .vt-next {
	flex: 1;
	align-self: stretch;
	margin: .75rem 0;
	border-radius: 6px;
	background: repeating-linear-gradient(135deg, var(--border) 0 6px, transparent 6px 12px);
}

@supports (writing-mode: sideways-lr) {
	.demo-vertical-text .vt-turned {
		writing-mode: sideways-lr;
		rotate: none;
	}
}

/* ── Variant: upright letters ── */

.demo-vertical-text .vt-signs {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: center;
	gap: 2.5rem;
}

.demo-vertical-text .vt-sign {
	writing-mode: vertical-rl;
	margin: 0;
	padding: 1rem .7rem;
	border: 2px solid var(--rose);
	border-radius: 10px;
	font-size: 1.6rem;
	font-weight: 800;
	line-height: 1;
	color: var(--rose);
}

.demo-vertical-text .vt-signs .vt-case {
	justify-items: center;
}

.demo-vertical-text .vt-upright {
	text-orientation: upright;
	text-transform: uppercase;
	letter-spacing: .12em;
}

/* ── Variant: vertical Japanese ── */

.demo-vertical-text .vt-cjk {
	writing-mode: vertical-rl;
	height: 15rem;
	margin: 0;
	padding: 1rem 1.2rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
	font-size: 1.2rem;
	line-height: 1.9;
	color: var(--text);
	background: var(--surface-2);
}

.demo-vertical-text .vt-cjk-title {
	margin: 0 0 0 .6rem;
	font-weight: 700;
	color: var(--accent);
}

.demo-vertical-text .vt-cjk p {
	margin: 0;
}

/* two digits set side by side inside one character's space */
.demo-vertical-text .vt-tcy {
	text-combine-upright: all;
}
