/* 1. Font Import & Global Variables */
@import url("https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Poppins:wght@300;400;500&display=swap");

:root {
	--bg-color: #fdfbf8;
	--text-color: #432e21;
	--heading-color: #2e1f16;
	--accent-color: #d96d3b;
	--accent-color-darker: #b85b2f;
	--surface-color: #ffffff;
	--border-color: rgba(67, 46, 33, 0.1);
	--font-heading: "Lora", serif;
	--font-body: "Poppins", sans-serif;
	--transition-speed: 400ms;
	--border-radius: 16px;
}

body.dark-theme {
	--bg-color: #1a120d;
	--text-color: #d7cfc8;
	--heading-color: #f3ece7;
	--accent-color: #e58254;
	--accent-color-darker: #d96d3b;
	--surface-color: #241811;
	--border-color: rgba(243, 236, 231, 0.1);
}

/* 2. Basic Reset & Body Styles */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
html {
	scroll-behavior: smooth;
}
body {
	font-family: var(--font-body);
	background-color: var(--bg-color);
	color: var(--text-color);
	transition: background-color var(--transition-speed) ease,
		color var(--transition-speed) ease;
	overflow-x: hidden; /* This is still good to keep */
}
body.nav-open {
	overflow: hidden;
}
h1,
h2,
h3 {
	font-family: var(--font-heading);
	font-weight: 500;
	color: var(--heading-color);
}
p {
	line-height: 1.7;
	font-weight: 300;
}
a {
	color: var(--accent-color);
	text-decoration: none;
}
img {
	max-width: 100%;
	display: block;
}
.container {
	width: 100%;
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	padding: 0 5%;
}

/* 3. Header & Navigation */
header {
	/* Reverted to space-between for correct desktop layout */
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem 5%;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	z-index: 100;
	background-color: hsla(30, 60%, 98%, 0.7);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--border-color);
	transition: background-color var(--transition-speed) ease,
		border-color var(--transition-speed) ease;
}
body.dark-theme header {
	background-color: hsla(28, 43%, 8%, 0.7);
}
.logo {
	height: 55px;
}
header nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: var(--bg-color);
	display: none; /* Mobile-first: nav is hidden by default */
	flex-direction: column;

	/* FIX 1: Removed justify-content, added padding-top */
	padding-top: 100px;

	transform: translateX(100%);
	transition: transform 0.4s ease-in-out;
	z-index: 99;
}
header nav.is-open {
	transform: translateX(0);
	display: flex; /* Show nav when open */
}
header nav ul {
	display: flex;
	flex-direction: column;
	list-style: none;
	gap: 2rem;
	align-items: center; /* Center links horizontally */
}
header nav a {
	font-weight: 500;
	font-size: 2rem;
}

.header-controls {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

/* Mobile Nav Toggle (Hamburger) */
.mobile-nav-toggle {
	/* FIX 2: Set to block by default to stop layout flash */
	display: block;
	width: 30px;
	height: 22px;
	background: transparent;
	border: none;
	cursor: pointer;
	z-index: 100;
	position: relative;
}
.mobile-nav-toggle .bar {
	display: block;
	width: 100%;
	height: 3px;
	background-color: var(--heading-color);
	border-radius: 2px;
	transition: transform 0.3s ease, opacity 0.3s ease;
	position: absolute;
}
.mobile-nav-toggle .bar:nth-child(1) {
	top: 0;
}
.mobile-nav-toggle .bar:nth-child(2) {
	top: 50%;
	transform: translateY(-50%);
}
.mobile-nav-toggle .bar:nth-child(3) {
	bottom: 0;
}

.nav-open .mobile-nav-toggle .bar:nth-child(1) {
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
}
.nav-open .mobile-nav-toggle .bar:nth-child(2) {
	opacity: 0;
}
.nav-open .mobile-nav-toggle .bar:nth-child(3) {
	top: 50%;
	transform: translateY(-50%) rotate(-45deg);
}

/* 4. Dark/Light Mode Toggle Switch */
.theme-switch {
	display: inline-block;
	height: 26px;
	position: relative;
	width: 50px;
}
.theme-switch input {
	display: none;
}
.slider {
	background-color: #ccc;
	bottom: 0;
	cursor: pointer;
	left: 0;
	position: absolute;
	right: 0;
	top: 0;
	transition: 0.4s;
}
.slider:before {
	background-color: #fff;
	bottom: 4px;
	content: "";
	height: 18px;
	left: 4px;
	position: absolute;
	transition: 0.4s;
	width: 18px;
}
input:checked + .slider {
	background-color: var(--accent-color);
}
input:checked + .slider:before {
	transform: translateX(24px);
}
.slider.round {
	border-radius: 34px;
}
.slider.round:before {
	border-radius: 50%;
}

/* 5. Hero Section Styling */
#hero {
	height: 100vh;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: white;
	overflow: hidden;
}
.hero-video {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	min-width: 100%;
	min-height: 100%;
	z-index: -2;
}
.hero-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0.2) 0%,
		rgba(0, 0, 0, 0.6) 100%
	);
	z-index: -1;
}
.cursor-flare {
	position: absolute;
	width: 400px;
	height: 400px;
	background: radial-gradient(
		circle,
		hsla(25, 100%, 80%, 0.15) 0%,
		transparent 70%
	);
	border-radius: 50%;
	pointer-events: none;
	transform: translate(-50%, -50%);
	left: var(--x, 50%);
	top: var(--y, 50%);
	transition: left 100ms ease-out, top 100ms ease-out;
}
.hero-content h1 {
	font-size: clamp(2.5rem, 6vw, 4.5rem);
	margin-bottom: 0.5rem;
	color: #fff;
	font-weight: 600;
}
.hero-content p {
	font-size: clamp(1rem, 2vw, 1.25rem);
	margin-bottom: 2rem;
	color: #e0d8d3;
}
.cta-button {
	background-color: var(--accent-color);
	color: white;
	padding: 0.9rem 2.2rem;
	border-radius: 50px;
	font-weight: 500;
	font-family: var(--font-body);
	transition: transform var(--transition-speed) ease,
		background-color var(--transition-speed) ease;
}
.cta-button:hover {
	transform: scale(1.05);
	background-color: var(--accent-color-darker);
}

/* 6. General Section Styling & Story Section */
section {
	padding: 7rem 0;
}
#story {
	padding: 7rem 5%;
}

.story-wrapper {
	display: flex;
	gap: 5rem;
	align-items: flex-start;
}
.story-visual {
	flex: 1;
	position: sticky;
	top: 120px;
	height: calc(80vh - 120px);
}
.story-visual img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: var(--border-radius);
}
.story-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8rem;
	padding: 2rem 0;
}
.story-step {
	position: relative;
	overflow: hidden; /* <-- THIS IS THE NEW FIX */
}
.story-decorator {
	position: absolute;
	top: -2rem;
	left: -2rem;
	font-family: var(--font-heading);
	font-size: 5rem;
	font-style: italic;
	color: var(--border-color);
	z-index: -1;
	opacity: 0.7;
	transition: color var(--transition-speed) ease;
}
.story-step h2 {
	font-size: clamp(2rem, 4vw, 2.8rem);
	margin-bottom: 1rem;
}

/* 7. "Explore Coffee" Carousel Section */
#coffee {
	position: relative;
}
#coffee .container {
	padding-bottom: 2rem;
}
#coffee h2 {
	text-align: center;
	font-size: clamp(2.2rem, 5vw, 3rem);
}

.carousel-container-full-bleed {
	width: 100%;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.carousel-container-full-bleed::-webkit-scrollbar {
	display: none;
}

.carousel-container {
	display: flex;
	gap: 2rem;
	padding: 0 5%;
	width: max-content;
	scroll-snap-type: x mandatory;
}

.product-card {
	flex: 0 0 420px;
	border-radius: var(--border-radius);
	text-align: center;
	position: relative;
	overflow: hidden;
	scroll-snap-align: start;
	border: 1px solid var(--border-color);
	transition: opacity var(--transition-speed) ease;
}
.product-card-bg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: hsla(30, 20%, 95%, 0.5);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	z-index: 1;
}
body.dark-theme .product-card-bg {
	background-color: hsla(28, 30%, 10%, 0.5);
}
.product-card-content {
	position: relative;
	z-index: 2;
	padding: 2.5rem 2rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
}
.product-card img {
	width: 300px;
	height: 300px;
	object-fit: contain;
	margin-bottom: 1.5rem;
	transition: transform 600ms ease;
}
.product-card:hover img {
	transform: scale(1.05);
}
.product-card h3 {
	font-size: 1.8rem;
	margin-bottom: 0.75rem;
}
.product-card p {
	font-size: 0.95rem;
	margin-bottom: 1.5rem;
	flex-grow: 1;
}
.tasting-note-tags {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
}
.tasting-note-tags span {
	background-color: transparent;
	border: 1px solid var(--border-color);
	padding: 0.25rem 0.75rem;
	border-radius: 20px;
	font-size: 0.8rem;
	font-weight: 500;
}
.product-price {
	font-size: 1.25rem;
	font-weight: 500;
	font-family: var(--font-heading);
	color: var(--heading-color);
	margin-bottom: 1.5rem;
}

.product-status-tag {
	position: absolute;
	top: 1rem;
	right: 1rem;
	padding: 0.3rem 0.8rem;
	font-size: 0.75rem;
	font-weight: 500;
	border-radius: 20px;
	z-index: 3;
}
.product-card[data-status="available"] .product-status-tag {
	background-color: #2e7d32;
	color: white;
}
.product-card[data-status="available"] .product-status-tag::before {
	content: "Available";
}
.product-card[data-status="out-of-stock"] .product-status-tag {
	background-color: #616161;
	color: white;
}
.product-card[data-status="out-of-stock"] .product-status-tag::before {
	content: "Out of Stock";
}
.product-card[data-status="coming-soon"] .product-status-tag {
	background-color: #0277bd;
	color: white;
}
.product-card[data-status="coming-soon"] .product-status-tag::before {
	content: "Coming Soon";
}
.product-card[data-status="out-of-stock"],
.product-card[data-status="coming-soon"] {
	opacity: 0.7;
}

.order-btn {
	background: var(--accent-color);
	color: white;
	border: none;
	padding: 0.8rem 1.5rem;
	border-radius: 50px;
	font-weight: 500;
	cursor: pointer;
	width: 100%;
	transition: background-color var(--transition-speed) ease;
}
.order-btn:hover {
	background-color: var(--accent-color-darker);
}
.order-btn:disabled {
	background-color: #9e9e9e;
	cursor: not-allowed;
}
.order-btn:disabled:hover {
	background-color: #9e9e9e;
}
body.dark-theme .order-btn:disabled {
	background-color: #424242;
}

.carousel-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background-color: var(--surface-color);
	border: 1px solid var(--border-color);
	border-radius: 50%;
	width: 50px;
	height: 50px;
	font-size: 1.5rem;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
#prev-btn {
	left: 2%;
}
#next-btn {
	right: 2%;
}

/* 8. Side-Cart & Product Detail Page */
.side-cart {
	position: fixed;
	top: 0;
	right: 0;
	width: 420px;
	max-width: 90%;
	height: 100%;
	background-color: var(--bg-color);
	box-shadow: -5px 0 35px rgba(0, 0, 0, 0.1);
	z-index: 200;
	transform: translateX(100%);
	visibility: hidden;
	transition: transform var(--transition-speed) ease,
		visibility var(--transition-speed) ease;
}
.side-cart.open {
	transform: translateX(0);
	visibility: visible;
}
.cart-content {
	padding: 2.5rem 2rem;
	height: 100%;
	display: flex;
	flex-direction: column;
}
.cart-content > h2 {
	text-align: center;
	margin-bottom: 0.5rem;
	font-size: 1.8rem;
}
#product-name-in-cart {
	text-align: center;
	margin-bottom: 2rem;
	font-family: var(--font-body);
	font-weight: 300;
}
.close-btn {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: none;
	border: none;
	font-size: 2.5rem;
	cursor: pointer;
	color: var(--text-color);
}
#order-form {
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	gap: 1.2rem;
}
.form-group label {
	margin-bottom: 0.5rem;
	font-weight: 500;
	font-size: 0.9rem;
}
.form-group input,
.form-group select {
	padding: 0.8rem;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	background-color: var(--surface-color);
	color: var(--text-color);
	font-family: var(--font-body);
	font-size: 1rem;
}
.grind-options {
	display: flex;
	gap: 0.5rem;
}
.grind-options label {
	flex: 1;
}
.grind-options input[type="radio"] {
	display: none;
}
.grind-options span {
	display: block;
	text-align: center;
	padding: 0.75rem;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	cursor: pointer;
	transition: all var(--transition-speed) ease;
}
.grind-options input[type="radio"]:checked + span {
	background-color: var(--accent-color);
	color: white;
	border-color: var(--accent-color);
}
.phone-input-group {
	display: flex;
	align-items: center;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	overflow: hidden;
}
.country-code-display {
	padding: 0.8rem;
	background-color: var(--surface-color);
	font-weight: 500;
}
.phone-input-group input {
	border: none;
	flex-grow: 1;
}
.submit-order-btn {
	background: var(--accent-color);
	color: white;
	border: none;
	padding: 1rem;
	border-radius: 8px;
	font-weight: 500;
	cursor: pointer;
	width: 100%;
	margin-top: auto;
	font-size: 1rem;
	transition: background-color var(--transition-speed) ease;
}
.submit-order-btn:hover {
	background-color: var(--accent-color-darker);
}
.submit-order-btn.is-loading {
	background-color: #b0a698;
	cursor: not-allowed;
}

.product-detail-page {
	padding-top: 80px;
}
.product-hero {
	background-color: var(--surface-color);
	padding: 5rem 5%;
	border-bottom: 1px solid var(--border-color);
}
.product-hero-content {
	max-width: 1200px;
	margin: auto;
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	gap: 4rem;
	align-items: center;
}
.product-detail-image img {
	width: 100%;
	max-width: 500px;
	border-radius: var(--border-radius);
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}
.product-hero-text h1 {
	font-size: clamp(2.5rem, 6vw, 4rem);
	line-height: 1.1;
}
.product-hero-text .product-tagline {
	font-size: 1.2rem;
	font-style: italic;
	margin-top: 1rem;
	margin-bottom: 1.5rem;
}
.product-hero-text .product-price {
	font-size: 1.75rem;
	font-weight: 500;
	margin-bottom: 2rem;
}
.product-deeper-dive {
	max-width: 900px;
	margin: auto;
	padding: 6rem 5%;
}
.detail-section {
	position: relative;
	padding-left: 3rem;
	margin-bottom: 4rem;
	border-left: 1px solid var(--border-color);
}
.detail-decorator {
	position: absolute;
	top: -1.5rem;
	left: -2rem;
	font-family: var(--font-heading);
	font-size: 4rem;
	font-style: italic;
	color: var(--border-color);
	z-index: -1;
	opacity: 0.7;
}
.detail-section h2 {
	font-size: 2rem;
	margin-bottom: 1rem;
}
.detail-tags span {
	font-size: 0.9rem;
}
.product-card-link {
	text-decoration: none;
	color: inherit;
}

/* 9. Footer Styling */
footer {
	padding: 5rem 5% 2rem;
	background-color: var(--surface-color);
	border-top: 1px solid var(--border-color);
	transition: all var(--transition-speed) ease;
}
.footer-content {
	display: flex;
	justify-content: space-between;
	gap: 2rem;
	margin-bottom: 4rem;
	flex-wrap: wrap;
}
.footer-brand {
	flex-basis: 300px;
}
.footer-logo {
	height: 50px;
	margin-bottom: 1rem;
}
.footer-content h3 {
	margin-bottom: 1rem;
}
.social-info a,
.contact-info a {
	margin-right: 1.5rem;
	font-weight: 400;
	font-size: 0.9rem;
}
.footer-bottom {
	text-align: center;
	font-size: 0.9rem;
	opacity: 0.7;
}

/* 10. Responsive & Animation */
@media (min-width: 901px) {
	header nav {
		position: static;
		transform: none;
		background-color: transparent;
		flex-direction: row;
		height: auto;
		width: auto;
		z-index: 100;
		display: block; /* Show nav on desktop */
		padding-top: 0; /* Reset padding for desktop */
	}
	header nav ul {
		flex-direction: row;
		gap: 2.5rem;
		align-items: center;
	}
	header nav a {
		font-size: 0.9rem;
	}

	/* Hide the hamburger menu on desktop */
	.mobile-nav-toggle {
		display: none;
	}
}
@media (max-width: 900px) {
	/* .mobile-nav-toggle { display: block; } <-- No longer needed here */

	.carousel-btn {
		width: 40px;
		height: 40px;
		font-size: 1.2rem;
	}
	.product-hero-content {
		grid-template-columns: 1fr;
		text-align: center;
	}
	.product-detail-image {
		margin: 0 auto 2rem;
	}
	.story-wrapper {
		flex-direction: column;
	}
	.story-visual {
		position: static;
		height: 300px;
	}
	.product-card {
		flex-basis: 80vw;
	}
	.footer-content {
		flex-direction: column;
		text-align: center;
		align-items: center;
	}
	/* Improved mobile navigation */
	.mobile-nav-toggle {
		width: 35px;
		height: 30px;
		padding: 5px;
	}
	.mobile-nav-toggle .bar {
		height: 3px;
	}
	/* Improved touch targets */
	.order-btn,
	.cta-button {
		padding: 1rem 2rem;
		font-size: 1.1rem;
	}
	/* Better spacing for mobile */
	section {
		padding: 5rem 0;
	}
	.hero-content h1 {
		margin-bottom: 1rem;
	}
	/* Improved readability */
	p {
		font-size: 1rem;
		line-height: 1.8;
	}
}

/* Additional mobile optimizations for smaller screens */
@media (max-width: 480px) {
	.logo {
		height: 40px;
	}
	header {
		padding: 0.8rem 5%;
	}
	.hero-content h1 {
		font-size: clamp(2rem, 5vw, 3rem);
	}
	.hero-content p {
		font-size: 0.95rem;
	}
	.story-step h2 {
		font-size: 1.8rem;
	}
	.product-card {
		flex-basis: 90vw;
	}
	.product-card img {
		width: 250px;
		height: 250px;
	}
	.side-cart {
		width: 100%;
		max-width: 100%;
	}
	.tasting-note-tags span {
		font-size: 0.75rem;
	}
	.footer-content {
		gap: 1.5rem;
	}
}

.fade-in-section {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 800ms ease-out, transform 800ms ease-out;
}
.fade-in-section.is-visible {
	opacity: 1;
	transform: translateY(0);
}
