@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700;900&family=Outfit:wght@300;400;600;700&display=swap');

/* --- Reset & Base Variables --- */
:root {
  /* Layout Bounding Box coordinates for the iPhone back panel */
  --film-top: 0.37%;
  --film-left: 1.92%;
  --film-width: 96.16%;
  --film-height: 99.63%;

  /* Accents */
  --gold-accent: #c9a84c;
  --focus-red: #c0392b;

  /* Theme Text/Colors dynamically set by season class on body */
  --text-color-primary: #fff;
  --text-color-secondary: rgba(255, 255, 255, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.3);
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Serif JP', serif;
  overflow-x: hidden;
  min-height: 100vh;
  color: var(--text-color-primary);
  transition: color 0.8s ease-in-out;
}

/* Background Gradients cross-fade mechanism */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

.bg-gradient.active {
  opacity: 1;
}

/* Gradients representing seasons */
.bg-gradient.spring {
  background: linear-gradient(135deg, #fff0f5 0%, #ffe4e1 50%, #ffc0cb 100%);
}
.bg-gradient.summer {
  background: linear-gradient(135deg, #050e1e 0%, #0c1a30 50%, #17325c 100%);
}
.bg-gradient.autumn {
  background: linear-gradient(135deg, #2b0601 0%, #541103 50%, #85220c 100%);
}
.bg-gradient.winter {
  background: linear-gradient(135deg, #020712 0%, #091328 50%, #15274d 100%);
}
.bg-gradient.modern {
  background: linear-gradient(135deg, #0a0015 0%, #1a0a2e 50%, #2d1b4e 100%);
}

/* Body color adjustment depending on light/dark backgrounds */
body.season-0 {
  --text-color-primary: #3c2f2f;
  --text-color-secondary: rgba(60, 47, 47, 0.8);
  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-border: rgba(60, 47, 47, 0.15);
  --glass-shadow: rgba(60, 47, 47, 0.1);
}
body.season-1,
body.season-2,
body.season-3,
body.season-4 {
  --text-color-primary: #f0f4f8;
  --text-color-secondary: rgba(240, 244, 248, 0.75);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.4);
}

/* Background Particle Canvas layer */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* --- Layout Structure --- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 24px 60px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* --- Header & Navigation --- */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 75px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5%;
  z-index: 100;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.4s, border-color 0.4s;
}

header.scrolled {
  background: rgba(12, 12, 20, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
body.season-0 header.scrolled {
  background: rgba(255, 240, 245, 0.9);
  border-bottom-color: rgba(60, 47, 47, 0.15);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-seal {
  background: var(--focus-red);
  color: #ffffff;
  padding: 5px 6px;
  font-family: 'Noto Serif JP', serif;
  font-weight: 900;
  font-size: 0.75rem;
  line-height: 1;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: -2px;
  border-radius: 3px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.logo-text {
  font-family: 'Noto Serif JP', serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.15rem;
  color: var(--text-color-primary);
  transition: color 0.8s;
}

.nav-actions {
  display: flex;
  align-items: center;
}

.btn-3d {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  color: var(--text-color-primary);
  border: 1px solid var(--text-color-primary);
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-3d:hover {
  background: var(--text-color-primary);
  color: #121212;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}
body.season-0 .btn-3d:hover {
  color: #fff;
  background: #3c2f2f;
  box-shadow: 0 4px 15px rgba(60, 47, 47, 0.15);
}

.btn-3d:focus-visible {
  outline: 2px solid var(--focus-red);
  outline-offset: 2px;
}

.showcase-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-top: 20px;
  min-width: 0;
}

.visualizer-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 800px;
}

#iphone-wrapper {
  position: relative;
  display: block;
  width: 230px;
  height: 472px;
  max-width: 100%;
  border-radius: 36px;
  box-shadow: 0 20px 60px var(--glass-shadow);
  transition: transform 0.15s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.1);
  margin: 0 auto;
  flex-shrink: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

#iphone-wrapper.drag-over {
  scale: 1.04;
  box-shadow: 0 25px 70px rgba(201, 168, 76, 0.35);
  border-color: var(--gold-accent);
}

.iphone-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transform: translateZ(4px);
}

/* Film overlays placed absolutely */
.film-overlay {
  position: absolute;
  top: var(--film-top);
  left: var(--film-left);
  width: var(--film-width);
  height: var(--film-height);
  pointer-events: none;
  z-index: 2;
  transform: translateZ(10px);
}

.iphone-sheen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  border-radius: 32px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.05) 40%,
    transparent 60%
  );
  transform: translateZ(14px);
}

.film-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
  border-radius: 32px; /* matches inner body corners of phone */
  /* Film thickness and depth effect */
  box-shadow: 
    inset 0 0 2px rgba(0,0,0,0.1),
    0 0 3px rgba(0,0,0,0.15),
    0 1px 2px rgba(0,0,0,0.1);
  /* Subtle film texture */
  filter: drop-shadow(0 0 1px rgba(255,255,255,0.1));
}

.film-img.active {
  opacity: 1;
}

/* Top-to-bottom luxurious film-like wipe reveal */
#iphone-wrapper.drop-mode .film-img {
  transition: clip-path 1.6s cubic-bezier(0.4, 0.0, 0.2, 1), opacity 0.8s ease-in-out;
  will-change: clip-path, opacity;
}

#iphone-wrapper.drop-mode .film-img.wipe-reveal {
  clip-path: inset(0% 0 0 0);
  opacity: 1;
  /* Add subtle glow effect */
  filter: drop-shadow(0 0 8px rgba(255,215,0,0.3));
}

#iphone-wrapper.drop-mode .film-img.wipe-fade {
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

/* Add subtle scale pulse to the wrapper during transition */
#iphone-wrapper.drop-mode {
  animation: wrapper-pulse 1.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

@keyframes wrapper-pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

.details-pane {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

#design-info-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 10px 30px var(--glass-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.25s ease-in-out, transform 0.25s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#design-info-panel.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

.design-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 12px;
}

#design-name {
  font-family: 'Noto Serif JP', serif;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.05rem;
}

#design-desc {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-color-secondary);
}

.drop-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1.5px dashed var(--glass-border);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--text-color-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.drop-prompt svg {
  color: var(--gold-accent);
}

.gallery-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  overflow: hidden;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-header h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05rem;
}

.gallery-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 12px 4px 20px 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-accent) rgba(255, 255, 255, 0.05);
  will-change: transform;
}

/* Scrollbar customization */
.gallery-scroll::-webkit-scrollbar {
  height: 6px;
}
.gallery-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}
.gallery-scroll::-webkit-scrollbar-thumb {
  background: var(--gold-accent);
  border-radius: 3px;
}

/* Gallery Cards */
.design-card {
  flex: 0 0 95px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
  position: relative;
  user-select: none;
  box-shadow: 0 5px 15px var(--glass-shadow);
}

.design-card:hover {
  transform: scale(1.08) translateY(-4px);
  border-color: var(--gold-accent);
  box-shadow: 0 10px 25px rgba(201, 168, 76, 0.3);
}

.design-card.active {
  border-color: var(--gold-accent);
  box-shadow: 0 0 15px rgba(201, 168, 76, 0.45);
  background: rgba(201, 168, 76, 0.12);
}

.design-card:focus-visible {
  outline: 2px solid var(--focus-red);
  outline-offset: 2px;
}

.card-image-wrapper {
  width: 100%;
  aspect-ratio: 100 / 179;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.card-thumb {
  display: none;
}

.card-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-top: 6px;
  color: #fff;
}

.card-badge.season-0 { background-color: #ff69b4; } /* Spring */
.card-badge.season-1 { background-color: #00fa9a; color: #121212; } /* Summer */
.card-badge.season-2 { background-color: #e65c00; } /* Autumn */
.card-badge.season-3 { background-color: #00bfff; } /* Winter */
.card-badge.season-4 { background-color: #a855f7; } /* Modern */

.card-name {
  font-family: 'Noto Serif JP', serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* --- Product Information Section (Washi Background) --- */
.info-section {
  background-color: #f7f6f0;
  /* Premium SVG noise data URI representing washi paper texture */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.045'/%3E%3C/svg%3E");
  border-radius: 20px;
  padding: 48px;
  color: #2b2b24;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
  margin-top: 40px;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Gold-rimmed hanko (stamp) badge for Shibuya Loft */
.hanko-badge {
  display: inline-block;
  border: 3px double #c0392b;
  color: #c0392b;
  padding: 8px 10px;
  font-family: 'Noto Serif JP', serif;
  font-weight: 900;
  font-size: 0.95rem;
  line-height: 1.1;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 2px;
  border-radius: 4px;
  background: transparent;
  box-shadow: 0 0 0 3px #f7f6f0, inset 0 0 0 1px #c0392b;
  transform: rotate(-7deg);
  position: absolute;
  top: -15px;
  right: 32px;
  z-index: 10;
  pointer-events: none;
}

.info-section h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.1rem;
  margin-bottom: 30px;
  color: #1a1a15;
  border-bottom: 2px solid #e2decb;
  padding-bottom: 10px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.feature-card {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  transition: transform 0.3s;
}

.feature-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.7);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.15);
  color: #b08d32;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-text {
  font-family: 'Noto Serif JP', serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #33332a;
  line-height: 1.4;
}

.price-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 12px;
  margin-top: 20px;
  gap: 8px;
}

.price-main {
  font-size: 1.8rem;
  font-weight: 700;
  color: #b08d32;
  font-family: 'Noto Serif JP', serif;
}

.price-tax {
  font-size: 1.1rem;
  font-weight: 600;
  color: #55554d;
}

.price-note {
  font-size: 0.8rem;
  color: #77776f;
  margin-top: 4px;
}

/* --- How-to Video Section --- */
.howto-section {
  background-color: #f7f6f0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.045'/%3E%3C/svg%3E");
  border-radius: 20px;
  padding: 48px;
  color: #2b2b24;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
  margin-top: 40px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.howto-section h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.1rem;
  margin-bottom: 30px;
  color: #1a1a15;
  border-bottom: 2px solid #e2decb;
  padding-bottom: 10px;
}

.howto-video-wrapper {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.howto-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

@media (max-width: 768px) {
  .howto-section {
    padding: 30px 20px;
  }

  .howto-section h3 {
    font-size: 1.5rem;
    text-align: center;
  }

  .howto-video-wrapper {
    max-width: 100%;
  }
}

/* --- Footer --- */
footer {
  width: 100%;
  border-top: 1px solid var(--glass-border);
  background: rgba(12, 12, 20, 0.3);
  backdrop-filter: blur(5px);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-color-secondary);
  margin-top: 60px;
}

footer a {
  color: var(--gold-accent);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.3s;
}

footer a:hover {
  opacity: 0.8;
}

/* --- Confetti & Touch Drag Styling --- */
.seasonal-confetti {
  animation: confetti-burst 0.75s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes confetti-burst {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) rotate(0deg) scale(1.3);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) rotate(var(--spin)) scale(0.25);
    opacity: 0;
  }
}

.touch-drag-ghost {
  position: fixed;
  width: 70px;
  height: 110px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  opacity: 0.85;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  border: 2px solid var(--gold-accent);
  will-change: left, top;
}

/* --- Responsive Layout / Breakpoints --- */

@media (max-width: 768px) {
  .app-container {
    padding-top: 90px;
  }

  .showcase-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .visualizer-pane {
    order: 1;
  }

  .details-pane {
    order: 2;
    display: flex;
    flex-direction: column;
  }

  #design-info-panel {
    order: 2;
  }

  .gallery-container {
    order: 1;
  }

  #iphone-wrapper {
    width: 200px;
    height: 410px;
  }

  .info-section {
    padding: 30px 20px;
  }
  
  .hanko-badge {
    top: -20px;
    right: 20px;
    font-size: 0.85rem;
    padding: 6px 8px;
  }

  .info-section h3 {
    font-size: 1.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0 4%;
  }

  .logo-text {
    font-size: 1.15rem;
  }

  .btn-3d {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  #iphone-wrapper {
    width: 180px;
    height: 370px;
  }

  #design-info-panel {
    padding: 24px;
  }

  #design-name {
    font-size: 1.6rem;
  }

  #design-desc {
    font-size: 0.95rem;
  }

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