/* StringTune masonry + sequence — portfolio theme (tutorial-02-masonry-orchestrated, tutorial-16-sequence) */

.st-seq-section .sec-sub,
.st-masonry-section .sec-sub {
  max-width: 640px;
}

/* ─── Sequence band ─────────────────────────────────────────────── */
.st-seq-shell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(16px, 3vw, 24px);
  width: 100%;
  max-width: min(920px, 100%);
  margin: 0 auto;
}

.st-seq-arrows {
  display: none;
}

.st-seq-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.st-seq-arrow:hover {
  background: color-mix(in oklab, var(--accent), transparent 88%);
  border-color: color-mix(in oklab, var(--accent), transparent 40%);
}

.st-seq-arrow:active {
  transform: scale(0.97);
}

.st-sequence {
  position: relative;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--card) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  /* Wide automation canvases (Make/n8n); letterbox with contain */
  aspect-ratio: 21 / 9;
  width: 100%;
  max-height: min(62vh, 640px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.st-seq-figure {
  grid-area: 1 / 1;
  margin: 0;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  transform: translateZ(0);
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.35, 0.35, 0, 1),
    clip-path 0.85s cubic-bezier(0.35, 0.35, 0, 1);
}

.st-seq-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.st-seq-figure.-leaving {
  z-index: 2;
  opacity: 0;
}

.st-seq-figure.-entering {
  opacity: 1;
  clip-path: polygon(38% 38%, 62% 38%, 62% 62%, 38% 62%);
  transition: opacity 0s linear, clip-path 0s linear;
}

.st-seq-figure.-active {
  z-index: 3;
  opacity: 1;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.st-seq-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.st-seq-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.st-seq-dot:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.st-seq-dot.-active,
.st-seq-dot.-entering {
  background: color-mix(in oklab, var(--accent), transparent 78%);
  border-color: var(--accent);
  color: var(--text);
}

.st-seq-legend {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

@media (min-width: 560px) {
  .st-seq-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.st-seq-legend li {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.st-seq-legend strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.st-seq-legend span {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.35;
}

.st-seq-shell--static .st-seq-figure--static {
  opacity: 1;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 21 / 9;
  max-height: min(54vh, 560px);
  margin: 0 auto;
  width: 100%;
  max-width: min(920px, 100%);
}

.st-seq-shell--static .st-seq-figure--static img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 480px) {
  .st-sequence {
    aspect-ratio: 16 / 12;
    max-height: min(68vh, 560px);
  }
}

/* ─── Masonry gallery ─────────────────────────────────────────────── */
.st-masonry-grid {
  position: relative;
  width: 100%;
}

.st-masonry-item {
  padding-bottom: 4px;
  will-change: transform, width, height;
}

.st-masonry-item figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.st-masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  transform: translateZ(0);
  object-fit: contain;
}

.st-masonry-cap {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── Masonry controls (tutorial-02-masonry-orchestrated pattern) ─── */
.st-masonry-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: clamp(12px, 2vw, 18px);
  width: 100%;
  margin-bottom: 8px;
}

.st-control-group {
  padding: 10px 14px 12px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--card), transparent 12%);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.st-control-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e8b896;
  border-bottom: 1px solid rgba(232, 184, 150, 0.35);
  padding-bottom: 6px;
}

.st-button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  background: color-mix(in oklab, var(--bg), transparent 30%);
  border-radius: 10px;
}

.st-control-btn {
  border: none;
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.st-control-btn:hover {
  background: color-mix(in oklab, var(--accent), transparent 88%);
}

.st-control-btn.-active {
  background: var(--bg);
  color: #f0c9a8;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.st-timing-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
}

.st-timing-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s, opacity 0.2s;
}

.st-timing-label.-on {
  color: #f0c9a8;
  opacity: 1;
}

.st-timing-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.st-timing-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.st-timing-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--border-strong), transparent 20%);
  border: 1px solid var(--border);
  transition: background 0.2s;
  flex-shrink: 0;
}

.st-timing-slider::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.2s cubic-bezier(0.35, 0.35, 0, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.st-timing-switch input:checked + .st-timing-slider::after {
  transform: translate(20px, -50%);
}

.st-timing-switch input:checked + .st-timing-slider {
  background: color-mix(in oklab, var(--accent), transparent 65%);
  border-color: color-mix(in oklab, var(--accent), transparent 40%);
}

@media (max-width: 1023px) {
  .st-control-btn--wide-only {
    display: none;
  }
}

/* Reduced-motion fallback: CSS columns */
.st-masonry-fallback {
  column-count: 1;
  column-gap: 16px;
  width: 100%;
}

@media (min-width: 480px) {
  .st-masonry-fallback {
    column-count: 2;
  }
}

@media (min-width: 900px) {
  .st-masonry-fallback {
    column-count: 3;
  }
}

.st-masonry-item--static {
  break-inside: avoid;
  margin-bottom: 20px;
}

.st-masonry-item--static figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}
