/*
 * PPALMA Theme — Global Styles
 * =============================================================================
 * Mobile-first, WCAG 2.2 AA compliant global stylesheet.
 * Design tokens are defined in theme.json and exposed as CSS custom properties.
 *
 * NOTE: Colors, fonts, and spacing defined here are PROVISIONAL placeholder
 * values for development. Official PPALMA brand standards must be confirmed
 * before production launch.
 * =============================================================================
 */

/* ---------------------------------------------------------------------------
 * 1. Reset & Base
 * --------------------------------------------------------------------------- */

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

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
	font-size: 16px;
	overflow-x: hidden;
	max-width: 100vw;
	width: 100%;
}

body {
	margin: 0;
	padding: 0;
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--text-dark);
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: hidden;
	max-width: 100vw;
	width: 100%;
	position: relative;
}

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

/* ---------------------------------------------------------------------------
 * 2. Accessibility
 * --------------------------------------------------------------------------- */

/* Skip to content link */
.skip-link {
	position: absolute;
	top: -100px;
	left: 1rem;
	z-index: 9999;
	padding: 0.75rem 1.5rem;
	background: var(--wp--preset--color--accent-gold);
	color: var(--wp--preset--color--text-dark);
	font-weight: 700;
	border-radius: 0 0 8px 8px;
	text-decoration: none;
	transition: top 0.2s ease;
}

.skip-link:focus {
	top: 0;
	outline: 3px solid var(--wp--preset--color--primary-navy);
	outline-offset: 2px;
}

/* Focus ring for keyboard navigation */
:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-gold);
	outline-offset: 3px;
	border-radius: 2px;
}

/* Screen reader only */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Reduced 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;
	}
}

/* ---------------------------------------------------------------------------
 * 3. Typography
 * --------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
	margin-top: 0;
	margin-bottom: 0.75rem;
	font-family: var(--wp--preset--font-family--outfit);
	font-weight: 700;
	line-height: 1.25;
	color: var(--wp--preset--color--text-dark);
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: clamp(1.125rem, 2vw, 1.375rem); }
h5 { font-size: 1.125rem; font-family: var(--wp--preset--font-family--inter); }
h6 { font-size: 1rem; font-family: var(--wp--preset--font-family--inter); }

p {
	margin-top: 0;
	margin-bottom: 1rem;
}

a {
	color: var(--wp--preset--color--primary-blue);
	text-decoration: none;
	transition: color 0.2s ease;
}

a:hover {
	color: var(--wp--preset--color--primary-navy);
	text-decoration: underline;
}

ul, ol {
	margin-top: 0;
	margin-bottom: 1rem;
	padding-left: 1.5rem;
}

li {
	margin-bottom: 0.25rem;
}

strong, b {
	font-weight: 700;
}

em, i {
	font-style: italic;
}

blockquote {
	margin: 1.5rem 0;
	padding: 1rem 1.5rem;
	border-left: 4px solid var(--wp--preset--color--accent-gold);
	background: var(--wp--preset--color--background-light);
	border-radius: 0 8px 8px 0;
}

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

code {
	font-family: 'Courier New', Courier, monospace;
	font-size: 0.875em;
	background: var(--wp--preset--color--background-light);
	padding: 0.2em 0.4em;
	border-radius: 4px;
}

pre {
	padding: 1rem;
	background: var(--wp--preset--color--text-dark);
	color: var(--wp--preset--color--white);
	border-radius: 8px;
	overflow-x: auto;
}

pre code {
	background: none;
	padding: 0;
	color: inherit;
}

/* ---------------------------------------------------------------------------
 * 4. Layout
 * --------------------------------------------------------------------------- */

.site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.site-content {
	flex: 1;
}

.container {
	width: 100%;
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1rem;
	padding-right: 1rem;
}

@media (min-width: 640px) {
	.container {
		padding-left: 1.5rem;
		padding-right: 1.5rem;
	}
}

@media (min-width: 1024px) {
	.container {
		padding-left: 2rem;
		padding-right: 2rem;
	}
}

.container--narrow {
	max-width: 760px;
}

.container--wide {
	max-width: 1400px;
}

/* ---------------------------------------------------------------------------
 * 5. Section Styles
 * --------------------------------------------------------------------------- */

.section {
	padding-top: 4rem;
	padding-bottom: 4rem;
}

.section--sm {
	padding-top: 2rem;
	padding-bottom: 2rem;
}

.section--lg {
	padding-top: 6rem;
	padding-bottom: 6rem;
}

.section--navy {
	background-color: var(--wp--preset--color--primary-navy);
	color: var(--wp--preset--color--white);
}

.section--navy h1,
.section--navy h2,
.section--navy h3 {
	color: var(--wp--preset--color--white);
}

.section--light {
	background-color: var(--wp--preset--color--background-light);
}

.section--gradient {
	background: var(--wp--preset--gradient--navy-to-blue);
	color: var(--wp--preset--color--white);
}

/* Section heading layout */
.section__header {
	margin-bottom: 2.5rem;
}

.section__header--centered {
	text-align: center;
}

.section__title {
	position: relative;
	margin-bottom: 0.5rem;
}

.section__title::after {
	content: '';
	display: block;
	width: 60px;
	height: 4px;
	background: var(--wp--preset--color--accent-gold);
	border-radius: 2px;
	margin-top: 0.75rem;
}

.section__header--centered .section__title::after {
	margin-left: auto;
	margin-right: auto;
}

.section__subtitle {
	color: var(--wp--preset--color--text-medium);
	font-size: var(--wp--preset--font-size--lg);
	margin-bottom: 0;
}

.section--navy .section__subtitle {
	color: rgba(255, 255, 255, 0.8);
}

/* ---------------------------------------------------------------------------
 * 6. Grid Systems
 * --------------------------------------------------------------------------- */

.grid {
	display: grid;
	gap: 1.5rem;
}

.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
	.grid--2 { grid-template-columns: repeat(2, 1fr); }
	.grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
	.grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
	.grid--3 { grid-template-columns: repeat(3, 1fr); }
	.grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---------------------------------------------------------------------------
 * 7. Buttons
 * --------------------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 1.75rem;
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	border: 2px solid transparent;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
	user-select: none;
	white-space: nowrap;
}

.btn:hover {
	text-decoration: none;
	transform: translateY(-1px);
}

.btn:active {
	transform: translateY(0);
}

.btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-gold);
	outline-offset: 3px;
}

/* Primary */
.btn--primary {
	background-color: var(--wp--preset--color--primary-navy);
	border-color: var(--wp--preset--color--primary-navy);
	color: var(--wp--preset--color--white);
	box-shadow: 0 2px 8px rgba(10, 37, 64, 0.35);
}

.btn--primary:hover {
	background-color: var(--wp--preset--color--accent-gold);
	border-color: var(--wp--preset--color--accent-gold);
	color: var(--wp--preset--color--navy-dark);
	box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* Secondary (outline on dark) */
.btn--secondary {
	background-color: transparent;
	border-color: rgba(255, 255, 255, 0.7);
	color: var(--wp--preset--color--white);
}

.btn--secondary:hover {
	background-color: rgba(255, 255, 255, 0.15);
	border-color: var(--wp--preset--color--accent-gold);
	color: var(--wp--preset--color--accent-gold);
}

/* Outline (on light backgrounds) */
.btn--outline {
	background-color: transparent;
	border-color: var(--wp--preset--color--primary-navy);
	color: var(--wp--preset--color--primary-navy);
}

.btn--outline:hover {
	background-color: var(--wp--preset--color--primary-navy);
	border-color: var(--wp--preset--color--primary-navy);
	color: var(--wp--preset--color--white);
}

/* Gold / Yellow */
.btn--gold {
	background-color: var(--wp--preset--color--accent-gold);
	border-color: var(--wp--preset--color--accent-gold);
	color: var(--wp--preset--color--navy-dark);
	font-weight: 700;
	box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.btn--gold:hover {
	background-color: var(--wp--preset--color--gold-dark);
	border-color: var(--wp--preset--color--gold-dark);
	color: var(--wp--preset--color--navy-dark);
}

/* Sizes */
.btn--sm {
	padding: 0.5rem 1rem;
	font-size: var(--wp--preset--font-size--xs);
}

.btn--lg {
	padding: 1rem 2.5rem;
	font-size: var(--wp--preset--font-size--md);
}

/* ---------------------------------------------------------------------------
 * 8. Badges
 * --------------------------------------------------------------------------- */

.badge {
	display: inline-flex;
	align-items: center;
	padding: 0.2em 0.65em;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	border-radius: 9999px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	white-space: nowrap;
}

.badge--category {
	background-color: var(--wp--preset--color--background-light);
	color: var(--wp--preset--color--primary-blue);
	border: 1px solid var(--wp--preset--color--border-color);
	text-decoration: none;
}

.badge--category:hover {
	background-color: var(--wp--preset--color--primary-blue);
	color: var(--wp--preset--color--white);
	text-decoration: none;
}

.badge--active {
	background-color: #E8F5E9;
	color: var(--wp--preset--color--success-green);
}

.badge--resolved {
	background-color: #E3F2FD;
	color: #0277BD;
}

.badge--scheduled {
	background-color: #FFF3E0;
	color: var(--wp--preset--color--warning-orange);
}

.badge--expired {
	background-color: var(--wp--preset--color--background-light);
	color: var(--wp--preset--color--text-light);
}

/* ---------------------------------------------------------------------------
 * 9. Breadcrumbs
 * --------------------------------------------------------------------------- */

.breadcrumbs {
	padding: 0.75rem 0;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--text-medium);
}

.breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.breadcrumbs__item + .breadcrumbs__item::before {
	content: '/';
	margin-right: 0.25rem;
	color: var(--wp--preset--color--text-light);
}

.breadcrumbs__item a {
	color: var(--wp--preset--color--primary-blue);
}

.breadcrumbs__item a:hover {
	color: var(--wp--preset--color--primary-navy);
}

.breadcrumbs__item span {
	color: var(--wp--preset--color--text-medium);
}

/* ---------------------------------------------------------------------------
 * 10. Page Title Banner
 * --------------------------------------------------------------------------- */

.page-title-banner {
	background: #ffffff;
	border-bottom: 1px solid #e2e8f0;
	color: #0f172a;
	padding: 2.75rem 0 2rem;
	text-align: center;
}

.page-title-banner h1,
.page-title-banner .page-title-banner__title {
	color: #0f172a;
	font-size: 2.25rem;
	font-weight: 800;
	margin-bottom: 0.5rem;
	text-align: center;
}

.page-title-banner .lead,
.page-title-banner p {
	font-size: 1.125rem;
	line-height: 1.7;
	color: #334155;
	max-width: 820px;
	margin: 0 auto;
	text-align: center;
}

.page-title-banner .breadcrumbs {
	color: #64748b;
	justify-content: center;
	margin-top: 0.75rem;
	font-size: 0.875rem;
}

.page-title-banner .breadcrumbs__item a {
	color: #1565c0;
	font-weight: 600;
}

.page-title-banner .breadcrumbs__item span {
	color: #64748b;
}

/* ---------------------------------------------------------------------------
 * 11. Announcements / Alerts
 * --------------------------------------------------------------------------- */

.site-alert {
	padding: 0.875rem 1rem;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 500;
	text-align: center;
}

.site-alert--warning {
	background-color: #FFF8E1;
	color: #5D4037;
	border-bottom: 3px solid var(--wp--preset--color--accent-gold);
}

.site-alert--info {
	background-color: #E3F2FD;
	color: #01579B;
	border-bottom: 3px solid var(--wp--preset--color--primary-blue);
}

.site-alert--error {
	background-color: #FFEBEE;
	color: #B71C1C;
	border-bottom: 3px solid var(--wp--preset--color--error-red);
}

/* ---------------------------------------------------------------------------
 * 12. Pagination
 * --------------------------------------------------------------------------- */

.pagination,
.nav-links {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 2rem 0;
}

.page-numbers,
.nav-links a,
.nav-links span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	padding: 0 0.75rem;
	border: 1px solid var(--wp--preset--color--border-color);
	border-radius: 6px;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 500;
	color: var(--wp--preset--color--primary-blue);
	text-decoration: none;
	transition: all 0.2s ease;
}

.page-numbers:hover,
.nav-links a:hover {
	background-color: var(--wp--preset--color--primary-blue);
	border-color: var(--wp--preset--color--primary-blue);
	color: var(--wp--preset--color--white);
	text-decoration: none;
}

.page-numbers.current {
	background-color: var(--wp--preset--color--primary-navy);
	border-color: var(--wp--preset--color--primary-navy);
	color: var(--wp--preset--color--white);
	font-weight: 700;
}

/* ---------------------------------------------------------------------------
 * 13. Forms
 * --------------------------------------------------------------------------- */

label {
	display: block;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	margin-bottom: 0.375rem;
	color: var(--wp--preset--color--text-dark);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="password"],
textarea,
select {
	display: block;
	width: 100%;
	padding: 0.625rem 0.875rem;
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.5;
	color: var(--wp--preset--color--text-dark);
	background-color: var(--wp--preset--color--white);
	border: 1.5px solid var(--wp--preset--color--border-color);
	border-radius: 6px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary-blue);
	box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

textarea {
	min-height: 120px;
	resize: vertical;
}

.form-group {
	margin-bottom: 1.25rem;
}

.form-error {
	display: block;
	margin-top: 0.375rem;
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--error-red);
}

/* Search form */
.search-form {
	display: flex;
	gap: 0.5rem;
}

.search-form input[type="search"] {
	flex: 1;
}

.search-form .search-submit {
	flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
 * 14. Tables
 * --------------------------------------------------------------------------- */

table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--sm);
}

th, td {
	padding: 0.75rem 1rem;
	text-align: left;
	border-bottom: 1px solid var(--wp--preset--color--border-color);
}

th {
	background-color: var(--wp--preset--color--primary-navy);
	color: var(--wp--preset--color--white);
	font-weight: 600;
	font-size: var(--wp--preset--font-size--xs);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

tr:nth-child(even) td {
	background-color: var(--wp--preset--color--background-light);
}

tr:hover td {
	background-color: #E0F2FE;
}

.table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------------------------
 * 15. WordPress Blocks Global Overrides
 * --------------------------------------------------------------------------- */

/* Query Loop */
.wp-block-query-loop {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* Comments */
.comment-list {
	list-style: none;
	padding: 0;
}

/* Alignments */
.wp-block-image.alignfull {
	margin-left: calc(-1 * max(1rem, (100vw - 1200px) / 2));
	margin-right: calc(-1 * max(1rem, (100vw - 1200px) / 2));
}

/* Responsive embeds */
.responsive-embed {
	position: relative;
	padding-bottom: 56.25%;
	height: 0;
	overflow: hidden;
}

.responsive-embed iframe,
.responsive-embed object,
.responsive-embed embed {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* Separator */
.wp-block-separator {
	border-color: var(--wp--preset--color--border-color);
	opacity: 1;
}

/* ---------------------------------------------------------------------------
 * 16. Utility Classes
 * --------------------------------------------------------------------------- */

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-sm    { font-size: var(--wp--preset--font-size--sm); }
.text-xs    { font-size: var(--wp--preset--font-size--xs); }
.text-lg    { font-size: var(--wp--preset--font-size--lg); }
.text-muted { color: var(--wp--preset--color--text-medium); }
.text-light { color: var(--wp--preset--color--text-light); }
.text-white { color: var(--wp--preset--color--white); }
.text-gold  { color: var(--wp--preset--color--accent-gold); }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold   { font-weight: 700; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-auto { margin-top: auto; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.rounded { border-radius: 8px; }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: 0 1px 3px rgba(18,59,102,0.08); }
.shadow-md { box-shadow: 0 4px 6px rgba(18,59,102,0.07), 0 2px 4px rgba(18,59,102,0.05); }
.shadow-lg { box-shadow: 0 10px 15px rgba(18,59,102,0.10), 0 4px 6px rgba(18,59,102,0.05); }

.border { border: 1px solid var(--wp--preset--color--border-color); }
.border-top { border-top: 1px solid var(--wp--preset--color--border-color); }
.border-bottom { border-bottom: 1px solid var(--wp--preset--color--border-color); }

.overflow-hidden { overflow: hidden; }
.w-full { width: 100%; }
.max-w-prose { max-width: 65ch; }

/* Link with arrow */
.link--arrow {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--primary-blue);
}

.link--arrow::after {
	content: '→';
	transition: transform 0.2s ease;
}

.link--arrow:hover::after {
	transform: translateX(4px);
}

.link--arrow:hover {
	text-decoration: none;
	color: var(--wp--preset--color--primary-navy);
}

/* ---------------------------------------------------------------------------
 * 17. Empty States
 * --------------------------------------------------------------------------- */

.empty-state {
	text-align: center;
	padding: 4rem 2rem;
	color: var(--wp--preset--color--text-medium);
}

.empty-state__icon {
	font-size: 3rem;
	margin-bottom: 1rem;
	opacity: 0.5;
	display: flex;
	align-items: center;
	justify-content: center;
}

.empty-state__icon svg {
	width: 48px;
	height: 48px;
	stroke: currentColor;
}

.empty-state__title {
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 600;
	color: var(--wp--preset--color--text-dark);
	margin-bottom: 0.5rem;
}

.empty-state__description {
	max-width: 40ch;
	margin: 0 auto 1.5rem;
}

/* ---------------------------------------------------------------------------
 * 18. Entry Content Styles
 * --------------------------------------------------------------------------- */

.entry-content {
	max-width: 100%;
}

.entry-content > * + * {
	margin-top: 1.25rem;
}

.entry-content a {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.entry-content a:hover {
	color: var(--wp--preset--color--primary-navy);
}

.entry-header {
	margin-bottom: 2rem;
}

.entry-footer {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--border-color);
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--text-medium);
}

/* ---------------------------------------------------------------------------
 * 19. Print Styles
 * --------------------------------------------------------------------------- */

@media print {
	.site-header,
	.site-footer,
	.sidebar,
	.btn,
	nav {
		display: none !important;
	}

	body {
		font-size: 12pt;
		color: #000;
	}

	a {
		color: #000;
		text-decoration: underline;
	}

	a[href]::after {
		content: ' (' attr(href) ')';
		font-size: 0.75em;
	}
}
