/* Astral-SMP Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Outfit:wght@400;700;900&display=swap');

/* Custom Font Setup */
@font-face {
  font-family: 'HamburgerHeaven';
  src: url('../assets/fonts/HamburgerHeaven.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Color Palette */
  --color-bg-deep: #0f0f4d;
  /* 宇宙・深夜 */
  --color-bg-dark: #05051a;
  /* より深い闇 */
  --color-text-main: #ffffff;
  --color-text-sub: #ccccff;
  --color-accent: #4d4dff;
  /* Neon Blue */
  --color-accent-glow: rgba(77, 77, 255, 0.6);
  --color-glass: rgba(15, 15, 77, 0.7);
  --color-glass-border: rgba(255, 255, 255, 0.1);

  /* Fonts */
  --font-main: 'Outfit', 'Inter', sans-serif;
  --font-pixel: 'Silkscreen', cursive;

  /* Spacing */
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --space-xl: 64px;

  /* UI */
  --header-height: 80px;
  --radius-md: 12px;
  --radius-lg: 24px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg-deep);
  color: var(--color-text-main);
  line-height: 1.6;
  overflow-x: hidden;
  background-image: url('../assets/images/home_bg2.png');
  /* Fallback / Base texture */
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

ul {
  list-style: none;
}

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

/* Typography */
h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 {
  font-size: 3.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2.5rem;
  color: var(--color-text-main);
  text-shadow: 0 0 20px var(--color-accent-glow);
  font-family: var(--font-pixel);
  /* Pixel font headers */
}

h3 {
  font-size: 1.5rem;
}

/* Utilities */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section {
  padding: var(--space-xl) 0;
}

.text-gradient {
  background: linear-gradient(135deg, #fff 0%, #b3b3ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
  display: flex;
  align-items: center;
}

.main-header.scrolled {
  background-color: var(--color-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-glass-border);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
}

.logo-text {
  font-size: 2.8rem;
  font-weight: 900;
  color: #ffffffe3;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
  transition: opacity 0.3s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  /* Prevent line break on mobile */
}

.logo-text:hover {
  opacity: 0.8;
  text-shadow: 0 0 15px var(--color-accent-glow);
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
}

.nav-item {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  position: relative;
  padding: 10px 24px;
  border-radius: 30px;
  transition: all 0.3s ease;

  /* Glassmorphism Base */
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.05em;
  font-family: var(--font-pixel);
  /* Pixel font navigation */
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.nav-item.active {
  background: rgba(77, 77, 255, 0.25);
  border-color: var(--color-accent);
  color: #ffffff;
  box-shadow: 0 0 15px var(--color-accent-glow);
}

/* Home Page specific logo behavior */
.home-page .main-header:not(.scrolled) .logo-text {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.home-page .main-header.scrolled .logo-text {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Footer */
.main-footer {
  background: rgba(0, 0, 0, 0.4);
  padding: var(--space-xl) 0;
  text-align: center;
  backdrop-filter: blur(5px);
  border-top: 1px solid var(--color-glass-border);
}

.footer-social {
  margin-bottom: var(--space-lg);
}

.social-title {
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
  color: var(--color-text-sub);
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
}

.social-icon {
  width: 32px;
  height: 32px;
  fill: var(--color-text-main);
  transition: transform 0.3s, fill 0.3s;
}

.social-icon:hover {
  transform: translateY(-5px);
  fill: var(--color-accent);
}

.copyright {
  color: var(--color-text-sub);
  font-size: 0.9rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.animate-in {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

.delay-1 {
  animation-delay: 0.2s;
}

.delay-2 {
  animation-delay: 0.4s;
}

.delay-3 {
  animation-delay: 0.6s;
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  .nav-links {
    gap: 6px;
    /* Tighter gap */
  }

  .nav-item {
    font-size: 0.8rem;
    padding: 5px 10px;
    /* Smaller padding */
  }

  .logo-text {
    font-size: 1.5rem;
    /* prevent wrap */
  }
}

@media (max-width: 500px) {

  /* Stack Layout for Mobile Header */
  .main-header {
    height: auto;
    padding: 10px 0;
  }

  .nav-container {
    flex-direction: column;
    gap: 0;
    /* No gap needed */
  }

  /* Hide Logo on Mobile */
  .logo-link {
    display: none;
  }

  .nav-links {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 20px;
    /* Safe area */
  }

  .nav-links li {
    width: 100%;
    display: block;
  }

  .nav-item {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 0;
    font-size: 0.9rem;
    white-space: nowrap;
  }
}

/* Member Cards */
.members-grid {
  counter-reset: member-counter;
  /* Initialize counter */
}

.member-card {
  display: flex;
  background: var(--color-glass);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  align-items: flex-start;
  gap: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  backdrop-filter: blur(10px);
  position: relative;
  /* Context for pseudo-element */
  counter-increment: member-counter;
  /* Increment counter */
}

/* Numbering Style */
.member-card::before {
  content: counter(member-counter);
  position: absolute;
  top: -10px;
  left: -10px;
  background: linear-gradient(135deg, var(--color-accent) 0%, #aaccff 100%);
  color: #fff;
  font-family: var(--font-pixel);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  /* Square badge */
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 10;
  border: 2px solid var(--color-bg-deep);
}

.member-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(77, 77, 255, 0.2);
  border-color: var(--color-accent);
}

.member-icon-wrapper {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--color-glass-border);
  background: rgba(0, 0, 0, 0.3);
}

.member-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-info {
  flex-grow: 1;
}

.member-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.member-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.member-subname {
  font-size: 0.9rem;
  color: var(--color-text-sub);
  font-weight: 400;
  opacity: 0.8;
  font-size: 0.95rem;
  color: #ddddff;
  line-height: 1;
  /* Prevent height issues */
  display: block;
  /* Ensure transform works */
  text-decoration: none !important;
  /* Remove underline */
}

/* Custom Font Toggle for Header */
.logo-text.custom-font {
  font-family: 'HamburgerHeaven', var(--font-main);
  letter-spacing: 0.05em;
  font-size: 1.8rem;
  /* Adjust if font is small */
}

@media (max-width: 768px) {
  .member-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 30px;
    /* Space for number */
  }

  .member-icon-wrapper {
    width: 60px;
    height: 60px;
  }

  .member-card::before {
    left: 50%;
    transform: translateX(-50%);
    top: -15px;
  }

  .member-header {
    justify-content: center;
  }

  .logo-text {
    font-size: 1.4rem;
    /* Even smaller for very small screens */
  }

  .nav-item {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

/* Hero Title Redesign */
.hero-title {
  font-size: 7rem;
  /* Default Desktop */
  font-weight: 900;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
  /* Pure White Override */
  background: none;
  -webkit-text-fill-color: #ffffff;
  transition: font-family 0.3s ease;
  /* Solid white for clarity */
  /* Sharp shadow for definition, removed blue glow for pure white look */
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.8);
  opacity: 0;
  animation: titleAppear 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 2;
}

/* Custom Font Toggle */
.hero-title.custom-font {
  font-family: 'HamburgerHeaven', var(--font-main);
  font-size: 5rem;
  /* Adjust if needed */
  letter-spacing: 0.02em;
}

/* Responsive Font Sizes */
@media (max-width: 1024px) {
  .hero-title {
    font-size: 5.5rem;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 4rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.8rem;
    letter-spacing: -0.02em;
  }
}


/* Hero Background Logo */
.hero {
  position: relative;
  overflow: hidden;
  /* Ensure logo doesn't spill out */
}

/* Pixel Grid Overlay */
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(77, 77, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 77, 255, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, black 40%, transparent 90%);
  -webkit-mask-image: radial-gradient(circle at center, black 40%, transparent 90%);
}

/* Hero Background Logo Wrapper */
.hero-logo-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80vw;
  max-width: 800px;
  transform: translate(-50%, -50%);
  /* Centering */
  z-index: 0;
  pointer-events: none;
  /* Entry Animation applies to the wrapper */
  animation: logoWrapperEntry 2.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes logoWrapperEntry {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-15deg) scale(0.8);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
}

/* Hero Background Logo Image */
.hero-bg-logo {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.6;
  /* Base visibility */
  filter: drop-shadow(0 0 30px rgba(77, 77, 255, 0.5));
  mix-blend-mode: screen;
  will-change: transform, opacity;
  transition: opacity 0.1s linear;
  /* Smooth scroll fade */
  /* JS controls transform/opacity of this element */
}


/* Ensure content is above logo */
.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Horizontally center flex children */
  text-align: center;
  /* Center text content */
  height: 100%;
  /* Full height for centering */
}

/* Scroll Indicator Fixed at Bottom */
/* Scroll Indicator Fixed at Bottom */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  /* Ensure visible above overlay */
}

/* Inner wrapper handles layout and animation */
.scroll-indicator-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
  letter-spacing: 0.1em;
  opacity: 0.9;
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-10px);
  }

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

@keyframes titleAppear {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }

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

/* Hero Button */
.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Center alignment */
  gap: 12px;
  background: rgba(0, 0, 0, 0.7);
  /* Dark background for high contrast */
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 14px 32px;
  border-radius: 50px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 30px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);

  /* Edge/Safari Fixes */
  white-space: nowrap;
  /* Prevent text wrap */
  flex-shrink: 0;
  /* Prevent button shrinking */
}

.hero-btn:hover {
  transform: translateY(-5px);
  background: rgba(0, 0, 0, 0.85);
  border-color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.hero-btn .btn-icon {
  width: 24px;
  height: 24px;
  /* Explicit height */
  min-width: 24px;
  /* Prevent compression */
  flex-shrink: 0;
  object-fit: contain;
  transition: transform 0.3s ease;
  display: block;
  /* Avoid inline gaps */
}

.hero-btn:hover .btn-icon {
  transform: scale(1.1);
}

/* YouTube Button Specifics */
.youtube-btn:hover {
  border-color: #ff0000;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
}

/* About Section */
.about-section {
  position: relative;
  /* ensure z-index context if needed */
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* About Section Enhancements */
.about-description {
  font-size: 1.25rem;
  line-height: 2;
  font-weight: 500;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  color: #ffffff;
  /* Improved visibility */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  /* Stronger shadow */
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.spec-card {
  background: rgba(15, 15, 77, 0.4);
  /* Darker for contrast */
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  padding: 25px;
  border-radius: 4px;
  /* Voxel style */
  backdrop-filter: blur(12px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  /* Bouncy transition */
  text-align: center;
}

.spec-card:hover {
  transform: translateY(-10px) scale(1.02);
  border-color: var(--color-accent);
  background: rgba(15, 15, 77, 0.6);
  box-shadow: 0 10px 40px rgba(77, 77, 255, 0.3);
}

.spec-title {
  color: #a3a3ff;
  /* Lighter/Brighter */
  font-family: var(--font-pixel);
  /* Pixel font */
  /* Lighter accent */
  font-size: 1.0rem;
  /* readable size */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  font-weight: 700;
  text-shadow: 0 0 5px rgba(77, 77, 255, 0.3);
}

.spec-value {
  font-size: 1.8rem;
  /* Increased size */
  font-weight: 700;
  color: #fff;
  font-family: var(--font-pixel);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Server Structure Tree */
/* Server Structure Tree Fixed */
.structure-container {
  padding: 50px 20px;
  background: rgba(0, 0, 0, 0.4);
  /* Darker background */
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  margin-top: 20px;
  text-align: center;
}

.structure-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 60px;
  /* Increased gap for clear lines */
}

/* Node Styling */
.structure-node {
  background: rgba(15, 15, 40, 0.8);
  border: 2px solid var(--color-accent);
  padding: 15px 0;
  /* Remove side padding to stick to width */
  width: 220px;
  /* Fixed width for perfect math */
  border-radius: 4px;
  /* Voxel shape */
  text-align: center;
  position: relative;
  box-shadow: 0 0 20px rgba(77, 77, 255, 0.3);
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 80px;
  /* Fixed height for consistency */
}

.structure-node strong {
  display: block;
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 4px;
}

.structure-node span {
  font-size: 0.85rem;
  color: #ccccff;
}

.node-group {
  display: flex;
  justify-content: center;
  gap: 80px;
  position: relative;
}

/* Connecting Lines */
/* Lines Logic:
   Root has a line going DOWN to the midpoint.
   A horizontal line sits at that midpoint.
   Children have lines going UP to that midpoint.
*/

.structure-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 60px;
  /* Total vertical gap between Lobby and s1/c1 */
}

/* Node Group Container */
.node-group {
  display: flex;
  justify-content: center;
  gap: 80px;
  /* The Gap */
  position: relative;
  padding-top: 0;
}

/* 1. Line DOWN from Lobby (Root) */
.structure-node.root::after {
  content: '';
  position: absolute;
  bottom: -32px;
  /* Half of gap (60px) + 2px adjustment */
  left: 50%;
  width: 2px;
  height: 32px;
  /* Reaches midpoint */
  background: var(--color-accent);
  transform: translateX(-50%);
  box-shadow: 0 0 10px var(--color-accent);
  z-index: 1;
}

/* 2. Horizontal Line Connection */
/* Width = Node1_Half (110) + Gap (80) + Node2_Half (110) = 300px */
.node-group::before {
  content: '';
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  /* Exact match */
  height: 2px;
  background: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent);
  z-index: 1;
}

/* 3. Line UP from Children */
.node-group .structure-node::before {
  content: '';
  position: absolute;
  top: -32px;
  /* Reach up to horizontal line */
  left: 50%;
  width: 2px;
  height: 32px;
  background: var(--color-accent);
  transform: translateX(-50%);
  box-shadow: 0 0 10px var(--color-accent);
}

/* Features List Improved Readability */
.features-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 30px;
}

.feature-box {
  background: rgba(0, 0, 0, 0.6);
  /* Much darker for better text contrast */
  border-radius: 4px;
  /* Voxel style */
  padding: 25px;
  border-left: 4px solid var(--color-accent);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.feature-list {
  padding-left: 20px;
  color: #e0e0ff;
  /* Brighter text */
  line-height: 1.6;
}

.feature-list li {
  margin-bottom: 8px;
  list-style-type: disc;
}

@media (max-width: 768px) {
  .node-group {
    flex-direction: column;
    gap: 40px;
  }

  .structure-node.root::after {
    display: none;
  }

  .node-group .structure-node::before {
    display: none;
  }

  .connector-h {
    display: none;
  }
}

/* Animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.reveal-text {
  opacity: 0;
  animation: fadeUp 0.8s ease forwards;
}

.hover-float {
  transition: transform 0.3s ease-in-out;
}

.hover-float:hover {
  transform: translateY(-5px);
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s cubic-bezier(0.5, 0, 0, 1);
}

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

.stagger-1 {
  transition-delay: 0.1s;
}

.stagger-2 {
  transition-delay: 0.2s;
}

.stagger-3 {
  transition-delay: 0.3s;
}

/* Screenshot Gallery - Digital Polaroid */
.gallery-container {
  margin: 40px 0;
  text-align: center;
}

.gallery-title {
  font-family: var(--font-pixel);
  color: var(--color-text-sub);
  font-size: 1rem;
  margin-bottom: 20px;
  letter-spacing: 0.1em;
}

.gallery-scroll {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 20px 5px 30px 5px;
  /* Padding for hover space */
  justify-content: center;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.gallery-item {
  position: relative;
  /* Context for badge */
  cursor: zoom-in;
  /* Affordance */
  flex-shrink: 0;
  width: 300px;
  background: rgba(10, 10, 30, 0.85);
  /* Dark card base */
  border: 1px solid rgba(77, 77, 255, 0.3);
  padding: 12px;
  /* Frame padding */
  border-radius: 4px;
  backdrop-filter: blur(10px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Pop effect */
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.gallery-item::after {
  content: 'VIEW';
  font-family: var(--font-pixel);
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--color-accent);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 0 15px var(--color-accent);
  letter-spacing: 0.1em;
}

.gallery-item:hover::after {
  opacity: 1;
  top: 40%;
  transform: translate(-50%, -50%) scale(1);
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.03) rotate(1deg);
  border-color: var(--color-accent);
  box-shadow: 0 0 25px rgba(77, 77, 255, 0.5);
  z-index: 10;
}

.gallery-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 2px;
  /* Sharp inner image */
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
  transition: filter 0.3s ease;
}

.gallery-item:hover .gallery-img {
  filter: brightness(0.4);
}

.gallery-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  color: var(--color-text-sub);
  font-family: var(--font-pixel);
  transition: filter 0.3s ease;
}

.gallery-item:hover .gallery-placeholder {
  filter: brightness(0.4);
}

.gallery-placeholder span {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-accent);
}

.gallery-placeholder small {
  font-size: 0.8rem;
  opacity: 0.7;
}

.gallery-caption {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  color: #fff;
  text-align: right;
  /* Signature style */
  opacity: 0.8;
  letter-spacing: 0.05em;
}

/* Mobile Scroll Fix */
@media (max-width: 768px) {
  .gallery-scroll {
    justify-content: flex-start;
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease;
}

.lightbox-content {
  max-width: 90%;
  max-height: 75vh;
  box-shadow: 0 0 50px rgba(77, 77, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.lightbox-caption {
  font-family: var(--font-pixel);
  font-size: 1.5rem;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 10px #000;
  letter-spacing: 0.05em;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
  line-height: 1;
  z-index: 2001;
  font-family: var(--font-main);
}

.lightbox-close:hover {
  color: var(--color-accent);
}

/* Shared Zoomable Image Wrapper for Contents Page */
.card-image-wrapper {
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  display: block;
  /* Ensure it wraps img properly */
}

.card-image-wrapper::after {
  content: 'VIEW';
  font-family: var(--font-pixel);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--color-accent);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 0 15px var(--color-accent);
  letter-spacing: 0.1em;
}

.card-image-wrapper:hover::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-image-wrapper .card-image {
  transition: all 0.5s ease;
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.card-image-wrapper:hover .card-image {
  filter: brightness(0.4);
  transform: scale(1.05);
}