/* ============================================================
   Yokoyama Tatsuro — portfolio
   色はこの :root にまとまっています
   ============================================================ */

:root {
  /* 真っ白ではなく、わずかに温かみのあるオフホワイト */
  --bg: #f3f2ee;
  --bg-elev: #e6e5e0;
  --line: rgba(23, 22, 20, 0.14);
  --line-soft: rgba(23, 22, 20, 0.08);
  --fg: #171614;
  --fg-dim: #6a6862;
  --fg-faint: #9b9992;

  --font-sans: "Schibsted Grotesk", "Zen Kaku Gothic New", -apple-system,
    BlinkMacSystemFont, "Hiragino Sans", "Helvetica Neue", Arial, sans-serif;

  --page-x: clamp(20px, 4.4vw, 64px);
  --maxw: 1680px;

  --ease: cubic-bezier(0.22, 0.7, 0.19, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  /* 内容が短いページでもフッターが画面下に来るように */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  font-feature-settings: "palt" 1;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

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

:focus-visible {
  outline: 1.5px solid var(--fg);
  outline-offset: 3px;
  border-radius: 2px;
}

main {
  flex: 1 0 auto;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--page-x);
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.8125rem;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 12px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.35s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line-soft);
}

.site-header__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-block: 18px;
}

/* ロゴタイプ */
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55em;
  font-size: clamp(1.25rem, 1.9vw, 1.5rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.017em;
  white-space: nowrap;
}
.brand__role {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  color: var(--fg-dim);
}
/* 横に並べるときだけダッシュでつなぐ（縦に積むモバイルでは出さない） */
.brand__role::before {
  content: "— ";
}

.nav {
  display: flex;
  align-items: baseline;
  gap: clamp(16px, 2.2vw, 32px);
}

.nav a {
  position: relative;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  color: var(--fg-dim);
  transition: color 0.25s var(--ease);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--fg);
}
.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__social {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: center;
}
.nav__social a {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--fg-faint);
  transition: color 0.25s var(--ease);
}
.nav__social a::after {
  display: none;
}
.nav__social a:hover {
  color: var(--fg);
}
.nav__social svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ---------- section head ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: clamp(20px, 2.2vw, 30px);
  border-bottom: 1px solid var(--line);
}

.section-head h1,
.section-head h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.section-head .count {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- work grid ---------- */

.works {
  padding-block: clamp(26px, 3vw, 44px) clamp(60px, 8vh, 100px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(26px, 2.6vw, 40px) clamp(12px, 1.3vw, 20px);
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card__thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-elev);
  border-radius: 3px;
}

.card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform 0.9s var(--ease);
}

.card__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  pointer-events: none;
}

.card__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.card__play span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transform: scale(0.88);
  transition: transform 0.45s var(--ease);
}
.card__play svg {
  width: 13px;
  height: 13px;
  margin-left: 2px;
  fill: var(--fg);
}

.card__duration {
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.card__body {
  display: block;
  padding-top: 11px;
}

/* クライアント名は小さく淡く、タイトルは中太で。サムネイルとの間より
   クライアント名とタイトルの間を詰めて、ひとかたまりに見せる */
.card__client {
  display: block;
  min-height: 1.15em; /* 空でも高さが揃うように */
  font-size: 0.6875rem;
  line-height: 1.15;
  letter-spacing: 0.03em;
  color: var(--fg-faint);
  transition: color 0.3s var(--ease);
}

.card__title {
  display: block;
  margin: 5px 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0;
  line-break: strict;
  word-break: auto-phrase;
}

@media (hover: hover) {
  .card:hover .card__thumb img,
  .card:focus-visible .card__thumb img {
    transform: scale(1.045);
  }
  .card:hover .card__play,
  .card:focus-visible .card__play {
    opacity: 1;
  }
  .card:hover .card__play span,
  .card:focus-visible .card__play span {
    transform: scale(1);
  }
  .card:hover .card__client {
    color: var(--fg-dim);
  }
}

@media (hover: none) {
  .card__play {
    opacity: 1;
  }
  .card__play span {
    width: 46px;
    height: 46px;
    transform: scale(1);
    background: color-mix(in srgb, var(--bg) 72%, transparent);
  }
}

/* ---------- about ---------- */

.about {
  padding-block: clamp(34px, 4.5vw, 66px) clamp(60px, 8vh, 100px);
}

/* 左に本文＋写真、右に Career などを縦に通す。
   2行目を 1fr にして、写真が右カラムの下端と揃うところまで伸びるようにしている。
   本文の1行が短くなりすぎないよう、左カラムには上限を持たせる */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 600px) minmax(0, 1fr);
  gap: clamp(30px, 3.5vw, 64px);
  align-items: start;
}
.about__grid .prose {
  grid-column: 1;
  grid-row: 1;
}
.about__side {
  grid-column: 2;
  grid-row: 1;
}
/* 写真があるときだけ2行目ができる */
.about__grid.has-photo .about__side {
  grid-row: 1 / span 2;
}

/* 路地が奥へ抜けていく縦の構図なので、縦位置でトリミングする。
   人物が全身入る高さは保ったまま、意味の薄い左右（手前の人物・シャッター）を落とす。
   小さく置いて主張させない */
.about__photo {
  grid-column: 1;
  grid-row: 2;
  margin: 0;
  max-width: 200px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 3px;
}
.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% center;
}

/* 和文が単語の途中で折れないように。auto-phrase は文節単位で改行する
   （Chrome / Safari 対応。非対応ブラウザは line-break: strict で最低限を担保） */
/* 本文の頭に置く名前 */
.prose p.prose__name {
  margin: 0 0 1.1em;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--fg);
}

.prose p {
  margin: 0 0 1.4em;
  font-size: 0.9375rem;
  line-height: 1.95;
  color: #3a3833;
  /* 和文は 1文字 ≒ 1em なので、ch ではなく em で行長を決める（40文字前後） */
  max-width: 40em;
  line-break: strict;
  word-break: auto-phrase;
  text-wrap: pretty;
}
.prose p:last-child {
  margin-bottom: 0;
}

.panel + .panel {
  margin-top: clamp(32px, 4vw, 50px);
}

.panel__label {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
  padding-bottom: 11px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 18px;
  padding: 9px 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--line-soft);
}
.timeline li:last-child {
  border-bottom: 0;
}
.timeline .y {
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.timeline .t {
  color: #3a3833;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tags li {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.contact-lines {
  display: grid;
  gap: 4px;
  font-size: 0.9375rem;
}
.contact-lines a {
  display: inline-block;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color 0.25s var(--ease);
}
.contact-lines a:hover {
  border-bottom-color: var(--fg);
}

/* ---------- 404 ---------- */

.notfound {
  padding-block: clamp(72px, 14vh, 180px) clamp(72px, 12vh, 150px);
}
.notfound__code {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
}
.notfound__text {
  margin: 20px 0 28px;
  color: var(--fg-dim);
  font-size: 0.9375rem;
}
.notfound__back {
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.25s var(--ease);
}
.notfound__back:hover {
  border-bottom-color: var(--fg);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-soft);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 26px calc(26px + env(safe-area-inset-bottom));
  font-size: 0.8125rem;
  color: var(--fg-faint);
}
.site-footer a {
  transition: color 0.25s var(--ease);
}
.site-footer a:hover {
  color: var(--fg);
}
.site-footer__links {
  display: flex;
  gap: 18px;
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, #0d0c0b 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__stage {
  width: min(1240px, 100%);
  transform: translateY(8px) scale(0.99);
  transition: transform 0.4s var(--ease);
}
.lightbox.is-open .lightbox__stage {
  transform: none;
}

.lightbox__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 3px;
  overflow: hidden;
}
.lightbox__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.lightbox__caption {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  padding-top: 14px;
  font-size: 0.875rem;
  color: #d8d6d1;
}
.lightbox__caption .c {
  font-size: 0.75rem;
  color: #97948d;
}

.lightbox__close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: none;
  color: #f3f2ee;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.lightbox__close:hover {
  background: #f3f2ee;
  color: #171614;
}
.lightbox__close svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.4;
}

/* ---------- reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */

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

/* 1カラムになったときは 本文 → Career など → 写真 の順。
   写真が本文と Career の間に挟まらないようにする */
@media (max-width: 900px) {
  .about__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }
  .about__grid .prose {
    grid-row: 1;
  }
  .about__side {
    grid-column: 1;
    grid-row: 2;
  }
  .about__photo {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 720px) {
  .site-header__inner {
    padding-block: 14px;
    align-items: center;
  }
  /* 横に並べる幅が無いので、肩書きは名前の下に積む */
  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    font-size: 1.125rem;
  }
  .brand__role {
    font-size: 0.625rem;
    letter-spacing: 0.03em;
  }
  .brand__role::before {
    content: none;
  }
  .nav {
    gap: 14px;
    align-items: center;
  }
  .nav a {
    font-size: 0.875rem;
  }
  .nav__social {
    gap: 6px;
  }

  .works {
    padding-block: 20px 56px;
  }

  /* 1カラムでは、カード内は詰めてカード同士は離す＝ひとかたまりに見せる */
  .grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }
  .card__body {
    padding-top: 9px;
  }
  .card__client {
    font-size: 0.6875rem;
  }
  .card__title {
    margin-top: 3px;
    font-size: 0.875rem;
    line-height: 1.55;
  }
  .card__duration {
    right: 7px;
    bottom: 7px;
    font-size: 0.625rem;
  }

  .about__lead {
    font-size: 1.375rem;
  }

  .lightbox {
    padding: 0;
  }
  .lightbox__stage {
    width: 100%;
  }
  .lightbox__frame {
    border-radius: 0;
  }
  .lightbox__caption {
    padding: 14px 20px 0;
  }

  .timeline li {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
