@font-face {
  font-family: Inter;
  src: url("../assets/home/inter.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("../assets/home/playfair.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

@font-face {
  font-family: "Playfair Display";
  src: url("../assets/home/playfair-italic.woff2") format("woff2");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Mono";
  src: url("../assets/home/roboto-mono.woff2") format("woff2");
  font-weight: 300 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans JP";
  src: url("../assets/home/noto-sans-jp-home.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --navy: #0d1a33;
  --white: #f5f9ff;
  --accent: #ff6a2b;
  --secondary: #b7c7dc;
  --line: rgb(245 249 255 / 50%);
  --page-gutter: 32px;
  --header-height: 72px;
  --section-padding: 120px;
  --japanese: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --mono: "Roboto Mono", monospace;
  color: var(--white);
  background: var(--navy);
  font-family: Inter, Arial, var(--japanese);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
img { display: block; }
a { color: inherit; text-decoration: none; }
button { border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.8;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow:
    inset 0 1px rgb(245 249 255 / 12%),
    inset 1px 0 rgb(245 249 255 / 12%),
    inset -1px 0 rgb(245 249 255 / 12%);
}

.header-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--page-gutter);
  background: rgb(13 26 51 / 20%);
}

.brand, .menu-toggle { opacity: 0.8; }
.primary-nav { display: flex; gap: 56px; font-size: 14px; font-weight: 600; line-height: 1; }
.primary-nav a { opacity: 0.8; }
.nav-caption, .menu-toggle, .sp-break { display: none; }

@media (width > 767px) and (hover: hover) and (prefers-reduced-motion: no-preference) {
  .primary-nav .nav-label {
    display: inline-block;
    pointer-events: none;
    transform-origin: center bottom;
    backface-visibility: hidden;
  }
  .primary-nav a:hover .nav-label { animation: nav-label-turn 0.6s ease-in-out; }
}

@keyframes nav-label-turn {
  from { transform: perspective(180px) rotateX(0deg); }
  to { transform: perspective(180px) rotateX(-360deg); }
}

.hero {
  display: grid;
  justify-items: center;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100svh - var(--header-height));
  gap: clamp(12px, 6svh, 80px);
  padding-block: clamp(12px, 5svh, 80px);
  background: linear-gradient(to bottom, var(--navy) 84.529%, var(--secondary));
}

.hero-copy {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-inline: 16px;
  text-align: center;
}

.eyebrow { color: var(--accent); font-size: 14px; font-weight: 700; line-height: 16px; letter-spacing: 0.05em; }
.hero h1 { font-size: clamp(44px, 4.73vw, 68px); line-height: 1.4; font-weight: 300; letter-spacing: -0.03em; }
.hero h1 span { display: block; }
.hero h1 em { font-family: "Playfair Display", Georgia, serif; font-weight: 900; letter-spacing: normal; }
.hero-second { font-size: clamp(34px, 3.89vw, 56px); }
.hero-second small { font-size: 0.857em; }
.hero-intro { padding-top: 24px; font: 500 15px/1.8 var(--japanese); letter-spacing: 0.1em; }

@media (prefers-reduced-motion: no-preference) {
  .hero-reveal {
    display: inline-block;
    animation: hero-word-reveal 0.9s ease-out backwards;
  }

  .hero-second .hero-reveal:first-of-type { animation-delay: 0.2s; }
  .hero-second .hero-reveal:last-of-type { animation-delay: 0.4s; }
}

@keyframes hero-word-reveal {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: none; }
}

.hero-track {
  position: relative;
  width: 100%;
  height: min(100%, clamp(400px, 34.73vw, 500px));
  overflow: hidden;
}

.hero-scene {
  position: absolute;
  inset: 0;
  perspective: max(390px, 64vw);
  transform-style: preserve-3d;
}

.hero-scene img {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 88%;
  width: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 16px;
  background: #d7d7d7;
  visibility: hidden;
}

.featured, .works { position: relative; isolation: isolate; overflow: clip; padding-top: var(--section-padding); }
.featured { background: var(--secondary); color: var(--navy); }

@media (prefers-reduced-motion: no-preference) {
  .hero-featured > .hero {
    position: sticky;
    top: var(--header-height);
  }

  .hero-featured > .featured { z-index: 1; }
}

.section-number {
  position: absolute;
  z-index: -1;
  top: 25px;
  right: var(--page-gutter);
  color: transparent;
  -webkit-text-stroke: 0.75px rgb(245 249 255 / 50%);
  font: 900 264px/1 "Playfair Display", Georgia, serif;
  pointer-events: none;
}

.featured .section-number { -webkit-text-stroke-color: rgb(13 26 51 / 40%); }
.section-heading { display: grid; gap: 10px; margin: 0 var(--page-gutter) 52px; }
.section-heading h2 { font-size: clamp(48px, 5vw, 72px); line-height: 1; letter-spacing: 0.005em; }
.section-heading p { color: var(--accent); font: 500 12px/1 var(--japanese); letter-spacing: 0.1em; }
.works .section-heading p { letter-spacing: 0.2em; }

.heading-reveal-word { white-space: nowrap; }
.heading-reveal-letter { display: inline-block; }

@media (prefers-reduced-motion: no-preference) {
  .heading-reveal-pending .heading-reveal-letter {
    opacity: 0;
    transform: translateY(12px);
  }

  .heading-reveal-active .heading-reveal-letter {
    animation: heading-letter-rise 0.6s ease-out var(--letter-delay) backwards;
  }
}

@keyframes heading-letter-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.featured-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.featured-card { display: block; min-width: 0; }

@media (width > 767px) and (prefers-reduced-motion: no-preference) {
  .featured-grid:is(.is-stacked, .is-unfolding) > .featured-card {
    background: var(--secondary);
    z-index: var(--stack-order);
  }

  .featured-grid.is-stacked > .featured-card { transform: var(--stack-position); }
  .featured-grid.is-unfolding > .featured-card {
    animation: featured-card-unfold 1.2s ease-out var(--unfold-delay) backwards;
  }
}

@keyframes featured-card-unfold {
  from { transform: var(--stack-position); }
  to { transform: none; }
}

@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  .featured-card { --mobile-slide-start: clamp(-96px, -22vw, -56px); }
  .featured-card:nth-child(even) { --mobile-slide-start: clamp(56px, 22vw, 96px); }
  .featured-card.is-mobile-pending {
    opacity: 0;
    transform: translateX(var(--mobile-slide-start));
  }

  .featured-card.is-mobile-revealed { animation: featured-mobile-slide 1.2s ease-in-out; }
}

@keyframes featured-mobile-slide {
  from { opacity: 0; transform: translateX(var(--mobile-slide-start)); }
  to { opacity: 1; transform: translateX(0); }
}

.featured-media {
  position: relative;
  aspect-ratio: 720 / 525;
  overflow: hidden;
  border: 1px solid var(--white);
  border-bottom: 0;
  background: #d7d7d7;
}

.featured-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-card[data-project="cluel"] .featured-media { background: #feeff4; }
.featured-details {
  display: grid;
  justify-items: end;
  gap: 24px;
  padding: 32px;
  border-inline: 1px solid var(--white);
  line-height: 1;
}

@media (width > 767px) {
  .featured-card:nth-child(even) :is(.featured-media, .featured-details) {
    border-inline-start-width: 0;
  }
}

.featured-label { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.featured-name { display: flex; align-items: center; gap: 12px; }
.featured-name span { color: var(--accent); font-size: 12px; font-weight: 600; }
.featured-name h3 { font-size: 24px; font-weight: 600; }
.featured-type { text-align: right; }
.card-arrow { justify-self: end; width: auto; height: auto; }

.works { margin-inline: var(--page-gutter); scroll-margin-top: 72px; }
.works .section-heading { margin-inline: 0; }
.works .section-number { right: 0; }
.works-body {
  position: relative;
  display: grid;
  gap: 120px;
  justify-items: center;
  padding-block: 20px 120px;
  border-block: 1px solid var(--line);
  background: var(--navy);
}

.works-filters { width: 100%; display: flex; justify-content: flex-end; gap: 48px; }
.works-filters button { padding: 12px 8px; line-height: 1; }
.works-filters span { display: block; padding-bottom: 4px; border-bottom: 1px solid transparent; }
.works-filters [aria-pressed="true"] { font-weight: 600; }
.works-filters [aria-pressed="true"] span { border-color: var(--accent); }

.works-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 328px));
  justify-content: center;
  gap: 20px;
}

.works-grid:empty { display: none; }
.works-card {
  display: grid;
  align-content: start;
  gap: 20px;
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .works-card.is-works-pending { opacity: 0; }
  .works-card.is-works-entering {
    animation: works-card-enter 1s ease-in-out var(--works-enter-delay) backwards;
  }
}

@keyframes works-card-enter {
  from { opacity: 0; translate: 0 -40px; }
  to { opacity: 1; translate: 0 0; }
}

@media (hover: hover) and (pointer: fine) {
  .works-filters span { position: relative; }
  .works-filters button[aria-pressed="false"] span::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
  }

  .works-filters button[aria-pressed="false"]:hover span::after { transform: scaleX(1); }
  .works-card:hover { border-color: var(--white); }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .works-filters button[aria-pressed="false"] span::after { transition: transform 0.3s ease; }
  .works-card {
    position: relative;
    transition: transform 0.35s ease, border-color 0.35s ease;
  }

  .works-card:hover { transform: translateY(-10px); }
  .works-card:hover::after {
    /* Keep the original bottom edge hoverable as the card rises. */
    content: "";
    position: absolute;
    inset: 100% -1px -11px;
  }
}

@media (max-width: 767px) and (hover: none) and (pointer: coarse) {
  .works-card:is(:active, .is-touch-pressed) { border-color: var(--white); }
}

@media (max-width: 767px) and (hover: none) and (pointer: coarse) and (prefers-reduced-motion: no-preference) {
  .works-card { transition: transform 0.35s ease, border-color 0.35s ease; }
  .works-card:is(:active, .is-touch-pressed) { transform: translateY(-10px); }
}

.works-media { aspect-ratio: 288 / 200; overflow: hidden; border-radius: 8px; background: #d7d7d7; }
.works-media img { width: 100%; height: 100%; object-fit: cover; }
.works-details { display: grid; }
.works-category { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 11px; }
.works-category::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.works-details h3 { padding-top: 32px; font-size: 24px; font-weight: 500; overflow-wrap: anywhere; }
.works-details h3:lang(ja) { font-size: 21px; }
.works-type { margin: 16px 0 8px; overflow-wrap: anywhere; }

.view-more {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  width: 160px;
  min-height: 44px;
  border-inline: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
}

.view-more[hidden] { display: none; }

.site-footer {
  display: grid;
  place-items: center;
  min-height: 80px;
  font: 300 11px/1 Inter, Arial, sans-serif;
}

.site-footer-links {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.site-footer-links a { text-decoration: underline; text-underline-offset: 0.2em; }

@media (max-width: 1150px) {
  .works-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .featured-details { padding-inline: 24px; }
}

@media (max-width: 900px) {
  .works-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  :root { --page-gutter: 16px; --section-padding: 80px; --header-height: 64px; }

  .header-bar { padding-block: 10px; }
  .menu-toggle { display: grid; place-items: center; width: 44px; height: 44px; }
  .menu-lines { display: grid; gap: 6px; }
  .menu-lines i { width: 24px; height: 1px; background: var(--white); }
  .menu-toggle img, .menu-toggle[aria-expanded="true"] .menu-lines { display: none; }
  .menu-toggle[aria-expanded="true"] img { display: block; }

  .primary-nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    flex-direction: column;
    gap: 32px;
    padding: 32px 32px 64px;
    background: var(--navy);
  }

  .menu-toggle[aria-expanded="true"] + .primary-nav { display: flex; }
  .primary-nav a { display: grid; align-content: start; gap: 8px; min-height: 52px; opacity: 1; font-size: 28px; color: white; }
  .primary-nav .nav-caption { display: block; color: var(--accent); font: 500 12px/1 var(--japanese); letter-spacing: 0.1em; }
  .sp-break { display: initial; }

  .hero { gap: clamp(12px, 6svh, 40px); background: linear-gradient(to bottom, var(--navy) 85.792%, var(--secondary)); }
  .hero-copy { gap: 16px; }
  .hero h1 { font-size: clamp(29px, 9.6vw, 36px); }
  .hero-second { font-size: clamp(24px, 8vw, 30px); }
  .hero-intro { padding-top: 0; font-size: 13px; }

  .section-number { top: 38.25px; font-size: 180px; }
  .featured .section-heading { position: relative; }
  .featured .section-number { top: auto; right: 0; bottom: -68.25px; }
  .section-heading h2 { font-size: clamp(38px, 12.8vw, 48px); }
  .featured-grid { grid-template-columns: minmax(0, 1fr); }
  .featured-media { border: 0; }
  .featured-details { position: relative; padding: 32px 17px; border-inline: 0; }
  .featured-label { align-items: flex-start; flex-direction: column; gap: 16px; }
  .featured-type { text-align: left; }
  .featured-details .card-arrow { position: absolute; bottom: 32px; right: 16px; }

  .works { scroll-margin-top: 64px; }
  .works-body { gap: 80px; padding-bottom: 80px; }
  .works-filters { justify-content: space-between; gap: 0; }
  .works-filters button { padding-inline: clamp(3px, 2vw, 8px); font-size: clamp(13px, 4.27vw, 16px); }
  .works-grid { grid-template-columns: minmax(0, 328px); justify-content: center; }
  .site-footer { min-height: 64px; }
}
