@charset "UTF-8";
.main {
  /* =====================
    MV
  ===================== */
  .u-mv {
    background-image: url('../img/works/mv.png');
  }

  /* =====================
    共通
  ===================== */

  .tab {
    display: block flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-block-start: 48px;

    @media (width <= 768px) {
      gap: calc((100 / 390) * 16 * 1vw);
      margin-block-start: calc((100 / 390) * 32 * 1vw);
      justify-content: center;
    }

    & > li {
      .u-anchor {
        padding-inline: 40px;
        padding-block: 8px;
        background: linear-gradient(180deg, #1990bc 0%, #4ae296 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;

        @media (width <= 768px) {
          padding-inline: calc((100 / 390) * 40 * 1vw);
          padding-block: calc((100 / 390) * 8 * 1vw);
          font-size: calc((100 / 390) * 16 * 1vw);
        }

        &::after {
          display: none;
        }
        @media (any-hover: hover) {
          &:hover {
            color: white;
            -webkit-background-clip: unset;
            background-clip: unset;
            -webkit-text-fill-color: unset;
            background: linear-gradient(180deg, #1990bc 0%, #4ae296 100%);
          }
        }
      }
    }
  }

  /* =====================
  事業例
  ===================== */
  .photo {
    position: relative;
    padding-block-start: 112px;
    padding-block-end: 112px;

    @media (width <= 768px) {
      padding-block-start: calc((100 / 390) * 64 * 1vw);
      padding-block-end: calc((100 / 390) * 64 * 1vw);
      background-color: #fff;
    }

    .u-inner {
      padding-inline: 40px;

      @media (width <= 768px) {
        padding-inline: calc((100 / 390) * 16 * 1vw);
      }

      .img_list {
        .item {
          margin-block-start: 58px;

          @media (width <= 768px) {
            margin-block-start: calc((100 / 390) * 32 * 1vw);
          }

          .img_unit {
            display: block grid;
            grid-template-columns: repeat(2, max-content);
            align-items: center;
            justify-content: center;
            gap: 48px 60px;
            margin-block-start: 32px;

            @media (width <= 768px) {
              grid-template-columns: 1fr;
              gap: calc((100 / 390) * 16 * 1vw);
              margin-block-start: calc((100 / 390) * 32 * 1vw);

              & img {
                inline-size: 100%;
              }
            }
          }

          + .item {
            margin-block-start: 57px;

            @media (width <= 768px) {
              margin-block-start: calc((100 / 390) * 32 * 1vw);
            }
          }
        }
      }
    }
  }

  /* =====================
    業務経歴
  ===================== */
  .history {
    position: relative;
    padding-block-start: 112px;
    padding-block-end: 112px;

    @media (width <= 768px) {
      padding-block-start: calc((100 / 390) * 64 * 1vw);
      padding-block-end: calc((100 / 390) * 64 * 1vw);
    }

    .u-inner {
      padding-inline: 40px;

      @media (width <= 768px) {
        padding-inline: calc((100 / 390) * 16 * 1vw);
      }

      .history_wrap {
        margin-block-start: 58px;

        @media (width <= 768px) {
          margin-block-start: calc((100 / 390) * 32 * 1vw);
        }

        .ex {
          display: block flow;
          text-align: right;
          margin-block-start: 23px;

          @media (width <= 768px) {
            margin-block-start: calc((100 / 390) * 16 * 1vw);
          }
        }
        .history_unit {
          @media (width <= 768px) {
            margin-inline: 0 calc(50% - 50vw);
            overflow-x: scroll;
            padding-inline-end: calc((100 / 390) * 16 * 1vw);
          }

          .table {
            margin-block-start: 9px;

            @media (width <= 768px) {
              margin-block-start: calc((100 / 390) * 9 * 1vw);
              /* white-space: nowrap; */
            }

            .thead {
              .tr {
                & th {
                  position: relative;
                  background: linear-gradient(180deg, #1990bc 0%, #4ae296 100%);
                  color: #fff;
                  text-align: center;

                  @media (width <= 768px) {
                    white-space: nowrap;
                  }

                  &:nth-child(1) {
                    inline-size: 130px;

                    @media (width <= 768px) {
                      inline-size: calc((100 / 390) * 130 * 1vw);
                    }
                  }
                  &:nth-child(2) {
                    inline-size: 690px;

                    @media (width <= 768px) {
                      inline-size: 100%;
                    }
                  }
                  &:nth-child(3) {
                    inline-size: 280px;

                    @media (width <= 768px) {
                      inline-size: calc((100 / 390) * 180 * 1vw);
                    }
                  }
                  &:nth-child(4) {
                    inline-size: 103px;

                    @media (width <= 768px) {
                      inline-size: calc((100 / 390) * 100 * 1vw);
                    }
                  }
                }
              }
            }
            .tbody {
              .tr {
                & td {
                  position: relative;
                  background-color: #fff;

                  @media (width <= 768px) {
                    white-space: nowrap;
                    text-size-adjust: none;
                    -webkit-text-size-adjust: none;
                  }

                  &:nth-child(4) {
                    & button {
                      display: block grid;
                      justify-items: center;
                      inline-size: 100%;
                      block-size: 100%;

                      @media (width <= 768px) {
                        & img {
                          width: calc((100 / 390) * 26 * 1vw);
                        }
                      }
                    }
                  }
                }
              }
            }
            & th,
            & td {
              border: solid 1px #e0e0e0;
              padding-block: 7.1px;
              padding-inline: 15px 14px;

              @media (width <= 768px) {
                padding-block: calc((100 / 390) * 6 * 1vw);
                padding-inline: calc((100 / 390) * 8 * 1vw);
              }
            }
          }
        }
      }
    }
  }
}

/* =====================
  tab
===================== */
.img_wrap,
.history_wrap {
  display: none;
  opacity: 0;
  transition:
    opacity 300ms,
    display 300ms allow-discrete;

  &.active {
    display: block;
    opacity: 1;

    @starting-style {
      opacity: 0;
    }
  }
}

.tab {
  & > li {
    &.active {
      .u-anchor {
        color: white;
        -webkit-background-clip: unset;
        background-clip: unset;
        -webkit-text-fill-color: unset;
        background: linear-gradient(180deg, #1990bc 0%, #4ae296 100%);
      }
    }
  }
}

/* =====================
  modal
===================== */
body[data-modal='open'] {
  overflow: hidden;
  .works-modal {
    display: block;
    opacity: 1;
    @starting-style {
      opacity: 0;
    }
  }
}
.works-modal {
  position: fixed;
  inset: 0;
  z-index: calc(infinity * 1);
  inline-size: 100%;
  block-size: 100%;
  background-color: rgba(10, 10, 10, 0.92);
  justify-content: center;
  align-items: center;
  display: none;
  opacity: 0;
  transition:
    opacity 300ms ease 0s,
    display 300ms allow-discrete;
  .gallery {
    display: grid;
    grid-template-columns: repeat(3, 160px);
    gap: 4px;
  }

  .img_unit {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .img_unit img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(30%);
    transition:
      transform var(--transition),
      filter var(--transition);
  }

  .img_unit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(200, 169, 126, 0.15));
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
  }

  .img_unit:hover img {
    transform: scale(1.06);
    filter: grayscale(0%);
  }
  .img_unit:hover::after {
    opacity: 1;
  }

  .img_unit .index-badge {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.6rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    opacity: 0;
    transition: opacity var(--transition);
  }
  .img_unit:hover .index-badge {
    opacity: 1;
  }

  /* ── Modal overlay ── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .modal-overlay.is-open {
    opacity: 1;
    pointer-events: all;
  }

  /* ── Modal panel ── */
  .modal {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 720px;
    display: grid;
    grid-template-rows: 1fr auto;
    transform: translateY(16px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .modal-overlay.is-open .modal {
    transform: translateY(0);
  }

  /* ── Image stage ── */
  .modal-stage {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/10;
    background: var(--bg);
  }

  .modal-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition:
      opacity 0.4s ease,
      transform 0.4s ease;
    transform: scale(1.02);
    will-change: opacity, transform;
  }

  .modal-img.is-active {
    opacity: 1;
    transform: scale(1);
  }

  /* Direction animation helpers */
  .modal-img.slide-from-right {
    transform: translateX(24px) scale(1.02);
  }
  .modal-img.slide-from-left {
    transform: translateX(-24px) scale(1.02);
  }

  /* ── Nav arrows ── */
  .modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(14, 14, 14, 0.7);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition:
      background var(--transition),
      border-color var(--transition),
      color var(--transition);
    backdrop-filter: blur(4px);
    font-size: 1rem;

    @media (width <= 768px) {
      width: calc((100 / 390) * 32 * 1vw);
      height: calc((100 / 390) * 32 * 1vw);
      backdrop-filter: blur(calc((100 / 390) * 4 * 1vw));
    }
  }
  .modal-nav:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
  }
  .modal-nav.prev {
    left: 12px;

    @media (width <= 768px) {
      left: calc((100 / 390) * 12 * 1vw);
    }
  }
  .modal-nav.next {
    right: 12px;

    @media (width <= 768px) {
      right: calc((100 / 390) * 12 * 1vw);
    }
  }
  .modal-nav:disabled {
    opacity: 0.2;
    cursor: default;
  }
  .modal-nav:disabled:hover {
    background: rgba(14, 14, 14, 0.7);
    border-color: var(--border);
    color: var(--text-primary);
  }

  /* ── Close button ── */
  .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(14, 14, 14, 0.7);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(4px);
    transition:
      color var(--transition),
      border-color var(--transition);
    font-size: 0.75rem;
    letter-spacing: 0;

    @media (width <= 768px) {
      top: calc((100 / 390) * 12 * 1vw);
      right: calc((100 / 390) * 12 * 1vw);
      width: calc((100 / 390) * 32 * 1vw);
      height: calc((100 / 390) * 32 * 1vw);
      backdrop-filter: blur(calc((100 / 390) * 4 * 1vw));
    }
  }
  .modal-close:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
  }

  /* ── Footer bar ── */
  .modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);

    @media (width <= 768px) {
      padding: calc((100 / 390) * 12 * 1vw) calc((100 / 390) * 16 * 1vw);
    }
  }

  .modal-caption {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    transition: opacity 0.3s ease;
  }

  .modal-counter {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.2em;
    flex-shrink: 0;
  }
  .modal-counter span {
    color: var(--accent);
  }

  /* ── Thumbnail strip ── */
  .modal-thumbs {
    display: flex;
    gap: 4px;
    padding: 0 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;

    @media (width <= 768px) {
      gap: calc((100 / 390) * 4 * 1vw);
      padding: 0 calc((100 / 390) * 16 * 1vw) calc((100 / 390) * 12 * 1vw);
    }
  }
  .modal-thumbs::-webkit-scrollbar {
    display: none;
  }

  .thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid transparent;
    overflow: hidden;
    opacity: 0.45;
    transition:
      opacity var(--transition),
      border-color var(--transition);

    @media (width <= 768px) {
      width: calc((100 / 390) * 44 * 1vw);
      height: calc((100 / 390) * 44 * 1vw);
    }
  }
  .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .thumb.is-active {
    border-color: var(--accent);
    opacity: 1;
  }
  .thumb:hover {
    opacity: 0.8;
  }

  /* ── Keyboard hint ── */
  .hint {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    opacity: 0.6;
  }
}

body[data-modal='open'] .works-modal {
  color: white;
  display: flex; /* ← grid でも可。中央寄せのため必要 */
  opacity: 1;
}
