/* Works page — builds on /assets/css/style.css and /assets/css/subpage.css */

/* ---------- finder (search + categories) ---------- */

/* this page uses the full screen width (other pages keep the 1160px column) */
.works-browser,
.page-cta {
  max-width: none;
}

.page-hero-inner {
  max-width: none;
}

.works-browser {
  padding-top: clamp(24px, 4vw, 48px);
}

/* columns step down with the screen: 4 → 3 → 2 (sidebar becomes a panel) → 1 */
#work-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(32px, 3vw, 44px) clamp(20px, 1.6vw, 28px);
}

.finder {
  position: relative;
  padding: clamp(22px, 3vw, 32px);
  background: var(--washi-card);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -32px rgba(30, 27, 24, 0.45);
  margin-top: calc(-1 * clamp(64px, 8vw, 104px));
  z-index: 2;
}

/* red corner mark, like a stamp on the paper */
.finder::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 44px;
  height: 3px;
  background: var(--shu);
}

.finder-search {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color .3s, box-shadow .3s;
}

.finder-search:focus-within {
  border-bottom-color: var(--shu);
  box-shadow: 0 1px 0 var(--shu);
}

.finder-search > i {
  color: var(--usuzumi);
  font-size: 17px;
  padding: 0 14px 0 4px;
  transition: color .3s;
}

.finder-search:focus-within > i {
  color: var(--shu);
}

.finder-search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--sumi);
  background: transparent;
  border: 0;
  padding: 14px 0;
  outline: none;
}

.finder-search input::placeholder {
  color: var(--usuzumi);
  opacity: 0.85;
}

.finder-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.finder-clear {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--usuzumi);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color .3s;
}

.finder-clear:hover {
  color: var(--shu);
}

.finder-clear[hidden] {
  display: none;
}

.finder-suggest {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 18px;
}

.finder-label {
  font-family: var(--f-mincho);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--usuzumi);
}

.suggest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggest-chip,
.work-tag {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--sumi-soft);
  background: transparent;
  border: 1px solid var(--line);
  padding: 2px 12px;
  cursor: pointer;
  transition: color .3s, border-color .3s, background-color .3s;
}

.suggest-chip::before {
  content: "#";
  margin-right: 2px;
  color: var(--shu);
}

.suggest-chip:hover,
.work-tag:hover {
  color: var(--shu);
  border-color: var(--shu);
}

.suggest-chip.is-active {
  background: var(--shu);
  border-color: var(--shu);
  color: var(--washi);
}

.suggest-chip.is-active::before {
  color: var(--washi);
}

/* category tabs */
.finder-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-mincho);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--sumi);
  background: transparent;
  border: 1px solid var(--line-strong);
  padding: 10px 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: color .4s var(--ease), border-color .4s var(--ease);
}

/* same sumi wipe as .btn */
.cat-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sumi);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .5s var(--ease);
}

.cat-chip:hover:not(:disabled)::before,
.cat-chip.is-active::before {
  transform: scaleX(1);
  transform-origin: left;
}

.cat-chip:hover:not(:disabled),
.cat-chip.is-active {
  color: var(--washi);
  border-color: var(--sumi);
}

.cat-chip em {
  font-style: normal;
  font-family: var(--f-latin);
  font-size: 15px;
  min-width: 1.6em;
  padding: 0 6px;
  text-align: center;
  line-height: 1.5;
  color: var(--shu);
  border-left: 1px solid currentColor;
  transition: color .4s var(--ease);
}

.cat-chip.is-active em,
.cat-chip:hover:not(:disabled) em {
  color: var(--washi);
}

.cat-chip:disabled {
  cursor: default;
  opacity: 0.4;
}

/* ---------- status ---------- */

.finder-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: clamp(28px, 4vw, 44px) 0 clamp(24px, 3vw, 32px);
  min-height: 34px;
}

#result-count {
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--sumi-soft);
}

#result-count strong {
  font-family: var(--f-latin);
  font-weight: 500;
  font-size: 28px;
  color: var(--shu);
  margin-right: 4px;
  vertical-align: -2px;
}

#result-count span {
  color: var(--usuzumi);
}

.finder-reset {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-family: var(--f-mincho);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--sumi);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  padding: 2px 0;
  cursor: pointer;
  transition: color .3s, border-color .3s;
}

.finder-reset:hover {
  color: var(--shu);
  border-color: var(--shu);
}

.finder-reset[hidden] {
  display: none;
}

/* ---------- cards (extends .work-card) ---------- */

.works-item {
  animation: works-in .6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

@keyframes works-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

.work-cat {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 3px 12px;
  background: rgba(245, 240, 230, 0.94);
  color: var(--sumi);
  font-family: var(--f-mincho);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.work-tag {
  font-size: 12px;
  padding: 0 10px;
}

.work-card mark {
  background: linear-gradient(transparent 55%, rgba(183, 40, 46, 0.22) 55%);
  color: inherit;
  padding: 0 1px;
}

.work-grid[hidden] {
  display: none;
}

/* ---------- empty state ---------- */

.finder-empty {
  text-align: center;
  padding: clamp(40px, 6vw, 72px) 16px;
  border: 1px dashed var(--line-strong);
}

.finder-empty[hidden] {
  display: none;
}

.finder-empty-mark {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border: 1px solid var(--shu);
  color: var(--shu);
  font-family: var(--f-mincho);
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
}

.finder-empty h2 {
  font-family: var(--f-mincho);
  font-weight: 800;
  font-size: clamp(19px, 2.2vw, 23px);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.finder-empty p {
  font-size: 14px;
  color: var(--sumi-soft);
  margin-bottom: 28px;
}

.finder-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

/* ---------- industry sidebar ---------- */

.works-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: clamp(28px, 2.4vw, 40px);
  align-items: start;
  margin-top: clamp(28px, 4vw, 44px);
}

.works-layout .finder-status {
  margin-top: 0;
}

.industry-panel {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  background: var(--washi-card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--sumi);
}

/* results bar: industry button (narrow screens only) + result count */
.finder-status-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.industry-toggle,
.industry-close {
  display: none;
}

.industry-heading-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.industry-heading-row .industry-heading {
  flex: 1;
}

.industry-backdrop[hidden] {
  display: none;
}

/* the list can be longer than the screen; it scrolls inside the sticky panel */
.industry-body {
  padding: 22px 20px 20px;
  max-height: calc(100vh - var(--header-h) - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.industry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--f-mincho);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.14em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.industry-heading small {
  font-family: var(--f-latin);
  font-style: italic;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--usuzumi);
}

.industry-note {
  margin: 10px 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--usuzumi);
}

.industry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.industry-option {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  margin: 0 -10px;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: var(--sumi);
  cursor: pointer;
  transition: background-color .3s, color .3s;
}

/* the real checkbox stays focusable but invisible; the icon acts as the marker */
.industry-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.industry-option > i {
  font-size: 13px;
  text-align: center;
  color: var(--usuzumi);
  transition: color .3s;
}

.industry-option em {
  font-style: normal;
  font-family: var(--f-gothic);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 1.4em;
  text-align: right;
  color: var(--usuzumi);
}

.industry-option::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--shu);
  transform: scaleY(0);
  transition: transform .3s var(--ease);
}

.industry-option:hover {
  background: rgba(30, 27, 24, 0.04);
}

.industry-option:hover > i {
  color: var(--shu);
}

.industry-option:focus-within {
  outline: 2px solid var(--shu);
  outline-offset: -2px;
}

.industry-option.is-checked {
  background: var(--sumi);
  color: var(--washi);
}

.industry-option.is-checked::before {
  transform: none;
}

.industry-option.is-checked > i,
.industry-option.is-checked em {
  color: var(--washi);
}

.industry-option.is-empty {
  cursor: default;
  opacity: 0.4;
}

.industry-option.is-empty:hover {
  background: none;
}

.industry-option.is-empty:hover > i {
  color: var(--usuzumi);
}

/* toggle for industries that have no projects yet */
.industry-more {
  margin: 10px -10px 0;
  border-top: 1px dashed var(--line-strong);
}

.industry-more-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 10px 4px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-align: left;
  color: var(--sumi-soft);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color .3s;
}

.industry-more-btn span span {
  color: var(--usuzumi);
}

.industry-more-btn i {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--shu);
  transition: transform .3s var(--ease);
}

.industry-more-btn[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.industry-more-btn:hover {
  color: var(--shu);
}

.industry-unused {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.industry-option.is-unused .industry-name {
  color: var(--usuzumi);
}

.industry-clear {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--sumi-soft);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  padding: 2px 0;
  cursor: pointer;
  transition: color .3s, border-color .3s;
}

.industry-clear:hover {
  color: var(--shu);
  border-color: var(--shu);
}

.industry-clear[hidden] {
  display: none;
}

/* industry line on each card */
.work-card .work-industry {
  margin-bottom: 4px;
  font-family: var(--f-mincho);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--shu);
  -webkit-line-clamp: 1;
}

.work-card .work-industry span {
  margin: 0 6px;
  color: var(--line-strong);
}

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

@media (max-width: 1699px) {
  #work-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

/* below 1080px two columns no longer fit beside the sidebar: it becomes a slide-in panel */
@media (max-width: 1079px) {
  .works-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .industry-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    width: min(340px, 88vw);
    border: 0;
    border-right: 1px solid var(--line);
    box-shadow: 24px 0 48px -28px rgba(30, 27, 24, 0.55);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform .45s var(--ease), visibility 0s .45s;
  }

  .industry-panel.is-open {
    transform: none;
    visibility: visible;
    transition: transform .45s var(--ease), visibility 0s;
  }

  .industry-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sumi);
  }

  .industry-body {
    height: 100%;
    max-height: none;
    padding: 26px 22px 28px;
  }

  .industry-close {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: -6px -6px 0 0;
    font-size: 16px;
    color: var(--sumi);
    background: none;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: color .3s, border-color .3s;
  }

  .industry-close:hover {
    color: var(--shu);
    border-color: var(--shu);
  }

  .industry-backdrop {
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(30, 27, 24, 0.42);
    animation: industry-backdrop-in .3s var(--ease);
  }

  @keyframes industry-backdrop-in {
    from {
      opacity: 0;
    }
  }

  html.drawer-open {
    overflow: hidden;
  }

  .industry-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font: inherit;
    font-family: var(--f-mincho);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.1em;
    color: var(--washi);
    background: var(--sumi);
    border: 1px solid var(--sumi);
    cursor: pointer;
    transition: background-color .3s, border-color .3s;
  }

  .industry-toggle:hover {
    background: var(--shu);
    border-color: var(--shu);
  }

  .industry-toggle em {
    font-style: normal;
    font-family: var(--f-gothic);
    font-size: 12px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    display: inline-grid;
    place-items: center;
    background: var(--shu);
    color: var(--washi);
  }

  .industry-toggle:hover em {
    background: var(--washi);
    color: var(--shu);
  }

  .industry-toggle em:empty {
    display: none;
  }
}

@media (max-width: 699px) {
  #work-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .finder-suggest {
    flex-direction: column;
    gap: 8px;
  }

  /* categories scroll sideways instead of wrapping into many rows */
  .finder-cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: calc(-1 * clamp(22px, 3vw, 32px));
    margin-right: calc(-1 * clamp(22px, 3vw, 32px));
    padding-left: clamp(22px, 3vw, 32px);
    padding-right: clamp(22px, 3vw, 32px);
    scrollbar-width: none;
  }

  .finder-cats::-webkit-scrollbar {
    display: none;
  }

  .cat-chip {
    flex-shrink: 0;
    font-size: 14px;
    padding: 8px 14px;
  }

  .finder-status {
    flex-wrap: wrap;
  }
}
