:root {
  --dx-bg: var(--primary-black, #0a0a0a);
  --dx-text: var(--text-primary, #fff);
  --dx-dim: var(--text-secondary, #b0b0b0);
  --dx-accent: var(--accent-purple, #8b5cf6);
  --dx-grid-gap: 16px;
  --dx-gallery-gap: 14px; /* actual gap used in gallery rows */
  --dx-timeline: #a8b0e8; /* light blue/purple for timeline */
  --dx-baseline-y: calc(30% + 1em); /* unified baseline for connectors */
  /* Background video tuning */
  --dx-video-opacity: 0.28; /* lower = more subtle */
  --dx-video-brightness: 0.75; /* higher = brighter video */
  --dx-video-saturation: 1.00;
}

.dx-main {
  background: var(--dx-bg);
  padding-top: 120px; /* header space */
}

/* Hero */
.dx-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 8px;
}
.dx-title {
  color: var(--dx-text);
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 800;
  letter-spacing: 0.02em;
  margin: 0 0 10px;
}
.dx-lead {
  color: var(--dx-dim);
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.8;
  margin: 0;
}

/* Services table (JA | EN in one row) */
.dx-services {
  min-height:537px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px 24px;
  position: relative;
  overflow: hidden; /* keep bg video clipped to section */
}
.dx-services-table {
  display: grid;
  gap: 10px;
  position: relative; /* for trunk positioning */
}
/* Background video behind services */
.dx-video-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.dx-bgvideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  filter: brightness(var(--dx-video-brightness)) saturate(var(--dx-video-saturation));
  opacity: var(--dx-video-opacity); /* subtle, non-intrusive */
  pointer-events: none;
}
/* Alias for sub pages */
.sub-bgvideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--crop-x, 50%) var(--crop-y, 50%); filter: brightness(var(--dx-video-brightness)) saturate(var(--dx-video-saturation)); opacity: var(--dx-video-opacity); pointer-events: none; }
.dx-services > *:not(.dx-video-backdrop) {
  position: relative;
  z-index: 1;
}

/* Audio toggle button (minimal, unobtrusive) */
.dx-audio-toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  background: rgba(0,0,0,0.35);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 18px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(2px);
  pointer-events: auto;
}
.dx-audio-toggle:hover {
  background: rgba(0,0,0,0.5);
}

/* Animations */
@keyframes dx-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes dx-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dx-fade-up { 0% { opacity: 0; transform: translateY(6px); } 100% { opacity: 1; transform: translateY(0); } }

.dx-services-table.animate::before {
  transform-origin: top center;
  transform: scaleY(0);
  animation: dx-grow-y 0.9s ease-out forwards;
}
.dx-services-table.animate .dx-row::before {
  transform-origin: left center;
  transform: scaleX(0);
  animation: dx-grow-x 0.6s ease-out forwards;
}
.dx-services-table.animate .dx-row::after {
  transform-origin: bottom center;
  transform: translateY(-100%) scaleY(0);
  animation: dx-grow-y 0.45s ease-out forwards;
  top: 14px; /* animate-time baseline override */
}
.dx-services-table.animate .dx-cell {
  opacity: 0;
  animation: dx-fade-up 0.45s ease-out forwards;
}

/* Staggered delays per row */
.dx-services-table.animate .dx-row:nth-child(1)::before,
.dx-services-table.animate .dx-row:nth-child(1) .dx-cell { animation-delay: 0.20s; }
.dx-services-table.animate .dx-row:nth-child(2)::before,
.dx-services-table.animate .dx-row:nth-child(2) .dx-cell { animation-delay: 0.35s; }
.dx-services-table.animate .dx-row:nth-child(3)::before,
.dx-services-table.animate .dx-row:nth-child(3) .dx-cell { animation-delay: 0.50s; }
.dx-services-table.animate .dx-row:nth-child(4)::before,
.dx-services-table.animate .dx-row:nth-child(4) .dx-cell { animation-delay: 0.65s; }
.dx-services-table.animate .dx-row:nth-child(5)::before,
.dx-services-table.animate .dx-row:nth-child(5) .dx-cell { animation-delay: 0.80s; }
.dx-services-table.animate .dx-row:nth-child(6)::before,
.dx-services-table.animate .dx-row:nth-child(6) .dx-cell { animation-delay: 0.95s; }
.dx-services-table.animate .dx-row:nth-child(7)::before,
.dx-services-table.animate .dx-row:nth-child(7) .dx-cell { animation-delay: 1.10s; }
.dx-services-table.animate .dx-row:nth-child(8)::before,
.dx-services-table.animate .dx-row:nth-child(8) .dx-cell { animation-delay: 1.25s; }
.dx-services-table.animate .dx-row:nth-child(9)::before,
.dx-services-table.animate .dx-row:nth-child(9) .dx-cell { animation-delay: 1.40s; }
.dx-services-table.animate .dx-row:nth-child(10)::before,
.dx-services-table.animate .dx-row:nth-child(10) .dx-cell { animation-delay: 1.55s; }
.dx-services-table.animate .dx-row:nth-child(11)::before,
.dx-services-table.animate .dx-row:nth-child(11) .dx-cell { animation-delay: 1.70s; }

/* After (vertical tip) starts after horizontal finishes: add +0.6s to delays */
.dx-services-table.animate .dx-row:nth-child(1)::after { animation-delay: 0.80s; }
.dx-services-table.animate .dx-row:nth-child(2)::after { animation-delay: 0.95s; }
.dx-services-table.animate .dx-row:nth-child(3)::after { animation-delay: 1.10s; }
.dx-services-table.animate .dx-row:nth-child(4)::after { animation-delay: 1.25s; }
.dx-services-table.animate .dx-row:nth-child(5)::after { animation-delay: 1.40s; }
.dx-services-table.animate .dx-row:nth-child(6)::after { animation-delay: 1.55s; }
.dx-services-table.animate .dx-row:nth-child(7)::after { animation-delay: 1.70s; }
.dx-services-table.animate .dx-row:nth-child(8)::after { animation-delay: 1.85s; }
.dx-services-table.animate .dx-row:nth-child(9)::after { animation-delay: 2.00s; }
.dx-services-table.animate .dx-row:nth-child(10)::after { animation-delay: 2.15s; }
.dx-services-table.animate .dx-row:nth-child(11)::after { animation-delay: 2.30s; }
.dx-services-table .dx-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: var(--dx-grid-gap);
  position: relative;
  padding-left: 52px; /* space for tree connector */
}
.dx-services-table::before {
  content: '';
  position: absolute;
  left: 0; /* move trunk to the very left */
  top: 29px; /* cut at top */
  bottom: 13px; /* cut at bottom */
  width: 2px;
  background: linear-gradient(180deg, #5a76c9 0%, #5a76c9 100%);
  box-shadow: 0 0 6px rgba(168,176,232,0.45);
}
.dx-services-table .dx-cell {
  font-size: clamp(13px, 1.3vw, 15px);
  line-height: 1.6;
  padding: 10px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 8px;
}
.dx-services-table .dx-row::before {
  content: '';
  position: absolute;
  left: 0; /* start from the trunk */
  top: var(--dx-baseline-y); /* align to unified baseline */
  width: 55px; /* connector length into JA cell gutter */
  height: 2px;
  background: linear-gradient(90deg, #5a76c9 0%, #8aa0e8 60%, #ffffff 100%);
  box-shadow: 0 0 6px rgba(168,176,232,0.45);
}
.dx-services-table .dx-row::after {
  content: '';
  position: absolute;
  left: 55px; /* end of horizontal connector */
  top: var(--dx-baseline-y);
  width: 2px;
  height: 17px; /* small vertical white line to connect to list */
  transform: translateY(-90%); /* extend upward from baseline */
  background: #ffffff;
  box-shadow: 0 0 4px rgba(255,255,255,0.45);
}
.dx-services-table .dx-cell.dx-ja { font-weight: 600; }
.dx-services-table .dx-cell.dx-en { color: var(--dx-dim); font-family: "agency-fb", sans-serif; font-weight: 400; }
.dx-services-col.dx-ja ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 52px; /* space for timeline */
  position: relative;
}
.dx-services-col.dx-ja ul::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px; /* vertical line position */
  width: 2px;
  background: var(--dx-timeline);
  box-shadow: 0 0 5px rgba(168,176,232,0.45);
}
.dx-services-col.dx-ja li {
  color: var(--dx-text);
  font-size: clamp(13px, 1.3vw, 15px);
  position: relative;
  padding: 10px 12px;
  margin: 12px 0;
  min-height: 34px;
  border: none; /* remove dashed separators */
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.dx-services-col.dx-ja li:last-child {
  border-bottom: none;
}
.dx-services-col.dx-ja li:hover {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
/* Horizontal connector */
.dx-services-col.dx-ja li::after {
  content: '';
  position: absolute;
  left: 19px; /* center of vertical line */
  top: 50%;
  transform: translateY(-50%);
  width: 26px; /* horizontal length */
  height: 2px;
  background: var(--dx-timeline);
  box-shadow: 0 0 5px rgba(168,176,232,0.45);
}
/* Notch at connector end */
.dx-services-col.dx-ja li::before {
  content: '';
  position: absolute;
  left: 44px; /* end of connector */
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border: 2px solid var(--dx-timeline);
  border-radius: 2px;
  background: var(--dx-bg);
  box-shadow: 0 0 5px rgba(168,176,232,0.45);
  z-index: 1;
}
.dx-ja li { font-weight: 600; }
.dx-en li { color: var(--dx-dim); }

/* EN column font (Typekit) */
.dx-en {
  font-family: "agency-fb", sans-serif;
  font-weight: 800;
  font-style: normal;
}

/* EN column: plain list (no timeline) */
/* Old column layout styles kept for reference; not used after table switch */
.dx-services-col.dx-en ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
  position: static;
}

/* Align EN item sizing to JA and force single-line */
.dx-services-col.dx-en li {
  font-size: clamp(13px, 1.3vw, 15px);
  line-height: 1.6;
  padding: 10px 12px;
  margin: 12px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Force JA items to single-line as well */
.dx-services-col.dx-ja li {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Gallery grid */
.dx-gallery {
  max-width: 1200px;
  margin: 8px auto 60px;
  padding: 0 20px;
  position: relative;
}
/* Stacked row-based layout to match mock */
.dx-gallery-rows { display: grid; gap: 40px; }
.dx-row { display: grid; gap: var(--dx-gallery-gap); }
.dx-grid-3 { grid-template-columns: repeat(3, 1fr); }
.dx-grid-4 { grid-template-columns: repeat(4, 1fr); }
/* Aliases for sub pages */
.sub-gallery-rows { display: grid; gap: 40px; }
.sub-row { display: grid; gap: var(--dx-gallery-gap); align-items: center; }
.sub-grid-3 { grid-template-columns: repeat(3, 1fr); }
.sub-grid-4 { grid-template-columns: repeat(4, 1fr); }
.dx-thumb {
  width: 100%;
  height: 100%;
  display: block;
  box-sizing: border-box;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  object-fit: cover;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  transform-origin: var(--crop-origin, 50% 50%);
  transform: translate(var(--crop-tx, 0), var(--crop-ty, 0)) scale(var(--crop-zoom, 1));
}
/* Alias for sub pages */
.sub-thumb { width: 100%; height: 100%; display: block; box-sizing: border-box; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; object-fit: cover; object-position: var(--crop-x, 50%) var(--crop-y, 50%); transform-origin: var(--crop-origin, 50% 50%); transform: translate(var(--crop-tx, 0), var(--crop-ty, 0)) scale(var(--crop-zoom, 1)); }
/* Letterbox: keep full image, fill surplus with black */
.dx-letterbox {
  object-fit: contain;
  object-position: 50% 50%;
  background: #232323;
}
/* Alias for sub pages */
.sub-letterbox { object-fit: contain; object-position: 50% 50%; background: #232323; }
/* Centered tight pair: two items glued together, centered in 3-col row */
.dx-tight-pair {
  grid-column: 1 / -1; /* span all columns for centering */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--dx-gallery-gap); /* match gallery grid gap */
  /* width = two 3-col columns + one inner gap (using gallery gap) */
  width: calc(((100% - (var(--dx-gallery-gap) * 2)) / 3) * 2 + var(--dx-gallery-gap));
  margin: 0 auto;
}
.dx-tight-pair > .dx-thumb { width: 100%; }
/* If a 3-col grid has only two items, center them in columns 1 and 3 */
.dx-grid-3.dx-center-two > :nth-child(1) { grid-column: 1; }
.dx-grid-3.dx-center-two > :nth-child(2) { grid-column: 3; }
/* Aspect ratios */
.dx-sq { aspect-ratio: 1 / 1; }
.dx-portrait { aspect-ratio: 3 / 4; }
.dx-wide { aspect-ratio: 16 / 9; }
/* Alias for sub pages */
.sub-sq { aspect-ratio: 1 / 1; }
.sub-portrait { aspect-ratio: 3 / 4; }
.sub-wide { aspect-ratio: 16 / 9; }
/* Span 2 columns for larger feature tiles */
.dx-wide2 { aspect-ratio: 16 / 9; grid-column: span 2; }

/* Label tile */
.dx-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #5a76c9;
  color: #fff;
  font-weight: 800;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  letter-spacing: 0.06em;
  aspect-ratio: 16 / 9;
}

/* Branch connectors under gallery */
.dx-branch-layer {
  position: absolute;
  left: 0; right: 0;
  top: 0; bottom: 0;
  pointer-events: none;
}
.dx-branch-svg { width: 100%; height: 100%; }
.dx-branch path { stroke: rgba(138,160,232,0.9); stroke-width: 2; fill: none; }
.dx-branch.fade-in { opacity: 0; animation: dx-branch-reveal 1s ease-out forwards; }
@keyframes dx-branch-reveal { from { opacity: 0; } to { opacity: 1; } }

/* Language-aware swap: when English is active, swap left/right for JA/EN rows */
.lang-en .dx-services-table { /* trunk will be on the right side */ }
.lang-en .dx-services-table::before { left: auto; right: 0; }
.lang-en .dx-services-table .dx-row { direction: rtl; }
.lang-en .dx-services-table .dx-row .dx-cell { direction: ltr; }
.lang-en .dx-services-table .dx-row::before { left: auto; right: 55px; /* connector moves to right side */ }
.lang-en .dx-services-table .dx-row::after { left: auto; right: 55px; }
/* When JA column moves to the right, mirror its timeline to the right side */
.lang-en .dx-services-col.dx-ja ul::before { left: auto; right: 18px; }
.lang-en .dx-services-col.dx-ja li::after { left: auto; right: 19px; }
.lang-en .dx-services-col.dx-ja li::before { left: auto; right: 44px; }
/* Also ensure the JA connector notch not clipping visually on small screens */
.lang-en .dx-services-col.dx-ja li::before { transform: translate(50%, -50%); }

/* Utility crop position helpers */
/* (restored below) */

/* Alternating fade for interior pairs (smooth cycles, no abrupt jump) */
@keyframes dx-alt-fade-a {
  0%   { opacity: 1; }
  40%  { opacity: 1; }
  60%  { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes dx-alt-fade-b {
  0%   { opacity: 0; }
  40%  { opacity: 0; }
  60%  { opacity: 1; }
  100% { opacity: 1; }
}
.dx-alt-pair-a { animation: dx-alt-fade-a 6s ease-in-out infinite alternate; animation-fill-mode: both; }
.dx-alt-pair-b { animation: dx-alt-fade-b 6s ease-in-out infinite alternate; animation-fill-mode: both; }
.dx-alt-pair { position: relative; overflow: hidden; }
.dx-alt-pair img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Utility crop position helpers */
.crop-top { --crop-y: 0%; }
.crop-bottom { --crop-y: 100%; }
.crop-left { --crop-x: 0%; }
.crop-right { --crop-x: 100%; }
.crop-center-top { --crop-x: 50%; --crop-y: 0%; }
.crop-center-bottom { --crop-x: 50%; --crop-y: 100%; }
.crop-top-left { --crop-x: 0%; --crop-y: 0%; }
.crop-top-right { --crop-x: 100%; --crop-y: 0%; }
.crop-bottom-left { --crop-x: 0%; --crop-y: 100%; }
.crop-bottom-right { --crop-x: 100%; --crop-y: 100%; }

/* Responsive */
@media (max-width: 1024px) {
  .dx-grid-4 { grid-template-columns: repeat(3, 1fr); }
  .dx-grid-3 { grid-template-columns: repeat(2, 1fr); }
  /* Reset manual placement on smaller screens */
  .dx-grid-3.dx-center-two > * { grid-column: auto !important; }
}
@media (max-width: 768px) {
  .dx-services-grid { grid-template-columns: 1fr; }
  .dx-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .dx-grid-3 { grid-template-columns: repeat(1, 1fr); }
  .dx-tight-pair { width: 100%; }
}

.sub-grid-dev-top {
  display: flex;
  flex-direction: row;
  gap: var(--dx-gallery-gap);
  padding: 20px 20px;
}
.sub-grid-dev-content {
  height: 483px;
  width: 417px;
  display: flex;
  flex-direction: column;
  gap: var(--dx-gallery-gap);
}
/* Ensure images fill their slot and use the same sizing as other pages */
.sub-grid-dev-content img {
  width: 100%;
  display: block;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  /* make images flexible within their column */
  flex: 1 1 auto;
  min-height: 0; /* allow flex children to shrink properly */
}

/* Bottom strip should match the visual height of the top columns */
:root { --dev-top-height: 483px; }
.sub-grid-dev-top { align-items: stretch; }
.sub-grid-dev-bottom { height: var(--dev-top-height); padding: 0 20px; }
.sub-grid-dev-bottom img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 6px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }

/* Make sure both .sub-grid-dev-content columns have identical widths */
.sub-grid-dev-top .sub-grid-dev-content { flex: 0 0 417px; }

/* Reduce height of the first image in the first column, grow the second to compensate */
.sub-grid-dev-top .sub-grid-dev-content:first-child img:first-child {
  flex: 0 0 20%;
}
.sub-grid-dev-top .sub-grid-dev-content:first-child img:last-child {
  flex: 1 1 60%;
}
.sub-event-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* three equal-width columns */
  grid-template-rows: auto auto;
  gap: var(--dx-gallery-gap);
  max-width: 1200px;
  margin: 0 auto;
  align-items: stretch;
}
.sub-event-grid .event-cell { overflow: hidden; display: block; }
/* Non-poster cells: force 16:9 frame and crop to fill */
.sub-event-grid img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* Poster: span two rows and avoid cropping (contain) */
.sub-event-grid .event-poster { grid-column: 3; grid-row: 1 / span 2; }
.sub-event-grid .event-top-left { grid-column: 1; grid-row: 1; }
.sub-event-grid .event-top-mid { grid-column: 2; grid-row: 1; }
.sub-event-grid .event-bottom-left { grid-column: 1; grid-row: 2; }
.sub-event-grid .event-bottom-mid { grid-column: 2; grid-row: 2; }
.sub-event-grid .event-poster img { object-fit: contain; }

/* Normalize gallery images across site: consistent frame and no cropping */
.dx-gallery img,
.sub-gallery img,
.sub-gallery .sub-thumb,
.dx-gallery .dx-thumb,
.sub-event-grid img,
.sub-grid-dev-content img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain; /* avoid cropping */
  object-position: 50% 50%;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

/* Ensure row/grid cells provide a stable frame for images */
.sub-event-grid .event-cell,
.sub-grid-dev-content,
.sub-row > img,
.dx-row > img {
  box-sizing: border-box;
}

/* Center the dev gallery contents horizontally */
.sub-gallery { display: flex; justify-content: center; }
/* constrain inner wrapper to the width of the two columns and center it */
.sub-gallery > div { max-width: 880px; width: 100%; margin: 0 auto; }
/* center columns inside the top grid */
.sub-grid-dev-top { justify-content: center; }
/* center the bottom image container */
.sub-grid-dev-bottom { display: flex; justify-content: center; align-items: center; padding: 0 20px; }
.sub-grid-dev-bottom img { max-width: 880px; width: 100%; }

@media (max-width: 900px) {
  .sub-grid-dev-top { flex-direction: column; }
  .sub-grid-dev-content { width: 100%; height: auto; padding: 0; }
  .sub-grid-dev-bottom { height: auto; padding: 0; width: 100%; }
  .sub-grid-dev-top { width: 100%; padding: 0 20px; }
  :root { --dev-top-height: auto; }
}
