/* ═══════════════════════════════════════════════════════════════
   CSS VARIABLES & RESET
   ═══════════════════════════════════════════════════════════════ */
:root {
  --color-bg: #ffffff;
  --color-fg: #000000;
  --color-gray: #666666;
  
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 600ms ease;
  
  --nav-bottom: 3rem;
  --nav-left: 3rem;
  --logo-top: 2rem;
  --logo-left: 2rem;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--color-bg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
  cursor: none; /* Hide default cursor */
}

/* Ensure custom cursor is used everywhere, even on clickable elements */
a, button, [role="button"], input, select, textarea, 
[onclick], .splash__start, .scroll-list__item, .contact__link,
.global-nav__link, .global-logo {
  cursor: none !important;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOM CURSOR
   ═══════════════════════════════════════════════════════════════ */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background: var(--color-fg);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: 
    width var(--transition-fast),
    height var(--transition-fast),
    opacity var(--transition-normal);
}

.cursor--visible {
  opacity: 1;
}

.cursor--hover {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 2px solid var(--color-fg);
}

/* ═══════════════════════════════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════════════════════════════ */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  z-index: 1000;
  transition: opacity var(--transition-slow);
}

.splash--hidden {
  opacity: 0;
  pointer-events: none;
}

.splash__logo {
  position: absolute;
  width: 120px;
  opacity: 1;
  transition: opacity var(--transition-slow);
}

.splash__logo--hidden {
  opacity: 0;
}

.splash__start {
  position: absolute;
  width: clamp(200px, 40vw, 500px);
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--transition-normal);
}

.splash__start--visible {
  opacity: 1;
}

.splash__start img {
  width: 100%;
  height: auto;
}

/* ═══════════════════════════════════════════════════════════════
   GLOBAL UI ELEMENTS (fixed position)
   ═══════════════════════════════════════════════════════════════ */

/* S Logo - Top Left (hidden by default, shown on subpages) */
.global-logo {
  position: fixed;
  top: var(--logo-top);
  left: var(--logo-left);
  z-index: 100;
  width: 60px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), transform var(--transition-fast);
}

.global-logo--visible {
  opacity: 0.8;
  visibility: visible;
}

.global-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}

.global-logo img {
  width: 100%;
  height: auto;
}

/* Navigation - Bottom Left (hidden by default, shown after splash) */
.global-nav {
  position: fixed;
  bottom: var(--nav-bottom);
  left: var(--nav-left);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal);
}

.global-nav--visible {
  opacity: 1;
  visibility: visible;
}

.global-nav__link {
  display: block;
  width: clamp(80px, 12vw, 150px);
  opacity: 0.7;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.global-nav__link:hover {
  opacity: 1;
  transform: translateX(4px);
}

.global-nav__link--active {
  opacity: 1;
}

.global-nav__link img {
  width: 100%;
  height: auto;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTAINER
   ═══════════════════════════════════════════════════════════════ */
.main {
  position: relative;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.main--visible {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   PAGES (shared)
   ═══════════════════════════════════════════════════════════════ */
.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: transparent; /* Transparent so grid lines show through */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-slow), visibility 0s var(--transition-slow);
  z-index: 5; /* Above grid lines (z-index: 1) */
}

.page--active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 5;
  transition: opacity var(--transition-slow), visibility 0s 0s;
}

/* ═══════════════════════════════════════════════════════════════
   HERO PAGE
   ═══════════════════════════════════════════════════════════════ */
.page--hero {
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Hero Background (video with barrel distortion) */
.hero__background {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transition: opacity 1s ease;
  background: #ffffff;
}

.hero__background--visible {
  opacity: 1;
}

.hero__background canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.hero__logo-container {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 2vw;
}

.hero__logo {
  width: clamp(300px, 50vw, 800px);
  height: auto;
}

.hero__kanji {
  width: clamp(40px, 5vw, 80px);
  height: auto;
}

/* ═══════════════════════════════════════════════════════════════
   SUBPAGES (About, Contact, Experience)
   ═══════════════════════════════════════════════════════════════ */
.page--sub {
  position: relative;
}

.page__content {
  position: fixed;
  right: 2rem;
  top: 6rem;
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-width: 280px;
  text-align: right;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.page__title {
  display: none; /* Hide the header */
}

.page__text {
  font-size: 0.85rem;
  line-height: 1.9;
  color: rgba(0, 0, 0, 0.7);
  font-weight: 300;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* Contact Page */
.page__content--contact {
  top: 6rem;
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: right;
}

.contact__link {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
}

.contact__link:hover {
  color: rgba(0, 0, 0, 0.9);
}

/* Experience Page */
.page__content--experience {
  position: relative;
  right: auto;
  top: auto;
  max-width: none;
  text-align: left;
}

.experience__scroll-container {
  position: relative;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  
  /* Fade edges with mask */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 15%,
    black 85%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 15%,
    black 85%,
    transparent 100%
  );
}

.experience__scroll-container::-webkit-scrollbar {
  display: none;
}

.experience__item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 0.5rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.experience__item:last-child {
  border-bottom: none;
}

.experience__date {
  font-size: 0.875rem;
  color: var(--color-gray);
  font-variant-numeric: tabular-nums;
}

.experience__title {
  font-size: 1rem;
  font-weight: 500;
}

.experience__company {
  grid-column: 2;
  font-size: 0.875rem;
  color: var(--color-gray);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════
   CURSOR GRID (subpage effect - punchred.xyz style)
   ═══════════════════════════════════════════════════════════════ */
.cursor-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1; /* LOW z-index so it appears BEHIND page content */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.cursor-grid--visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s 0s;
}

.cursor-grid__line {
  position: absolute;
  background-color: rgba(0, 0, 0, 0.12);
}

/* Horizontal line - moves with cursor Y */
.cursor-grid__line--h {
  left: 0;
  width: 100%;
  height: 1px;
  top: 33%; /* Default, overridden by JS */
}

/* Vertical line - FIXED position */
.cursor-grid__line--v {
  top: 0;
  width: 1px;
  height: 100%;
  left: 33%; /* Fixed at 33% from left */
}

/* Fill area - bottom-left quadrant */
.cursor-grid__fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 33%; /* Matches vLine position */
  height: 67%; /* Default = 100% - 33% */
  overflow: hidden;
  mix-blend-mode: multiply;
}

/* Date info display on horizontal line - follows hLine position */
.cursor-grid__info {
  position: absolute;
  left: 35%;
  top: var(--hLine-percent, 33%);
  transform: translateY(0.5rem);
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease, top 0.1s ease-out;
}

.cursor-grid__info--visible {
  opacity: 1;
}

/* Scrolling image inside fill area */
.cursor-grid__fill-image {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  /* Use the grid_circles_random_fine.png image */
  background-image: url('../grid_circles_hairline.svg');
  background-repeat: repeat-x;
  background-size: auto 100%; /* Height matches fill area - creates zoom effect */
  background-position: 0% 0%;
  opacity: 0;
  transition: opacity 0.5s ease;
  animation: outline-scroll 30s linear infinite;
  animation-play-state: paused;
}

.cursor-grid--visible .cursor-grid__fill-image {
  opacity: 1;
  animation-play-state: running;
}

/* Animation scrolls the background-position horizontally */
@keyframes outline-scroll {
  0% {
    background-position-x: 0%;
  }
  100% {
    background-position-x: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLABLE LIST (punchred.xyz style - for Experience page)
   ═══════════════════════════════════════════════════════════════ */
.scroll-list {
  position: fixed;
  right: 2rem; /* Right edge with small padding */
  top: 0;
  width: auto;
  max-width: 40%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10; /* Above grid lines */
  scrollbar-width: none; /* Hide scrollbar Firefox */
  -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
}

.scroll-list::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari */
}

.scroll-list__inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* Space between items */
  padding: 30vh 0; /* Padding top/bottom for scroll space */
  text-align: right; /* Align text to right */
}

.scroll-list__item {
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.35);
  transition: color 0.3s ease;
  cursor: none;
  white-space: nowrap;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
}

.scroll-list__item:hover {
  color: rgba(0, 0, 0, 0.9);
}

/* No transform/scale animation - just color change */
.scroll-list__item.is-active {
  color: rgba(0, 0, 0, 0.9);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --nav-bottom: 2rem;
    --nav-left: 2rem;
    --logo-top: 1.5rem;
    --logo-left: 1.5rem;
  }
  
  .hero__logo-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .hero__kanji {
    width: 40px;
  }
  
  .global-logo {
    width: 45px;
  }
  
  .page__content {
    margin-right: 2rem;
    padding-top: 6rem;
  }
}
