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

:root {
  /* Theme Variables - Default (Shrine/Japanese style) */
  --bg-color: #FCFAFA;
  --bg-image: none;
  --text-primary: #333333;
  --text-secondary: #666666;
  --color-primary: #C13D3D;
  /* Shrine Red (朱色) */
  --color-secondary: #D4AF37;
  /* Gold */
  --color-accent: #E8E2D9;
  /* Light border color */

  --font-serif: 'Noto Serif JP', serif;
  --font-sans: 'Noto Sans JP', sans-serif;

  /* Layout */
  --max-width: 480px;
  /* Smartphone optimized */
}

/* Dark Theme (Example for future toggling) */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-primary: #f0f0f0;
  --text-secondary: #b0b0b0;
  --color-primary: #D65A5A;
  --color-secondary: #E5C35E;
  --color-accent: #333333;
}

body {
  margin: 0;
  padding: 0;
  background-color: #e6e5d4;
  /* Outer light beige background color */
  background-image: url('../images/kami_background.jpg');
  background-repeat: repeat-y;
  background-position: center top;
  background-size: 1400px auto;
  /* Ensure it spans wide enough on desktop screens */
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  position: relative;
}

/* Mask the top 40px of the paper texture without using linear-gradient */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background-color: #e6e5d4;
  z-index: 1;
  pointer-events: none;
}

/* Desktop container simulation for SP layout */
.page-wrapper {
  max-width: var(--max-width);
  width: 100%;
  background-color: var(--bg-color);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
  /* Soft shadow on desktop sides */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
  z-index: 2;
  /* Sit on top of the body::before mask */
}

/* Adjust outer desktop background and mask on dark theme */
[data-theme="dark"] body {
  background-color: #121212;
  background-image: none;
}

[data-theme="dark"] body::before {
  background-color: #121212;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text-primary);
}

.container {
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
  flex: 1;
}

/* Hero Area (Interactive zoom-out and fade-in) */
.hero {
  position: relative;
  overflow: hidden;
  height: 380px;
  /* Taller hero area to match mockup */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-bottom: 40px;
  background-color: #d2a733;
  /* Fallback matching the ocher background */
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/background.png');
  background-size: cover;
  background-position: center;
  transform: scale(1.35);
  opacity: 0;
  animation: heroBgZoomOut 2.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.05);
  /* Very subtle overlay */
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 20px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
  line-height: 1.4;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(15px);
  animation: heroFadeIn 1.5s ease-out 1.2s forwards;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.hero-subtitle {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: #ffffff;
  margin: 15px 0 0 0;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(15px);
  animation: heroFadeIn 1.5s ease-out 1.7s forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  margin: 0;
  line-height: 1;
}

.hero-subtitle2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  color: #ffffff;
  margin: 15px 0 0 0;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(15px);
  animation: heroFadeIn 1.5s ease-out 1.7s forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Introduction Section */
.section-intro {
  text-align: center;
  margin-bottom: 50px;
}

.section-intro h2 {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-top: 0;
  margin-bottom: 5px;
}

.section-subtitle {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0;
  margin-bottom: 30px;
}

.intro-body p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  text-align: left;
  /* Left-aligned body text */
  margin-bottom: 24px;
}

.saru-illustration {
  display: flex;
  justify-content: center;
  margin-top: 35px;
  margin-bottom: 10px;
}

.saru-illustration img {
  max-width: 320px;
  width: 100%;
  height: auto;
  opacity: 0.95;
}

/* 3D Link Section (Main CTA) */
.section-3dlink {
  margin-bottom: 50px;
}

.card-3d {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-accent);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
}

[data-theme="dark"] .card-3d {
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-3d:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(193, 61, 61, 0.15);
}

.card-3d h3 {
  font-size: 1.2rem;
  color: var(--color-primary);
  margin-top: 0;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.card-3d-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.link-3d-img {
  display: block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--color-secondary);
  transition: opacity 0.3s;
}

.link-3d-img img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.5s ease;
}

.link-3d-img:hover img {
  transform: scale(1.03);
}

.touch-icon-overlay {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}

/* Work Section */
.section-work {
  margin-bottom: 50px;
}

.section-work h2 {
  font-size: 1.2rem;
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 8px;
  display: inline-block;
  margin-bottom: 20px;
}

.work-body p {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Buttons */
.btn {
  display: inline-block;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 30px;
  padding: 12px 24px;
  transition: all 0.3s ease;
  text-align: center;
  border: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(193, 61, 61, 0.3);
}

.btn-primary:hover {
  background-color: #A33333;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(212, 175, 55, 0.3);
}

.btn-secondary:hover {
  background-color: #B5952F;
  transform: translateY(-2px);
}

.action-container {
  margin-top: 50px;
  position: relative;
}

.bubble-tip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-secondary);
  color: #fff;
  font-size: 0.65rem;
  padding: 4px 12px;
  border-radius: 12px;
  white-space: nowrap;
  font-weight: bold;
  animation: bounce 2s infinite;
}

.bubble-tip::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: var(--color-secondary) transparent transparent transparent;
}

/* Footer */
.footer {
  background-color: #bba186;
  color: #fdfbf7;
  text-align: center;
  padding: 24px 0;
  font-size: 0.75rem;
  margin-top: 50px;
}

[data-theme="dark"] .footer {
  background-color: #000;
}

/* Theme Switcher Button (Floating) */
.theme-switcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--color-accent);
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}

[data-theme="dark"] .theme-switcher {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

.theme-switcher:hover {
  transform: scale(1.1);
}

/* Animations */
@keyframes heroBgZoomOut {
  0% {
    transform: scale(1.35);
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-active {
  opacity: 1;
  transform: translateY(0);
}

/* SP（画面幅480px以下）のみ改行を有効にし、481px以上では改行しない */
@media (min-width: 481px) {
  br.sp {
    display: none;
  }
}

/* ダークモード用の金粉パーティクルキャンバス */
#gold-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 3;
  /* コンテンツ本体(.page-wrapper: z-index: 2)の前面に優雅に降らせるため */
  display: none;
}