/* ==========================================================================
   PORTFOLIO DESIGN SYSTEM - JAPANESE CINEMATIC AESTHETIC
   ========================================================================== */

:root {
  /* Dark Charcoal & Sumi Ink Base */
  --bg-dark: #06080d;
  --bg-surface: #0c0f17;
  --bg-card: rgba(14, 18, 27, 0.85);
  --bg-card-hover: rgba(20, 25, 38, 0.95);
  
  /* Palette from Thumbnail Artwork */
  --ivory-white: #fdfaf3;
  --champagne-gold: #edd8b7;
  --gold-shadow: #c9ad80;
  
  --celadon-light: #a7f3d0;
  --celadon-mint: #4ee1c9;
  --celadon-deep: #14b8a6;
  --celadon-glow: rgba(78, 225, 201, 0.28);
  
  --hanko-crimson: #e11d48;
  --hanko-crimson-glow: rgba(225, 29, 72, 0.35);
  --sakura-pink: #fb7185;
  --sakura-soft: #fbcfe8;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-celadon: rgba(78, 225, 201, 0.35);
  --border-gold: rgba(237, 216, 183, 0.22);

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 9999px;

  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-kanji: 'Noto Serif JP', serif;
  
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Ambient Background Lights */
.ambient-glow {
  position: fixed;
  width: 650px;
  height: 650px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(160px);
  z-index: 0;
  opacity: 0.15;
}

.ambient-glow--sun {
  top: -180px;
  left: 12%;
  background: radial-gradient(circle, var(--hanko-crimson) 0%, rgba(225, 29, 72, 0) 70%);
}

.ambient-glow--celadon {
  bottom: -150px;
  right: 10%;
  background: radial-gradient(circle, var(--celadon-mint) 0%, rgba(78, 225, 201, 0) 70%);
}

/* Floating Subtle Sakura Petals */
.sakura-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.petal {
  position: absolute;
  background: linear-gradient(135deg, var(--sakura-soft), var(--sakura-pink));
  border-radius: 12px 2px 12px 2px;
  opacity: 0.22;
  filter: blur(0.5px);
  animation: fall 20s linear infinite;
}

.petal--1 { width: 14px; height: 9px; left: 8%; top: -20px; animation-duration: 22s; animation-delay: 0s; }
.petal--2 { width: 11px; height: 7px; left: 28%; top: -20px; animation-duration: 19s; animation-delay: 4s; }
.petal--3 { width: 16px; height: 10px; left: 55%; top: -20px; animation-duration: 25s; animation-delay: 2s; }
.petal--4 { width: 12px; height: 8px; left: 75%; top: -20px; animation-duration: 17s; animation-delay: 7s; }
.petal--5 { width: 15px; height: 9px; left: 88%; top: -20px; animation-duration: 21s; animation-delay: 5s; }
.petal--6 { width: 10px; height: 6px; left: 42%; top: -20px; animation-duration: 26s; animation-delay: 9s; }

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg) translateX(0); opacity: 0; }
  15% { opacity: 0.35; }
  85% { opacity: 0.25; }
  100% { transform: translateY(115vh) rotate(540deg) translateX(80px); opacity: 0; }
}

.site-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 3rem 1.75rem 6rem;
  position: relative;
  z-index: 1;
}

/* ==================== PROFILE INTRO HEADER ==================== */
.hero {
  position: relative;
  max-width: 880px;
  margin-bottom: 4rem;
}

.profile-intro {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.profile-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--celadon-mint);
  box-shadow: 0 0 16px var(--celadon-glow);
}

.profile-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background-color: #34d399;
  border: 2.5px solid var(--bg-dark);
  border-radius: 50%;
  box-shadow: 0 0 8px #34d399;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.profile-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--celadon-mint);
  background: rgba(78, 225, 201, 0.1);
  border: 1px solid rgba(78, 225, 201, 0.25);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
}

.profile-skills {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==================== 3D TITLE (NO CLIPPING, AMPLE PADDING) ==================== */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.2rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.title-top,
.title-bottom {
  display: block;
  line-height: 1.15; /* Compact line height */
  padding: 0.16em 0.05em; /* Safe padding for accents and descenders */
  margin-top: -0.08em; /* Clean, compact spacing between lines */
  margin-bottom: -0.08em;
  overflow: visible;
}

.title-top {
  background: linear-gradient(180deg, #ffffff 0%, var(--ivory-white) 40%, var(--champagne-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 15px rgba(237, 216, 183, 0.25));
}

.title-bottom {
  background: linear-gradient(180deg, var(--celadon-light) 0%, var(--celadon-mint) 55%, var(--celadon-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 25px var(--celadon-glow));
}

.hero-description {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 2.25rem;
  max-width: 680px;
}

/* Category Filter Pills */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  background: rgba(78, 225, 201, 0.08);
  border-color: rgba(78, 225, 201, 0.3);
  color: var(--celadon-mint);
}

.filter-pill.is-active {
  background: linear-gradient(135deg, var(--celadon-mint), var(--celadon-deep));
  color: #051410;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 4px 18px var(--celadon-glow);
}

/* Category Section Headers */
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 3.5rem 0 1.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.category-heading {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.category-heading span {
  color: var(--text-muted);
  font-size: 0.85em;
  font-weight: 500;
}

.category-badge-count {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--celadon-mint);
  background: rgba(78, 225, 201, 0.08);
  border: 1px solid rgba(78, 225, 201, 0.2);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-pill);
}

/* Projects Grids */
.projects-grid {
  display: grid;
  gap: 2.25rem;
}

.projects-grid--widescreen {
  grid-template-columns: repeat(2, 1fr);
}

.projects-grid--vertical {
  grid-template-columns: repeat(3, 1fr);
}

/* Project Card & Scroll Reveal Animation */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: visible; /* Allows volume popup to float cleanly above */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

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

.project-card:hover {
  border-color: var(--border-celadon);
  transform: translateY(-5px);
  box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.8), 0 0 25px -8px var(--celadon-glow);
}

.project-card.is-hidden {
  display: none !important;
}

/* Video Containers */
.video-container {
  position: relative;
  width: 100%;
  background: #000;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aspect-16-9 {
  aspect-ratio: 16 / 9;
}

.project-card--vertical-layout .aspect-9-16 {
  aspect-ratio: 9 / 16;
  max-height: 480px;
  margin: 0 auto;
}

.video-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Video UI Overlay */
.video-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.15rem;
  background: rgba(0, 0, 0, 0.2);
  transition: opacity 0.25s ease, background-color 0.25s ease;
  pointer-events: none;
}

.project-card:hover .video-ui {
  background: rgba(0, 0, 0, 0.1);
}

/* Center Play Trigger */
.play-trigger {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(14, 17, 26, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.play-trigger svg {
  width: 25px;
  height: 25px;
}

.play-trigger .icon-pause {
  display: none;
}

.video-container.is-playing .play-trigger {
  opacity: 0;
  pointer-events: none;
}

.video-container.is-playing:hover .play-trigger {
  opacity: 0.95;
  pointer-events: auto;
}

.video-container.is-playing .play-trigger .icon-play {
  display: none;
}

.video-container.is-playing .play-trigger .icon-pause {
  display: block;
}

.play-trigger:hover {
  transform: translate(-50%, -50%) scale(1.12);
  background: var(--celadon-mint);
  color: #061e17;
  border-color: #fff;
  box-shadow: 0 0 25px var(--celadon-glow);
}

/* Bottom Controls Panel */
.controls-panel {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(11, 14, 22, 0.92);
  backdrop-filter: blur(12px);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.25s ease;
  position: relative;
  z-index: 50;
}

.project-card:hover .controls-panel,
.video-container.is-playing .controls-panel {
  opacity: 1;
}

/* ==================== VERTICAL VOLUME POPUP (HOVER UPWARDS) ==================== */
.volume-group {
  position: relative;
  display: flex;
  align-items: center;
}

.audio-toggle,
.cinema-toggle,
.fullscreen-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.audio-toggle:hover,
.cinema-toggle:hover,
.fullscreen-toggle:hover {
  color: var(--celadon-mint);
}

.audio-toggle svg,
.cinema-toggle svg,
.fullscreen-toggle svg {
  width: 18px;
  height: 18px;
}

.audio-toggle .icon-vol-on {
  display: none;
}

.video-container.is-unmuted .audio-toggle .icon-vol-off {
  display: none;
}

.video-container.is-unmuted .audio-toggle .icon-vol-on {
  display: block;
}

/* Floating Vertical Popup Above the Audio Button */
.volume-slider-wrap {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(12, 16, 26, 0.96);
  border: 1px solid rgba(78, 225, 201, 0.3);
  border-radius: 12px;
  padding: 14px 6px;
  width: 32px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(78, 225, 201, 0.2);
  z-index: 100;
}

/* Invisible hover bridge connecting icon to popup */
.volume-slider-wrap::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 14px;
  background: transparent;
}

/* Downward Arrow pointing to the Volume Icon */
.volume-slider-wrap::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(12, 16, 26, 0.96) transparent transparent transparent;
}

.volume-group:hover .volume-slider-wrap {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Vertical Slider Slider Input */
.volume-range {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 5px;
  transform: rotate(-90deg);
  background: rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}

.volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--celadon-mint);
  box-shadow: 0 0 8px var(--celadon-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.volume-range::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

/* Time Scrubber (Expanded 20px hit area) */
.time-scrubber {
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  touch-action: none;
}

.time-scrubber__track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
  transition: height 0.15s ease;
}

.time-scrubber:hover .time-scrubber__track {
  height: 7px;
}

.time-scrubber__fill {
  height: 100%;
  width: 0%;
  background: var(--celadon-mint);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 8px var(--celadon-glow);
  pointer-events: none;
}

.time-display {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Card Body Details */
.card-body {
  padding: 1.6rem 1.6rem 1.85rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.category-tag--celadon { color: var(--celadon-mint); }
.category-tag--ivory { color: var(--champagne-gold); }
.category-tag--sakura { color: var(--sakura-pink); }
.category-tag--crimson { color: #fb7185; }

.format-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: 0.55rem;
}

.card-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.4rem;
  flex: 1;
}

/* Tech Tags */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tech-tag {
  font-size: 0.725rem;
  font-weight: 500;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  transition: var(--transition);
}

.tech-tag:hover {
  border-color: var(--border-celadon);
  color: #fff;
}

/* ==================== CINEMA MODE (HIGH-PERFORMANCE LIGHTBOX MODAL) ==================== */
.cinema-modal {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.cinema-modal.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cinema-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 10, 0.93);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99995;
  cursor: pointer;
}

.cinema-dialog {
  position: relative;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 94vw;
  max-height: 90vh;
  transform: scale(0.92);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinema-modal.is-active .cinema-dialog {
  transform: scale(1);
}

.cinema-close-floating {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 100010;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(14, 18, 28, 0.92);
  border: 1px solid rgba(78, 225, 201, 0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: scale(0.9);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.cinema-close-floating svg {
  width: 22px;
  height: 22px;
}

.cinema-modal.is-active .cinema-close-floating {
  transform: scale(1);
}

.cinema-close-floating:hover {
  background: var(--celadon-mint);
  color: #061e17;
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 25px var(--celadon-glow);
}

/* Modal video container */
#cinemaVideoContainer {
  position: relative;
  background: #000;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(78, 225, 201, 0.45);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.95), 0 0 60px rgba(78, 225, 201, 0.25);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cinemaVideoContainer.aspect-16-9 {
  width: min(92vw, 1100px);
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 86vh;
}

#cinemaVideoContainer.aspect-9-16 {
  width: auto;
  height: min(86vh, 850px);
  aspect-ratio: 9 / 16;
  max-width: 92vw;
}

/* Ensure modal controls panel is always active and interactive */
#cinemaVideoContainer .controls-panel {
  opacity: 1 !important;
  padding: 0.65rem 1.15rem;
}

#cinemaVideoContainer .time-scrubber {
  height: 24px;
}

#cinemaVideoContainer .time-scrubber__track {
  height: 6px;
}

#cinemaVideoContainer:hover .time-scrubber__track {
  height: 8px;
}

body.cinema-active {
  overflow: hidden;
}

/* Site Footer */
.site-footer {
  margin-top: 6rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.footer-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--champagne-gold);
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.footer-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==================== RESPONSIVE DESIGN (MOBILE & TABLETS) ==================== */

@media (max-width: 1024px) {
  .projects-grid--vertical {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .projects-grid--widescreen,
  .projects-grid--vertical {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .project-card--vertical-layout .aspect-9-16 {
    max-height: 520px;
  }
}

@media (max-width: 640px) {
  .site-wrapper {
    padding: 2rem 1.15rem 4rem;
  }

  .profile-intro {
    gap: 0.85rem;
  }

  .profile-avatar-wrap {
    width: 52px;
    height: 52px;
  }

  .profile-name {
    font-size: 1.25rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .category-filters {
    gap: 0.45rem;
  }

  .filter-pill {
    font-size: 0.78rem;
    padding: 0.4rem 0.85rem;
  }

  .card-body {
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .card-title {
    font-size: 1.2rem;
  }

  .play-trigger {
    width: 52px;
    height: 52px;
  }

  .play-trigger svg {
    width: 22px;
    height: 22px;
  }
}
