/* ========================================
   Kifubara Landing Page
   Warm, natural aesthetic with Japanese influences
   ======================================== */

/* --- Tokens --- */
:root {
  --color-surface: #F5F0E8;
  --color-surface-warm: #EDE5D8;
  --color-surface-card: #FFFDF8;
  --color-surface-overlay: #E8E0D3;
  --color-text: #3E2723;
  --color-text-secondary: #8D7B6A;
  --color-text-tertiary: #B0A090;
  --color-wood: #DEB06B;
  --color-wood-dark: #4A3B2A;
  --color-amber: #C68642;
  --color-wave: #C0B0A0;
  --color-wave-fill: var(--color-surface);
  --color-divider: rgba(62, 39, 35, 0.08);
  --color-store-bg: #3E2723;
  --color-store-text: #F5F0E8;
  --shadow-soft: 0 2px 20px rgba(62, 39, 35, 0.06);
  --shadow-card: 0 4px 24px rgba(62, 39, 35, 0.08);
  --shadow-hero-icon: 0 12px 40px rgba(62, 39, 35, 0.12);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #1A1510;
    --color-surface-warm: #221C14;
    --color-surface-card: #252018;
    --color-surface-overlay: #2E2820;
    --color-text: #E8E2D6;
    --color-text-secondary: #9B9384;
    --color-text-tertiary: #6B6358;
    --color-wood: #DEB06B;
    --color-wood-dark: #4A3B2A;
    --color-amber: #D4964E;
    --color-wave: #3E3530;
    --color-wave-fill: var(--color-surface);
    --color-divider: rgba(232, 226, 214, 0.06);
    --color-store-bg: #E8E2D6;
    --color-store-text: #1A1510;
    --shadow-soft: 0 2px 20px rgba(0, 0, 0, 0.2);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.25);
    --shadow-hero-icon: 0 12px 40px rgba(0, 0, 0, 0.3);
  }
}

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

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

body {
  font-family: 'Sora', system-ui, -apple-system, sans-serif;
  background: var(--color-surface);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* --- Navigation --- */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 24px;
  transition: background 0.4s, box-shadow 0.4s, backdrop-filter 0.4s;
}

#nav.scrolled {
  background: color-mix(in srgb, var(--color-surface) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-soft);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
}

.nav-icon {
  border-radius: 10px;
}

.nav-links {
  display: flex;
  gap: 32px;
  font-size: 0.9rem;
  font-weight: 400;
}

.nav-links a {
  color: var(--color-text-secondary);
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-amber);
  border-radius: 1px;
  transition: width 0.3s ease;
}

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

.nav-links a:hover::after {
  width: 100%;
}

.nav-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

/* --- Hero --- */
#hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 80px 24px 48px;
}

.seigaiha {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 40%, transparent 65%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 40%, transparent 65%);
  pointer-events: none;
}

.wave-fill {
  fill: var(--color-wave-fill);
}

.wave-stroke {
  fill: none;
  stroke: var(--color-wave);
  stroke-width: 0.7;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
}

.hero-icon-wrap {
  display: inline-block;
  margin-bottom: 32px;
  animation: hero-float 6s ease-in-out infinite;
}

.hero-icon {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-hero-icon);
  transition: transform 0.4s ease;
}

.hero-icon-wrap:hover .hero-icon {
  transform: rotate(-3deg) scale(1.03);
}

@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-title {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 36px;
  font-weight: 300;
}

/* --- Store Buttons --- */
.store-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-store-bg);
  color: var(--color-store-text);
  padding: 10px 22px 10px 16px;
  border-radius: var(--radius-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--color-divider);
}

.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

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

.store-btn-text {
  text-align: left;
  line-height: 1.2;
}

.store-btn-text small {
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.8;
  display: block;
}

.store-btn-text strong {
  font-size: 1rem;
  font-weight: 600;
}

/* --- Scroll Hint --- */
.scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-text-tertiary);
  animation: scroll-bounce 2s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* --- Sections --- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  font-weight: 300;
  margin-bottom: 48px;
}

/* --- Features --- */
#features {
  padding: 96px 0 80px;
  background: var(--color-surface-warm);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-divider);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}

.feature-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  color: var(--color-amber);
}

.feature-icon svg {
  width: 100%;
  height: 100%;
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--color-text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
  font-weight: 300;
}

/* --- How It Works --- */
#how-it-works {
  padding: 96px 0 80px;
}

.steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
}

.step {
  text-align: center;
  flex: 0 1 220px;
  padding: 0 12px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-amber);
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.step-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  color: var(--color-text-secondary);
}

.step-icon svg {
  width: 100%;
  height: 100%;
}

.step h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.step p {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  font-weight: 300;
}

.step-connector {
  flex: 0 0 48px;
  padding-top: 76px;
  color: var(--color-text-tertiary);
}

.step-connector svg {
  width: 48px;
  height: 8px;
}

/* --- Screenshots --- */
#screenshots {
  padding: 80px 0;
  background: var(--color-surface-warm);
}

.screenshots-scroll {
  display: flex;
  justify-content: center;
  gap: 20px;
  overflow-x: auto;
  padding: 8px 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.screenshot-placeholder {
  flex: 0 0 280px;
  height: 500px;
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  border: 2px dashed var(--color-divider);
  display: flex;
  align-items: center;
  justify-content: center;
}

.screenshot-inner {
  color: var(--color-text-tertiary);
  font-size: 0.9rem;
  font-weight: 300;
}

.screenshot {
  flex: 0 0 260px;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* --- CTA --- */
#cta {
  padding: 80px 0;
}

.cta-content {
  text-align: center;
  background: var(--color-surface-card);
  border-radius: var(--radius-lg);
  padding: 64px 40px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-divider);
}

.cta-content h2 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  margin-bottom: 8px;
}

.cta-content p {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  font-weight: 300;
  margin-bottom: 32px;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--color-divider);
  padding: 40px 0 24px;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-icon {
  border-radius: 12px;
}

.footer-name {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-weight: 300;
  font-style: italic;
}

.footer-links {
  display: flex;
  gap: 24px;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
}

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

.footer-bottom {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-tertiary);
  padding-top: 16px;
  border-top: 1px solid var(--color-divider);
}

/* --- Leaves Canvas --- */
#leaves {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* --- Reveal Animation --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.features-grid [data-reveal]:nth-child(2) { transition-delay: 0.1s; }
.features-grid [data-reveal]:nth-child(3) { transition-delay: 0.2s; }
.features-grid [data-reveal]:nth-child(4) { transition-delay: 0.3s; }
.steps .step[data-reveal]:nth-of-type(2) { transition-delay: 0.15s; }
.steps .step[data-reveal]:nth-of-type(3) { transition-delay: 0.3s; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: color-mix(in srgb, var(--color-surface) 95%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 16px 24px;
    gap: 0;
    box-shadow: var(--shadow-soft);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-divider);
  }

  .nav-links a::after {
    display: none;
  }

  .nav-menu-btn {
    display: flex;
  }

  .nav-menu-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-menu-btn.open span:nth-child(2) {
    opacity: 0;
  }

  .nav-menu-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .steps {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .step {
    flex: none;
    width: 100%;
    max-width: 320px;
  }

  .step-connector {
    padding-top: 0;
    transform: rotate(90deg);
  }

  .cta-content {
    padding: 40px 24px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .footer-brand {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero-icon {
    width: 160px;
    height: 160px;
  }

  .store-buttons {
    flex-direction: column;
    align-items: center;
  }

  .store-btn {
    width: 100%;
    max-width: 240px;
    justify-content: center;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  #leaves {
    display: none;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
