/* Work scanner (js/neo-scan.js, 2026-11-14): the SCAN button on each work, the line of light that reads the work, and
   the panel with the colours and the intent. Colours are written out: the panel keeps the guide's dark console look. */
.work-card[data-work-id] { position: relative; }
.work-card .work-thumb img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

.neo-scan-trigger {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(120, 247, 232, .6);
  background: rgba(2, 6, 9, .78);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #78f7e8;
  font: 600 .75rem/1 'Chakra Petch', sans-serif;
  letter-spacing: .18em;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  transition: background-color .2s ease, color .2s ease, opacity .2s ease;
}
/* A larger touch area than the label shows. */
.neo-scan-trigger::after { content: ""; position: absolute; inset: -6px; }
.neo-scan-trigger:hover { background: #78f7e8; color: #03211e; }
.neo-scan-trigger:focus-visible { outline: 2px solid #ffe27a; outline-offset: 2px; }
@media (hover: hover) {
  .work-card .neo-scan-trigger { opacity: .82; }
  .work-card:hover .neo-scan-trigger, .work-card .neo-scan-trigger:focus-visible { opacity: 1; }
}

/* ---- The scan across the work ---- */
.neo-scan-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(rgba(120, 247, 232, .09) 1px, transparent 1px) 0 0 / 100% 18px,
    linear-gradient(90deg, rgba(120, 247, 232, .09) 1px, transparent 1px) 0 0 / 18px 100%,
    rgba(2, 8, 12, .35);
  box-shadow: inset 0 0 0 1px rgba(120, 247, 232, .7);
  transition: opacity .2s ease;
}
.is-scanning > .neo-scan-layer { opacity: 1; }
.neo-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 32%;
  background: linear-gradient(180deg, transparent, rgba(120, 247, 232, .28) 85%, rgba(200, 255, 250, .95) 99%, transparent);
  box-shadow: 0 6px 16px -6px rgba(120, 247, 232, .9);
  transform: translateY(-100%);
}
.is-scanning .neo-scan-line { animation: neo-scan-sweep 1.5s cubic-bezier(.45, 0, .25, 1) both; }
@keyframes neo-scan-sweep { from { top: 0; transform: translateY(-100%); } to { top: 100%; transform: translateY(-100%); } }
.neo-scan-readout {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-left: 2px solid #78f7e8;
  background: rgba(2, 6, 9, .85);
  color: #78f7e8;
  font: 600 .75rem/1 'Chakra Petch', sans-serif;
  letter-spacing: .16em;
}

/* ---- The result ---- */
.neo-scan-panel {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 120px));
  overflow: hidden;
  border: 1px solid rgba(120, 247, 232, .45);
  background:
    linear-gradient(rgba(120, 247, 232, .035) 1px, transparent 1px) 0 0 / 100% 24px,
    radial-gradient(ellipse 90% 50% at 100% 0, rgba(120, 247, 232, .1), transparent 70%),
    #03080b;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .65), 0 0 32px rgba(120, 247, 232, .12);
  color: #f4fbfa;
  font-family: 'Noto Sans JP', sans-serif;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}
.neo-scan-panel[hidden] { display: none; }
.neo-scan-panel::before { content: ""; position: absolute; top: 0; left: 0; right: 18px; height: 2px; background: linear-gradient(90deg, #78f7e8, #ffe27a 70%, transparent); }
html[data-motion="on"] .neo-scan-panel:not([hidden]) { animation: neo-scan-rise .3s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes neo-scan-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.neo-scan-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 12px 14px; border-bottom: 1px solid rgba(120, 247, 232, .2); }
.neo-scan-thumb { flex: none; width: 56px; height: 56px; object-fit: cover; border: 1px solid rgba(120, 247, 232, .5); }
.neo-scan-head p { display: flex; flex-direction: column; flex: 1; gap: 4px; min-width: 0; margin: 0; }
.neo-scan-kicker { color: #78f7e8; font: 600 .6875rem/1.2 'Chakra Petch', sans-serif; letter-spacing: .22em; }
.neo-scan-head strong { color: #fff; font-size: 1rem; line-height: 1.45; }
.neo-scan-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 226, 122, .45);
  background: rgba(255, 226, 122, .04);
  color: #fff;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}
.neo-scan-close:hover { border-color: #ffe27a; background: rgba(255, 226, 122, .12); }

.neo-scan-scroll { padding: 14px 16px 4px; overflow-y: auto; overscroll-behavior: contain; }
.neo-scan-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; color: #fff; font-size: .9375rem; font-weight: 700; }
.neo-scan-label span { color: #ffe27a; font: 600 .6875rem/1 'Chakra Petch', sans-serif; letter-spacing: .2em; }
.neo-scan-label small { flex-basis: 100%; color: rgba(232, 240, 239, .6); font-size: .75rem; font-weight: 400; }
.neo-scan-colors { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.neo-scan-colors button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0 0 6px;
  border: 1px solid rgba(120, 247, 232, .22);
  background: rgba(2, 6, 9, .8);
  color: #f4fbfa;
  cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.neo-scan-colors button:hover { border-color: #78f7e8; }
.neo-scan-colors button:active { transform: scale(.97); }
.neo-scan-colors button:focus-visible { outline: 2px solid #ffe27a; outline-offset: 2px; }
.neo-scan-colors i { display: block; height: 48px; background: var(--swatch); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .12); }
.neo-scan-colors b { font: 600 .6875rem/1.2 'Chakra Petch', monospace; letter-spacing: .02em; }
.neo-scan-colors span { color: rgba(232, 240, 239, .65); font: 600 .6875rem/1 'Chakra Petch', sans-serif; }
.neo-scan-colors .is-copied { border-color: #ffe27a; }
.neo-scan-colors .is-copied span { color: #ffe27a; }
html[data-motion="on"] .neo-scan-panel:not([hidden]) .neo-scan-colors li { animation: neo-scan-chip .4s cubic-bezier(.2, .7, .2, 1) both; }
html[data-motion="on"] .neo-scan-colors li:nth-child(2) { animation-delay: .06s; }
html[data-motion="on"] .neo-scan-colors li:nth-child(3) { animation-delay: .12s; }
html[data-motion="on"] .neo-scan-colors li:nth-child(4) { animation-delay: .18s; }
html[data-motion="on"] .neo-scan-colors li:nth-child(5) { animation-delay: .24s; }
@keyframes neo-scan-chip { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.neo-scan-bar { height: 6px; margin: 10px 0 0; box-shadow: 0 0 14px rgba(120, 247, 232, .2); }

.neo-scan-notes { display: grid; gap: 12px; margin: 16px 0 12px; }
.neo-scan-notes div { padding-left: 12px; border-left: 2px solid rgba(120, 247, 232, .45); }
.neo-scan-notes dt { display: flex; align-items: baseline; gap: 8px; color: #fff; font-size: .8125rem; font-weight: 700; }
.neo-scan-notes dt span { color: #78f7e8; font: 600 .625rem/1 'Chakra Petch', sans-serif; letter-spacing: .2em; }
.neo-scan-notes dd { margin: 4px 0 0; color: rgba(244, 251, 250, .9); font-size: .9375rem; line-height: 1.7; }

.neo-scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid rgba(120, 247, 232, .18); }
.neo-scan-actions button, .neo-scan-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 10px;
  border: 1px solid rgba(120, 247, 232, .45);
  background: transparent;
  color: #f4fbfa;
  font: 700 .875rem/1.2 'Noto Sans JP', sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.neo-scan-actions button:hover { background: rgba(120, 247, 232, .12); }
.neo-scan-actions a { border-color: #78f7e8; background: #78f7e8; color: #03211e; }
.neo-scan-actions a:hover { background: #a6fff4; }
.neo-scan-actions :focus-visible { outline: 2px solid #ffe27a; outline-offset: 2px; }

/* While the panel is open, the corner guide and the floating sound button step aside. */
html.neo-scan-open .neo-guide, html.neo-scan-open .sound-toggle--float { display: none !important; }

@media (max-width: 760px) {
  .neo-scan-panel { right: 0; bottom: 0; width: 100%; max-height: 82dvh; padding-bottom: env(safe-area-inset-bottom, 0px); border-width: 1px 0 0; clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%); }
  .neo-scan-colors i { height: 40px; }
  .neo-scan-colors b { font-size: .625rem; }
}
@media (prefers-reduced-motion: reduce) {
  .neo-scan-panel, .neo-scan-colors li, .neo-scan-line { animation: none !important; }
}
