/* 
  Designer Portfolio - Minimalist Monochome
  Strictly Dark Mode, Black/White/Grays
*/

:root {
  /* Strictly Monochrome Color Palette */
  --color-bg: #000000;
  --color-white: #ffffff;
  --color-light-gray: #cccccc;
  --color-gray: #888888;
  --color-dark-gray: #444444;
  --color-border: #222222;

  --font-family: 'Inter', 'Noto Sans SC', 'Noto Sans JP', sans-serif;

  --spacing-unit: 8px;
  --container-padding: 24px;
}

body.light-mode {
  --color-bg: #EAEAEA;
  --color-white: #111111;
  --color-light-gray: #444444;
  --color-gray: #777777;
  --color-dark-gray: #aaaaaa;
  --color-border: #cccccc;
}

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

/* Hide Global Scrollbar */
::-webkit-scrollbar {
  display: none;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body {
  font-family: var(--font-en);
  background-color: var(--color-bg);
  color: var(--color-white);
  line-height: var(--lh-base);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 3.5s ease-in-out, color 3.5s ease-in-out;
}

.text-white,
.text-light-gray,
.text-gray,
.text-dark-gray,
.bg-medium-gray,
.bg-dark-gray,
.bg-gray,
.border-top,
.border-bottom,
.border-top-bottom,
.research-item,
.about-info {
  transition: color 3.5s ease-in-out, background-color 3.5s ease-in-out, border-color 3.5s ease-in-out;
}

.text-white {
  color: var(--color-white);
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  transition: transform 1.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.8s ease;
  transform-origin: center center;
  /* Ignore clicks so it doesn't block the UI */
  background: var(--color-bg);
}

#bg-canvas.zoomed-intro {
  transform: scale(30);
}

.text-light-gray {
  color: var(--color-light-gray);
}

.text-gray {
  color: var(--color-gray);
}

.text-dark-gray {
  color: var(--color-dark-gray);
}

.font-light {
  font-weight: 300;
}

.font-regular {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.tracking-wide {
  letter-spacing: 0.1em;
}

.uppercase {
  text-transform: uppercase;
}

.text-center {
  text-align: center;
}

.leading-relaxed {
  line-height: 1.6;
}

.text-sm {
  font-size: 0.875rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-3xl {
  font-size: 2rem;
}

.cover-name {
  font-size: clamp(2.5rem, 8vw, 5rem);
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 600px;
  /* Mobile focused, constrained width on desktop */
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.section {
  position: relative;
}

.fill-height {
  min-height: 100vh;
  /* Handle mobile browser UI height issues */
  min-height: 100dvh;
}

.flex-center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.pt-section {
  padding-top: 5rem;
}

.pb-section {
  padding-bottom: 5rem;
}

.py-8 {
  padding: 4rem 0;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mb-12 {
  margin-bottom: 3rem;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1.5rem var(--container-padding);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  mix-blend-mode: difference;
  /* Ensures visibility over any content */
}

.logo {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: #ffffff;
}

.lang-switcher {
  display: flex;
  gap: 1rem;
}

.lang-btn {
  font-size: 0.75rem;
  color: #888888;
  cursor: pointer;
  transition: color 0.3s ease;
}

.lang-btn:hover,
.lang-btn.active {
  color: #ffffff;
}

/* Specific Section Styles */

/* Cover */
.scroll-indicator {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  height: 60px;
  display: flex;
  justify-content: center;
}

.scroll-indicator .line {
  width: 1px;
  height: 100%;
  background-color: var(--color-dark-gray);
  position: relative;
  overflow: hidden;
}

.scroll-indicator .line::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background-color: var(--color-white);
  animation: scrollLine 2s infinite cubic-bezier(0.65, 0, 0.35, 1);
}

@keyframes scrollLine {
  0% {
    transform: translateY(-100%);
  }

  100% {
    transform: translateY(200%);
  }
}

/* Type */
.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  font-weight: 300;
}

/* Experience */
.experience-list {
  display: flex;
  flex-direction: column;
}

.experience-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 2rem;
  border-top: 1px solid var(--color-border);
  padding: 1.5rem 0;
}

@media (max-width: 480px) {
  .experience-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Portfolio */
.portfolio-grid {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.work-item {
  width: 100%;
}

.work-images-scroll {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* smooth scrolling on iOS */
  /* Hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.work-images-scroll::-webkit-scrollbar {
  display: none;
}

.work-image {
  flex: 0 0 calc(100% - 2rem);
  /* Each image takes up nearly full width, revealing part of next */
  scroll-snap-align: center;
  aspect-ratio: 4 / 5;
  /* Tall portrait ratio for elegant mobile viewing */
  background-color: var(--color-border);
  position: relative;
  overflow: hidden;
  object-fit: cover;
  transition: background-color 0.4s ease;
}

.work-images-grid-scroll {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  grid-auto-flow: column;
  grid-auto-columns: calc(40% - 0.6rem);
  /* About 2.5 items visible on mobile */
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .work-images-grid-scroll {
    grid-template-rows: auto;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-flow: row;
    overflow-x: visible;
    scroll-snap-type: none;
  }
}

.work-images-grid-scroll::-webkit-scrollbar {
  display: none;
}

/* Active Hijack state for scroll tracking */
.hijack-track {
  overflow: visible !important;
  scroll-snap-type: none !important;
}

.work-images-grid-scroll .work-image {
  flex: none;
  aspect-ratio: 1 / 1;
  width: 100%;
  scroll-snap-align: center;
}

.work-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Photo Wall */
.photo-wall {
  column-count: 2;
  column-gap: 1rem;
}

@media (min-width: 768px) {
  .photo-wall {
    column-count: 3;
    column-gap: 1.5rem;
  }
}

.photo-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  width: 100%;
  display: block;
}

@media (min-width: 768px) {
  .photo-item {
    margin-bottom: 1.5rem;
  }
}

.bg-gray {
  background-color: #2a2a2a;
}

.bg-dark-gray {
  background-color: #1a1a1a;
}

.bg-medium-gray {
  background-color: #222222;
}

/* Research items mobile fix */
@media (max-width: 480px) {
  .research-item {
    flex-direction: column !important;
    gap: 1rem !important;
  }
}

/* Contact */
.block-links {
  display: flex;
  flex-direction: column;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 0;
}

.border-top-bottom {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.border-bottom {
  border-bottom: 1px solid var(--color-border);
}

.social-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  /* allow natural wrap if screen tiny */
}

a {
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.hover-opacity:hover {
  opacity: 0.6;
}

/* Mobile specific adjustments */
@media (max-width: 480px) {
  .flex-column-mobile {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* Animations */
.reveal-on-load,
.reveal,
.reveal-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s cubic-bezier(0.19, 1, 0.22, 1), transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.reveal-on-load.visible,
.reveal.visible,
.reveal-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger portfolio items */
.portfolio-grid .reveal-item:nth-child(1) {
  transition-delay: 0.1s;
}

.portfolio-grid .reveal-item:nth-child(2) {
  transition-delay: 0.2s;
}

.portfolio-grid .reveal-item:nth-child(3) {
  transition-delay: 0.3s;
}

/* Highlight Effects */
.text-glow-red {
  color: #ff3333;
  text-shadow: 0 0 8px rgba(255, 51, 51, 0.8), 0 0 16px rgba(255, 51, 51, 0.4);
  font-weight: 500;
  transition: all 0.5s ease;
}

/* Embedded Map Styling */
.gmap-container iframe {
  width: 100%;
  height: 100%;
  filter: grayscale(1) invert(1);
  transition: filter 3.5s ease-in-out;
}

body.light-mode .gmap-container iframe {
  filter: grayscale(1);
}

/* Social link groups for multi-line */
.social-links-groups {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

@media (max-width: 480px) {
  .social-links-groups {
    align-items: flex-start;
    margin-top: 0.5rem;
  }
}

/* QR Full Screen Modal */
.qr-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.qr-modal.active {
  opacity: 1;
  visibility: visible;
}

.qr-modal-content {
  background-color: var(--color-bg);
  padding: 2.5rem 2rem 2rem;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
}

.qr-modal.active .qr-modal-content {
  transform: translateY(0) scale(1);
}

.qr-modal-img {
  width: 280px;
  height: auto;
  max-width: 100%;
  border-radius: 4px;
  object-fit: contain;
  display: block;
}

.qr-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #888;
  cursor: pointer;
  padding: 0;
  transition: color 0.3s;
}

.qr-close:hover {
  color: #fff;
}