/* ============================================================
   SAKURA ONLINE MUSEUM — shared styles (v2)
   Ported from labs/renewal/sakura-online-museum/proto-f.
   Used by the TOP page (EmbedSocial feed) and the ARCHIVE page.
   ============================================================ */
:root{
  --bg: #F8F4EF;
  --ink: #1B1B1B;
  --nav-w: 210px;
  --nav-gap: 24px;
  --gold: #C9A24B;
  --jmul: 1; /* jitter multiplier (reduced on SP) */
}
*,*::before,*::after{ box-sizing: border-box; margin: 0; padding: 0; }
html{ scroll-behavior: smooth; }
body{
  font-family: "Lato", sans-serif;
  font-weight: 400;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img{ max-width: 100%; display: block; }
/* hidden 属性を常に効かせる（.modal-artist の display:flex 等に負けないように） */
[hidden]{ display: none !important; }

button{ font-family: inherit; border: none; background: transparent; cursor: pointer; color: inherit; }
ul{ list-style: none; }
a{ color: inherit; text-decoration: none; transition: opacity .3s; }
a:hover{ opacity: .7; }
body.modal-open{ overflow: hidden; }

/* ------------------------------------------------------------
   Left fixed navigation (same dark rounded panel as current)
   ------------------------------------------------------------ */
.nav{
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--nav-gap);
  left: var(--nav-gap);
  width: var(--nav-w);
  height: calc(100% - var(--nav-gap) * 2);
  background: var(--ink);
  padding: 24px;
  border-radius: 12px;
  color: #fff;
  z-index: 1000;
}
.nav-logo img{ width: 100%; height: auto; }
.nav-scroll{
  flex: 1;
  margin: 26px 0 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}
.nav-cont + .nav-cont{ margin-top: 26px; }
.nav-heading{
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
}
.nav-list{ margin-top: .8em; }
.nav-list li{ margin-top: 2px; }
.nav-filter{
  display: block;
  width: 100%;
  text-align: left;
  font-size: 12px;
  line-height: 1.4;
  padding: 5px 8px 5px 14px;
  border-radius: 6px;
  position: relative;
  color: rgba(255,255,255,.82);
  transition: color .25s, background-color .25s;
}
.nav-filter::before{
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  transform: translateY(-50%) scale(0);
  transition: transform .25s;
}
.nav-filter:hover{ color: #fff; background: rgba(255,255,255,.08); }
.nav-filter.is-active{
  color: #fff;
  background: rgba(255,255,255,.12);
  font-weight: 700;
}
.nav-filter.is-active::before{ transform: translateY(-50%) scale(1); }
.nav-reset{
  display: inline-block;
  margin-top: 22px;
  font-size: 10px;
  letter-spacing: .08em;
  color: #fff;
  border: 1px solid #fff;
  border-radius: 20px;
  padding: 2px 18px 3px 28px;
  position: relative;
  transition: background-color .25s, color .25s;
}
.nav-reset::before{
  content: '';
  position: absolute;
  top: 50%;
  left: 13px;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  background: url(https://craypas-global.g.kuroco-img.app/files/user/sakura-online-museum/images/icon_close.svg) center center / contain no-repeat;
}
.nav-reset:hover{ background: rgba(255,255,255,.15); }
.nav-count{
  font-size: 11px;
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 8px 0 10px;
  border-top: 1px solid rgba(255,255,255,.15);
}
.nav-count b{ color: #fff; font-weight: 700; }
.nav-link{
  color: var(--ink);
  background: #fff;
  border-radius: 20px;
  display: block;
  width: 100%;
  padding: 4px;
  text-align: center;
}
.nav-link + .nav-link{ margin-top: 8px; }
.nav-link span{
  position: relative;
  font-size: 12px;
  font-weight: 700;
}
.nav-link span::after{
  content: '';
  position: absolute;
  top: 50%;
  right: -20px;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  background: url(https://craypas-global.g.kuroco-img.app/files/user/sakura-online-museum/images/icon_e-link.svg) center center no-repeat;
}
.nav-copyright{
  margin-top: 12px;
  text-align: center;
  line-height: 1.2;
}
.nav-copyright small{ font-size: 10px; color: rgba(255,255,255,.75); }
.nav-spMenu{ display: none; }

/* ------------------------------------------------------------
   Main / jittered grid
   ------------------------------------------------------------ */
.main{
  margin-left: calc(var(--nav-w) + var(--nav-gap) * 2);
  padding: 56px 48px 0;
}
.grid,
.grid-loading{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 52px 48px;
}
@media (min-width: 1720px){
  .grid,
  .grid-loading{ grid-template-columns: repeat(6, 1fr); }
}
@media (max-width: 1280px){
  .grid,
  .grid-loading{ grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px){
  .grid,
  .grid-loading{ grid-template-columns: repeat(3, 1fr); }
}

/* cell = fade-in / filter visibility layer */
.cell{
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s ease, transform .5s ease;
}
.cell.in-view{
  opacity: 1;
  transform: none;
}
.cell.is-fading{
  opacity: 0;
  transform: scale(.94);
  transition-duration: .22s;
}
.cell.is-hidden{ display: none; }

/* card = jitter layer (positioning + transform only); the white
   polaroid lives on .card-main so stacked sheets can sit behind it */
.card{
  position: relative;
  cursor: pointer;
  transform:
    translate(calc(var(--jx) * var(--jmul)), calc(var(--jy) * var(--jmul)))
    rotate(var(--jr))
    scale(var(--js));
  transition: transform .3s ease;
}
.card:hover{
  transform:
    translate(calc(var(--jx) * var(--jmul)), calc(var(--jy) * var(--jmul) - 6px))
    rotate(var(--jr))
    scale(calc(var(--js) * 1.035));
  z-index: 5;
}
.cell:has(.card:hover){ z-index: 5; position: relative; }

/* the visible polaroid */
.card-main{
  position: relative;
  z-index: 1;
  display: block;
  background: #fff;
  padding: 10px 10px 12px;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(27,27,27,.07), 0 10px 24px rgba(27,27,27,.08);
  transition: box-shadow .3s ease;
}
.card:hover .card-main{
  box-shadow: 0 6px 14px rgba(27,27,27,.10), 0 22px 40px rgba(27,27,27,.14);
}
.card.is-award .card-main{
  box-shadow: 0 0 0 1px var(--gold), 0 2px 6px rgba(27,27,27,.07), 0 10px 24px rgba(27,27,27,.10);
}
.card.is-award:hover .card-main{
  box-shadow: 0 0 0 1px var(--gold), 0 6px 14px rgba(27,27,27,.10), 0 22px 40px rgba(27,27,27,.14);
}

/* stacked sheets peeking out behind multi-image posts */
.card-sheet{
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(27,27,27,.08), 0 8px 18px rgba(27,27,27,.06);
  transform-origin: center;
  transition: transform .3s ease;
}
.card-sheet.s1{ transform: rotate(2.6deg) translate(3px, 2px); }
.card-sheet.s2{ transform: rotate(-3.2deg) translate(-4px, 3px); }
.card:hover .card-sheet.s1{ transform: rotate(3.6deg) translate(5px, 3px); }
.card:hover .card-sheet.s2{ transform: rotate(-4.2deg) translate(-6px, 4px); }
.card-frame{
  aspect-ratio: 4 / 5;
  background: #fcfaf7;
  overflow: hidden;
  display: flex;
}
.card-frame img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.card-badge{
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .12em;
  padding: 1px 7px 2px;
  border-radius: 10px;
  z-index: 2;
  pointer-events: none;
}
.card-badge.carousel{
  color: rgba(27,27,27,.55);
  background: rgba(248,244,239,.9);
  border: 1px solid rgba(27,27,27,.15);
}
.card-badge.award{
  color: var(--ink);
  background: var(--gold);
}
.card-badge.new{
  left: auto;
  right: 4px;
  color: var(--ink);
  background: #E0526B;
}
.card-caption{
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  padding: 8px 9px 7px;
  background: rgba(255,255,255,.92);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
  line-height: 1.35;
}
.card:hover .card-caption{ opacity: 1; transform: none; }
.card-caption strong{
  display: block;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-caption span{
  display: block;
  font-size: 10px;
  color: rgba(27,27,27,.6);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* empty result */
.grid-empty{
  display: none;
  padding: 120px 24px;
  text-align: center;
  color: rgba(27,27,27,.7);
  font-size: 14px;
  letter-spacing: .05em;
}
.grid-empty.is-shown{ display: block; }

/* ------------------------------------------------------------
   Loading skeleton / error message
   ------------------------------------------------------------ */
.grid-loading.is-hidden{ display: none; }
.grid-loading .sk-cell{
  background: #fff;
  padding: 10px 10px 12px;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(27,27,27,.07), 0 10px 24px rgba(27,27,27,.08);
}
.grid-loading .sk-frame{
  aspect-ratio: 4 / 5;
  background: linear-gradient(100deg, #f0ebe3 40%, #faf7f1 50%, #f0ebe3 60%);
  background-size: 200% 100%;
  animation: som-shimmer 1.4s linear infinite;
}
@keyframes som-shimmer{
  from{ background-position: 130% 0; }
  to{ background-position: -70% 0; }
}
.grid-error{
  display: none;
  padding: 120px 24px;
  text-align: center;
  color: rgba(27,27,27,.7);
  font-size: 14px;
  letter-spacing: .05em;
  line-height: 2;
}
.grid-error.is-shown{ display: block; }

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.footer{
  padding: 96px 0 40px;
  text-align: center;
}
.footer-link{
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  border: 1px solid var(--ink);
  border-radius: 20px;
  padding: 5px 28px;
}
.footer small{
  display: block;
  margin-top: 20px;
  font-size: 10px;
  color: rgba(27,27,27,.6);
}

/* ------------------------------------------------------------
   Detail modal
   ------------------------------------------------------------ */
.modal{
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 72px;
}
.modal.is-open{ display: flex; }
.modal-overlay{
  position: absolute;
  inset: 0;
  background: rgba(27,27,27,.55);
  opacity: 0;
  transition: opacity .3s;
}
.modal.is-visible .modal-overlay{ opacity: 1; }
.modal-container{
  position: relative;
  display: flex;
  width: 100%;
  max-width: 1060px;
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(.985);
  transition: opacity .3s ease, transform .3s ease;
}
.modal.is-visible .modal-container{ opacity: 1; transform: none; }
.modal-stage{
  flex: 1.35;
  min-width: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  position: relative;
}
.modal-stage img,
.modal-stage video{
  max-width: 100%;
  max-height: calc(100vh - 64px - 72px);
  object-fit: contain;
  box-shadow: 0 8px 32px rgba(27,27,27,.16);
  background: #fff;
  padding: 8px;
}
/* carousel controls inside the stage */
.stage-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  box-shadow: 0 2px 8px rgba(27,27,27,.18);
  font-size: 14px;
  font-weight: 700;
  z-index: 2;
  transition: background-color .25s;
}
.stage-nav:hover{ background: #fff; }
.stage-nav.prev{ left: 12px; }
.stage-nav.next{ right: 12px; }
.stage-count{
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: .1em;
  color: rgba(27,27,27,.6);
  background: rgba(255,255,255,.85);
  border-radius: 10px;
  padding: 1px 10px 2px;
}
.modal-stage.no-carousel .stage-nav,
.modal-stage.no-carousel .stage-count{ display: none; }
.modal-info{
  flex: 1;
  min-width: 320px;
  max-width: 380px;
  padding: 44px 36px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-flag{
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
  margin-bottom: 14px;
}
.modal-flag .flag{
  display: inline-block;
  padding: 2px 10px 3px;
  border-radius: 10px;
  margin-right: 6px;
}
.modal-flag .flag.award{ background: var(--gold); color: var(--ink); }
.modal-flag .flag.carousel{ border: 1px solid rgba(27,27,27,.25); color: rgba(27,27,27,.6); }
.modal-flag .flag.new{ background: #E0526B; color: var(--ink); }
.modal-title{
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
}
.modal-artist{
  margin-top: 6px;
  font-size: 13px;
  color: rgba(27,27,27,.65);
  display: flex;
  align-items: center;
  gap: 8px;
}
.artist-avatar{
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(27,27,27,.12);
}
.modal-meta{
  margin-top: 22px;
  border-top: 1px solid rgba(27,27,27,.12);
  padding-top: 18px;
  font-size: 12px;
}
.modal-meta > div{
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
}
.modal-meta dt{
  flex-shrink: 0;
  width: 92px;
  font-weight: 700;
}
.modal-meta dt::after{ content: '/'; float: right; color: rgba(27,27,27,.3); }
.modal-meta dd{ color: rgba(27,27,27,.8); }
.modal-comment{
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.8;
  color: rgba(27,27,27,.78);
  white-space: pre-line;
}
.modal-ig{
  display: inline-block;
  margin-top: 16px;
  margin-right: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  border: 1px solid rgba(27,27,27,.25);
  border-radius: 20px;
  padding: 4px 18px;
}
.modal-actions{
  margin-top: auto;
  padding-top: 26px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.modal-pager{ display: flex; gap: 8px; }
.modal-pager button{
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 7px 14px;
  border: 1px solid rgba(27,27,27,.18);
  border-radius: 24px;
  transition: background-color .25s, color .25s;
}
.modal-pager button:hover{ background: var(--ink); color: #fff; }
.modal-close{
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  z-index: 3;
  transition: background-color .25s;
}
.modal-close:hover{ background: #eee; }
.modal-close::before,
.modal-close::after{
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.5px;
  height: 17px;
  background: var(--ink);
}
.modal-close::before{ transform: translate(-50%,-50%) rotate(45deg); }
.modal-close::after{ transform: translate(-50%,-50%) rotate(-45deg); }

/* ------------------------------------------------------------
   SP
   ------------------------------------------------------------ */
@media (max-width: 768px){
  :root{ --jmul: .6; }
  .nav{
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    height: auto;
    max-height: calc(100dvh - 24px);
    padding: 14px 16px;
    flex-direction: column;
  }
  .nav-logo{ max-width: 150px; }
  .nav-spMenu{
    display: block;
    position: absolute;
    top: 14px;
    right: 16px;
    width: 30px;
    height: 30px;
  }
  .nav-spMenu i{
    display: block;
    position: absolute;
    left: 3px;
    width: 24px;
    height: 2px;
    background: #fff;
    transition: all .3s;
  }
  .nav-spMenu i:nth-of-type(1){ top: 7px; }
  .nav-spMenu i:nth-of-type(2){ top: 14px; }
  .nav-spMenu i:nth-of-type(3){ top: 21px; }
  .nav.is-open .nav-spMenu i:nth-of-type(1){ transform: translateY(7px) rotate(45deg); }
  .nav.is-open .nav-spMenu i:nth-of-type(2){ opacity: 0; }
  .nav.is-open .nav-spMenu i:nth-of-type(3){ transform: translateY(-7px) rotate(-45deg); }
  .nav-scroll{ display: none; margin: 20px 0 10px; }
  .nav-link, .nav-copyright{ display: none; }
  .nav-count{ display: none; }
  .nav.is-open .nav-scroll{ display: block; }
  .nav.is-open .nav-count{ display: block; }
  .nav.is-open .nav-link{ display: block; }
  .nav.is-open .nav-copyright{ display: block; }

  .main{
    margin-left: 0;
    padding: 92px 20px 0;
  }
  .grid,
  .grid-loading{
    grid-template-columns: repeat(2, 1fr);
    gap: 30px 26px;
  }
  .card-caption{ display: none; }

  .modal{ padding: 0; }
  .modal-container{
    flex-direction: column;
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    overflow-y: auto;
  }
  .modal-stage{
    flex: none;
    padding: 56px 20px 20px;
  }
  .modal-stage img{ max-height: 52dvh; }
  .modal-info{
    flex: none;
    max-width: none;
    min-width: 0;
    padding: 24px 24px 40px;
    overflow: visible;
  }
  .modal-actions{ padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce){
  *{ transition-duration: .01ms !important; animation-duration: .01ms !important; }
  html{ scroll-behavior: auto; }
}
