/* VideoShare design system, Phase 1.
 * Direction: "projection room". Deep ink surfaces, a projector-amber accent
 * used only for primary actions and the current location, quiet neutrals elsewhere.
 * Mobile first. Tokens first, components after. */

/* ---------- Tokens ---------- */
:root {
	--vs-accent: #f2a30f;
	--vs-accent-hover: color-mix(in srgb, var(--vs-accent) 86%, #000);
	--vs-on-accent: #1b1400;

	--vs-bg: #f6f7f9;
	--vs-surface: #ffffff;
	--vs-surface-2: #eceef2;
	--vs-border: #dfe3e9;
	--vs-text: #12161c;
	--vs-muted: #586271;
	--vs-link: #8a5600;
	--vs-focus: #1f5fe0;
	--vs-overlay: rgba(10, 14, 20, 0.5);
	--vs-shadow: 0 8px 28px rgba(12, 18, 28, 0.14);

	--vs-font: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
	--vs-text-xs: 0.75rem;
	--vs-text-sm: 0.875rem;
	--vs-text-md: 1rem;
	--vs-text-lg: 1.25rem;
	--vs-text-xl: 1.75rem;

	--vs-space-1: 4px;
	--vs-space-2: 8px;
	--vs-space-3: 12px;
	--vs-space-4: 16px;
	--vs-space-5: 24px;
	--vs-space-6: 32px;

	--vs-radius-sm: 6px;
	--vs-radius-md: 12px;
	--vs-radius-pill: 999px;

	--vs-header-h: 60px;
	--vs-sidebar-w: 236px;
	--vs-adminbar: 0px;
	--vs-ease: cubic-bezier(0.2, 0.7, 0.2, 1);

	color-scheme: light;
}

html[data-theme="dark"] {
	--vs-bg: #0d1015;
	--vs-surface: #151a21;
	--vs-surface-2: #1e252e;
	--vs-border: #28313c;
	--vs-text: #e9edf3;
	--vs-muted: #9ba6b4;
	--vs-link: #f2b63f;
	--vs-focus: #7aa7ff;
	--vs-overlay: rgba(0, 0, 0, 0.62);
	--vs-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
	color-scheme: dark;
}

html[data-sidebar="collapsed"] { --vs-sidebar-w: 76px; }

body.admin-bar { --vs-adminbar: 32px; }
@media (max-width: 782px) { body.admin-bar { --vs-adminbar: 46px; } }
@media (max-width: 600px) { body.admin-bar { --vs-adminbar: 0px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--vs-header-h) + var(--vs-adminbar) + 12px); }
body {
	margin: 0;
	background: var(--vs-bg);
	color: var(--vs-text);
	font-family: var(--vs-font);
	font-size: var(--vs-text-md);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--vs-link); text-underline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 var(--vs-space-3); }
:focus-visible { outline: 3px solid var(--vs-focus); outline-offset: 2px; border-radius: var(--vs-radius-sm); }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.vs-skip-link {
	position: absolute; left: var(--vs-space-3); top: -60px; z-index: 1000;
	background: var(--vs-accent); color: var(--vs-on-accent); padding: var(--vs-space-2) var(--vs-space-4);
	border-radius: var(--vs-radius-sm); text-decoration: none; font-weight: 600;
}
.vs-skip-link:focus { top: var(--vs-space-3); }

/* ---------- Buttons ---------- */
.vs-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--vs-space-2);
	min-height: 40px; padding: 0 var(--vs-space-4);
	border: 1px solid transparent; border-radius: var(--vs-radius-pill);
	font: inherit; font-size: var(--vs-text-sm); font-weight: 600; text-decoration: none; cursor: pointer;
	transition: background-color 0.15s var(--vs-ease), border-color 0.15s var(--vs-ease);
}
.vs-btn--primary { background: var(--vs-accent); color: var(--vs-on-accent); }
.vs-btn--primary:hover { background: var(--vs-accent-hover); }
.vs-btn--soft { background: var(--vs-surface-2); color: var(--vs-text); }
.vs-btn--soft:hover { border-color: var(--vs-border); }
.vs-btn--ghost { background: transparent; color: var(--vs-text); border-color: var(--vs-border); }
.vs-btn--ghost:hover { background: var(--vs-surface-2); }

.vs-icon-btn {
	display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
	border: 0; border-radius: 50%; background: transparent; color: var(--vs-text); cursor: pointer;
	transition: background-color 0.15s var(--vs-ease);
}
.vs-icon-btn:hover { background: var(--vs-surface-2); }

/* ---------- Header ---------- */
.vs-header {
	position: sticky; top: var(--vs-adminbar); z-index: 100;
	display: flex; align-items: center; gap: var(--vs-space-3);
	height: var(--vs-header-h); padding: 0 var(--vs-space-3);
	background: var(--vs-surface); border-bottom: 1px solid var(--vs-border);
}
.vs-header__start, .vs-header__end { display: flex; align-items: center; gap: var(--vs-space-1); flex: 0 0 auto; }
.vs-header__end { margin-left: auto; gap: var(--vs-space-2); }
.vs-header__center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }

.vs-logo { display: inline-flex; align-items: center; gap: var(--vs-space-2); color: var(--vs-text); text-decoration: none; font-weight: 700; font-size: var(--vs-text-lg); letter-spacing: -0.01em; }
.vs-logo img { display: block; max-height: 36px; width: auto; }
.vs-logo__mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--vs-accent); color: var(--vs-on-accent); }
.vs-logo__mark svg { fill: currentColor; stroke: none; }
.vs-logo__text { display: none; }

.vs-search { display: flex; width: 100%; max-width: 640px; }
.vs-search__input {
	flex: 1 1 auto; min-width: 0; height: 42px; padding: 0 var(--vs-space-4);
	border: 1px solid var(--vs-border); border-right: 0; border-radius: var(--vs-radius-pill) 0 0 var(--vs-radius-pill);
	background: var(--vs-bg); color: var(--vs-text); font: inherit; font-size: var(--vs-text-md);
}
.vs-search__input::placeholder { color: var(--vs-muted); }
.vs-search__input:focus { outline: none; border-color: var(--vs-focus); box-shadow: 0 0 0 2px var(--vs-focus); position: relative; z-index: 1; }
.vs-search__submit {
	display: grid; place-items: center; width: 56px; height: 42px; padding: 0;
	border: 1px solid var(--vs-border); border-radius: 0 var(--vs-radius-pill) var(--vs-radius-pill) 0;
	background: var(--vs-surface-2); color: var(--vs-text); cursor: pointer;
}
.vs-search__submit:hover { background: var(--vs-border); }

.vs-theme-icon { display: grid; place-items: center; }
.vs-theme-icon--sun { display: none; }
html[data-theme="dark"] .vs-theme-icon--sun { display: grid; }
html[data-theme="dark"] .vs-theme-icon--moon { display: none; }

.vs-avatar-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.vs-avatar { width: 36px; height: 36px; border-radius: 50%; display: block; object-fit: cover; }
.vs-user-menu { position: relative; }
.vs-user-menu__panel {
	position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: var(--vs-space-2);
	background: var(--vs-surface); border: 1px solid var(--vs-border); border-radius: var(--vs-radius-md); box-shadow: var(--vs-shadow);
}
.vs-user-menu__name { margin: 0; padding: var(--vs-space-2) var(--vs-space-3); font-weight: 700; border-bottom: 1px solid var(--vs-border); margin-bottom: var(--vs-space-2); }
.vs-user-menu__item {
	display: flex; align-items: center; gap: var(--vs-space-3); padding: var(--vs-space-3);
	color: var(--vs-text); text-decoration: none; border-radius: var(--vs-radius-sm); font-size: var(--vs-text-sm);
}
.vs-user-menu__item:hover { background: var(--vs-surface-2); }

/* Small screens: search lives behind a toggle; secondary actions hide. */
.vs-header__center { display: none; }
.vs-header.is-search-open .vs-header__start,
.vs-header.is-search-open .vs-header__end > :not(.vs-search-toggle) { display: none; }
.vs-header.is-search-open .vs-header__center { display: flex; }
.vs-header.is-search-open .vs-header__end { margin-left: 0; }
.vs-header__upload span, .vs-header__register { display: none; }

@media (min-width: 640px) {
	.vs-header { padding: 0 var(--vs-space-4); gap: var(--vs-space-4); }
	.vs-header__center, .vs-header.is-search-open .vs-header__center { display: flex; }
	.vs-search-toggle { display: none; }
	.vs-logo__text { display: inline; }
	.vs-header__upload span, .vs-header__register { display: inline; }
}

/* ---------- Shell, sidebar ---------- */
.vs-shell { position: relative; }
.vs-sidebar {
	position: fixed; z-index: 90; left: 0; bottom: 0; top: calc(var(--vs-header-h) + var(--vs-adminbar));
	width: 272px; max-width: 86vw; overflow-y: auto; overscroll-behavior: contain;
	padding: var(--vs-space-3); background: var(--vs-surface); border-right: 1px solid var(--vs-border);
	transform: translateX(-100%); visibility: hidden;
	transition: transform 0.22s var(--vs-ease), visibility 0s linear 0.22s;
}
body.vs-sidebar-open .vs-sidebar { transform: none; visibility: visible; transition-delay: 0s; }
.vs-overlay { position: fixed; z-index: 80; inset: calc(var(--vs-header-h) + var(--vs-adminbar)) 0 0 0; background: var(--vs-overlay); }
.vs-overlay[hidden] { display: none; }

.vs-nav ul { list-style: none; margin: 0; padding: 0; }
.vs-nav__group { padding: var(--vs-space-2) 0; border-bottom: 1px solid var(--vs-border); }
.vs-nav__group:last-child { border-bottom: 0; }
.vs-nav__link, .vs-nav__group--custom a {
	display: flex; align-items: center; gap: var(--vs-space-4); min-height: 44px; padding: 0 var(--vs-space-3);
	color: var(--vs-text); text-decoration: none; border-radius: var(--vs-radius-sm); font-size: var(--vs-text-sm);
}
.vs-nav__link:hover, .vs-nav__group--custom a:hover { background: var(--vs-surface-2); }
.vs-nav__link.is-current { background: var(--vs-surface-2); font-weight: 700; box-shadow: inset 3px 0 0 var(--vs-accent); }

@media (min-width: 1024px) {
	.vs-sidebar { width: var(--vs-sidebar-w); max-width: none; transform: none; visibility: visible; transition: width 0.2s var(--vs-ease); }
	.vs-overlay { display: none !important; }
	.vs-main { margin-left: var(--vs-sidebar-w); transition: margin-left 0.2s var(--vs-ease); }
	.vs-footer { margin-left: var(--vs-sidebar-w); transition: margin-left 0.2s var(--vs-ease); }

	/* Collapsed rail: icon over a small label. */
	html[data-sidebar="collapsed"] .vs-nav__link { flex-direction: column; justify-content: center; gap: 2px; min-height: 62px; padding: var(--vs-space-2) 0; font-size: 0.6875rem; text-align: center; }
	html[data-sidebar="collapsed"] .vs-nav__label { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	html[data-sidebar="collapsed"] .vs-nav__group--custom { display: none; }
}

/* ---------- Main content ---------- */
.vs-main { min-height: calc(100vh - var(--vs-header-h)); outline: none; }
.vs-container { padding: var(--vs-space-4); max-width: 2200px; margin: 0 auto; }
.vs-container--narrow { max-width: 820px; }
@media (min-width: 900px) { .vs-container { padding: var(--vs-space-5); } }

.vs-page-header { margin-bottom: var(--vs-space-5); }
.vs-page-title { font-size: var(--vs-text-xl); letter-spacing: -0.01em; }
.vs-page-desc { color: var(--vs-muted); max-width: 70ch; }
.vs-empty { padding: var(--vs-space-6) 0; max-width: 60ch; }
.vs-empty p { color: var(--vs-muted); margin-bottom: var(--vs-space-5); }
.vs-breadcrumbs { font-size: var(--vs-text-sm); color: var(--vs-muted); margin-bottom: var(--vs-space-3); }

/* ---------- Video grid ---------- */
.vs-grid { display: grid; gap: var(--vs-space-5) var(--vs-space-4); grid-template-columns: 1fr; }
@media (min-width: 600px)  { .vs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px)  { .vs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .vs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1700px) { .vs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- Video card ---------- */
.vs-card { display: flex; flex-direction: column; gap: var(--vs-space-3); min-width: 0; }
.vs-card__thumb {
	position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
	border-radius: var(--vs-radius-md); background: var(--vs-surface-2);
}
.vs-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s var(--vs-ease); }
.vs-card:hover .vs-card__thumb img { transform: scale(1.04); }
.vs-card__placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--vs-muted); }
.vs-card__placeholder svg { fill: currentColor; stroke: none; }
.vs-card__duration {
	position: absolute; right: var(--vs-space-2); bottom: var(--vs-space-2); padding: 1px 6px;
	border-radius: var(--vs-radius-sm); background: rgba(0, 0, 0, 0.82); color: #fff; font-size: var(--vs-text-xs); font-weight: 600; font-variant-numeric: tabular-nums;
}
.vs-card__title { margin: 0; font-size: var(--vs-text-md); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vs-card__title a { color: var(--vs-text); text-decoration: none; }
.vs-card__title a:hover { text-decoration: underline; }
.vs-card__meta { margin: var(--vs-space-1) 0 0; color: var(--vs-muted); font-size: var(--vs-text-sm); display: flex; flex-wrap: wrap; gap: 0 var(--vs-space-2); }

/* ---------- Prose, pagination, comments, footer ---------- */
.vs-prose { overflow-wrap: anywhere; }
.vs-prose p, .vs-prose ul, .vs-prose ol { max-width: 72ch; }
.vs-prose img { border-radius: var(--vs-radius-sm); }

.navigation.pagination { margin: var(--vs-space-6) 0; }
.navigation.pagination .nav-links { display: flex; flex-wrap: wrap; gap: var(--vs-space-2); justify-content: center; }
.navigation.pagination .page-numbers {
	display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--vs-space-4);
	border: 1px solid var(--vs-border); border-radius: var(--vs-radius-pill); color: var(--vs-text); text-decoration: none; font-size: var(--vs-text-sm);
}
.navigation.pagination .page-numbers.current { background: var(--vs-accent); border-color: var(--vs-accent); color: var(--vs-on-accent); font-weight: 700; }

.vs-comments { margin-top: var(--vs-space-6); }
.vs-comments__list { list-style: none; padding: 0; }
.vs-comments input[type="text"], .vs-comments input[type="email"], .vs-comments input[type="url"], .vs-comments textarea {
	width: 100%; padding: var(--vs-space-3); border: 1px solid var(--vs-border); border-radius: var(--vs-radius-sm); background: var(--vs-surface); color: var(--vs-text); font: inherit;
}
.vs-comments .submit { min-height: 40px; padding: 0 var(--vs-space-5); border: 0; border-radius: var(--vs-radius-pill); background: var(--vs-accent); color: var(--vs-on-accent); font: inherit; font-weight: 700; cursor: pointer; }

.vs-footer { border-top: 1px solid var(--vs-border); color: var(--vs-muted); font-size: var(--vs-text-sm); }
.vs-footer__inner { display: flex; flex-wrap: wrap; gap: var(--vs-space-3) var(--vs-space-5); justify-content: space-between; padding: var(--vs-space-5) var(--vs-space-4); }
.vs-footer__copy { margin: 0; }
.vs-footer__menu { display: flex; flex-wrap: wrap; gap: var(--vs-space-4); list-style: none; margin: 0; padding: 0; }
.vs-footer__menu a { color: var(--vs-muted); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
	.vs-card:hover .vs-card__thumb img { transform: none; }
}
