/* ==========================================================================
   Pen and Paper Labs - Main Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
	/* Colors */
	--color-bg-primary: #000000;
	--color-bg-secondary: #000000;
	--color-text-primary: #CFB700;
	--color-text-secondary: #CFB700;
	--color-accent: #3B82F6;
	--color-accent-hover: #2563EB;
	--color-border: #CFB700;
	--color-error: #EF4444;
	--color-success: #22C55E;
	--color-gold: #CFB700;

	/* Typography */
	--font-heading: 'Rubik Glitch', cursive;
	--font-body: 'Rubik Glitch', cursive;

	/* Type Scale */
	--text-h1: 48px;
	--text-h2: 36px;
	--text-h3: 28px;
	--text-h4: 22px;
	--text-body: 16px;
	--text-small: 14px;
	--text-button: 16px;

	/* Spacing (base-8 system) */
	--space-xs: 4px;
	--space-sm: 8px;
	--space-md: 16px;
	--space-lg: 24px;
	--space-xl: 32px;
	--space-2xl: 48px;
	--space-3xl: 64px;

	/* Layout */
	--container-max: 1280px;
	--container-padding: 24px;

	/* Borders */
	--radius-sm: 4px;
	--radius-md: 8px;
	--radius-lg: 12px;
	--radius-pill: 9999px;

	/* Transitions */
	--transition-default: all 0.2s ease;
	--transition-hover: 0.15s ease-out;
	--transition-drawer: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	--transition-expand: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

	/* Z-index scale */
	--z-base: 1;
	--z-nav: 100;
	--z-overlay: 200;
	--z-modal: 300;
	--z-quadrant-nav: 400;
}

@media (min-width: 768px) {
	:root {
		--container-padding: 48px;
	}
}

/* --------------------------------------------------------------------------
   2. Reset / Normalize
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

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

body,
h1, h2, h3, h4, h5, h6,
p, ol, ul, figure, blockquote,
dl, dd {
	margin: 0;
}

ul[role='list'],
ol[role='list'] {
	list-style: none;
}

html:focus-within {
	scroll-behavior: smooth;
}

body {
	min-height: 100vh;
	text-rendering: optimizeSpeed;
	line-height: 1.6;
}

a:not([class]) {
	text-decoration-skip-ink: auto;
}

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

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

button {
	cursor: pointer;
	border: none;
	background: transparent;
	padding: 0;
}

@media (prefers-reduced-motion: reduce) {
	html:focus-within {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* --------------------------------------------------------------------------
   3. Base Typography
   -------------------------------------------------------------------------- */
body {
	font-family: var(--font-body);
	font-size: var(--text-body);
	font-weight: 400;
	line-height: 1.6;
	color: var(--color-text-primary);
	background-color: var(--color-bg-primary);
}

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-heading);
	line-height: 1.2;
}

h1 {
	font-size: var(--text-h1);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

h2 {
	font-size: var(--text-h2);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

h3 {
	font-size: var(--text-h3);
	font-weight: 600;
	line-height: 1.3;
}

h4 {
	font-size: var(--text-h4);
	font-weight: 600;
	line-height: 1.4;
}

small,
.text-small {
	font-size: var(--text-small);
	line-height: 1.5;
}

a {
	color: var(--color-text-primary);
	text-decoration: underline;
	transition: var(--transition-hover);
}

a:hover {
	opacity: 0.8;
}

/* Responsive type scale */
@media (max-width: 768px) {
	h1 { font-size: 32px; }
	h2 { font-size: 26px; }
	h3 { font-size: 22px; }
	h4 { font-size: 18px; }
}

/* --------------------------------------------------------------------------
   4. Layout & Grid
   -------------------------------------------------------------------------- */
.container {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-padding);
}

/* Quadrant grid - the core homepage layout */
.quadrant-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-template-rows: 1fr 1fr;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
}

.quadrant-grid__cell {
	position: relative;
	overflow: hidden;
	cursor: pointer;
	padding: var(--space-lg);
	border: none;
	background-color: var(--color-bg-primary);
}

/*
 * Expanding / Expanded: uses position:fixed to escape the grid entirely
 * and animate from the cell's viewport rect to full viewport.
 */
.quadrant-grid__cell.is-animating {
	position: fixed;
	z-index: var(--z-overlay);
	transition: top 0.6s cubic-bezier(0.4, 0, 0.2, 1),
	            left 0.6s cubic-bezier(0.4, 0, 0.2, 1),
	            width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
	            height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.quadrant-grid__cell.is-expanded {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: var(--z-overlay);
	cursor: default;
	padding: var(--space-2xl);
	padding-right: 80px; /* Room for sidebar nav */
	overflow-y: auto;
}

/* Hide non-expanded cells behind the fullscreen one */
.quadrant-grid.has-expanded .quadrant-grid__cell:not(.is-expanded):not(.is-animating) {
	visibility: hidden;
}

/* Expanded layout with sidebar (used on inner pages like single.php) */
.expanded-layout {
	display: flex;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	position: relative;
}

.expanded-layout__content {
	flex: 1;
	overflow-y: auto;
	padding: var(--space-2xl);
}

.expanded-layout__sidebar {
	width: 60px;
	flex-shrink: 0;
}

/* Mobile: stack quadrants vertically */
@media (max-width: 768px) {
	.quadrant-grid {
		grid-template-columns: 1fr;
		grid-template-rows: repeat(4, 1fr);
	}

	.quadrant-grid__cell.is-expanded {
		padding: var(--space-lg);
		padding-right: 60px;
	}
}

/* --------------------------------------------------------------------------
   5. Quadrant Sidebar Navigation
   -------------------------------------------------------------------------- */
.quadrant-nav {
	position: fixed;
	top: 0;
	right: 0;
	width: 60px;
	height: 100vh;
	background-color: var(--color-bg-primary);
	border-left: 2px solid var(--color-gold);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-lg) 0;
	z-index: var(--z-quadrant-nav);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.quadrant-nav.is-visible {
	opacity: 1;
	pointer-events: auto;
}

.quadrant-nav__list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-xl);
}

.quadrant-nav__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	transition: var(--transition-hover);
	color: var(--color-gold);
}

.quadrant-nav__btn:hover,
.quadrant-nav__btn:focus-visible {
	transform: scale(1.15);
}

.quadrant-nav__btn.is-active {
	opacity: 0.5;
}

.quadrant-nav__icon {
	width: 36px;
	height: 36px;
	object-fit: contain;
}

.quadrant-nav__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	color: var(--color-gold);
	transition: var(--transition-hover);
	margin-bottom: var(--space-sm);
}

.quadrant-nav__close:hover,
.quadrant-nav__close:focus-visible {
	transform: scale(1.15);
}

/* Bottom gold border line across expanded viewport */
.quadrant-grid__cell.is-expanded::after,
.quadrant-grid__cell.is-animating::after {
	content: '';
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100vw;
	height: 2px;
	background-color: var(--color-gold);
	z-index: var(--z-quadrant-nav);
}

/* --------------------------------------------------------------------------
   6. Component Styles - Buttons
   -------------------------------------------------------------------------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-body);
	font-size: var(--text-button);
	font-weight: 600;
	letter-spacing: 0.02em;
	line-height: 1;
	padding: 12px 24px;
	border-radius: var(--radius-md);
	transition: var(--transition-default);
	text-decoration: none;
	cursor: pointer;
	border: 2px solid transparent;
}

.btn--primary {
	background-color: var(--color-gold);
	color: var(--color-bg-primary);
	border-color: var(--color-gold);
}

.btn--primary:hover {
	opacity: 0.9;
	transform: scale(1.02);
}

.btn--secondary {
	background-color: transparent;
	color: var(--color-gold);
	border-color: var(--color-gold);
}

.btn--secondary:hover {
	background-color: var(--color-gold);
	color: var(--color-bg-primary);
}

.btn--ghost {
	background-color: transparent;
	color: var(--color-gold);
	border-color: transparent;
}

.btn--ghost:hover {
	opacity: 0.8;
}

.btn:disabled,
.btn[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. Component Styles - Cards (Shop product cards)
   -------------------------------------------------------------------------- */
.product-card {
	background-color: var(--color-bg-secondary);
	border: 2px solid var(--color-gold);
	border-radius: 0;
	overflow: hidden;
	transition: var(--transition-default);
}

.product-card:hover {
	box-shadow: 0 0 20px rgba(207, 183, 0, 0.15);
	transform: translateY(-2px);
}

.product-card__image {
	width: 100%;
	aspect-ratio: 3 / 4;
	background-color: var(--color-bg-primary);
	border-bottom: 2px solid var(--color-gold);
}

.product-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.product-card__info {
	padding: var(--space-sm) var(--space-md);
	border-top: 2px solid var(--color-gold);
}

.product-card__title {
	font-size: var(--text-small);
	font-weight: 400;
	color: var(--color-text-primary);
}

/* Shop grid */
.shop-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: var(--space-lg);
}

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

@media (max-width: 480px) {
	.shop-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* --------------------------------------------------------------------------
   8. Component Styles - Post Card
   -------------------------------------------------------------------------- */
.post-card {
	padding: var(--space-md) 0;
	border-bottom: 1px solid rgba(207, 183, 0, 0.2);
}

.post-card__title {
	font-size: var(--text-h3);
	margin-bottom: var(--space-sm);
}

.post-card__title a {
	color: var(--color-text-primary);
	text-decoration: none;
}

.post-card__title a:hover {
	text-decoration: underline;
}

.post-card__excerpt {
	margin-bottom: var(--space-sm);
	opacity: 0.9;
}

.post-card__meta {
	font-size: var(--text-small);
	opacity: 0.7;
}

/* --------------------------------------------------------------------------
   9. Component Styles - Forms & Inputs
   -------------------------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="password"],
textarea {
	width: 100%;
	padding: 12px var(--space-md);
	font-family: var(--font-body);
	font-size: var(--text-body);
	color: var(--color-text-primary);
	background-color: var(--color-bg-primary);
	border: 2px solid var(--color-gold);
	border-radius: var(--radius-md);
	transition: var(--transition-default);
}

input:focus,
textarea:focus {
	outline: none;
	border-color: var(--color-gold);
	box-shadow: 0 0 0 3px rgba(207, 183, 0, 0.25);
}

label {
	display: block;
	margin-bottom: var(--space-xs);
	font-weight: 600;
}

/* Search form */
.search-form {
	display: flex;
	gap: var(--space-sm);
}

.search-form .search-field {
	flex: 1;
}

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

/* --------------------------------------------------------------------------
   10. Blog Index List (quadrant)
   -------------------------------------------------------------------------- */
.blog-index-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.blog-index-list__item {
	padding: var(--space-xs) 0;
}

.blog-index-list__item::before {
	content: '\25B8';
	margin-right: var(--space-sm);
	color: var(--color-gold);
}

.blog-index-list__link {
	color: var(--color-text-primary);
	text-decoration: underline;
	font-weight: 700;
}

.blog-index-list__link:hover {
	opacity: 0.8;
}

/* --------------------------------------------------------------------------
   11. Homepage Quadrant Sections
   -------------------------------------------------------------------------- */
.quadrant--blog {
	grid-area: 1 / 1 / 2 / 2;
}

.quadrant--index {
	grid-area: 2 / 1 / 3 / 2;
}

.quadrant--logo {
	grid-area: 1 / 2 / 2 / 2;
}

.quadrant--shop {
	grid-area: 2 / 2 / 3 / 2;
}

.quadrant__title {
	font-size: var(--text-h2);
	margin-bottom: var(--space-md);
}

/* Hide grid-only titles (e.g. "Index") when quadrant is expanded */
.is-expanded .quadrant__title--grid-only {
	display: none;
}

/* Add top padding to index list when expanded (title is hidden) */
.quadrant--index.is-expanded .blog-index-list {
	padding-top: var(--space-xl);
}

/* Logo quadrant - center the video */
.quadrant--logo .quadrant__content {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

/* Logo video: 50% size in grid view, full size when expanded */
.quadrant--logo video {
	width: 50%;
	height: 50%;
	object-fit: contain;
}

.quadrant--logo.is-expanded video {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Shop grid: 3 columns in quadrant, 5 columns when expanded */
.quadrant--shop .shop-grid {
	grid-template-columns: repeat(3, 1fr);
}

.quadrant--shop.is-expanded .shop-grid {
	grid-template-columns: repeat(5, 1fr);
}

/* In grid view, only show first 3 product cards */
.quadrant--shop:not(.is-expanded) .product-card:nth-child(n+4) {
	display: none;
}

@media (max-width: 768px) {
	.quadrant--blog { grid-area: 1 / 1 / 2 / 2; }
	.quadrant--logo { grid-area: 2 / 1 / 3 / 2; }
	.quadrant--index { grid-area: 3 / 1 / 4 / 2; }
	.quadrant--shop { grid-area: 4 / 1 / 5 / 2; }
}

/* --------------------------------------------------------------------------
   12. Mobile Navigation Drawer
   -------------------------------------------------------------------------- */
.nav-drawer {
	position: fixed;
	inset: 0;
	z-index: var(--z-modal);
	pointer-events: none;
}

.nav-drawer[aria-hidden="false"] {
	pointer-events: auto;
}

.nav-drawer__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.7);
	opacity: 0;
	transition: opacity var(--transition-drawer);
}

.nav-drawer[aria-hidden="false"] .nav-drawer__overlay {
	opacity: 1;
}

.nav-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	width: 280px;
	height: 100%;
	background-color: var(--color-bg-primary);
	border-left: 2px solid var(--color-gold);
	padding: var(--space-2xl) var(--space-lg);
	transform: translateX(100%);
	transition: transform var(--transition-drawer);
}

.nav-drawer[aria-hidden="false"] .nav-drawer__panel {
	transform: translateX(0);
}

.nav-drawer__close {
	position: absolute;
	top: var(--space-lg);
	right: var(--space-lg);
	color: var(--color-gold);
}

.nav-drawer__menu {
	list-style: none;
	padding: 0;
	margin: var(--space-2xl) 0 0;
}

.nav-drawer__menu li {
	padding: var(--space-md) 0;
	border-bottom: 1px solid rgba(207, 183, 0, 0.2);
}

.nav-drawer__menu a {
	color: var(--color-text-primary);
	text-decoration: none;
	font-size: var(--text-h4);
}

/* Hamburger toggle for mobile */
.menu-toggle {
	display: none;
	position: fixed;
	top: var(--space-md);
	right: var(--space-md);
	z-index: var(--z-overlay);
	width: 44px;
	height: 44px;
	color: var(--color-gold);
}

@media (max-width: 768px) {
	.menu-toggle {
		display: flex;
		align-items: center;
		justify-content: center;
	}
}

/* --------------------------------------------------------------------------
   13. Reading Progress Bar
   -------------------------------------------------------------------------- */
.reading-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 0;
	height: 3px;
	background-color: var(--color-gold);
	z-index: var(--z-quadrant-nav);
	transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   14. Category Filter Bar
   -------------------------------------------------------------------------- */
.category-filter {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	padding: var(--space-md) 0;
	margin-bottom: var(--space-lg);
}

.category-filter__btn {
	padding: var(--space-xs) var(--space-md);
	border: 1px solid var(--color-gold);
	color: var(--color-gold);
	font-size: var(--text-small);
	transition: var(--transition-hover);
	background: transparent;
}

.category-filter__btn:hover,
.category-filter__btn.is-active {
	background-color: var(--color-gold);
	color: var(--color-bg-primary);
}

/* --------------------------------------------------------------------------
   15. Footer
   -------------------------------------------------------------------------- */
.site-footer {
	border-top: 2px solid var(--color-gold);
	padding: var(--space-2xl) 0;
}

.site-footer__inner {
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-padding);
}

.site-footer__copyright {
	font-size: var(--text-small);
	opacity: 0.7;
	margin-top: var(--space-lg);
}

/* --------------------------------------------------------------------------
   16. Utility & Accessibility
   -------------------------------------------------------------------------- */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal;
}

.screen-reader-text:focus {
	background-color: var(--color-gold);
	color: var(--color-bg-primary);
	clip: auto;
	clip-path: none;
	display: block;
	font-size: var(--text-body);
	font-weight: 700;
	height: auto;
	left: 5px;
	line-height: normal;
	padding: var(--space-md) var(--space-lg);
	text-decoration: none;
	top: 5px;
	width: auto;
	z-index: 100000;
}

.skip-link:focus {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 999999;
}

/* Focus visible styles */
:focus-visible {
	outline: 2px solid var(--color-gold);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   17. Scroll Animations
   -------------------------------------------------------------------------- */
.fade-in-up {
	opacity: 0;
	transform: translateY(50px);
	transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* --------------------------------------------------------------------------
   18. Single Post Page
   -------------------------------------------------------------------------- */
.site-main--single {
	max-width: 800px;
	padding: var(--space-2xl);
}

.site-main--single .entry-header {
	margin-bottom: var(--space-xl);
}

.site-main--single .entry-content p {
	margin-bottom: var(--space-md);
}

/* --------------------------------------------------------------------------
   19. Archive / Search
   -------------------------------------------------------------------------- */
.site-main--archive,
.site-main--search {
	max-width: var(--container-max);
	margin-inline: auto;
	padding: var(--space-2xl) var(--container-padding);
}

.archive-header,
.search-header {
	margin-bottom: var(--space-xl);
}

/* --------------------------------------------------------------------------
   20. 404 Page
   -------------------------------------------------------------------------- */
.site-main--404 {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 80vh;
	text-align: center;
	padding: var(--space-2xl);
}

.error-404__title {
	font-size: 120px;
	line-height: 1;
	margin-bottom: var(--space-md);
}

/* --------------------------------------------------------------------------
   21. General Page Styles
   -------------------------------------------------------------------------- */
.site-main--page,
.site-main--about,
.site-main--contact {
	max-width: 800px;
	margin-inline: auto;
	padding: var(--space-2xl) var(--container-padding);
}

.entry-header {
	margin-bottom: var(--space-xl);
}

.entry-content p {
	margin-bottom: var(--space-md);
}

.entry-content ul,
.entry-content ol {
	margin-bottom: var(--space-md);
	padding-left: var(--space-lg);
}

.entry-content blockquote {
	border-left: 3px solid var(--color-gold);
	padding-left: var(--space-lg);
	margin: var(--space-lg) 0;
	opacity: 0.9;
}

/* --------------------------------------------------------------------------
   22. WordPress Core Overrides
   -------------------------------------------------------------------------- */
.wp-block-image {
	margin-bottom: var(--space-lg);
}

.alignwide {
	max-width: calc(var(--container-max) + var(--container-padding) * 2);
	margin-inline: auto;
}

.alignfull {
	width: 100vw;
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
}

/* Navigation pagination */
.posts-navigation,
.post-navigation {
	padding: var(--space-xl) 0;
	border-top: 1px solid rgba(207, 183, 0, 0.2);
}

.nav-links {
	display: flex;
	justify-content: space-between;
}

.nav-links a {
	color: var(--color-text-primary);
}
