/**
 * Freedomman Theme - Safe Base & Reset Styling
 *
 * @package Freedomman
 * @version 1.0.0
 */

/* --------------------------------------------------------------------------
 * 1. Box Sizing Foundation (Standard Reset)
 * -------------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* --------------------------------------------------------------------------
 * 2. Root Document & Body
 * -------------------------------------------------------------------------- */
html {
	font-size: 16px;
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	padding: 0;
	background-color: var(--fm-bg-page);
	color: var(--fm-text-secondary);
	font-family: var(--fm-font-primary);
	font-size: var(--fm-text-body);
	line-height: var(--fm-leading-body);
	font-weight: var(--fm-weight-regular);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	min-height: 100vh;
}

/* --------------------------------------------------------------------------
 * 3. Typography Foundation (Headings & Content)
 * Note: No default gradient on H1/H2 (Design System locked rule)
 * -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
	margin-top: 0;
	margin-bottom: var(--fm-space-3);
	color: var(--fm-text-primary);
	font-family: var(--fm-font-primary);
	font-weight: var(--fm-weight-bold);
	letter-spacing: -0.02em;
}

h1 {
	font-size: var(--fm-text-h1);
	line-height: var(--fm-leading-h1);
	font-weight: var(--fm-weight-extrabold);
}

h2 {
	font-size: var(--fm-text-h2);
	line-height: var(--fm-leading-h2);
}

h3 {
	font-size: var(--fm-text-h3);
	line-height: var(--fm-leading-h3);
}

h4 {
	font-size: var(--fm-text-h4);
	line-height: var(--fm-leading-h4);
	font-weight: var(--fm-weight-semibold);
}

h5 {
	font-size: var(--fm-text-body-lg);
	line-height: var(--fm-leading-tight);
	font-weight: var(--fm-weight-semibold);
}

h6 {
	font-size: var(--fm-text-body);
	line-height: var(--fm-leading-tight);
	font-weight: var(--fm-weight-medium);
	color: var(--fm-text-muted);
}

p {
	margin-top: 0;
	margin-bottom: var(--fm-space-4);
}

p:last-child {
	margin-bottom: 0;
}

strong,
b {
	font-weight: var(--fm-weight-semibold);
	color: var(--fm-text-primary);
}

small {
	font-size: var(--fm-text-body-sm);
	color: var(--fm-text-muted);
}

/* --------------------------------------------------------------------------
 * 4. Links & Interactive States
 * -------------------------------------------------------------------------- */
a {
	color: var(--fm-brand-blue);
	text-decoration: none;
	transition: color var(--fm-transition-micro);
}

a:hover {
	color: var(--fm-brand-cyan);
}

/* --------------------------------------------------------------------------
 * 5. Media & Embeds (Responsive & Contained)
 * -------------------------------------------------------------------------- */
img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
	display: block;
	max-width: 100%;
	height: auto;
}

figure {
	margin: 0 0 var(--fm-space-4) 0;
}

figcaption {
	font-size: var(--fm-text-caption);
	color: var(--fm-text-muted);
	margin-top: var(--fm-space-2);
	text-align: center;
}

/* --------------------------------------------------------------------------
 * 6. Lists
 * -------------------------------------------------------------------------- */
ul,
ol {
	margin-top: 0;
	margin-bottom: var(--fm-space-4);
	padding-left: var(--fm-space-6);
}

li {
	margin-bottom: var(--fm-space-2);
}

/* --------------------------------------------------------------------------
 * 7. Form Controls Foundation
 * -------------------------------------------------------------------------- */
input,
button,
textarea,
select {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
textarea,
select {
	width: 100%;
	padding: var(--fm-space-3) var(--fm-space-4);
	background-color: var(--fm-bg-interactive);
	border: 1px solid var(--fm-border-subtle);
	border-radius: var(--fm-radius-md);
	color: var(--fm-text-primary);
	line-height: var(--fm-leading-tight);
	transition: border-color var(--fm-transition-micro), box-shadow var(--fm-transition-micro);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
	color: var(--fm-text-muted);
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--fm-brand-cyan);
	box-shadow: var(--fm-focus-glow);
}

/* --------------------------------------------------------------------------
 * 8. Accessibility: Focus Visible Replacement
 * Progressive enhancement: do NOT remove native outline for browsers lacking
 * :focus-visible support. Only suppress outline when element has focus but
 * does not match :focus-visible (i.e. mouse/pointer interaction).
 * -------------------------------------------------------------------------- */
:focus:not(:focus-visible) {
	outline: none;
}

:focus-visible {
	outline: var(--fm-focus-ring);
	outline-offset: var(--fm-focus-offset);
}

/* --------------------------------------------------------------------------
 * 9. Accessibility Exception: Prefers-Reduced-Motion
 * NOTE: The use of !important below is an authorized accessibility override
 * designed to protect sensitive users by eliminating layout shifts and motion.
 * -------------------------------------------------------------------------- */
@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;
	}
}
