/**
 * VirtualMind Hub — main stylesheet.
 *
 * Mobile-first. Sections: design tokens, reset, base typography, layout.
 */

/* ------------------------------------------------------------------------
 * Design tokens
 * --------------------------------------------------------------------- */

:root {
	/*
	 * Palette — dark slate with blue accent.
	 * WCAG AA notes: --vm-primary is for GRAPHICS (bars, icons, focus
	 * rings — 3:1 ok); text links use --vm-link (4.5:1 on surface);
	 * button backgrounds use --vm-primary-deep (white text 4.5:1+).
	 * --vm-text-muted lightened from #94a3b8 (4.4:1 on surface, AA
	 * fail) to #a3b0c4 (5.2:1).
	 * Mirrored hexes live in inc/login-branding.php — keep in sync.
	 */
	--vm-primary:      #3b82f6;
	--vm-primary-deep: #2563eb;
	--vm-link:         #60a5fa;
	--vm-bg:           #0f172a;
	--vm-surface:      #1e293b;
	--vm-text:         #e2e8f0;
	--vm-text-muted:   #a3b0c4;
	--vm-border:       #334155;

	/* Status colors. */
	--vm-success:    #22c55e;
	--vm-warning:    #f59e0b;
	--vm-danger:     #ef4444;

	/* Shape. */
	--vm-radius:     8px;
}

/* ------------------------------------------------------------------------
 * Reset
 * --------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	-webkit-text-size-adjust: 100%;
}

img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
	height: auto;
}

input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

ul[class],
ol[class] {
	list-style: none;
}

/* ------------------------------------------------------------------------
 * Base typography
 * --------------------------------------------------------------------- */

body {
	background-color: var(--vm-bg);
	color: var(--vm-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	line-height: 1.25;
	margin-bottom: 0.5em;
}

p {
	margin-bottom: 1em;
}

a {
	color: var(--vm-link);
	text-decoration: none;
}

a:hover,
a:focus {
	text-decoration: underline;
}

/* ------------------------------------------------------------------------
 * Layout
 * --------------------------------------------------------------------- */

.vm-container {
	margin-inline: auto;
	max-width: 72rem;
	padding-inline: 1rem;
	width: 100%;
}

@media (min-width: 48em) {
	.vm-container {
		padding-inline: 1.5rem;
	}
}

/* Header. */

.vm-header {
	background-color: var(--vm-surface);
	border-bottom: 1px solid var(--vm-border);
	padding-block: 1rem;
	position: sticky;
	top: 0;
	z-index: 100;
}

.vm-header__inner {
	align-items: center;
	display: flex;
	gap: 1rem;
	justify-content: space-between;
}

.vm-header__user {
	align-items: center;
	display: flex;
	font-size: 0.875rem;
	gap: 1rem;
}

.vm-header__name {
	color: var(--vm-text-muted);
	max-width: 40vw;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.vm-header__logout {
	padding: 0.6rem 0.25rem; /* enlarges the touch target */
	white-space: nowrap;
}

.vm-header__brand {
	color: var(--vm-text);
	font-size: 1.125rem;
	font-weight: 700;
}

.vm-header__brand:hover,
.vm-header__brand:focus {
	color: var(--vm-primary);
	text-decoration: none;
}

/* Main content area. */

.vm-main {
	padding-block: 2rem;
}

/* Footer. */

.vm-footer {
	border-top: 1px solid var(--vm-border);
	color: var(--vm-text-muted);
	font-size: 0.875rem;
	padding-block: 1.5rem;
}

.vm-footer__copyright {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------------
 * Dashboard
 * --------------------------------------------------------------------- */

/* Admin preview bar (admins only). */

.vm-admin-preview {
	background-color: color-mix(in srgb, var(--vm-warning) 12%, var(--vm-surface));
	border-bottom: 1px solid var(--vm-border);
	font-size: 0.875rem;
	padding-block: 0.5rem;
}

.vm-admin-preview__form {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.vm-admin-preview select {
	background-color: var(--vm-bg);
	border: 1px solid var(--vm-border);
	border-radius: var(--vm-radius);
	padding: 0.25rem 0.5rem;
}

/* Greeting. */

.vm-greeting {
	margin-bottom: 2rem;
}

.vm-greeting h1 {
	font-size: 1.5rem;
	margin-bottom: 0.25em;
}

.vm-greeting p {
	color: var(--vm-text-muted);
	margin-bottom: 0;
}

/* Card grid: 1 column mobile, 2 ≥768px, 3 ≥1200px. */

.vm-card-grid {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: 1fr;
}

@media (min-width: 48em) {
	.vm-card-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 75em) {
	.vm-card-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* Site card. */

.vm-card {
	background-color: var(--vm-surface);
	border: 1px solid var(--vm-border);
	border-radius: var(--vm-radius);
	box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	padding: 1.25rem;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.vm-card:hover {
	box-shadow: 0 6px 16px rgb(0 0 0 / 0.35);
	transform: translateY(-2px);
}

.vm-card__title {
	font-size: 1.125rem;
	margin-bottom: 0;
}

.vm-card__url {
	color: var(--vm-text-muted);
	font-size: 0.8125rem;
	word-break: break-all;
}

.vm-card__meta {
	color: var(--vm-text-muted);
	font-size: 0.8125rem;
	margin-bottom: 0;
}

/* Pills & tags. */

.vm-pill {
	align-self: flex-start;
	border-radius: 999px;
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.2em 0.75em;
}

.vm-pill--success {
	background-color: color-mix(in srgb, var(--vm-success) 15%, transparent);
	color: var(--vm-success);
}

.vm-pill--warning {
	background-color: color-mix(in srgb, var(--vm-warning) 15%, transparent);
	color: var(--vm-warning);
}

.vm-pill--info {
	background-color: color-mix(in srgb, var(--vm-primary) 15%, transparent);
	color: var(--vm-link);
}

.vm-pill--muted {
	background-color: color-mix(in srgb, var(--vm-text-muted) 15%, transparent);
	color: var(--vm-text-muted);
}

.vm-tag {
	align-self: flex-start;
	border: 1px solid var(--vm-border);
	border-radius: 999px;
	color: var(--vm-text-muted);
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.2em 0.75em;
}

/* Progress bar (percent is always shown as text, never color-only). */

.vm-progress {
	background-color: var(--vm-bg);
	border-radius: 999px;
	height: 8px;
	overflow: hidden;
}

.vm-progress__bar {
	background-color: var(--vm-primary);
	border-radius: 999px;
	height: 100%;
}

.vm-progress__text {
	color: var(--vm-text-muted);
	font-size: 0.8125rem;
	margin: 0.35rem 0 0;
}

/* Attention strip — items waiting on the client. */

.vm-attention {
	background-color: color-mix(in srgb, var(--vm-warning) 12%, transparent);
	border: 1px solid color-mix(in srgb, var(--vm-warning) 40%, transparent);
	border-radius: var(--vm-radius);
	font-size: 0.875rem;
	margin-bottom: 0;
	padding: 0.6rem 0.75rem;
}

/* Card CTA. */

.vm-button {
	align-items: center;
	align-self: flex-start;
	background-color: var(--vm-primary-deep);
	border-radius: var(--vm-radius);
	color: #fff;
	display: inline-flex;
	font-size: 0.875rem;
	font-weight: 600;
	margin-top: auto;
	min-height: 44px; /* touch target */
	padding: 0.5rem 1.25rem;
}

.vm-button:hover,
.vm-button:focus {
	filter: brightness(1.15);
	text-decoration: none;
}

/* Empty state. */

.vm-empty-state {
	background-color: var(--vm-surface);
	border: 1px dashed var(--vm-border);
	border-radius: var(--vm-radius);
	color: var(--vm-text-muted);
	padding: 3rem 1.5rem;
	text-align: center;
}

.vm-empty-state p {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------------
 * Site Detail
 * --------------------------------------------------------------------- */

/* Breadcrumb & header. */

.vm-breadcrumb {
	color: var(--vm-text-muted);
	display: inline-block;
	font-size: 0.875rem;
	margin-bottom: 1.5rem;
}

.vm-detail-header {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-bottom: 2rem;
}

.vm-detail-header h1 {
	font-size: 1.5rem;
	margin-bottom: 0;
}

.vm-section {
	margin-bottom: 2.5rem;
}

.vm-section__title {
	font-size: 1.125rem;
	margin-bottom: 1rem;
}

/* Attention panel — all items waiting on the client. */

.vm-attention-panel {
	background-color: color-mix(in srgb, var(--vm-warning) 12%, transparent);
	border: 1px solid color-mix(in srgb, var(--vm-warning) 40%, transparent);
	border-radius: var(--vm-radius);
	padding: 1rem 1.25rem;
}

.vm-attention-panel__title {
	font-size: 1rem;
	margin-bottom: 0.5rem;
}

.vm-attention-panel ul {
	list-style: none;
}

.vm-attention-panel li {
	padding-block: 0.25rem;
}

.vm-attention-panel__note {
	color: var(--vm-text-muted);
	display: block;
	font-size: 0.875rem;
}

/* Project block. */

.vm-project {
	background-color: var(--vm-surface);
	border: 1px solid var(--vm-border);
	border-radius: var(--vm-radius);
	margin-bottom: 1.25rem;
	padding: 1.25rem;
}

.vm-project__head {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 0.5rem;
}

.vm-project__title {
	font-size: 1rem;
	margin-bottom: 0;
}

.vm-project__summary {
	font-size: 0.9375rem;
	margin-block: 0.5rem 1rem;
}

/* Timeline: phases as <details>, steps with icon + connector line. */

.vm-timeline-wrap {
	margin-top: 1.25rem;
}

.vm-phase {
	border-bottom: 1px solid var(--vm-border);
}

.vm-phase summary {
	cursor: pointer;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	padding-block: 0.6rem;
	text-transform: uppercase;
}

.vm-phase--done summary {
	color: var(--vm-success);
}

.vm-timeline {
	list-style: none;
	margin: 0.25rem 0 0.75rem;
}

.vm-timeline__step {
	font-size: 0.9375rem;
	padding: 0.4rem 0 0.4rem 28px;
	position: relative;
}

.vm-timeline__step svg {
	left: 0;
	position: absolute;
	top: 0.55rem;
}

/* Vertical connector between step icons. */
.vm-timeline__step:not(:last-child)::before {
	background-color: var(--vm-border);
	bottom: -0.55rem;
	content: "";
	left: 7px;
	position: absolute;
	top: 1.7rem;
	width: 2px;
}

.vm-timeline__note {
	color: var(--vm-warning);
	display: block;
	font-size: 0.8125rem;
}

/* Maintenance table — stacked cards on mobile, real table ≥768px. */

.vm-table {
	border-collapse: collapse;
	width: 100%;
}

.vm-table thead {
	display: none;
}

.vm-table tr {
	border-bottom: 1px solid var(--vm-border);
	display: block;
	padding-block: 0.75rem;
}

.vm-table td {
	display: block;
	font-size: 0.875rem;
	padding: 0.25rem 0;
}

.vm-table td::before {
	color: var(--vm-text-muted);
	content: attr(data-label);
	display: block;
	font-size: 0.6875rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

@media (min-width: 48em) {
	.vm-table thead {
		display: table-header-group;
	}

	.vm-table tr {
		display: table-row;
	}

	.vm-table th,
	.vm-table td {
		display: table-cell;
		padding: 0.6rem 0.75rem 0.6rem 0;
		text-align: left;
		vertical-align: top;
	}

	.vm-table th {
		color: var(--vm-text-muted);
		font-size: 0.6875rem;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	.vm-table td::before {
		content: none;
	}
}

.vm-tasktag {
	border: 1px solid var(--vm-border);
	border-radius: 999px;
	color: var(--vm-text-muted);
	display: inline-block;
	font-size: 0.75rem;
	margin: 2px 4px 2px 0;
	padding: 0.1em 0.6em;
}

.vm-showing-note {
	color: var(--vm-text-muted);
	font-size: 0.8125rem;
	margin-top: 0.5rem;
}

/* Requests list. */

.vm-request-list {
	list-style: none;
}

.vm-request {
	border-bottom: 1px solid var(--vm-border);
	padding-block: 0.85rem;
}

.vm-request__head {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.vm-request__title {
	font-weight: 600;
}

.vm-request__summary {
	font-size: 0.875rem;
	margin: 0.35rem 0 0;
}

/* ------------------------------------------------------------------------
 * Landing
 * --------------------------------------------------------------------- */

.vm-landing {
	background-color: var(--vm-surface);
	border: 1px solid var(--vm-border);
	border-radius: var(--vm-radius);
	margin: 10vh auto 0;
	max-width: 28rem;
	padding: 3rem 2rem;
	text-align: center;
}

.vm-landing__title {
	font-size: 1.75rem;
	margin-bottom: 0.5rem;
}

.vm-landing__subline {
	color: var(--vm-text-muted);
	margin-bottom: 1.75rem;
}

.vm-landing__cta {
	align-self: center;
	margin-top: 0;
}

.vm-landing__alt {
	color: var(--vm-text-muted);
	font-size: 0.875rem;
	margin: 1.5rem 0 0;
}

/* ------------------------------------------------------------------------
 * Login
 * --------------------------------------------------------------------- */

/*
 * wp-login.php does not load this stylesheet; the login screen styles
 * live inline in inc/login-branding.php with hardcoded hex mirrors of
 * the tokens above. Update both when the palette changes.
 */

/* ------------------------------------------------------------------------
 * A11y & polish
 * --------------------------------------------------------------------- */

/* Skip link — first focusable element, visible only on focus. */

.vm-skip-link {
	background-color: var(--vm-primary-deep);
	border-radius: var(--vm-radius);
	color: #fff;
	left: 1rem;
	padding: 0.6rem 1rem;
	position: absolute;
	top: -100px;
	z-index: 200;
}

.vm-skip-link:focus {
	top: 1rem;
	text-decoration: none;
}

/* Visually hidden, available to assistive tech (WP convention class). */

.screen-reader-text {
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Visible focus for keyboard users. */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
	outline: 2px solid var(--vm-primary);
	outline-offset: 2px;
}

/* Timeline phase rows: hover/focus affordance on summary. */

.vm-phase summary:hover,
.vm-phase summary:focus-visible {
	color: var(--vm-link);
}

.vm-phase--done summary:hover,
.vm-phase--done summary:focus-visible {
	color: var(--vm-success);
	text-decoration: underline;
}

/* Print: clean sheet for maintenance history / detail printouts. */

@media print {
	body {
		background: #fff;
		color: #000;
	}

	.vm-header,
	.vm-footer,
	.vm-skip-link,
	.vm-admin-preview,
	.vm-breadcrumb,
	.vm-button,
	.vm-request-placeholder {
		display: none !important;
	}

	.vm-card,
	.vm-project,
	.vm-landing,
	.vm-attention-panel {
		border: 1px solid #999;
		box-shadow: none;
	}

	.vm-phase:not([open]) {
		display: block; /* details print expanded via open attr below-less browsers vary; borders keep structure */
	}
}
