/* ============================================
   Perdue Shop — Design System
   Aesthetic: "Refined Antique × Elegant Surrealism"
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Color Palette - Night Sky × Golden Warmth */
  --color-bg: #0a0a12;
  --color-bg-secondary: #111122;
  --color-surface: #1a1a2e;
  --color-surface-hover: #252540;
  --color-border: rgba(212, 175, 105, 0.15);
  --color-border-hover: rgba(212, 175, 105, 0.35);

  /* Gold Accent */
  --color-gold: #d4af69;
  --color-gold-light: #e8d5a3;
  --color-gold-dim: rgba(212, 175, 105, 0.6);

  /* Blue Star */
  --color-star: #6b8cce;
  --color-star-glow: rgba(107, 140, 206, 0.3);

  /* Text */
  --color-text: #e8e4dc;
  --color-text-muted: #9a9490;
  --color-text-dim: #6a6460;

  /* Typography */
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Noto Sans JP', -apple-system, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 200ms;
  --duration-normal: 400ms;
  --duration-slow: 800ms;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-gold-light);
}

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

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
  color: var(--color-text);
}

/* --- Header --- */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--duration-normal) var(--ease-out);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--color-gold) !important;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-link {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--color-text-muted) !important;
  transition: color var(--duration-fast) var(--ease-out);
}

.nav-link:hover {
  color: var(--color-gold-light) !important;
}

.cart-btn {
  position: relative;
  padding: var(--space-xs);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.cart-btn:hover {
  color: var(--color-gold);
}

.cart-count {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--color-gold);
  color: var(--color-bg);
  font-size: 0.65rem;
  font-weight: 500;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-link {
  display: flex;
  align-items: center;
  color: var(--color-text-dim);
  transition: color var(--duration-fast) var(--ease-out);
}

.account-link:hover {
  color: var(--color-gold);
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, var(--color-star-glow), transparent 60%),
              radial-gradient(ellipse at 50% 80%, rgba(212, 175, 105, 0.05), transparent 50%),
              var(--color-bg);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 60% 20%, rgba(107, 140, 206, 0.6), transparent),
    radial-gradient(1px 1px at 80% 50%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1px 1px at 10% 80%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1.5px 1.5px at 70% 85%, rgba(212, 175, 105, 0.4), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.25), transparent),
    radial-gradient(1px 1px at 30% 60%, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(2px 2px at 45% 15%, rgba(107, 140, 206, 0.8), transparent);
  animation: twinkle 8s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: var(--space-md);
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 300;
  font-style: italic;
  color: var(--color-star);
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 0.3s forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 7rem);
  font-weight: 300;
  letter-spacing: 0.2em;
  color: var(--color-gold);
  text-shadow: 0 0 60px rgba(212, 175, 105, 0.2);
  margin-bottom: var(--space-sm);
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 0.6s forwards;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--color-text-muted);
  letter-spacing: 0.3em;
  margin-bottom: var(--space-lg);
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 0.9s forwards;
}

.hero-cta {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.15em;
  padding: 0.8em 2.5em;
  border: 1px solid var(--color-gold-dim);
  color: var(--color-gold) !important;
  transition: all var(--duration-normal) var(--ease-out);
  opacity: 0;
  animation: fadeUp 1.2s var(--ease-out) 1.2s forwards;
}

.hero-cta:hover {
  background: rgba(212, 175, 105, 0.1);
  border-color: var(--color-gold);
  box-shadow: 0 0 30px rgba(212, 175, 105, 0.1);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Products Section --- */
.products-section {
  padding: var(--space-xl) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--color-gold);
  text-align: center;
  margin-bottom: var(--space-lg);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
}

/* --- Product Card --- */
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
}

.product-card:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
              0 0 40px rgba(212, 175, 105, 0.05);
}

.product-image-container {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.product-card:hover .product-image {
  transform: scale(1.05);
}

.product-info {
  padding: var(--space-md);
}

.product-link {
  display: block;
  color: inherit;
  text-decoration: none;
  flex: 1;
}

.add-to-cart-btn {
  display: block;
  width: calc(100% - var(--space-md) * 2);
  margin: 0 var(--space-md) var(--space-md);
  padding: 10px 0;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: var(--color-gold);
  border: 1px solid var(--color-border);
  background: transparent;
  transition: all var(--duration-fast) var(--ease-out);
}

.add-to-cart-btn:hover {
  background: rgba(212, 175, 105, 0.08);
  border-color: var(--color-gold-dim);
}

.add-to-cart-btn:active {
  transform: scale(0.98);
}

.add-to-cart-btn.added {
  background: rgba(212, 175, 105, 0.15);
  border-color: var(--color-gold);
  color: var(--color-gold-light);
}

.product-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.product-description {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--color-gold);
  margin-bottom: var(--space-sm);
}

/* Loading */
.product-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-lg);
  color: var(--color-text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-sm);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- About --- */
.about-section {
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(212, 175, 105, 0.03), transparent 60%);
}

.about-content {
  max-width: 600px;
  margin: 0 auto;
}

.about-text {
  font-size: 0.95rem;
  line-height: 2.2;
  color: var(--color-text-muted);
}

/* --- Footer --- */
#site-footer {
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-links a:hover {
  color: var(--color-gold-dim);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

/* --- Cart Sidebar --- */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--color-border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-smooth);
}

.cart-sidebar.active {
  transform: translateX(0);
}

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

.cart-header h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--color-gold);
}

.cart-close {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.cart-close:hover {
  color: var(--color-text);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
}

.cart-empty {
  text-align: center;
  color: var(--color-text-dim);
  padding: var(--space-lg) 0;
}

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

.cart-item-image {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--color-surface);
}

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

.cart-item-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

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

.cart-item-remove {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-top: 4px;
  padding: 0;
  transition: color var(--duration-fast) var(--ease-out);
}

.cart-item-remove:hover {
  color: #e57373;
}

.cart-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--color-text);
}

#cart-total-price {
  color: var(--color-gold);
}

.checkout-btn {
  width: 100%;
  padding: 1em;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--color-bg);
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  border: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.checkout-btn:hover {
  box-shadow: 0 4px 20px rgba(212, 175, 105, 0.3);
  transform: translateY(-1px);
}

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

/* --- Language Switch --- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: var(--space-sm);
}

.lang-opt {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding: 4px 10px 6px;
  color: rgba(255, 255, 255, 0.2);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.25s ease;
}

.lang-opt:hover {
  color: rgba(255, 255, 255, 0.5);
}

.lang-opt.active {
  color: var(--color-gold);
  border-bottom-color: var(--color-gold);
  font-weight: 600;
}

.lang-dot {
  color: rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  user-select: none;
}

/* --- Stars (JS-driven) --- */
.stars-container {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  border-radius: 50%;
  animation: starTwinkle 4s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0; transform: scale(0.8); }
  20% { opacity: 1; transform: scale(1.2); }
  50% { opacity: 0.4; transform: scale(1); }
  80% { opacity: 0.9; transform: scale(1.1); }
  100% { opacity: 0.1; transform: scale(0.9); }
}

/* Shooting star */
.shooting-star {
  position: absolute;
  width: 100px;
  height: 1.5px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));
  border-radius: 1px;
  transform: rotate(var(--shoot-angle, 30deg));
  animation: shoot 2.5s ease-out forwards;
}

.shooting-star::after {
  content: '';
  position: absolute;
  right: 0;
  top: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.6);
}

@keyframes shoot {
  0% {
    opacity: 1;
    transform: rotate(var(--shoot-angle, 30deg)) translateX(0);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--shoot-angle, 30deg)) translateX(300px);
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-title {
    letter-spacing: 0.1em;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .nav-links .nav-link {
    display: none;
  }

  #site-header {
    padding: var(--space-sm);
  }
}
