/**
 * ReDICE Official Site Styles
 * ループ系ダイス探索アドベンチャー
 * Theme: Ethereal Unease - 透明感と不穏さの共存
 */

/* ===== Page Layout ===== */
.page-redice {
  background-color: var(--redice-bg);
  color: var(--redice-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ===== SVG Filters (hidden) ===== */
.svg-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ===== Logo Splash Animation ===== */
.logo-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--redice-bg);
  z-index: var(--z-modal);
  opacity: 1;
  animation: logoSplashFade 3s ease-in-out forwards;
  pointer-events: none;
}

.logo-splash__image {
  position: relative;
  max-width: 500px;
  width: 80%;
  z-index: 2;
  animation: logoSplashScale 3s ease-in-out forwards;
}

.logo-splash__glitch-layers {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 500px;
  pointer-events: none;
  opacity: 0;
}

.logo-splash__glitch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
}

.logo-splash__glitch-layer--1 {
  filter: url(#glitch-rgb);
  mix-blend-mode: screen;
}

.logo-splash__glitch-layer--2 {
  opacity: 0.7;
  mix-blend-mode: color-dodge;
}

@keyframes logoSplashScale {
  0% {
    transform: scale(1.1);
    opacity: 0;
  }
  20% {
    transform: scale(1);
    opacity: 1;
  }
  60% {
    transform: scale(1);
    opacity: 1;
    filter: none;
  }
  100% {
    transform: scale(0.95);
    opacity: 0;
    filter: url(#glitch-dilate);
  }
}

@keyframes logoSplashFade {
  0%, 60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

/* Glitch Effect - Morphology Dilate */
.logo-splash--glitch .logo-splash__image {
  animation: glitchDilateImage 1s ease-out forwards;
}

.logo-splash--glitch .logo-splash__glitch-layers {
  opacity: 1;
  animation: glitchLayersFade 1s ease-out forwards;
}

.logo-splash--glitch .logo-splash__glitch-layer--1 {
  animation: glitchLayerShift1 0.8s steps(4) infinite;
}

.logo-splash--glitch .logo-splash__glitch-layer--2 {
  animation: glitchLayerShift2 0.6s steps(3) infinite;
}

@keyframes glitchDilateImage {
  0% {
    filter: none;
    transform: scale(1);
    opacity: 1;
  }
  20% {
    filter: url(#glitch-dilate) brightness(1.1);
    transform: scale(1) translateX(-2px);
  }
  40% {
    filter: url(#glitch-dilate) brightness(1.2);
    transform: scale(1.02) translateX(3px);
  }
  60% {
    filter: url(#glitch-dilate) brightness(1.3) saturate(1.5);
    transform: scale(1.05) translateX(-1px);
  }
  80% {
    filter: url(#glitch-dilate) brightness(1.5) saturate(2);
    transform: scale(1.1);
    opacity: 0.7;
  }
  100% {
    filter: url(#glitch-dilate) brightness(2) blur(2px);
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes glitchLayersFade {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 0.8;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
  }
}

@keyframes glitchLayerShift1 {
  0%, 100% {
    transform: translateX(0) skewX(0);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
  25% {
    transform: translateX(-8px) skewX(-2deg);
    clip-path: polygon(0 10%, 100% 0, 100% 90%, 0 100%);
  }
  50% {
    transform: translateX(5px) skewX(1deg);
    clip-path: polygon(0 20%, 100% 10%, 100% 80%, 0 90%);
  }
  75% {
    transform: translateX(-3px) skewX(-1deg);
    clip-path: polygon(0 5%, 100% 15%, 100% 95%, 0 85%);
  }
}

@keyframes glitchLayerShift2 {
  0%, 100% {
    transform: translateX(0) scaleY(1);
    filter: hue-rotate(0deg);
  }
  33% {
    transform: translateX(10px) scaleY(1.02);
    filter: hue-rotate(90deg);
  }
  66% {
    transform: translateX(-6px) scaleY(0.98);
    filter: hue-rotate(-60deg);
  }
}

.logo-splash--hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

/* ===== Hero Section ===== */
.redice-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-xl);
  overflow: hidden;
  background: linear-gradient(180deg, var(--redice-bg) 0%, var(--redice-bg-secondary) 100%);
}

/* Subtle unease: floating particles effect via CSS */
.redice-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(184, 84, 80, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(107, 163, 184, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.redice-hero__visual {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 1200px;
  opacity: 0.85;
  z-index: 0;
  filter: saturate(0.9);
}

.redice-hero__visual img {
  width: 100%;
  height: auto;
  mask-image: radial-gradient(ellipse 80% 70% at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 100%);
}

/* Vignette overlay for key visual */
.redice-hero__visual::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse 100% 100% at center, transparent 30%, var(--redice-bg) 100%);
  pointer-events: none;
}

.redice-hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
  margin-top: 40vh;
  animation: fadeInUp 1s ease-out 2.5s backwards;
}

.redice-hero__tagline {
  font-size: var(--font-size-xl);
  color: #ffffff;
  margin-bottom: var(--space-md);
  font-weight: var(--font-weight-bold);
  text-shadow: 0 2px 8px rgba(58, 69, 80, 0.6), 0 0 20px rgba(58, 69, 80, 0.3);
}

.redice-hero__genre {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: #ffffff;
  background-color: rgba(58, 69, 80, 0.5);
  backdrop-filter: blur(4px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Loop motif decoration - more subtle */
.redice-hero__loop-motif {
  position: absolute;
  width: 400px;
  height: 400px;
  border: 1px solid var(--redice-border);
  border-radius: 50%;
  opacity: 0.15;
  animation: rotate 90s linear infinite;
}

.redice-hero__loop-motif:nth-child(1) {
  top: 5%;
  right: -150px;
}

.redice-hero__loop-motif:nth-child(2) {
  bottom: 5%;
  left: -150px;
  animation-direction: reverse;
}

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

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

/* ===== Story Section ===== */
.redice-story {
  padding: var(--space-3xl) 0;
  background-color: var(--redice-bg-secondary);
  position: relative;
}

/* Subtle vertical line - loop/timeline motif */
.redice-story::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 60px;
  background: linear-gradient(180deg, transparent, var(--redice-border));
}

.redice-story__content {
  max-width: 800px;
  margin: 0 auto;
}

.redice-story__title {
  font-size: var(--font-size-2xl);
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--redice-accent-cyan);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.1em;
}

.redice-story__text {
  font-size: var(--font-size-base);
  line-height: 2;
  color: var(--redice-text);
}

.redice-story__text p {
  margin-bottom: var(--space-lg);
}

.redice-story__highlight {
  color: var(--redice-accent-red);
  font-weight: var(--font-weight-medium);
}

/* ===== System Section ===== */
.redice-system {
  padding: var(--space-3xl) 0;
  background-color: var(--redice-bg);
  position: relative;
}

.redice-system__content {
  max-width: 900px;
  margin: 0 auto;
}

.redice-system__title {
  font-size: var(--font-size-2xl);
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--redice-accent-cyan);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.1em;
}

.redice-system__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.redice-system__item {
  background: var(--redice-bg-secondary);
  border: 1px solid var(--redice-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-fast);
}

.redice-system__item:hover {
  border-color: var(--redice-accent-cyan);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--redice-shadow);
}

.redice-system__item-title {
  font-size: var(--font-size-lg);
  color: var(--redice-accent-red);
  margin-bottom: var(--space-md);
  font-weight: var(--font-weight-bold);
}

.redice-system__item-text {
  color: var(--redice-text);
  line-height: var(--line-height-loose);
  font-size: var(--font-size-sm);
}

/* ===== Event Section (Comiket) ===== */
.redice-event {
  padding: var(--space-3xl) 0;
  background: var(--redice-bg);
}

.redice-event__card {
  max-width: 700px;
  margin: 0 auto;
  background: var(--redice-bg-secondary);
  border: 1px solid var(--redice-accent-red);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  box-shadow: 0 4px 20px var(--redice-shadow);
  position: relative;
  overflow: hidden;
}

/* Subtle gradient accent */
.redice-event__card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--redice-accent-red), var(--redice-accent-cyan));
}

.redice-event__badge {
  display: inline-block;
  background-color: var(--redice-accent-red);
  color: white;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-md);
  letter-spacing: 0.05em;
}

.redice-event__title {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-lg);
  color: var(--redice-text);
}

.redice-event__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.redice-event__title a:hover {
  color: var(--redice-accent-cyan);
}

.redice-event__details {
  display: grid;
  gap: var(--space-md);
  text-align: left;
  margin-bottom: var(--space-lg);
}

.redice-event__detail {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--redice-border);
}

.redice-event__label {
  flex-shrink: 0;
  width: 80px;
  color: var(--redice-text-muted);
  font-size: var(--font-size-sm);
}

.redice-event__value {
  color: var(--redice-text);
}

.redice-event__value--highlight {
  color: var(--redice-accent-red);
  font-weight: var(--font-weight-bold);
}

.redice-event__value a {
  color: var(--redice-accent-cyan);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.redice-event__value a:hover {
  color: var(--redice-accent-cyan-muted);
  text-decoration: underline;
}

.redice-event__note {
  font-size: var(--font-size-sm);
  color: var(--redice-text-muted);
  margin-top: var(--space-md);
}

.redice-event__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--redice-border);
}

.redice-event__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  background: var(--redice-bg);
  border: 1px solid var(--redice-accent-cyan);
  border-radius: var(--radius-md);
  color: var(--redice-accent-cyan);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-fast);
}

.redice-event__link:hover {
  background: var(--redice-accent-cyan);
  color: white;
}

.redice-event__link--riddle {
  background: var(--redice-accent-cyan);
  border-color: var(--redice-accent-cyan);
  color: white;
}

.redice-event__link--riddle:hover {
  background: var(--redice-accent-cyan-muted);
  border-color: var(--redice-accent-cyan-muted);
  color: white;
}

.redice-event__link--survey {
  border-color: var(--redice-accent-red);
  color: var(--redice-accent-red);
}

.redice-event__link--survey:hover {
  background: var(--redice-accent-red);
  color: white;
}

.redice-event__link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Highlighted Survey Link */
.redice-event__link--highlight {
  flex-direction: column;
  padding: var(--space-md) var(--space-xl);
  background: linear-gradient(135deg, var(--redice-accent-red), #c96a5e);
  border-color: transparent;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: pulseGlow 2s ease-in-out infinite;
}

.redice-event__link--highlight:hover {
  background: linear-gradient(135deg, #c96a5e, var(--redice-accent-red));
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(184, 84, 80, 0.4);
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 84, 80, 0.4); }
  50% { box-shadow: 0 0 15px 5px rgba(184, 84, 80, 0.3); }
}

.redice-event__link-icon {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-xs);
}

.redice-event__link-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.redice-event__link-main {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
}

.redice-event__link-sub {
  font-size: var(--font-size-xs);
  opacity: 0.9;
}

.redice-event__link--highlight svg {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  opacity: 0.8;
}

/* ===== Development Section ===== */
.redice-dev {
  padding: var(--space-3xl) 0;
  text-align: center;
  background-color: var(--redice-bg-secondary);
}

.redice-dev__content {
  max-width: 600px;
  margin: 0 auto;
}

.redice-dev__title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-md);
  color: var(--redice-accent-cyan);
  letter-spacing: 0.1em;
}

.redice-dev__text {
  color: var(--redice-text-muted);
  margin-bottom: var(--space-lg);
}

.redice-dev__text a {
  color: var(--redice-accent-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.redice-dev__text a:hover {
  color: var(--redice-accent-cyan-muted);
}

.redice-dev__status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--redice-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  background-color: rgba(107, 163, 184, 0.05);
}

.redice-dev__status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--redice-accent-cyan);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Footer ===== */
.redice-footer {
  margin-top: auto;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--redice-border);
  text-align: center;
  background-color: var(--redice-bg);
}

.redice-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

.redice-footer__logo {
  max-width: 150px;
  width: 40%;
  opacity: 0.8;
}

.redice-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md) var(--space-xl);
}

.redice-footer__link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.redice-footer__link:hover {
  color: var(--redice-accent-cyan);
}

.redice-footer__back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--redice-text-muted);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.redice-footer__back:hover {
  color: var(--redice-accent-cyan);
}

.redice-footer__back svg {
  width: 16px;
  height: 16px;
}

.redice-footer__social {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

.redice-footer__social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--redice-bg-secondary);
  color: var(--redice-text);
  transition: all var(--transition-fast);
}

.redice-footer__social-link:hover {
  background-color: var(--redice-accent-cyan);
  color: white;
  transform: scale(1.1);
}

.redice-footer__social-link svg {
  width: 18px;
  height: 18px;
}

.redice-footer__copyright {
  font-size: var(--font-size-xs);
  color: var(--redice-text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .redice-hero {
    min-height: 100vh;
    padding: var(--space-3xl) var(--space-md);
  }

  .redice-hero__content {
    margin-top: 50vh;
  }

  .logo-splash__image {
    max-width: 300px;
  }

  .redice-hero__visual {
    opacity: 0.5;
  }

  .redice-hero__loop-motif {
    display: none;
  }

  .redice-event__card {
    padding: var(--space-lg);
  }

  .redice-event__detail {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .redice-event__label {
    width: auto;
  }

  .redice-footer__logo {
    max-width: 150px;
  }
}

/* ===== Language Toggle (Fixed Position) ===== */
.lang-toggle-fixed {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: var(--z-fixed);
  padding: var(--space-xs) var(--space-md);
  border: 2px solid var(--redice-accent-cyan);
  border-radius: var(--radius-full);
  background: rgba(245, 248, 250, 0.9);
  color: var(--redice-accent-cyan);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.lang-toggle-fixed:hover {
  background: var(--redice-accent-cyan);
  color: #ffffff;
}

/* ===== Twitter Section ===== */
.redice-twitter {
  padding: var(--space-3xl) 0;
  background: var(--redice-bg-secondary);
}

.redice-twitter__content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.redice-twitter__title {
  font-size: var(--font-size-2xl);
  color: var(--redice-accent-cyan);
  margin-bottom: var(--space-md);
  text-align: center;
}

.redice-twitter__note {
  color: var(--redice-text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-lg);
}

.redice-twitter__note a {
  color: var(--redice-accent-cyan);
}

.redice-twitter__embed {
  background: rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
}

/* ===== Event Riddle Note ===== */
.redice-event__riddle-note {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(107, 163, 184, 0.1);
  border: 1px dashed var(--redice-accent-cyan);
  border-radius: var(--radius-md);
  color: var(--redice-text);
  font-size: var(--font-size-sm);
  line-height: 1.7;
  text-align: center;
}

/* ===== Fixed Riddle Button ===== */
.riddle-fixed-btn {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: var(--redice-accent-red);
  color: #ffffff;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  box-shadow: 0 4px 20px rgba(184, 84, 80, 0.4);
  z-index: var(--z-fixed);
  transition: all var(--transition-fast);
  animation: riddle-pulse 2s ease-in-out infinite;
}

.riddle-fixed-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(184, 84, 80, 0.5);
}

.riddle-fixed-btn svg {
  flex-shrink: 0;
}

@keyframes riddle-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(184, 84, 80, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(184, 84, 80, 0.6); }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .redice-hero__loop-motif {
    animation: none;
  }

  .redice-dev__status-dot {
    animation: none;
  }

  .logo-splash {
    animation: none;
    display: none;
  }

  .logo-splash__image {
    animation: none;
  }

  .redice-hero__content {
    animation: none;
  }
}
