/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* darker base background for a richer atmosphere */
  --cream: #e0e4e8;
  /* deeper charcoal for text readability */
  --ink: #1f2428;
  /* darker secondary tone */
  --muted: #4b5358;
  /* deeper purple accent for contrast */
  --accent: #5a3ea8;
  /* keep card backgrounds white for clarity */
  --card-bg: #ffffff;
  --border: #c8d0d4;
  --font-display: 'DM Serif Display', serif;
  --font-body: 'DM Sans', sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: inline-block;
  text-decoration: none;
}

.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

/* fallback text if image doesn't load */
.logo::after {
  content: "Aeterna Studio";
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  color: var(--ink);
  display: none;
}

@media (prefers-reduced-data: reduce) {
  .logo-img { display: none; }
  .logo::after { display: inline; }
}

.cart-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ink);
  color: var(--cream);
  border: none;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}
.cart-btn:hover { background: #333; }

.cart-count {
  background: var(--accent);
  color: white;
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  font-weight: 500;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 300;
}

/* ── Products ─────────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.section-title {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-bottom: 2rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 2rem;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.08);
}

.product-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.product-info {
  padding: 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.3rem;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  flex: 1;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-price {
  font-size: 1rem;
  font-weight: 500;
}

.add-to-cart {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.add-to-cart:hover {
  background: var(--ink);
  color: var(--cream);
}

.add-to-cart.added {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Cart Sidebar ─────────────────────────────────────────── */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.cart-sidebar.open { right: 0; }

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cart-header h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.close-cart {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0.3rem;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

.empty-cart {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 2rem;
}

.cart-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.cart-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  flex-shrink: 0;
}

.cart-item-info { flex: 1; }

.cart-item-name {
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.cart-item-price {
  font-size: 0.85rem;
  color: var(--muted);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.qty-btn {
  background: var(--border);
  border: none;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-display {
  font-size: 0.85rem;
  min-width: 20px;
  text-align: center;
}

.remove-item {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: auto;
}

.cart-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.checkout-btn {
  width: 100%;
  background: var(--ink);
  color: var(--cream);
  border: none;
  padding: 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.checkout-btn:hover { background: #333; }
.checkout-btn:disabled { background: var(--muted); cursor: not-allowed; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 150;
}
.overlay.visible { display: block; }

/* ── Loading skeleton ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 2px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Brand & Utility Enhancements ─────────────────────────── */

/* Container for consistent horizontal padding */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Hero with optional background image */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
  position: relative;
  text-align: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(248,245,240,0.55);
  pointer-events: none;
}

.hero h1,
.hero p {
  position: relative;
  z-index: 1;
}

/* Footer styling */
footer {
  background: var(--cream);
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

footer a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}

/* Success / Cancel pages */
.message-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 70vh;
  text-align: center;
  padding: 2rem;
}

.message-page h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 1rem;
}

.message-page p {
  font-size: 1.1rem;
  color: var(--muted);
}

/* Buttons refinement */
button,
.checkout-btn,
.cart-btn,
.add-to-cart {
  border-radius: 4px;
}

/* Accessibility: focus states */
button:focus,
a:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Utility classes */
.hidden { display: none !important; }

/* Responsive tweaks */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; gap: 0.8rem; }
  .hero { padding: 4rem 1rem 2rem; }
  .cart-sidebar { width: 100%; }
}
