/* ==========================================================================
   TAIRYOKU (体力) — Contemporary Artist Archive / Kinetic Contact Wall
   Single-Color Ink System (Violet / Ultramarine / Cobalt) + Raw HTML UI
   ========================================================================== */

:root {
  /* Default Ink: Electric Ultramarine Violet */
  --ink: #3519e8;
  --ink-rgb: 53, 25, 232;
  --ink-soft: rgba(53, 25, 232, 0.12);
  --ink-mid: rgba(53, 25, 232, 0.38);
  --bg: #faf9ff;
  --bg-rgb: 250, 249, 255;
  --font-raw: "Times New Roman", Times, "Hiragino Mincho ProN", "YuMincho", serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Courier New", monospace;
  --font-sans: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --tile-min: 265px;
  --grid-gap: 1px;
}

html[data-ink="ultramarine"] {
  --ink: #1424f5;
  --ink-rgb: 20, 36, 245;
  --ink-soft: rgba(20, 36, 245, 0.12);
  --ink-mid: rgba(20, 36, 245, 0.38);
  --bg: #f8faff;
  --bg-rgb: 248, 250, 255;
}

html[data-ink="purple"] {
  --ink: #5a12d9;
  --ink-rgb: 90, 18, 217;
  --ink-soft: rgba(90, 18, 217, 0.12);
  --ink-mid: rgba(90, 18, 217, 0.38);
  --bg: #fcf9ff;
  --bg-rgb: 252, 249, 255;
}

html[data-ink="night"] {
  --ink: #b6a8ff;
  --ink-rgb: 182, 168, 255;
  --ink-soft: rgba(182, 168, 255, 0.14);
  --ink-mid: rgba(182, 168, 255, 0.42);
  --bg: #0c0721;
  --bg-rgb: 12, 7, 33;
}

html[data-size="s"] { --wall-cols: 6; }
html[data-size="m"] { --wall-cols: 4; }
html[data-size="l"] { --wall-cols: 3; }

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

/* Raw HTML Link & Button Reset */
a, .raw-btn {
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0 2px;
  margin: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  cursor: pointer;
  display: inline;
}

a:hover,
.raw-btn:hover,
a[aria-current="page"],
a[aria-pressed="true"],
.raw-btn[aria-pressed="true"],
.raw-btn.is-active {
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}

a:focus-visible,
.raw-btn:focus-visible {
  outline: 1px dashed var(--ink);
  outline-offset: 2px;
}

/* Hidden inline SVG filter container */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ==========================================================================
   TOP RAW HTML HEADER & DIRECTORY BAR
   ========================================================================== */
.raw-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(var(--bg-rgb), 0.94);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--ink);
}

.raw-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 18px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--ink);
}

.brand-cluster {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-link {
  font-family: var(--font-raw);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.brand-link:hover {
  background: var(--ink);
  color: var(--bg);
}

.brand-logo-mini {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: url(#tairyoku-duotone);
  transition: transform 0.35s ease;
  vertical-align: middle;
}

.brand-link:hover .brand-logo-mini {
  transform: rotate(18deg) scale(1.15);
}

.raw-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.85;
}

.raw-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-family: var(--font-raw);
  font-size: 14px;
}

.raw-sep {
  opacity: 0.45;
  user-select: none;
  font-family: var(--font-mono);
  font-size: 11px;
}

.raw-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg);
}

.ctrl-group {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.ctrl-label {
  opacity: 0.65;
}

/* ==========================================================================
   COLLAPSIBLE RAW HTML INDEX LIST (Top Directory)
   ========================================================================== */
.raw-directory {
  border-bottom: 1px solid var(--ink);
  background: var(--bg);
  padding: 8px 10px 10px;
  font-family: var(--font-raw);
  font-size: 13.5px;
  line-height: 1.5;
}

.raw-directory[hidden] {
  display: none;
}

.directory-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  align-items: baseline;
}

.dir-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.dir-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  opacity: 0.7;
  text-decoration: none;
}

.dir-cat {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.65;
}

.dir-item.is-highlighted a {
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}

/* ==========================================================================
   WALL OF IMAGES (Contact Sheet / Edge-to-Edge Tiled Grid)
   ========================================================================== */
.stage-wrap {
  position: relative;
  min-height: calc(100vh - 90px);
  width: 100%;
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(var(--wall-cols, 4), minmax(0, 1fr));
  gap: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  will-change: transform;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wall-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: transparent;
  overflow: visible;
  cursor: pointer;
  display: block;
  padding: 0;
  text-decoration: none;
  user-select: none;
  z-index: 1;
}

.wall-tile:hover,
.wall-tile:focus-visible,
.wall-tile.is-project-match {
  z-index: 45;
  background: transparent;
  color: var(--ink);
}

.wall-tile-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg);
  padding: 6px;
  overflow: hidden;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  transform: scale(1);
  transform-origin: center center;
  transition:
    transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.28s ease,
    border-color 0.2s ease,
    background-color 0.25s ease;
}

.wall-tile:hover .wall-tile-card,
.wall-tile:focus-visible .wall-tile-card,
.wall-tile.is-project-match .wall-tile-card {
  transform: scale(1.26);
  border: 1px solid var(--ink);
  box-shadow: 10px 10px 0 var(--ink);
  background: var(--bg);
}

.wall-tile-inner {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.wall-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Single-color purple/blue ink duotone by default */
  filter: url(#tairyoku-duotone) contrast(1.06);
  transition:
    filter 0.3s ease,
    opacity 0.25s ease;
}

.wall-tile[data-group="zine"] img,
.wall-tile[data-group="commission"] img {
  object-fit: contain;
  padding: 4px;
}

/* Reveal full original color on hover, afterglow wake, sibling resonance, or all-color mode */
.wall-tile:hover img,
.wall-tile:focus-visible img,
.wall-tile.is-awake img,
.wall-tile.is-project-match img,
html[data-color="color"] .wall-tile img {
  filter: none;
}

/* If user locks all-mono mode */
html[data-color="mono"] .wall-tile img,
html[data-color="mono"] .wall-tile:hover img,
html[data-color="mono"] .wall-tile.is-awake img,
html[data-color="mono"] .wall-tile.is-project-match img {
  filter: url(#tairyoku-duotone) contrast(1.08);
}

/* Dim non-matching tiles when hovering a project in the index list */
.wall-grid.has-project-focus .wall-tile:not(.is-project-match) {
  opacity: 0.25;
}

.wall-grid.has-project-focus .wall-tile.is-project-match .wall-tile-card {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

/* Tiny raw HTML frame numbers and hover label on each tile */
.tile-idx {
  position: absolute;
  top: 5px;
  left: 6px;
  z-index: 4;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.1;
  color: var(--ink);
  background: rgba(var(--bg-rgb), 0.88);
  padding: 2px 4px;
  pointer-events: none;
  border: 1px solid rgba(var(--ink-rgb), 0.25);
}

.wall-tile:hover .tile-idx {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.3;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.wall-tile:hover .tile-caption,
.wall-tile:focus-visible .tile-caption,
.wall-tile.is-project-match .tile-caption {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   MODE 2: KINETIC DRIFT CONVEYOR (view="drift")
   ========================================================================== */
.drift-stage {
  display: none;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
  padding: 28px 0;
}

html[data-view="drift"] .wall-grid { display: none; }
html[data-view="drift"] .drift-stage { display: flex; }

.drift-row {
  display: flex;
  width: max-content;
  background: var(--bg);
  border-top: 1px solid var(--ink);
  gap: 0;
  will-change: transform;
}

.drift-row .wall-tile {
  width: clamp(230px, 24vw, 340px);
  height: clamp(230px, 24vw, 340px);
  flex: 0 0 auto;
}

.drift-row .wall-tile:hover .wall-tile-card {
  transform: scale(1.16);
}

/* ==========================================================================
   MODE 3: ARTIST STUDIO SCATTER CANVAS (view="scatter")
   ========================================================================== */
.scatter-stage {
  display: none;
  position: relative;
  width: 100%;
  height: calc(100vh - 92px);
  min-height: 620px;
  overflow: hidden;
  background:
    radial-gradient(var(--ink-mid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  border-bottom: 1px solid var(--ink);
}

html[data-view="scatter"] .wall-grid { display: none; }
html[data-view="scatter"] .scatter-stage { display: block; }

.scatter-toolbar {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 40;
  background: rgba(var(--bg-rgb), 0.9);
  border: 1px solid var(--ink);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.scatter-card {
  position: absolute;
  width: clamp(170px, 19vw, 260px);
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 4px 4px 18px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  box-shadow: 3px 3px 0 var(--ink);
  transition: box-shadow 0.2s ease;
}

.scatter-card:active {
  cursor: grabbing;
  box-shadow: 7px 7px 0 var(--ink);
}

.scatter-card:hover {
  box-shadow: 9px 9px 0 var(--ink);
}

.scatter-card img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: url(#tairyoku-duotone) contrast(1.06);
  transition: filter 0.3s ease, transform 0.25s ease;
}

.scatter-card:hover img {
  transform: scale(1.04);
}

.scatter-card:hover img,
.scatter-card.is-awake img,
html[data-color="color"] .scatter-card img {
  filter: none;
}

.scatter-meta {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   MODE 4: RAW HTML TABLE VIEW (view="table")
   ========================================================================== */
.table-stage {
  display: none;
  padding: 14px 10px 60px;
}

html[data-view="table"] .wall-grid { display: none; }
html[data-view="table"] .table-stage { display: block; }

.raw-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--ink);
  font-family: var(--font-raw);
  font-size: 14px;
}

.raw-table th,
.raw-table td {
  border: 1px solid var(--ink);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.raw-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  background: var(--ink-soft);
}

.raw-table tbody tr {
  cursor: pointer;
}

.raw-table tbody tr:hover {
  background: var(--ink);
  color: var(--bg);
}

.raw-table tbody tr:hover a,
.raw-table tbody tr:hover .raw-btn {
  color: var(--bg);
}

.table-thumb-strip {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  vertical-align: middle;
}

.table-thumb-strip img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid currentColor;
  filter: url(#tairyoku-duotone);
}

.raw-table tbody tr:hover .table-thumb-strip img {
  filter: none;
}

/* ==========================================================================
   EDITORIAL RAW HTML SECTIONS (ABOUT / CREATORS / CONTACT)
   ========================================================================== */
.raw-section {
  border-bottom: 1px solid var(--ink);
  padding: 24px 12px 36px;
  position: relative;
  background: var(--bg);
}

.raw-section-inner {
  max-width: 960px;
}

.raw-h1 {
  font-family: var(--font-raw);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 400;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.raw-lead {
  font-family: var(--font-raw);
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.45;
  margin: 0 0 12px;
}

.raw-p {
  margin: 0 0 12px;
  max-width: 68ch;
  font-size: 13.5px;
  line-height: 1.65;
}

.raw-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px;
  margin-top: 18px;
}

.stamp-zone {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  transition: transform 0.16s cubic-bezier(0.2, 1.6, 0.4, 1), background-color 0.15s ease, box-shadow 0.15s ease;
}

.stamp-zone:hover {
  background: var(--ink-soft);
  border-style: solid;
  box-shadow: 3px 3px 0 var(--ink);
}

.stamp-zone:active,
.stamp-zone.is-popping {
  transform: scale(0.94);
}

.stamp-zone img {
  width: 52px;
  height: 52px;
  filter: url(#tairyoku-duotone);
  transition: transform 0.24s cubic-bezier(0.18, 1.8, 0.35, 1);
}

.stamp-zone:hover img {
  transform: scale(1.12) rotate(-4deg);
}

.stamp-zone.is-popping img {
  transform: scale(1.36) rotate(8deg);
}

.contact-split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(230px, 320px);
  gap: 28px;
  align-items: center;
  justify-content: space-between;
}

.contact-table {
  max-width: 560px;
}

.contact-video-frame {
  margin: 0;
  width: 100%;
  max-width: 320px;
  justify-self: end;
  border: 1px solid var(--ink);
  background: var(--bg);
  overflow: hidden;
  line-height: 0;
}

.contact-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: contrast(1.16) brightness(1.05) url(#tairyoku-duotone);
  transition: filter 0.28s ease;
}

html[data-color="color"] .contact-video,
html[data-color="hover"] .contact-video-frame:hover .contact-video {
  filter: none;
}

/* ==========================================================================
   PROJECT DETAIL OVERLAY / MODAL SHEET
   ========================================================================== */
.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(var(--bg-rgb), 0.97);
  overflow-y: auto;
  padding: 0;
}

.detail-sheet[hidden] {
  display: none;
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.detail-body {
  padding: 16px 12px 64px;
  display: grid;
  grid-template-columns: minmax(260px, 370px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.detail-meta-col {
  position: sticky;
  top: 46px;
}

.detail-title {
  font-family: var(--font-raw);
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 400;
  margin: 0 0 12px;
  line-height: 1.2;
}

.detail-desc {
  margin: 14px 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.detail-desc p {
  margin: 0 0 10px;
}

.detail-images-col {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.detail-figure {
  margin: 0;
  border: 1px solid var(--ink);
  background: var(--bg);
  padding: 8px;
}

.detail-figure img {
  width: 100%;
  height: auto;
  display: block;
  filter: none;
  transition: filter 0.3s ease;
}

.detail-figure.is-duotone img {
  filter: url(#tairyoku-duotone);
}

.detail-figure.is-duotone:hover img {
  filter: none;
}

.detail-figcap {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  display: flex;
  justify-content: space-between;
  opacity: 0.8;
}

/* ==========================================================================
   FLOATING KINETIC CURSOR TAG & BOTTOM STATUS TICKER
   ========================================================================== */
.cursor-tag {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  pointer-events: none;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -140%);
  transition: opacity 0.12s ease;
}

.cursor-tag.is-visible {
  opacity: 1;
}

.raw-footer {
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: var(--bg);
  border-top: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
}

.raw-marquee {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  padding: 4px 0;
}

.raw-marquee-track {
  display: inline-block;
  white-space: nowrap;
  animation: raw-scroll 32s linear infinite;
}

.raw-marquee:hover .raw-marquee-track {
  animation-play-state: paused;
}

@keyframes raw-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.footer-status {
  padding: 4px 10px;
  border-left: 1px solid var(--ink);
  background: var(--bg);
  white-space: nowrap;
}

/* Stamp clones created on click — large random full-window stamps */
.ink-stamp {
  position: fixed;
  width: var(--stamp-size, 200px);
  height: var(--stamp-size, 200px);
  pointer-events: none;
  z-index: 95;
  filter: url(#tairyoku-duotone);
  transform-origin: center center;
  will-change: transform, opacity;
  animation: tairyoku-stamp-pop var(--stamp-dur, 2300ms) cubic-bezier(0.16, 1, 0.3, 1) var(--stamp-delay, 0ms) both;
}

@keyframes tairyoku-stamp-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--r0, 0deg)) scale(0.2);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--r1, -6deg)) scale(var(--s-pop, 1.35));
  }
  28% {
    opacity: 0.95;
    transform: translate(-50%, -50%) rotate(var(--r2, -4deg)) scale(var(--s-land, 1));
  }
  78% {
    opacity: 0.9;
    transform: translate(-50%, -50%) rotate(var(--r2, -4deg)) scale(var(--s-land, 1));
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--r2, -4deg)) scale(calc(var(--s-land, 1) * 0.96));
  }
}

@media (max-width: 1120px) {
  html[data-size="s"] { --wall-cols: 4; }
  html[data-size="m"] { --wall-cols: 3; }
  html[data-size="l"] { --wall-cols: 2; }
}

@media (max-width: 780px) {
  html[data-size="s"] { --wall-cols: 3; }
  html[data-size="m"] { --wall-cols: 2; }
  html[data-size="l"] { --wall-cols: 1; }
  .wall-tile:hover .wall-tile-card {
    transform: scale(1.08);
  }
  .detail-body {
    grid-template-columns: 1fr;
  }
  .detail-meta-col {
    position: static;
  }
  .detail-images-col {
    grid-template-columns: 1fr;
  }
  .cursor-tag {
    display: none;
  }
  .contact-split {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .contact-video-frame {
    justify-self: center;
    max-width: 300px;
    margin-top: 4px;
  }
}
