/* 名札掛け（トップ画面）。上に「いまいる人」の写真、下に全員の札 */

/* ---------------------------------------------------------------- いま何人 */

.now {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4) 0 var(--space-section);
}

@media (min-width: 768px) {
  .now {
    grid-template-columns: minmax(12rem, auto) 1fr;
    align-items: start;
    gap: var(--space-4);
  }
}

.now__head {
  display: grid;
  gap: var(--space-1);
  align-content: start;
}

.now__count {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 700;
  line-height: 1;
}

.now__label {
  font-size: var(--text-sm);
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  writing-mode: vertical-rl;
  align-self: center;
}

.now__number {
  font-family: var(--font-plaque);
  font-size: var(--text-count);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

.now__unit {
  font-size: var(--text-lg);
}

.now[data-empty] .now__number {
  color: var(--ink-faint);
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.live::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--shu);
  animation: pulse 2.4s ease-in-out infinite;
}

.live[data-state='stale']::before {
  background: var(--ink-faint);
  animation: none;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.now__empty {
  margin: 0;
  padding: var(--space-3);
  border: 1.5px dashed var(--line-field);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  align-self: center;
}

.now__empty[hidden] {
  display: none;
}

/* ---- 壁に貼った顔写真。スマホでは横に流し、広い画面では折り返す ---- */

.faces {
  display: flex;
  gap: var(--space-3);
  margin: 0 calc(-1 * var(--gutter));
  padding: var(--space-3) var(--gutter) var(--space-2);
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.faces:empty {
  display: none;
}

@media (min-width: 768px) {
  .faces {
    flex-wrap: wrap;
    margin: 0;
    padding: var(--space-2) 0 0;
    overflow: visible;
  }
}

.faces li {
  flex: none;
  scroll-snap-align: start;
}

.faces li:nth-child(3n + 1) {
  --tilt: -2deg;
}

.faces li:nth-child(3n + 2) {
  --tilt: 1.5deg;
}

.faces li:nth-child(3n) {
  --tilt: -0.6deg;
}

.face {
  display: grid;
  justify-items: center;
  width: 7.25rem;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  transition: transform var(--duration-fast) var(--ease-out-expo);
}

.face:hover {
  transform: rotate(0deg) translateY(-3px);
}

.face:active {
  transform: rotate(0deg) scale(0.97);
}

.face__name {
  margin-top: 0.55rem;
  font-family: var(--font-plaque);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.2;
}

.face__meta {
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.face__since {
  font-size: var(--text-xs);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.face__since strong {
  color: var(--shu);
}

/* ---- 写真の台紙（portrait.js）。シートでも使う ---- */

.portrait {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.4rem;
  background: var(--mat);
  border-radius: 2px;
  box-shadow: var(--shadow-photo);
}

/* マスキングテープ */
.portrait::before {
  content: '';
  position: absolute;
  top: -0.55rem;
  left: 50%;
  width: 46%;
  height: 1.1rem;
  background: var(--tape);
  transform: translateX(-50%) rotate(-3deg);
}

.portrait__img,
.portrait__blank {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
}

.portrait__img {
  object-fit: cover;
  background: var(--mat-blank);
}

.portrait__blank {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, oklch(100% 0 0 / 0.12) 7px 8px),
    var(--mat-blank);
  color: var(--mat-blank-ink);
  font-family: var(--font-plaque);
  font-weight: 800;
  font-size: 2.6rem;
}

/* ---------------------------------------------------------------- 名札掛け */

.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
}

.board-head h2 {
  margin: 0;
  font-family: var(--font-plaque);
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: 0.1em;
}

.board-head p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* ---- 札の見分け方 ---- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: var(--space-2) 0 var(--space-3);
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.plaque__face.legend__chip {
  --pw: 0.8rem;
  --ph: 1.15rem;
  padding: 0;
  filter: none;
  border-radius: 2px;
}

.legend__in {
  width: 0.8rem;
  height: 1.15rem;
  border-radius: 2px;
  border-top: 0.3rem solid var(--shu);
  background: var(--plaque-face);
  box-shadow: inset 0 0 0 1px oklch(0% 0 0 / 0.12);
}

/* ---- 板と棚 ---- */

.board {
  padding: 0 var(--space-2);
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 37px,
      var(--wood-grain) 37px 39px,
      transparent 39px 83px,
      var(--wood-grain) 83px 84px
    ),
    var(--wood);
  box-shadow: inset 0 2px 0 oklch(100% 0 0 / 0.12), var(--shadow-card);
}

/* 代ごとの棚。下の縁が棚板 */
.shelf {
  margin: 0 calc(-1 * var(--space-2));
  padding: var(--space-3) var(--space-2) var(--space-2);
  border-bottom: 6px solid var(--wood-edge);
}

.shelf:last-child {
  border-radius: 0 0 6px 6px;
}

/* 真鍮の銘板 */
.shelf__label {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0 0 var(--space-3);
  padding: 0.05rem 0.7rem 0.1rem;
  border-radius: 2px;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--brass-ink);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass-lo));
  box-shadow: 0 1px 0 oklch(0% 0 0 / 0.35), inset 0 1px 0 oklch(100% 0 0 / 0.45);
}

.shelf__label b {
  font-family: var(--font-plaque);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.shelf__label[data-ob] {
  filter: saturate(0.55) brightness(0.88);
}

/* 棚の中の在室人数 */
.shelf__count {
  margin-left: 0.35rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--shu);
  color: oklch(99% 0 0);
  letter-spacing: 0.04em;
  filter: none;
}

.shelf__plaques {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--plaque-w));
  justify-content: center;
  gap: var(--space-3) 0.55rem;
}

.plaque {
  position: relative;
  perspective: 600px;
}

/* 札を掛ける釘 */
.plaque::before {
  content: '';
  position: absolute;
  top: -0.7rem;
  left: 50%;
  width: 0.4rem;
  height: 0.4rem;
  margin-left: -0.2rem;
  border-radius: 50%;
  background: oklch(78% 0.02 80);
  box-shadow: 0 1px 1px oklch(0% 0 0 / 0.4);
}

/* 凡例の見本は「いる時」の面を見せる（くすんだ面だと金と銅の区別がつきにくい） */
.plaque__face.legend__chip {
  background: var(--face);
}
