/* ============================================
   SORAO SAKIMURA — Portfolio
   ============================================ */

/* --- Fonts --- */
@font-face {
  font-family: 'GT Flexa';
  src: url('../fonts/GT-Flexa-Extended-Medium.woff2') format('woff2'),
       url('../fonts/GT-Flexa-Extended-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Saans';
  src: url('../fonts/Saans-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MidashiGo';
  src: url('../fonts/A-OTF-MiGoMB1Std-DeBold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --color-bg: #000;
  --color-text: #fff;
  --font-logo: 'GT Flexa', 'Helvetica Neue', Arial, sans-serif;
  --font-nav: 'Saans', 'MidashiGo', 'Helvetica Neue', Arial, sans-serif;
  --font-mixed: 'Saans', 'MidashiGo', 'Helvetica Neue', Arial, sans-serif;
  --pad-x: clamp(28px, 5.2vw, 75px);
  --pad-top: clamp(20px, 2.5vh, 28px);
  --pad-bottom: clamp(24px, 3.5vh, 35px);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; cursor: pointer; font: inherit; }

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--pad-top) var(--pad-x);
}

.nav__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.nav__logo {
  font-family: var(--font-logo);
  font-size: clamp(15px, 1.35vw, 19px);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  gap: clamp(24px, 2.8vw, 42px);
  align-items: baseline;
  padding-top: 2px;
}

.nav__links a {
  font-family: var(--font-nav);
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity 0.25s ease;
}

.nav__links a:hover {
  opacity: 0.6;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 7px;
  width: 28px;
  padding-top: 4px;
  position: absolute;
  right: var(--pad-x);
  top: var(--pad-top);
}

.nav__toggle span {
  display: block;
  height: 1.5px;
  background: var(--color-text);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* --- Hero --- */
.hero {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.hero__slides {
  position: absolute;
  inset: 0;
}

.hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s ease;
  will-change: opacity;
}

.hero__slide.active {
  opacity: 1;
}

.hero__slide video,
.hero__slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gradient overlays */
.hero__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.15) 35%, transparent 55%),
    linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 20%);
  pointer-events: none;
  z-index: 2;
}

/* --- Bottom Bar --- */
.hero__bottom {
  position: absolute;
  bottom: var(--pad-bottom);
  left: var(--pad-x);
  right: var(--pad-x);
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: clamp(28px, 4.5vw, 65px);
}

.hero__counter {
  font-family: var(--font-mixed);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 500;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.hero__title {
  font-family: var(--font-mixed);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Progress Bar --- */
.hero__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.12);
  z-index: 10;
}

.hero__progress-bar {
  width: 0%;
  height: 100%;
  background: var(--color-text);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .nav__links {
    position: fixed;
    inset: 0;
    background: var(--color-bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .nav__links.open {
    opacity: 1;
    visibility: visible;
  }

  .nav__links a {
    font-size: 16px;
    opacity: 1;
  }

  .nav__toggle {
    display: flex;
    z-index: 101;
  }

  .nav__toggle.open span:first-child {
    transform: translateY(4.25px) rotate(45deg);
  }

  .nav__toggle.open span:last-child {
    transform: translateY(-4.25px) rotate(-45deg);
  }

  .hero__title {
    white-space: normal;
  }
}

/* ============================================
   WORKS Page
   ============================================ */

.page-works {
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Filters (nav right column, works page only) --- */
.filters {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-top: 2px;
}

.filters__row {
  display: flex;
  gap: clamp(24px, 2.8vw, 42px);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filters__btn {
  font-family: var(--font-nav);
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.4;
  transition: opacity 0.25s ease;
}

.filters__btn:hover {
  opacity: 0.6;
}

.filters__btn.active {
  opacity: 1;
}

/* --- Nav overlay gradient (matches landing page) --- */
.works-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(120px, 18vh, 200px);
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 100%);
  pointer-events: none;
  z-index: 99;
}

/* --- Works Grid (3-column, edge-to-edge) --- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  grid-auto-flow: dense;
  gap: 0;
  padding-top: 0;
  min-height: 100vh;
}

/* --- Work Card --- */
.work-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.work-card.hidden {
  display: none;
}

/* Small card (default) */
.work-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
}

/* Large card */
.work-card--large {
  grid-column: span 3;
  grid-row: span 2;
}

.work-card--large .work-card__thumb {
  aspect-ratio: auto;
  height: 100%;
}

.work-card__thumb img,
.work-card__thumb video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.work-card:hover .work-card__thumb img {
  transform: scale(1.03);
}

.work-card__thumb video {
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}

.work-card__thumb video.playing {
  opacity: 1;
}

/* Info overlay on image */
.work-card__info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: clamp(12px, 1.5vw, 20px) clamp(14px, 1.8vw, 24px);
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.work-card__title {
  font-family: var(--font-mixed);
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.4;
}

.work-card--large .work-card__title {
  font-size: clamp(16px, 1.5vw, 22px);
}

.work-card__meta {
  font-family: var(--font-mixed);
  font-size: clamp(9px, 0.7vw, 11px);
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0.6;
  margin-top: 3px;
  text-transform: uppercase;
}

.work-card--large .work-card__meta {
  font-size: clamp(10px, 0.85vw, 13px);
}

/* --- Works Mobile --- */
@media (max-width: 768px) {
  .works-grid {
    grid-template-columns: 1fr;
  }

  .work-card--large {
    grid-column: span 1;
    grid-row: span 1;
  }

  .work-card--large .work-card__thumb {
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .filters {
    display: none;
  }

  .filters.open {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg);
    align-items: center;
    padding: 20px var(--pad-x);
    z-index: 100;
    gap: 8px;
  }

  .filters.open .filters__row {
    justify-content: center;
    gap: 16px;
  }

  .filters.open .filters__btn {
    font-size: 11px;
    opacity: 0.5;
  }

  .filters.open .filters__btn.active {
    opacity: 1;
  }
}

/* ============================================
   WORK Detail Page
   ============================================ */

.page-work {
  overflow-y: auto;
  overflow-x: hidden;
}

/* --- Hero Video --- */
.work-detail__hero {
  width: 100%;
  padding-top: clamp(80px, 10vh, 120px);
}

/* --- Custom Video Player --- */
.video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.video-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Big central play button */
.video-player__big-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: clamp(56px, 6vw, 80px);
  height: clamp(56px, 6vw, 80px);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 5;
}

.video-player__big-play svg {
  width: 100%;
  height: 100%;
}

.video-player__big-play:hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.08);
}

.video-player--playing .video-player__big-play {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.8);
}

/* Bottom control bar */
.video-player__controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  padding: clamp(10px, 1.2vw, 16px) clamp(12px, 1.5vw, 20px);
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.video-player:hover .video-player__controls,
.video-player--show-controls .video-player__controls {
  opacity: 1;
}

/* Control buttons */
.video-player__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.2s ease;
  padding: 0;
}

.video-player__btn:hover {
  opacity: 1;
}

.video-player__icon {
  width: 20px;
  height: 20px;
}

/* Progress bar */
.video-player__progress {
  flex: 1;
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  cursor: pointer;
}

.video-player__progress:hover {
  height: 6px;
}

.video-player__progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  pointer-events: none;
}

.video-player__progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  pointer-events: none;
}

.video-player__progress-seek {
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  height: 20px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

/* Time display */
.video-player__time {
  font-family: var(--font-mixed);
  font-size: clamp(10px, 0.8vw, 12px);
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 0.8;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* YouTube link */
.work-detail__youtube-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 0 var(--pad-x);
  font-family: var(--font-mixed);
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.4;
  transition: opacity 0.25s ease;
}

.work-detail__youtube-link:hover {
  opacity: 1;
}

.work-detail__youtube-link svg {
  flex-shrink: 0;
}

/* Fullscreen */
.video-player:fullscreen,
.video-player:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
}

.video-player:fullscreen video,
.video-player:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Mobile player adjustments */
@media (max-width: 768px) {
  .video-player__controls {
    gap: 6px;
    padding: 8px 10px;
  }

  .video-player__time {
    font-size: 10px;
  }

  .video-player__btn {
    width: 24px;
    height: 24px;
  }

  .video-player__icon {
    width: 16px;
    height: 16px;
  }

  .work-detail__youtube-link {
    padding: 0 var(--pad-x);
  }
}

/* --- Content Area --- */
.work-detail__content {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(40px, 6vh, 80px) var(--pad-x) clamp(60px, 10vh, 120px);
}

/* --- Info --- */
.work-detail__title {
  font-family: var(--font-mixed);
  font-size: clamp(22px, 2.5vw, 36px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.work-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 12px;
  font-family: var(--font-mixed);
  font-size: clamp(11px, 0.9vw, 14px);
  font-weight: 500;
  letter-spacing: 0.03em;
  opacity: 0.5;
  text-transform: uppercase;
}

.work-detail__meta span + span::before {
  content: ' — ';
}

/* --- Description --- */
.work-detail__description {
  margin-top: clamp(32px, 4vh, 48px);
  font-family: var(--font-mixed);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.8;
  opacity: 0.8;
  max-width: 680px;
}

/* --- Stills Gallery --- */
.work-detail__stills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 1vw, 16px);
  margin-top: clamp(40px, 5vh, 64px);
}

.work-detail__still {
  display: block;
  cursor: pointer;
  overflow: hidden;
  background: #111;
  border: none;
  padding: 0;
}

.work-detail__still img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}

.work-detail__still:hover img {
  transform: scale(1.03);
}

/* --- Lightbox (native dialog) --- */
.lightbox {
  border: none;
  background: rgba(0, 0, 0, 0.95);
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.95);
}

.lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

.lightbox__close {
  position: fixed;
  top: 20px;
  right: 24px;
  font-size: 32px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lightbox__close:hover { opacity: 1; }

.lightbox__prev,
.lightbox__next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 48px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  opacity: 0.5;
  transition: opacity 0.2s ease;
  padding: 20px;
}

.lightbox__prev:hover,
.lightbox__next:hover { opacity: 1; }

.lightbox__prev { left: 12px; }
.lightbox__next { right: 12px; }

/* --- Credits --- */
.work-detail__credits {
  margin-top: clamp(40px, 5vh, 64px);
}

.work-detail__section-title {
  font-family: var(--font-mixed);
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.4;
  margin-bottom: 16px;
}

.work-detail__credits-list {
  display: grid;
  gap: 0;
}

.work-detail__credit-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mixed);
  font-size: clamp(12px, 0.95vw, 14px);
}

.work-detail__credit-row dt {
  width: 200px;
  flex-shrink: 0;
  opacity: 0.5;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.work-detail__credit-row dd {
  font-weight: 500;
}

/* --- Prev/Next Navigation --- */
.work-detail__nav {
  display: flex;
  justify-content: space-between;
  margin-top: clamp(60px, 8vh, 100px);
  padding-top: clamp(24px, 3vh, 40px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.work-detail__nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: opacity 0.25s ease;
  max-width: 45%;
}

.work-detail__nav-link:hover { opacity: 0.6; }

.work-detail__nav-link--next {
  text-align: right;
  align-items: flex-end;
}

.work-detail__nav-label {
  font-family: var(--font-mixed);
  font-size: clamp(10px, 0.8vw, 12px);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.4;
}

.work-detail__nav-title {
  font-family: var(--font-mixed);
  font-size: clamp(14px, 1.2vw, 18px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

/* --- Work Detail Mobile --- */
@media (max-width: 768px) {
  .work-detail__stills {
    grid-template-columns: 1fr;
  }

  .work-detail__credit-row {
    flex-direction: column;
    gap: 2px;
  }

  .work-detail__credit-row dt {
    width: auto;
    font-size: 10px;
  }

  .work-detail__nav {
    flex-direction: column;
    gap: 24px;
  }

  .work-detail__nav-link {
    max-width: 100%;
  }

  .work-detail__nav-link--next {
    text-align: left;
    align-items: flex-start;
  }
}
