/* Final Poster details treatment. The right-panel experiments are retired in dev. */

/*
  Poster geometry is intentionally independent:
  - metadata stays in one fixed row,
  - the character name owns a fixed title zone,
  - When and Where always begin at the same positions.
  A one-line name therefore cannot pull the facts upward, and a two-line name
  cannot push them down.
*/
body[data-details-variant="poster"] .studio-details {
  --poster-title-zone: clamp(150px, 34%, 245px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--poster-title-zone) minmax(0, 1fr);
  justify-content: stretch;
  width: 100%;
  min-width: 0;
}

body[data-details-variant="poster"] .studio-details-top {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  grid-template-rows: clamp(34px, 5.5%, 44px) minmax(0, 1fr);
  grid-template-areas:
    "handle status"
    "title title";
  column-gap: 10px;
  align-content: stretch;
  min-width: 0;
  min-height: 0;
}

body[data-details-variant="poster"] .studio-handle {
  grid-area: handle;
  align-self: start;
  min-width: 0;
  max-width: 100%;
  max-height: 2.5em;
  margin: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: clamp(.68rem, 1.5vw, .82rem);
  line-height: 1.2;
}

body[data-details-variant="poster"] .studio-event-status {
  position: static;
  grid-area: status;
  align-self: start;
  justify-self: end;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  transform: rotate(1deg);
}

body[data-details-variant="poster"] .studio-event-status[hidden] {
  display: none !important;
}

body[data-details-variant="poster"] #studio-character-name {
  grid-area: title;
  align-self: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  text-wrap: balance;
  line-height: .82;
}

body[data-details-variant="poster"] .studio-facts {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  min-width: 0;
  min-height: 0;
  margin-top: 0;
}

body[data-details-variant="poster"] .studio-facts div,
body[data-details-variant="poster"] .studio-facts div:first-child,
body[data-details-variant="poster"] .studio-facts div:last-child {
  min-width: 0;
}

body[data-details-variant="poster"] #studio-event-date,
body[data-details-variant="poster"] #studio-event-time,
body[data-details-variant="poster"] #studio-event-place {
  display: block;
  min-width: 0;
  font-size: 1em;
  white-space: normal;
}

body[data-details-variant="poster"] #studio-event-date {
  white-space: nowrap;
}

body[data-details-variant="poster"] #studio-event-place {
  text-wrap: balance;
}

/* Keep both fact groups as deliberate left-aligned stacks. The rail has
   one column; date/time and venue/address must not reserve a phantom right
   column on narrow cards. */
body[data-details-variant="poster"] .studio-fact-when dd,
body[data-details-variant="poster"] .studio-fact-where dd,
body[data-details-variant="poster"] #studio-event-location {
  display: block;
  width: 100%;
  min-width: 0;
  text-align: left;
}

body[data-details-variant="poster"] #studio-event-date,
body[data-details-variant="poster"] #studio-event-time,
body[data-details-variant="poster"] #studio-event-place {
  display: block;
  min-width: 0;
  white-space: nowrap;
}

body[data-details-variant="poster"] #studio-event-time {
  margin-top: 5px;
}

body[data-details-variant="poster"] #studio-event-doors {
  display: block;
  margin-top: 4px;
}

body[data-details-variant="poster"] .studio-event-address {
  display: block;
  width: 100%;
  max-width: none;
  margin-top: 5px;
  text-align: left;
  white-space: pre-line;
}

/* Finish each fact spine with a small semantic icon. The cream halo interrupts
   the rule just like the label does on the left, so the icon reads as the
   matching right-hand endpoint rather than floating over the divider. */
body[data-details-variant="poster"] .studio-fact-when::after,
body[data-details-variant="poster"] .studio-fact-where::after {
  position: absolute;
  top: 0;
  right: 2px;
  z-index: 2;
  box-sizing: border-box;
  content: "";
  color: var(--theme-accent);
  background-color: var(--studio-cream);
  pointer-events: none;
}

body[data-details-variant="poster"] .studio-fact-when::after {
  width: 15px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-shadow: 0 0 0 5px var(--studio-cream);
  background:
    linear-gradient(currentColor, currentColor) 0 3px / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) 3px 0 / 1.5px 4px no-repeat,
    linear-gradient(currentColor, currentColor) calc(100% - 3px) 0 / 1.5px 4px no-repeat,
    var(--studio-cream);
  transform: translateY(-50%);
}

body[data-details-variant="poster"] .studio-fact-where::after {
  width: 13px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 0 0 5px var(--studio-cream);
  background:
    radial-gradient(circle at 50% 50%, currentColor 0 1.55px, transparent 1.75px),
    var(--studio-cream);
  transform: translateY(-58%) rotate(-45deg);
}

/* Preserve the locked card height while keeping the rail visually balanced. */
@media (max-width: 760px) {
  body[data-details-variant="poster"] .studio-details {
    --poster-title-zone: clamp(118px, 32%, 144px);
    padding: 16px 14px 12px;
  }

  body[data-details-variant="poster"] .studio-details-top {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    grid-template-rows: 32px minmax(0, 1fr);
    column-gap: 7px;
  }

  body[data-details-variant="poster"] .studio-handle {
    max-height: 2.4em;
    font-size: .66rem;
  }

  body[data-details-variant="poster"] .studio-event-status {
    padding: 4px 6px 3px;
    font-size: .47rem;
    letter-spacing: .08em;
  }

  body[data-details-variant="poster"] .studio-facts {
    margin-top: 0;
  }

  body[data-details-variant="poster"] .studio-facts div,
  body[data-details-variant="poster"] .studio-facts div:first-child,
  body[data-details-variant="poster"] .studio-facts div:last-child {
    padding-top: 13px;
    padding-bottom: 7px;
  }

  body[data-details-variant="poster"] #studio-event-time {
    margin-top: 4px;
  }

  body[data-details-variant="poster"] #studio-event-doors {
    margin-top: 2px;
  }

  body[data-details-variant="poster"] .studio-event-address {
    margin-top: 4px;
    line-height: 1.28;
  }

  body[data-details-variant="poster"] .studio-fact-when::after {
    width: 14px;
    height: 12px;
  }

  body[data-details-variant="poster"] .studio-fact-where::after {
    width: 12px;
    height: 12px;
  }
}

/* Common short phones: retain every fact and CTA without page scrolling. */
@media (max-width: 760px) and (max-height: 720px) {
  body[data-details-variant="poster"] .studio-details {
    --poster-title-zone: 106px;
    padding: 12px 11px 9px;
  }

  body[data-details-variant="poster"] .studio-details-top {
    grid-template-rows: 28px minmax(0, 1fr);
    column-gap: 6px;
  }

  body[data-details-variant="poster"] .studio-event-status {
    padding: 3px 5px 2px;
    font-size: .43rem;
  }

  body[data-details-variant="poster"] #studio-character-name {
    font-size: calc(clamp(1.9rem, 10vw, 2.6rem) * var(--name-size, 1));
  }

  body[data-details-variant="poster"] .studio-handle {
    font-size: .6rem;
  }

  body[data-details-variant="poster"] .studio-facts {
    grid-template-rows:
      minmax(76px, .9fr)
      minmax(94px, 1.1fr);
    margin-top: 0;
  }

  body[data-details-variant="poster"] .studio-facts div,
  body[data-details-variant="poster"] .studio-facts div:first-child,
  body[data-details-variant="poster"] .studio-facts div:last-child {
    padding-top: 11px;
    padding-bottom: 5px;
  }

  /* Keep Poster event details at the same readable scale on short phones.
     Compact mode may reduce geometry, but must not turn the facts into
     a visually different micro-type treatment. */
  body[data-details-variant="poster"] .studio-facts dd {
    font-size: clamp(1rem, 4.5vw, 1.18rem);
  }

  body[data-details-variant="poster"] .studio-fact-when dd,
  body[data-details-variant="poster"] #studio-event-location {
    gap: 5px;
  }

  body[data-details-variant="poster"] #studio-event-time {
    margin-top: 3px;
  }

  body[data-details-variant="poster"] #studio-event-doors,
  body[data-details-variant="poster"] .studio-event-address {
    margin-top: 2px;
  }
}

/* Dev tuning share controls. */
.studio-tuning-share-fieldset {
  gap: 8px !important;
}

.studio-tuning-share-note {
  margin: 0;
  color: rgba(255,240,210,.72);
  font-size: .64rem;
  font-weight: 700;
  line-height: 1.35;
}

.studio-tuning-share {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid rgba(255,240,210,.38);
  border-radius: 6px;
  color: var(--studio-cream);
  background: rgba(0,0,0,.2);
  font: 600 .62rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.studio-tuning-share-copy {
  min-height: 36px;
  border: 1px solid rgba(255,240,210,.55);
  border-radius: 6px;
  color: var(--studio-cream);
  background: rgba(255,240,210,.12);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .04em;
  cursor: pointer;
}

.studio-tuning-share-copy:active {
  transform: translateY(1px);
}
