/* ===== Variables ===== */
:root {
  --green: #3aaa3a;
  --dark: #1a1a1a;
  --bg: #ffffff;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; }
body { font-family: 'Arial', Helvetica, sans-serif; background: var(--bg); color: var(--dark); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }

/* ===== HOME ===== */
body.page-home { overflow: hidden; }

#game-container {
  position: fixed;
  inset: 0;
  background: #c0d8c8;
  z-index: 0;
}

#unity-canvas {
  display: block;
  pointer-events: none;
}

#unity-loading-bar {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  opacity: 1;
  transition: opacity 0.5s;
}

#unity-loading-bar.hidden { opacity: 0; pointer-events: none; }

#unity-progress-bar-empty { height: 1px; background: rgba(255,255,255,0.3); }
#unity-progress-bar-full { height: 100%; background: rgba(255,255,255,0.7); width: 0%; transition: width 0.3s; }

/* Cover with loading bar */
#cover {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}

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

#load-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s;
}

#load-ui.done { opacity: 0; pointer-events: none; }

#load-percent {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--green);
}

#load-bar-wrap {
  width: 320px;
  height: 14px;
  border: 1px solid var(--green);
}

#load-bar-fill {
  height: 100%;
  background: var(--green);
  width: 0%;
}

/* Overlay */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

/* Artist name + play button — top right */
#artist-header {
  position: absolute;
  top: 26px;
  right: 28px;
  text-align: right;
  pointer-events: auto;
}

#artist-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #888;
  line-height: 1;
}

#play-btn {
  display: block;
  margin: 5px 0 0 auto;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--green);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: opacity 0.2s;
}

#play-btn:hover { opacity: 0.6; }

/* Bottom nav */
#main-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 20px 36px;
  pointer-events: auto;
}

.nav-links, .nav-www { display: contents; }
.mobile-only { display: none; }

/* Desktop: interleave HOME WWW ABOUT WWW WWWORKS WWW WWW */
.nav-links > *:nth-child(1) { order: 1; }
.nav-www   > *:nth-child(1) { order: 2; }
.nav-links > *:nth-child(2) { order: 3; }
.nav-www   > *:nth-child(2) { order: 4; }
.nav-links > *:nth-child(3) { order: 5; }
.nav-www   > *:nth-child(3) { order: 6; }
.nav-www   > *:nth-child(4) { order: 7; }

#main-nav .nav-item {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--green);
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
}

#main-nav .nav-item:hover { opacity: 0.55; }
#main-nav .nav-item.disabled { cursor: default; pointer-events: none; }
#main-nav .nav-item.active { text-decoration: none; }

/* Site name on sub-pages */
.name-menu-wrapper {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 50;
  text-align: right;
}

.site-name-link {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #888;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  transition: opacity 0.2s;
  text-align: right;
  width: 100%;
}

.site-name-link:hover { opacity: 0.6; }

/* Dropdown nav below name */
#page-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--green);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

#page-nav.open {
  opacity: 1;
  pointer-events: auto;
}

#page-nav .nav-item {
  color: white;
}

#page-nav .nav-item.disabled {
  color: rgba(255,255,255,0.45);
}

/* ===== ABOUT ===== */
body.page-about { background: #c8daea; min-height: 100vh; overflow-y: auto; }

@keyframes sky-float {
  0%   { transform: scale(1.12) translate(0%, 0%); }
  25%  { transform: scale(1.15) translate(-3%, 2%); }
  50%  { transform: scale(1.12) translate(0%, 4%); }
  75%  { transform: scale(1.15) translate(3%, 2%); }
  100% { transform: scale(1.12) translate(0%, 0%); }
}

.about-bg {
  position: fixed;
  inset: 0;
  background: url('assets/images/sky.jpg') center center / cover no-repeat;
  z-index: 0;
  animation: sky-float 30s ease-in-out infinite;
}

.about-content {
  position: relative;
  z-index: 2;
  padding: 52px 90px 100px;
}

.page-title {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--green);
  margin-bottom: 48px;
  line-height: 1;
}

.about-grid {
  display: grid;
  grid-template-columns: 160px 2fr 1fr;
  gap: 44px;
  align-items: start;
}

.about-left { display: flex; flex-direction: column; align-items: flex-start; }

.about-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.about-right { padding-top: 2px; }

.name-line {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 16px;
  line-height: 1.5;
}

.bio-text {
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--green);
  margin-bottom: 36px;
}

/* CV inline */
.about-cv { border-top: 1px solid rgba(26,26,26,0.15); padding-top: 28px; }

.cv-inline-block { margin-bottom: 24px; }

.cv-inline-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.cv-inline-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  margin-bottom: 6px;
  align-items: start;
}

.cv-inline-year {
  font-size: 11px;
  color: var(--green);
  padding-top: 1px;
  opacity: 0.6;
}

.cv-inline-text {
  font-size: 11.5px;
  line-height: 1.85;
  color: var(--green);
}

/* ===== WORKS ===== */
body.page-works { background: var(--bg); }

.works-content { padding: 52px 90px 120px; }

.works-title {
  font-size: 56px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--green);
  margin-bottom: 72px;
  line-height: 1;
}

.sort-btn {
  display: block;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  padding: 0;
  margin-bottom: 24px;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
}
.sort-btn:hover { opacity: 1; }

.works-year-group { margin-bottom: 12px; }

.works-year-label {
  font-size: 12px;
  color: var(--green);
  margin-bottom: 24px;
  font-weight: 600;
}

.work-row {
  display: grid;
  grid-template-columns: 200px 140px 1fr;
  gap: 0;
  margin-bottom: 56px;
  cursor: pointer;
  align-items: start;
}

.work-row:hover .work-thumb { opacity: 0.8; }

.work-meta { padding-top: 2px; padding-right: 12px; }

.work-meta .work-title-zh {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.5;
}

.work-meta .work-title-ja {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.5;
  margin-bottom: 8px;
}

.work-meta .work-info {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.85;
}

.work-links {
  padding-top: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.85;
}

.work-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s;
}

/* Series / sub-work rows */
.work-row--series {
  grid-template-columns: 200px 140px;
  margin-bottom: 10px;
}

.work-row--sub {
  grid-template-columns: 28px 172px 140px 1fr;
  padding-left: 0;
}

.work-row--sub .work-thumb { grid-column: 4; }

.subwork-symbol {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  padding-top: 2px;
}

/* ===== SINGLE WORK ===== */
body.page-work { background: var(--bg); }

.work-hero {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #111;
}

.work-hero-slides { display: flex; transition: transform 0.38s ease; }
.work-hero-slide { flex-shrink: 0; width: 100vw; }

.work-hero-slide img {
  width: 100%;
  height: auto;
  display: block;
}

.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: none;
}

.hero-nav button {
  pointer-events: auto;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 18px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.hero-nav button:hover { background: rgba(255,255,255,0.35); }

.hero-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
}

.hero-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: background 0.2s;
}

.hero-dot.active { background: white; }

/* Work info */
.work-body {
  padding: 40px 60px 64px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 44px;
  align-items: start;
}

.work-sidebar .work-title-zh {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 1px;
  line-height: 1.5;
}

.work-sidebar .work-title-ja {
  font-size: 12px;
  color: var(--green);
  margin-bottom: 1px;
  line-height: 1.5;
}

.work-sidebar .work-title-en {
  font-size: 11.5px;
  color: var(--green);
  opacity: 0.65;
  margin-bottom: 12px;
  line-height: 1.5;
}

.work-sidebar .work-detail-line {
  font-size: 11px;
  color: var(--green);
  line-height: 1.9;
}

.work-description {
  font-size: 13px;
  line-height: 2;
  color: var(--green);
}

.work-description p { margin-bottom: 24px; }
.work-description p:last-child { margin-bottom: 0; }

/* Videos */
/* Series diagrams section */
.work-subworks { padding: 0 60px 48px; }

.series-diagrams-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 20px;
}

.series-diagrams-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.series-diagram-img {
  width: 100%;
  display: block;
  margin-bottom: 14px;
}

.series-diagram-title-zh {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.5;
}

.series-diagram-title-ja,
.series-diagram-title-en {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green);
  line-height: 1.5;
}

.work-videos { padding: 0 60px 64px; }

.work-video-item { margin-bottom: 18px; max-width: 680px; }

.work-video-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 7px;
  text-transform: uppercase;
}

.work-video-frame { width: 100%; aspect-ratio: 16/9; border: none; display: block; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
}
#lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s;
}
#lightbox-close:hover { opacity: 1; }

#lightbox-prev, #lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 18px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#lightbox-prev { left: 16px; }
#lightbox-next { right: 16px; }
#lightbox-prev:hover, #lightbox-next:hover { background: rgba(255,255,255,0.35); }
.work-hero-slide img { cursor: zoom-in; }

/* Back link */
.work-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 60px 48px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
  text-transform: uppercase;
  border-bottom: 1px solid var(--green);
  padding-bottom: 1px;
  transition: opacity 0.2s;
}

.work-back:hover { opacity: 0.5; }
.work-back::before { content: '←'; font-size: 13px; }

/* Mobile background video */
#mobile-bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  z-index: 1;
  display: none;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {

  /* Home */
  #main-nav { flex-direction: column; padding: 16px 24px; gap: 6px; }
  .nav-links, .nav-www { display: flex; justify-content: space-between; width: 100%; }
  #main-nav .nav-item.active { text-decoration: none; }
  .mobile-only { display: inline; }
  #load-percent { font-size: 9px; }
  #load-bar-wrap { width: 213px; height: 9px; }
  #artist-header { top: 16px; right: 20px; }

  /* Fix name-menu-wrapper blocking hero slide buttons */
  .name-menu-wrapper { top: 16px; right: 16px; pointer-events: none; }
  .site-name-link { pointer-events: auto; }
  #page-nav.open { pointer-events: auto; }

  /* Works list */
  .works-content { padding: 36px 24px 80px; }
  .works-title { font-size: 32px; margin-bottom: 44px; }
  .work-row {
    grid-template-columns: 1fr;
    margin-bottom: 48px;
  }
  .work-thumb { order: -1; margin-bottom: 12px; }
  .work-links { display: none; }
  .work-meta { padding-right: 0; }
  .work-row--series { grid-template-columns: 1fr auto; margin-bottom: 6px; }
  .work-row--sub { grid-template-columns: 20px 1fr; margin-bottom: 48px; }
  .work-row--sub .work-thumb { order: -1; grid-column: 1 / -1; margin-bottom: 12px; }

  /* Work detail */
  .work-body {
    grid-template-columns: 1fr;
    padding: 24px 36px 36px;
    gap: 20px;
  }
  .work-subworks { padding: 0 36px 40px; }
  .series-diagrams-grid { grid-template-columns: 1fr; gap: 28px; }
  .work-videos { padding: 0 36px 40px; }
  .work-back { margin: 0 36px 32px; }

  /* About */
  .about-content { padding: 36px 36px 80px; }
  .page-title { font-size: 32px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-right { max-width: 100%; }
  .about-photo { width: 120px; height: 120px; }

  /* CV */
  .cv-inline-row { grid-template-columns: 32px 1fr; }
}
