.sec-pattern {
  position: relative;
  padding-top: clamp(56px, 8vw, 120px);
  padding-bottom: clamp(56px, 8vw, 120px);
}

/* Stage: rail + frame + list */
.sec-pattern__stage {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(300px, 380px);
  gap: 28px;
  align-items: start;
}

.sec-pattern__rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
  /* Matches .sec-pattern__frame's height below so the rail's vertical line
     still runs the full height of the frame next to it — set explicitly
     rather than via grid stretch, which fought with the frame's old
     aspect-ratio sizing (see note there). */
  min-height: clamp(380px, 34vw, 560px);
  color: var(--at-neutral-500);
}
.sec-pattern__rail-index {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.sec-pattern__rail-line {
  width: 1px;
  flex: 1;
  min-height: 60px;
  background: var(--at-neutral-100);
}
.sec-pattern__rail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFB703;
  box-shadow: 0 0 10px rgba(255, 183, 3, 0.7);
  flex-shrink: 0;
}
.sec-pattern__rail-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sec-pattern__frame-wrap {
  position: relative;
  /* Defaults match the Warm Amber row, which loads active; pattern-chooser.js
     overwrites these two custom properties (from the selected row's dot
     colors) whenever a different pattern is picked, so the halo below
     always tracks the active button's color(s) instead of staying fixed. */
  --pattern-glow-1: rgba(255, 183, 3, 0.55);
  --pattern-glow-2: rgba(240, 70, 14, 0.4);
}
/* Blurred conic-gradient sitting behind the frame, oversized so the blur
   bleeds out past its rounded edges. Patterns with two dot colors get a
   genuine color-to-color gradient sweep; single-dot patterns pass the same
   color for both stops, which degenerates to a plain halo automatically —
   no separate single-vs-multi branching needed. */
.sec-pattern__frame-wrap::before {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: 0;
  border-radius: 26px;
  background: conic-gradient(from 0deg, var(--pattern-glow-1), var(--pattern-glow-2), var(--pattern-glow-1));
  filter: blur(10px);
  transition: background 0.6s ease;
  pointer-events: none;
}

.sec-pattern__frame {
  position: relative;
  z-index: 1;
  border-radius: 24px;
  overflow: hidden;
  /* Explicit height rather than aspect-ratio: an aspect-ratio box inside a
     1fr grid track computes a width-from-height "preferred size" that can
     fight the track's own width, which was overflowing the row (the list
     column got pushed off past the container's right edge). A fixed/clamped
     height has no such feedback loop. */
  height: clamp(380px, 34vw, 560px);
  background: var(--at-neutral-50, #101010);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--pattern-glow-1);
  transition: box-shadow 0.6s ease;
}
.sec-pattern__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.sec-pattern__media.is-active {
  opacity: 1;
}
.sec-pattern__hint {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 2;
  font-size: 13px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.sec-pattern__hint svg {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.6);
}
.sec-pattern__frame-chip {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 50px;
  background: rgba(12, 12, 12, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fefefe;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.25s ease;
}
.sec-pattern__frame-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sec-pattern__frame-chip svg {
  color: rgba(255, 255, 255, 0.6);
}

/* Right-hand toggle list */
.sec-pattern__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sec-pattern__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--at-neutral-100, #212121);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.sec-pattern__item:hover {
  border-color: rgba(255, 183, 3, 0.4);
}
.sec-pattern__item.is-active {
  border-color: rgba(255, 183, 3, 0.55);
  background: rgba(255, 183, 3, 0.06);
  box-shadow: 0 0 0 1px rgba(255, 183, 3, 0.18), 0 16px 34px -18px rgba(255, 183, 3, 0.45);
}
.sec-pattern__item-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
}
.sec-pattern__item-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sec-pattern__item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sec-pattern__item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-pattern__item-dots {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}
.sec-pattern__item-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: block;
}
.sec-pattern__item-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--at-neutral-900);
}
.sec-pattern__item-desc {
  font-size: 13px;
  color: var(--at-neutral-500);
}
.sec-pattern__item-arrow {
  flex-shrink: 0;
  color: var(--at-neutral-500);
  transition: transform 0.3s ease, color 0.3s ease;
}
.sec-pattern__item.is-active .sec-pattern__item-arrow {
  color: #FFB703;
  transform: translateX(2px);
}

/* Feature strip */
.sec-pattern__features {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 0;
  margin-top: clamp(32px, 5vw, 56px);
  padding: 20px clamp(16px, 3vw, 32px);
  border: 1px solid var(--at-neutral-100, #212121);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.015);
}
.sec-pattern__feature {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 clamp(14px, 2.2vw, 28px);
  border-right: 1px solid var(--at-neutral-100, #212121);
}
.sec-pattern__feature:first-child {
  padding-left: 0;
}
.sec-pattern__feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  color: #FFB703;
  border: 1px solid rgba(255, 183, 3, 0.35);
}
.sec-pattern__feature-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--at-neutral-500);
  line-height: 1.35;
}
.sec-pattern__feature-text strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--at-neutral-900);
}
.sec-pattern__more {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  padding-left: clamp(14px, 2.2vw, 28px);
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--at-neutral-900);
  cursor: pointer;
  white-space: nowrap;
}
.sec-pattern__more-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--at-neutral-100, #212121);
  color: currentColor;
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.sec-pattern__more:hover .sec-pattern__more-arrow {
  transform: rotate(45deg);
  background: var(--at-theme-primary, #f0460e);
  border-color: var(--at-theme-primary, #f0460e);
  color: #fefefe;
}

@media (max-width: 1199.98px) {
  .sec-pattern__stage {
    grid-template-columns: minmax(0, 1fr);
  }
  .sec-pattern__rail {
    display: none;
  }
  .sec-pattern__frame {
    height: clamp(280px, 60vw, 420px);
  }
  .sec-pattern__list {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sec-pattern__item {
    width: calc(50% - 5px);
  }
}
@media (max-width: 767.98px) {
  .sec-pattern__item {
    width: 100%;
  }
  .sec-pattern__feature {
    width: 50%;
    border-right: none;
    padding: 6px 0;
  }
  .sec-pattern__more {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    padding-left: 0;
    margin-top: 12px;
  }
}
