/* Sport tracker studio, digital twin and embed. Scoped under .st, .sd, .se. */

.st-shell {
  --st-header: 82px;
  --st-pad: clamp(0.75rem, 1.6vw, 1.6rem);
  padding-bottom: 2rem;
}

.st {
  display: grid;
  grid-template-columns: clamp(250px, 19vw, 330px) minmax(0, 1fr) clamp(250px, 19vw, 320px);
  grid-template-areas: "left stage right";
  height: clamp(640px, calc(100dvh - var(--st-header) - 1.5rem), 1280px);
  border: 1px solid var(--line);
  background: var(--surface-raised);
}

.st--dragging .st__viewport {
  outline: 3px dashed var(--accent);
  outline-offset: -8px;
}

.st__col {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 0.9rem 1.5rem;
  scrollbar-width: thin;
}

.st__col--left {
  grid-area: left;
  border-right: 1px solid var(--line);
}

.st__col--right {
  grid-area: right;
  border-left: 1px solid var(--line);
}

.st__group {
  margin-bottom: 1.4rem;
}

.st__group:last-child {
  margin-bottom: 0;
}

.st__group .eyebrow {
  margin: 0 0 0.55rem;
}

.st__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.st__group-head .eyebrow {
  margin: 0;
}

.st__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.st-presets {
  display: grid;
  gap: 0.3rem;
}

.st-preset,
.st-thumb {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.st-preset {
  padding: 0.5rem 0.6rem;
  line-height: 1.3;
}

.st-preset span {
  display: block;
  font-size: 0.86rem;
  font-weight: 620;
}

.st-preset small {
  display: block;
  margin-top: 0.1rem;
  color: var(--ink-muted);
  font-size: 0.7rem;
}

.st-preset--custom {
  margin-bottom: 0.4rem;
  font-size: 0.84rem;
  font-weight: 620;
}

.st-preset:hover,
.st-preset--active,
.st-thumb:hover,
.st-thumb--active {
  border-color: var(--ink);
}

.st-preset--active {
  background: var(--ink);
  color: var(--surface);
}

.st-preset--active small {
  color: color-mix(in srgb, var(--surface) 72%, transparent);
}

.st-thumbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.st-thumb {
  display: grid;
  gap: 0.2rem;
  padding: 0.3rem;
}

.st-thumb--active {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.st-thumb__figure {
  aspect-ratio: 297 / 420;
  overflow: hidden;
  background: #111;
}

.st-thumb__figure svg {
  display: block;
  width: 100%;
  height: auto;
}

.st-thumb__name {
  font-size: 0.74rem;
  font-weight: 650;
}

.st-thumb small {
  display: none;
}

.st-meta {
  margin: 0.45rem 0 0;
  color: var(--ink-muted);
  font-size: 0.74rem;
}

.st__stage {
  grid-area: stage;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}

.st__viewport {
  position: relative;
  min-height: 0;
  background: #1a1a1a;
  background-image: radial-gradient(circle at 50% 30%, #262626 0%, #161616 70%);
}

.st__poster {
  position: absolute;
  inset: var(--st-pad);
  display: grid;
  place-items: center;
}

.st__poster svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.st__toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.st__toolbar-text {
  flex: 1 1 18rem;
  min-width: 0;
}

.st__status {
  margin: 0;
  color: var(--ink);
  font-size: 0.75rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.st__hint {
  margin: 0.15rem 0 0;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.st__toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.st__tick {
  min-width: 9ch;
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.st-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.st-button--primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.st-button--ghost {
  border-color: var(--line);
}

.st-button--small {
  min-height: 1.85rem;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
}

.st-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.st-field {
  display: grid;
  gap: 0.25rem;
  margin: 0 0 0.6rem;
  color: var(--ink-muted);
  font-size: 0.76rem;
}

.st-field input,
.st-field select {
  min-height: 2.25rem;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
}

.st-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.3rem 0;
  color: var(--ink);
  font-size: 0.84rem;
}

.st-check input {
  accent-color: var(--ink);
}

.st-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.st-swatch {
  appearance: none;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: pointer;
}

.st-swatch--active {
  box-shadow: 0 0 0 2px var(--ink);
}

.st-swatch--custom {
  border-radius: 4px;
  background: conic-gradient(#f44, #fa0, #4c4, #4cf, #44f, #f4f, #f44);
}

.st-swatch--custom::-webkit-color-swatch-wrapper {
  padding: 0;
}

.st-swatch--custom::-webkit-color-swatch {
  border: 0;
  opacity: 0;
}

.st-photos {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.st-photos:empty {
  display: none;
}

.st__count {
  margin-left: 0.4rem;
  color: var(--ink);
  font-weight: 700;
}

.st-dropzone {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0.8rem;
  border: 1.5px dashed var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.st-dropzone:hover,
.st--dragging .st-dropzone {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-soft));
}

.st-dropzone strong {
  font-size: 0.84rem;
}

.st-dropzone span {
  color: var(--ink-muted);
  font-size: 0.7rem;
}

.st-dropzone--full {
  opacity: 0.55;
}

.st-dropzone[hidden] {
  display: none;
}

.st-photo {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
}

.st-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.st-photo__pick {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: crosshair;
}

.st-photo__focal {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.st-photo__tools {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  gap: 2px;
}

.st-photo__tool {
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.st-photo__main {
  align-self: center;
  padding: 0 0.3rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.st-photo--main {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.st-button--swatch .st-button__dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--swatch, transparent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.st-photo__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 1.3rem;
  height: 1.3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.st-dl {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

.st-dl div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.5rem;
  font-size: 0.74rem;
}

.st-dl dt {
  color: var(--ink-muted);
}

.st-dl dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.st-docs {
  display: grid;
  gap: 2rem;
  padding-top: 1rem;
}

.st-docs h2 {
  margin: 0.2rem 0 0.55rem;
  font-size: clamp(1.7rem, 3.5vw, 2.8rem);
  letter-spacing: -0.045em;
}

.st-docs p {
  max-width: 68ch;
  margin: 0;
  color: var(--ink-muted);
}

/* ---------- digital twin ---------- */

.sd {
  min-height: calc(100dvh - var(--st-header, 82px));
  background: #0e0e0e;
  color: #f2f2f2;
}

.sd__inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: calc(100dvh - 82px);
  width: min(1600px, calc(100% - 32px));
  margin-inline: auto;
  padding: 1rem 0 1.25rem;
}

.sd__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-bottom: 0.9rem;
}

.sd__brand {
  margin: 0;
  color: #9a9a9a;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sd__title {
  margin: 0.2rem 0 0;
  font-size: clamp(1.2rem, 2.4vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sd__status {
  margin: 0.2rem 0 0;
  color: #9a9a9a;
  font-size: 0.74rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.sd__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.sd__tick {
  min-width: 14ch;
  color: #f2f2f2;
  font-size: 1rem;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.sd__scrub {
  width: min(320px, 50vw);
  accent-color: #f2f2f2;
}

.sd .st-button {
  background: #1c1c1c;
  color: #f2f2f2;
  border-color: #3a3a3a;
}

.sd .st-button--primary {
  background: #f2f2f2;
  color: #111;
  border-color: #f2f2f2;
}

.sd__poster {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}

.sd__poster svg {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 82px - 9.5rem);
  width: auto;
  height: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.sd__foot {
  padding-top: 0.9rem;
  color: #7a7a7a;
  font-size: 0.72rem;
}

.sd__foot a {
  color: #d0d0d0;
}

/* ---------- embed ---------- */

.se {
  margin: 0;
  height: 100%;
  background: transparent;
}

.se .sd__poster {
  height: 100vh;
  padding: 0;
}

.se .sd__poster svg {
  max-height: 100vh;
  box-shadow: none;
  cursor: pointer;
}

/* ---------- responsive ---------- */

@media (min-width: 1800px) {
  .st {
    grid-template-columns: 340px minmax(0, 1fr) 340px;
  }
}

@media (max-width: 1100px) {
  .st {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "stage stage"
      "left right";
    grid-template-rows: auto auto;
    height: auto;
  }

  .st__stage {
    grid-template-rows: minmax(0, clamp(420px, 68dvh, 900px)) auto;
  }

  .st__col {
    max-height: none;
    overflow: visible;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .st-shell,
  .analog-lab-wide {
    width: calc(100% - 20px);
  }

  .st {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stage"
      "left"
      "right";
    grid-template-rows: auto auto auto;
  }

  .st-shell {
    --st-pad: 0.5rem;
  }

  .st__stage {
    grid-template-rows: minmax(0, clamp(300px, 58dvh, 640px)) auto;
  }

  .st__col--left,
  .st__col--right {
    border-left: 0;
    border-right: 0;
  }

  .st__hint {
    display: none;
  }

  .st__status {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .st__toolbar-text {
    flex-basis: 100%;
  }

  .st__toolbar-row {
    width: 100%;
  }

  .st__toolbar-row .st-button--primary {
    margin-left: auto;
  }

  .st__toolbar-row .st-button {
    min-height: 2.1rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.76rem;
  }

  .st-presets {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
    scroll-snap-type: x proximity;
  }

  .st-preset {
    flex: 0 0 auto;
    width: auto;
    min-width: 10rem;
    max-width: 14rem;
    scroll-snap-align: start;
  }

  .st-thumbs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sd__inner {
    width: calc(100% - 20px);
  }

  .sd__poster svg {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .st-shell {
    --st-header: 64px;
  }
}

/* ---------- showcase gallery ---------- */

.sg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem 1.25rem;
  padding: 1.5rem 0 5rem;
}

.sg__item {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.sg__poster {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: #1a1a1a;
  background-image: radial-gradient(circle at 50% 30%, #262626 0%, #161616 70%);
  text-decoration: none;
}

.sg__poster:hover {
  text-decoration: none;
}

.sg__poster svg {
  display: block;
  width: 100%;
  max-height: 520px;
  height: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  transition: transform 160ms ease;
}

.sg__poster:hover svg {
  transform: translateY(-3px);
}

.sg__poster svg [data-role="route-hit"],
.sg__poster svg [data-role="elev-hit"] {
  display: none;
}

.sg__kicker {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sg__meta h2 {
  margin: 0.15rem 0 0.25rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.sg__meta p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.84rem;
}

.sg__credit {
  margin-top: 0.35rem !important;
  font-size: 0.7rem !important;
}

.sg__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.sg__actions .st-button {
  text-decoration: none;
}

.st-showcase-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 0;
}

.st-showcase-row .sg__poster {
  padding: 0.9rem;
}

@media (max-width: 900px) {
  .st-showcase-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
