:root {
  --text: #303030;
  --muted: #606060;
  --nav: rgb(83, 97, 77);
  --nav-hover: rgb(42, 48, 39);
  --nav-current: rgb(153, 166, 171);
  --mincho: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "MS PMincho", "Noto Serif JP", "Noto Serif TC", serif;
  --sans: "Helvetica Neue", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans TC", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* ---------- header ---------- */
.site-header { text-align: center; padding: 38px 16px 0; }
.logo { display: inline-block; }
.logo img { width: 150px; height: auto; margin: 0 auto; }
.tagline {
  display: block;
  margin-top: 6px;
  font: 9px/1.4 var(--mincho);
  letter-spacing: .2em;
  color: var(--muted);
  text-decoration: none;
}
.nav { margin: 42px auto 0; max-width: 700px; }
.nav > ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.nav li { position: relative; }
.nav a, .nav button {
  font: 12px/1.4 var(--mincho);
  color: var(--nav);
  text-decoration: none;
  background: none; border: 0; margin: 0; padding: 5px 10px; cursor: pointer;
  display: block; letter-spacing: normal; -webkit-appearance: none; appearance: none;
  transition: color .4s ease;
}
.nav a:hover, .nav button:hover { color: var(--nav-hover); }
.nav a[aria-current="page"], .nav .active > button { color: var(--nav-current); }
.nav .sub {
  list-style: none; margin: 0; padding: 6px 0;
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  background: #fff; min-width: 120px; z-index: 20;
  display: none;
}
.nav .sub a { display: block; padding: 6px 12px; white-space: nowrap; }
.nav .has-sub:hover .sub,
.nav .has-sub:focus-within .sub,
.nav .has-sub.open .sub { display: block; }

/* ---------- footer ---------- */
.site-footer { text-align: center; padding: 70px 16px 40px; color: var(--muted); }
.site-footer .social { display: flex; justify-content: center; gap: 14px; }
.site-footer .social a { color: #888; }
.site-footer .social a:hover { color: var(--text); }
.site-footer p { font-size: 11px; margin: 10px 0 0; letter-spacing: .02em; }

/* ---------- galleries ---------- */
.gallery {
  margin: 40px auto 0;
  width: calc(100% - 2 * 83px);
  max-width: var(--maxw);
}
.page-gallery .gallery { margin-top: 30px; }
.gallery .item { display: block; position: relative; overflow: hidden; }
.gallery .item img { width: 100%; transition: opacity .3s ease, transform .6s ease; }
.gallery .item:hover img { opacity: .85; }

/* masonry: JS distributes items into columns (shortest column first, like Wix) */
.gallery.masonry { display: flex; gap: var(--gap); align-items: flex-start; }
.gallery.masonry .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
/* fallback before JS runs */
.gallery.masonry:not(.ready) { display: block; columns: var(--cols); column-gap: var(--gap); }
.gallery.masonry:not(.ready) .item { break-inside: avoid; margin-bottom: var(--gap); }

.gallery.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: var(--gap);
}
.gallery.grid .item { aspect-ratio: 1; }
.gallery.grid .item img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- project page ---------- */
.project { width: calc(100% - 32px); max-width: 980px; margin: 60px auto 0; }
.slideshow .stage {
  position: relative;
  aspect-ratio: var(--ratio);
  background: #fff;
}
.slideshow .slide {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; opacity: 0; transition: opacity .5s ease;
}
.slideshow .slide.is-active { opacity: 1; }
.slideshow .prev, .slideshow .next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 72px; border: 0; background: none; cursor: pointer;
  font: 300 46px/1 var(--sans); color: rgba(60, 60, 60, .55);
}
.slideshow .prev { left: -60px; }
.slideshow .next { right: -60px; }
.slideshow .prev:hover, .slideshow .next:hover { color: var(--text); }
.thumbs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.thumbs button {
  width: 100px; height: 100px; padding: 0; border: 0; cursor: pointer; background: #fff;
  opacity: .55; transition: opacity .3s;
}
.thumbs button[aria-current="true"], .thumbs button:hover { opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.single { margin: 0; }
.single img { width: 100%; }
.single.photo img { width: 600px; margin: 0 auto; }

.info { margin-top: 40px; }
.rt { margin-bottom: 28px; }
.rt p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.rt p.h { font-size: 14px; line-height: 1.4; letter-spacing: .02em; }
.rt p.mincho { font-family: var(--mincho); font-weight: 400; }
.rt a { text-decoration: underline; }
.back {
  display: inline-block; margin: 30px 0 0 6px;
  font: italic 13px/1 Georgia, "Times New Roman", serif;
  color: var(--text); text-decoration: none;
}
.back:hover { opacity: .6; }

/* ---------- about ---------- */
.about {
  display: grid; grid-template-columns: 437px minmax(0, 480px);
  gap: 64px; justify-content: center; align-items: start;
  width: calc(100% - 32px); max-width: 1000px; margin: 90px auto 0;
}
.about-photo { margin: 0; }
.about-text { padding-top: 60px; }
.about-name { width: 100px; margin-bottom: 8px; }
.about-text .rt { margin-bottom: 18px; }
.about-text .rt:first-of-type p { letter-spacing: .35em; }
.about-text hr { border: 0; border-top: 1px solid #555; width: 280px; margin: 0 0 30px; }

/* ---------- contact ---------- */
.contact {
  display: grid; grid-template-columns: 1fr 1.3fr; gap: 60px;
  width: calc(100% - 32px); max-width: 760px; margin: 110px auto 0;
}
.contact h1 { font: 400 22px/1.3 var(--mincho); letter-spacing: .15em; margin: 0 0 30px; }
.contact-info a { font: 13px var(--mincho); letter-spacing: .1em; text-decoration: none; }
.contact-form { display: flex; flex-wrap: wrap; gap: 18px 30px; }
.contact-form label { flex: 1 1 100%; }
.contact-form label.half { flex: 1 1 calc(50% - 15px); }
.contact-form label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.contact-form input, .contact-form textarea {
  width: 100%; border: 0; border-bottom: 1px solid #333; border-radius: 0;
  padding: 6px 4px; font: 14px var(--mincho); color: var(--text); background: none; resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-bottom-color: var(--nav-current); }
.contact-form button {
  margin: 0 auto; border: 0; background: none; cursor: pointer;
  font: italic 14px var(--mincho); color: var(--text); padding: 6px 20px;
}
.contact-form button:hover { opacity: .6; }
.form-note { flex: 1 1 100%; font-size: 12px; text-align: center; margin: 0; }

.notfound { text-align: center; margin-top: 100px; font-family: var(--mincho); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(255, 255, 255, .97);
  display: flex; align-items: center; justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: calc(100vw - 140px); max-height: calc(100vh - 80px); object-fit: contain; }
.lightbox button {
  position: absolute; border: 0; background: none; cursor: pointer;
  font: 300 44px/1 var(--sans); color: #555; padding: 10px 16px;
}
.lightbox .lb-close { top: 10px; right: 14px; font-size: 34px; }
.lightbox .lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 10px; top: 50%; transform: translateY(-50%); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .slideshow .prev { left: 0; }
  .slideshow .next { right: 0; }
}
@media (max-width: 900px) {
  .gallery { width: calc(100% - 32px); }
  .gallery.grid { --gap: 24px; }
  .about { grid-template-columns: 1fr; gap: 30px; margin-top: 50px; max-width: 520px; }
  .about-text { padding-top: 0; }
  .contact { grid-template-columns: 1fr; gap: 30px; margin-top: 60px; max-width: 520px; }
}
@media (max-width: 600px) {
  .site-header { padding-top: 28px; }
  .nav { margin-top: 26px; }
  .nav > ul { justify-content: center; flex-wrap: wrap; gap: 0; }
  .nav a, .nav button { padding: 6px 8px; }
  .gallery { width: calc(100% - 20px); }
  .gallery.grid { --cols: 2 !important; --gap: 14px; }
  .project { margin-top: 30px; }
  .thumbs button { width: 64px; height: 64px; }
  .single.photo img { width: 100%; }
  .contact-form label.half { flex-basis: 100%; }
  .lightbox img { max-width: 100vw; }
}

/* ---------- masonry cascade entrance ---------- */
/* hide cards until GSAP drops them in (only when JS runs and motion is allowed) */
@media (prefers-reduced-motion: no-preference) {
  .js .gallery.masonry .item { opacity: 0; }
}
.gallery.masonry .item { will-change: transform, opacity; transform-origin: 50% 50%; }

/* ---------- card expand detail ---------- */
.gallery { position: relative; }
.gallery .item-link { display: block; cursor: zoom-in; }
.gallery .item-link img { width: 100%; }
.gallery .detail[hidden] { display: none; }
.gallery .item-placeholder { visibility: hidden; }

.gallery .item.is-open {
  position: absolute; left: 0; z-index: 30;
  /* top / width / height are set from JS so the panel fills the visible part of the gallery */
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  gap: 48px;
  background: #fff;
  overflow: hidden;
}
.gallery .item.is-open .item-link { cursor: zoom-out; height: 100%; min-height: 0; }
.gallery .item.is-open .item-link img { width: 100%; height: 100%; object-fit: contain; }
.gallery .item.is-open:hover img { opacity: 1; }
.gallery .item.is-open .detail { position: relative; min-height: 0; overflow-y: auto; padding: 40px 24px 24px 0; }
.detail-close {
  position: absolute; top: 0; right: 0;
  border: 0; background: none; cursor: pointer;
  font: 300 30px/1 var(--sans); color: var(--muted); padding: 4px 8px;
}
.detail-close:hover { color: var(--text); }
.detail-body .rt { margin-bottom: 22px; }
.detail-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 24px; }
.detail-thumbs button {
  width: 56px; height: 56px; padding: 0; border: 0; background: #fff; cursor: pointer;
  opacity: .5; transition: opacity .3s;
}
.detail-thumbs button[aria-current="true"], .detail-thumbs button:hover { opacity: 1; }
.detail-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-more {
  display: inline-block; font: italic 13px/1 Georgia, "Times New Roman", serif;
  color: var(--text); text-decoration: none;
}
.detail-more:hover { opacity: .6; }

@media (max-width: 700px) {
  .gallery .item.is-open { grid-template-columns: 1fr; grid-template-rows: 48% 1fr; gap: 16px; }
  .gallery .item.is-open .detail { padding: 8px 4px 16px; }
  .detail-close { top: -6px; }
}
.detail-body { padding-right: 36px; }

/* ---------- filterable grid ---------- */
.filters {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 34px;
  margin: 34px auto -10px;
}
.filters button {
  position: relative;
  border: 0; background: none; cursor: pointer; padding: 6px 2px;
  font: 13px/1.4 var(--mincho); letter-spacing: .15em; color: var(--nav-current);
  transition: color .4s ease;
}
.filters button::after {
  content: ""; position: absolute; left: 50%; right: 50%; bottom: 0;
  border-bottom: 1px solid currentColor; transition: left .4s ease, right .4s ease;
}
.filters button:hover { color: var(--nav); }
.filters button[aria-pressed="true"] { color: var(--nav-hover); }
.filters button[aria-pressed="true"]::after { left: 0; right: .15em; }
.gallery .item.is-hidden { display: none; }

/* ---------- floating contact button + modal ---------- */
.contact-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--nav); color: #fff;
  box-shadow: 0 4px 14px rgba(42, 48, 39, .22);
  transition: background .4s ease, transform .3s ease;
}
.contact-fab:hover { background: var(--nav-hover); transform: translateY(-2px); }
.contact-fab:focus-visible { outline: 2px solid var(--nav-current); outline-offset: 3px; }

.contact-modal {
  width: min(820px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 56px 48px 40px; border: 0; background: #fff; color: var(--text);
  box-shadow: 0 10px 40px rgba(42, 48, 39, .15);
  opacity: 0; transform: translateY(16px);
  transition: opacity .35s ease, transform .35s ease, overlay .35s allow-discrete, display .35s allow-discrete;
}
.contact-modal[open] { opacity: 1; transform: none; }
@starting-style { .contact-modal[open] { opacity: 0; transform: translateY(16px); } }
.contact-modal::backdrop {
  background: rgba(255, 255, 255, 0);
  transition: background .35s ease, overlay .35s allow-discrete, display .35s allow-discrete;
}
.contact-modal[open]::backdrop { background: rgba(255, 255, 255, .85); }
@starting-style { .contact-modal[open]::backdrop { background: rgba(255, 255, 255, 0); } }
.contact-modal .contact { margin: 0; width: 100%; max-width: none; }
.contact-modal h2 { font: 400 22px/1.3 var(--mincho); letter-spacing: .15em; margin: 0 0 30px; }
.contact-modal-close {
  position: absolute; top: 12px; right: 14px; border: 0; background: none; cursor: pointer;
  font: 300 30px/1 var(--sans); color: var(--muted); padding: 4px 8px;
}
.contact-modal-close:hover { color: var(--text); }
body.modal-open { overflow: hidden; }

@media (max-width: 600px) {
  .contact-fab { right: 16px; bottom: 16px; width: 50px; height: 50px; }
  .contact-modal { padding: 48px 22px 28px; }
}
