/* Viewport — base, layout and shared components. Tokens live in tokens.css; see DESIGN.md. */

/* ---- base ---------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}
html {
	-webkit-text-size-adjust: 100%;
	scroll-padding-top: calc(var(--bar-h) + var(--s-4));
}
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 400 var(--t-md) / 1.5 var(--font);
	font-stretch: 100%;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}
img,
video,
svg {
	display: block;
	max-width: 100%;
}
img,
video {
	height: auto;
}
a {
	color: inherit;
	text-decoration: none;
}
button,
input,
select {
	font: inherit;
	color: inherit;
}
button {
	cursor: pointer;
	border: 0;
	background: none;
	padding: 0;
}
h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
	margin: 0;
}
ul,
ol {
	padding: 0;
	list-style: none;
}
:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 2px;
}
::selection {
	background: var(--ink);
	color: var(--floor);
}
.vp-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
.vp-skip {
	position: absolute;
	left: var(--s-4);
	top: -10rem;
	z-index: 100;
	padding: var(--s-2) var(--s-4);
	background: var(--ink);
	color: var(--floor);
	font-weight: 600;
}
.vp-skip:focus {
	top: var(--s-2);
}

/* ---- type ---------------------------------------------------------------- */
.vp-display {
	font-stretch: 125%;
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.02em;
}
.vp-data {
	font-stretch: 75%;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.01em;
}
.vp-muted {
	color: var(--ink-2);
}
.vp-prose {
	max-width: 68ch;
	color: var(--ink-2);
}
.vp-prose > * + * {
	margin-top: var(--s-4);
}
.vp-prose h2,
.vp-prose h3 {
	color: var(--ink);
	font-size: var(--t-lg);
	font-weight: 600;
	margin-top: var(--s-6);
}
.vp-prose a,
.vp-link {
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 0.2em;
}
.vp-prose a:hover,
.vp-link:hover {
	text-decoration-color: currentColor;
	color: var(--ink);
}

/* ---- axes ---------------------------------------------------------------- */
.vp-x {
	--axis: var(--x);
}
.vp-y {
	--axis: var(--y);
}
.vp-z {
	--axis: var(--z);
}
/* The axis mark: a short bar in the axis colour followed by its letter. */
.vp-axis {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	color: var(--axis);
	font-stretch: 75%;
	font-weight: 700;
}
.vp-axis::before {
	content: "";
	width: var(--s-5);
	height: 2px;
	background: currentColor;
}

/* ---- layout -------------------------------------------------------------- */
.vp-wrap {
	width: 100%;
	max-width: var(--page);
	margin-inline: auto;
	padding-inline: var(--gutter);
}
.vp-main {
	min-height: 70vh;
	padding-bottom: var(--s-8);
}
.vp-section {
	padding-top: var(--s-7);
}
.vp-head {
	display: flex;
	align-items: baseline;
	gap: var(--s-4);
	margin-bottom: var(--s-4);
}
.vp-head h2 {
	font-size: var(--t-xl);
	font-stretch: 125%;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.1;
}
.vp-head .vp-axis {
	transform: translateY(-0.15em);
}
.vp-head__more {
	margin-left: auto;
	flex: none;
	color: var(--ink-2);
	font-size: var(--t-sm);
	font-weight: 600;
	border-bottom: 1px solid var(--line);
}
.vp-head__more:hover {
	color: var(--ink);
	border-color: var(--axis);
}
.vp-pagehead {
	padding-block: var(--s-6) var(--s-5);
	border-bottom: 1px solid var(--line);
}
.vp-pagehead h1 {
	font-size: clamp(var(--t-2xl), 5vw, var(--t-3xl));
	margin-top: var(--s-2);
}
.vp-pagehead p {
	margin-top: var(--s-3);
	max-width: 68ch;
	color: var(--ink-2);
}

/* ---- top bar ------------------------------------------------------------- */
.vp-bar {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--floor);
	border-bottom: 1px solid var(--line);
}
.vp-bar__in {
	display: flex;
	align-items: center;
	gap: var(--s-4);
	height: var(--bar-h);
}
.vp-logo {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	flex: none;
	font-size: var(--t-lg);
	font-stretch: 125%;
	font-weight: 800;
	letter-spacing: -0.03em;
}
.vp-logo img {
	width: auto;
	height: 2rem;
}
@media (min-width: 768px) {
	.vp-logo img {
		height: 2.25rem;
	}
}
.vp-search {
	position: relative;
	flex: 1;
	min-width: 0;
	max-width: 36rem;
}
.vp-search input {
	width: 100%;
	height: 2.5rem;
	padding: 0 var(--s-4) 0 2.5rem;
	background: var(--panel);
	border: 1px solid transparent;
	border-radius: var(--radius);
}
.vp-search input::placeholder {
	color: var(--ink-2);
}
.vp-search input:focus {
	outline: none;
	border-color: var(--brand);
}
.vp-search svg {
	position: absolute;
	left: var(--s-3);
	top: 50%;
	width: 1.125rem;
	height: 1.125rem;
	transform: translateY(-50%);
	color: var(--ink-2);
	pointer-events: none;
}
.vp-suggest {
	position: absolute;
	inset: calc(100% + var(--s-1)) 0 auto 0;
	max-height: 70vh;
	overflow: auto;
	background: var(--floor);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}
.vp-suggest[hidden] {
	display: none;
}
.vp-suggest a {
	display: flex;
	align-items: center;
	gap: var(--s-3);
	padding: var(--s-2) var(--s-3);
	border-left: 2px solid var(--axis);
}
.vp-suggest a:hover,
.vp-suggest a[aria-selected="true"] {
	background: var(--panel);
}
.vp-suggest span:last-child {
	margin-left: auto;
	color: var(--ink-2);
	font-size: var(--t-sm);
}
.vp-nav {
	display: none;
	margin-left: auto;
	gap: var(--s-1);
}
.vp-nav a {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	height: var(--bar-h);
	padding-inline: var(--s-3);
	font-weight: 600;
	border-bottom: 2px solid transparent;
}
.vp-nav a::before {
	content: attr(data-axis);
	color: var(--axis);
	font-stretch: 75%;
	font-weight: 700;
}
.vp-nav a:hover,
.vp-nav a[aria-current="page"] {
	border-bottom-color: var(--axis);
}
@media (min-width: 768px) {
	.vp-nav {
		display: flex;
	}
}

/* ---- bottom tabs (phones) -------------------------------------------------- */
.vp-tabs {
	position: fixed;
	inset: auto 0 0 0;
	z-index: 50;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	background: var(--floor);
	border-top: 1px solid var(--line);
	padding-bottom: env(safe-area-inset-bottom);
}
.vp-tabs a {
	display: grid;
	justify-items: center;
	gap: 2px;
	padding: var(--s-2) 0;
	font-size: var(--t-xs);
	font-weight: 600;
	color: var(--ink-2);
	border-top: 2px solid transparent;
	margin-top: -1px;
}
.vp-tabs a b {
	color: var(--axis);
	font-size: var(--t-md);
	font-stretch: 75%;
	line-height: 1.2;
}
.vp-tabs a[aria-current="page"] {
	color: var(--ink);
	border-top-color: var(--axis);
}
@media (max-width: 767px) {
	body {
		padding-bottom: calc(3.5rem + env(safe-area-inset-bottom));
	}
}
@media (min-width: 768px) {
	.vp-tabs {
		display: none;
	}
}

/* ---- cards ---------------------------------------------------------------- */
.vp-grid {
	display: grid;
	gap: var(--s-5) var(--s-3);
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
.vp-grid--y {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (min-width: 600px) {
	.vp-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	.vp-grid--y {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
@media (min-width: 1024px) {
	.vp-grid {
		gap: var(--s-6) var(--s-4);
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	.vp-grid--y {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}
@media (min-width: 1440px) {
	.vp-grid {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
	.vp-grid--y {
		grid-template-columns: repeat(8, minmax(0, 1fr));
	}
}
.vp-card {
	position: relative;
	display: block;
	min-width: 0;
}
.vp-card__media {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--panel);
	border-radius: var(--radius);
}
.vp-card--y .vp-card__media {
	aspect-ratio: 3 / 4;
}
.vp-card__media img,
.vp-card__media video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
/* Axis edge: bottom bar for video (doubles as the hover-scrub track), left bar for comics. */
.vp-card__media::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 100%;
	background: var(--axis);
	transform-origin: left;
	transform: scaleX(var(--scrub, 1));
}
.vp-card--y .vp-card__media::after {
	width: 2px;
	height: 100%;
	transform: none;
}
.vp-card__n {
	position: absolute;
	right: var(--s-1);
	bottom: calc(var(--s-1) + 2px);
	padding: 0 var(--s-1);
	background: var(--floor);
	border-radius: 2px;
	font-size: var(--t-xs);
	line-height: 1.5;
}
.vp-card__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin-top: var(--s-2);
	font-size: var(--t-sm);
	font-weight: 600;
	line-height: 1.35;
}
.vp-card__sub {
	display: block;
	overflow: hidden;
	color: var(--ink-2);
	font-size: var(--t-xs);
	text-overflow: ellipsis;
	white-space: nowrap;
}
.vp-card:hover .vp-card__title {
	text-decoration: underline;
	text-decoration-color: var(--axis);
	text-underline-offset: 0.2em;
}
/* The whole card is one link target without nesting interactive content. */
.vp-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* ---- rails ------------------------------------------------------------------ */
.vp-rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 62%;
	gap: var(--s-3);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	margin-inline: calc(var(--gutter) * -1);
	padding-inline: var(--gutter);
	scroll-padding-inline: var(--gutter);
}
.vp-rail::-webkit-scrollbar {
	display: none;
}
.vp-rail > * {
	scroll-snap-align: start;
}
.vp-rail--y {
	grid-auto-columns: 36%;
}
@media (min-width: 600px) {
	.vp-rail {
		grid-auto-columns: 38%;
	}
	.vp-rail--y {
		grid-auto-columns: 22%;
	}
}
@media (min-width: 1024px) {
	.vp-rail {
		grid-auto-columns: calc((100% - var(--s-3) * 4) / 5);
	}
	.vp-rail--y {
		grid-auto-columns: calc((100% - var(--s-3) * 7) / 8);
	}
}

/* ---- render tiles: justified rows at real aspect ratios ------------------------ */
.vp-tiles {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-1);
	--row: 9rem;
}
.vp-tiles::after {
	content: "";
	flex-grow: 1e4;
}
@media (min-width: 768px) {
	.vp-tiles {
		--row: 13rem;
		gap: var(--s-2);
	}
}
.vp-tile {
	position: relative;
	flex: var(--r, 1) 1 calc(var(--r, 1) * var(--row));
	height: var(--row);
	overflow: hidden;
	background: var(--panel);
	border-radius: var(--radius);
}
.vp-tile img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.vp-tile span {
	position: absolute;
	inset: auto 0 0 0;
	padding: var(--s-2);
	background: var(--floor);
	border-top: 2px solid var(--z);
	font-size: var(--t-xs);
	font-weight: 600;
	line-height: 1.3;
	transform: translateY(100%);
	transition: transform 0.15s var(--ease);
}
.vp-tile:hover span,
.vp-tile:focus-visible span {
	transform: none;
}

/* ---- chips, tabs, index ---------------------------------------------------------- */
.vp-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-2);
}
.vp-chip {
	display: inline-flex;
	align-items: baseline;
	gap: var(--s-2);
	padding: var(--s-1) var(--s-3);
	background: var(--panel);
	border-radius: var(--radius);
	border-left: 2px solid var(--axis);
	font-size: var(--t-sm);
	font-weight: 600;
}
.vp-chip:hover,
.vp-chip[aria-current="page"],
.vp-chip[aria-pressed="true"] {
	background: var(--ink);
	color: var(--floor);
}
.vp-chip .vp-data {
	font-size: var(--t-xs);
	opacity: 0.7;
}
.vp-switch {
	display: flex;
	gap: var(--s-5);
	overflow-x: auto;
	scrollbar-width: none;
	border-bottom: 1px solid var(--line);
}
.vp-switch a {
	flex: none;
	padding-block: var(--s-3);
	margin-bottom: -1px;
	color: var(--ink-2);
	font-weight: 600;
	border-bottom: 2px solid transparent;
}
.vp-switch a:hover {
	color: var(--ink);
}
.vp-switch a[aria-current="page"],
.vp-switch a[aria-current="true"] {
	color: var(--ink);
	border-bottom-color: var(--axis);
}
.vp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-3) var(--s-5);
	margin-block: var(--s-4) var(--s-5);
}
.vp-index {
	columns: 2;
	column-gap: var(--s-5);
}
@media (min-width: 600px) {
	.vp-index {
		columns: 3;
	}
}
@media (min-width: 1024px) {
	.vp-index {
		columns: 5;
	}
}
.vp-index li {
	break-inside: avoid;
}
.vp-index a {
	display: flex;
	align-items: baseline;
	gap: var(--s-2);
	padding-block: var(--s-1);
	font-size: var(--t-sm);
}
.vp-index a:hover {
	text-decoration: underline;
	text-decoration-color: var(--axis);
	text-underline-offset: 0.2em;
}
.vp-index .vp-data {
	color: var(--ink-2);
	font-size: var(--t-xs);
}
.vp-index__letter {
	margin-top: var(--s-4);
	color: var(--axis);
	font-stretch: 125%;
	font-weight: 800;
	break-after: avoid;
}
.vp-az {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-1);
	margin-block: var(--s-4);
}
.vp-az a {
	min-width: 2rem;
	padding: var(--s-1);
	text-align: center;
	background: var(--panel);
	border-radius: var(--radius);
	font-weight: 600;
}
.vp-az a:hover,
.vp-az a[aria-current="page"] {
	background: var(--ink);
	color: var(--floor);
}

/* ---- buttons, pager, empty state ---------------------------------------------- */
.vp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--s-2);
	min-height: 2.75rem;
	padding: 0 var(--s-5);
	background: var(--ink);
	color: var(--floor);
	border-radius: var(--radius);
	font-weight: 700;
}
.vp-btn:hover {
	background: var(--brand);
}
.vp-btn--quiet {
	background: var(--panel);
	color: var(--ink);
}
.vp-btn--quiet:hover {
	background: var(--line);
}
.vp-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--s-4);
	margin-top: var(--s-7);
}
.vp-pager[hidden] {
	display: none;
}
.vp-empty {
	padding: var(--s-8) 0;
	max-width: 40ch;
}
.vp-empty h2 {
	font-size: var(--t-xl);
	font-stretch: 125%;
	font-weight: 800;
}
.vp-empty p {
	margin-block: var(--s-3) var(--s-5);
	color: var(--ink-2);
}

/* ---- facts (definition table used on video, render and comic pages) -------------- */
.vp-facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--s-2) var(--s-5);
	font-size: var(--t-sm);
}
.vp-facts dt {
	color: var(--ink-2);
}
.vp-facts dd a {
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 0.2em;
}
.vp-facts dd a:hover {
	text-decoration-color: var(--axis);
}
.vp-crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-2);
	color: var(--ink-2);
	font-size: var(--t-sm);
}
.vp-crumbs li + li::before {
	content: "/";
	margin-right: var(--s-2);
	color: var(--line);
}
.vp-crumbs a:hover {
	color: var(--ink);
}

/* ---- footer ------------------------------------------------------------------------- */
.vp-foot {
	background: var(--floor);
	border-top: 1px solid var(--line);
	padding-block: var(--s-7);
	color: var(--ink-2);
	font-size: var(--t-sm);
}
.vp-foot__cols {
	display: grid;
	gap: var(--s-6);
	grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px) {
	.vp-foot__cols {
		grid-template-columns: 2fr repeat(3, 1fr);
	}
}
.vp-foot h2 {
	margin-bottom: var(--s-3);
	color: var(--ink);
	font-size: var(--t-sm);
	font-weight: 700;
}
.vp-foot li + li {
	margin-top: var(--s-2);
}
.vp-foot a:hover {
	color: var(--ink);
}
.vp-foot__about {
	margin-top: var(--s-3);
	max-width: 36ch;
}
.vp-foot__legal {
	margin-top: var(--s-6);
	padding-top: var(--s-5);
	border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
