/*
Theme Name: Atelier CV
Theme URI: https://cvats.shop
Author: Atelier CV
Author URI: https://cvats.shop
Description: Native WordPress block theme recreating the Atelier CV design system (luxury editorial CV builder). Design tokens ported from the reference application's DESIGN.md specification. Phase 0 foundation: tokens and baseline CSS only — no landing-page templates, header, or footer markup yet.
Requires at least: 6.6
Tested up to: 7.0
Requires PHP: 8.0
Version: 0.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: atelier-cv
*/

/* ==========================================================================
   Phase 0 — Foundation stylesheet.

   Everything expressible as a design token lives in theme.json (colors,
   type scale, spacing, radii, shadows, layout widths). This file carries
   only the pieces theme.json cannot express: baseline focus-visibility,
   the print stylesheet, and scrollbar styling — all ported verbatim in
   value from the reference app's src/index.css. No landing-page, header,
   or footer markup/selectors are introduced here.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Accessibility: explicit focus indicator.
   Reference: DESIGN.md §12 — "Explicit focus ring state
   focus:outline-none focus:border-[#1A1A1A] across all text inputs and
   select dropdowns."
   -------------------------------------------------------------------------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--text-primary, #1a1a1a);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Reduced motion: respect user preference before any motion is introduced
   in a later phase.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* --------------------------------------------------------------------------
   Custom scrollbar.
   Reference: src/index.css lines 46–60.
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}
::-webkit-scrollbar-track {
	background: #f0eeeb;
}
::-webkit-scrollbar-thumb {
	background: #d1cec9;
	border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
	background: #b8b5af;
}

/* --------------------------------------------------------------------------
   Print baseline.
   Reference: src/index.css lines 62–108 ("Print Stylesheet for
   High-Resolution PDF Export"). Ported verbatim now as a global baseline;
   the #printable-cv-document target this rule isolates does not exist
   until the CV Builder is implemented in a later phase, so this rule is
   inert until then.
   -------------------------------------------------------------------------- */
@media print {
	@page {
		size: A4 portrait;
		margin: 0;
	}

	html, body {
		background: #ffffff !important;
		color: #000000 !important;
		margin: 0 !important;
		padding: 0 !important;
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	body * {
		visibility: hidden;
	}

	#printable-cv-document,
	#printable-cv-document * {
		visibility: visible;
	}

	#printable-cv-document {
		position: absolute;
		left: 0;
		top: 0;
		width: 100% !important;
		min-height: 100% !important;
		margin: 0 !important;
		padding: 16mm !important;
		box-shadow: none !important;
		border: none !important;
		background: #ffffff !important;
	}

	.print\:hidden,
	header.builder-header,
	aside.builder-sidebar,
	div.builder-controls,
	button,
	nav {
		display: none !important;
	}

	/* ==========================================================================
	   Phase 4.1 fix — blank PDF/print bug.

	   Root cause: #printable-cv-document's ancestor chain in the CV
	   Builder is body > .atelier-builder > .builder-body >
	   .builder-preview-main > .builder-preview-stage >
	   #builder-preview-canvas > .cv-document-wrapper >
	   #printable-cv-document. .builder-preview-main is `display: none`
	   below the 1024px breakpoint (revealing the desktop preview column
	   only on wide screens) — but browsers evaluate @media during print
	   against the PAPER's width (~794px CSS px for A4), not the browser
	   window, so that column stayed `display: none` during print
	   regardless of how wide the actual browser window was.
	   `visibility: visible` on a descendant (the rule above already
	   targets #printable-cv-document) can never repaint content whose
	   ancestor is `display: none` — hence a fully blank page.

	   Additionally #builder-preview-canvas carries an inline
	   `transform: scale(...)` for on-screen zoom, and
	   .builder-preview-stage/.builder-body use `overflow: auto|hidden` —
	   both would still corrupt output (wrong size, clipped multi-page
	   content) even after the display fix, so both are neutralized too.
	   ========================================================================== */
	.builder-body,
	.builder-preview-main,
	.builder-preview-stage {
		display: block !important;
		overflow: visible !important;
		position: static !important;
		height: auto !important;
		max-height: none !important;
		background: none !important;
	}

	#builder-preview-canvas,
	.builder-mobile-sheet__canvas {
		transform: none !important;
		overflow: visible !important;
	}

	.builder-mobile-sheet,
	.builder-mobile-sheet__viewport {
		display: block !important;
		overflow: visible !important;
		position: static !important;
	}
}
