/*
 * Project Outpost — Inventory Dossier v1
 *
 * The right rail is an action-oriented inspection surface: identity and the
 * primary command stay immediately visible, quick facts scan horizontally,
 * and longer effect/contract information continues in the rail's own scroll.
 * This layer is presentation-only and preserves every existing item action.
 */

@media (min-width: 821px) {
  body.outpost-real-page-preview #inventory .inventory-content-grid {
    grid-template-columns:
      clamp(148px, 13vw, 176px)
      minmax(0, 1fr)
      clamp(326px, 25vw, 372px);
  }

  body.outpost-real-page-preview #inventory .inventory-layout:is(
    [data-inventory-workspace-mode="equipment"],
    [data-inventory-workspace-mode="use"]
  ) .inventory-content-grid {
    grid-template-columns: minmax(0, 1fr) clamp(344px, 28vw, 400px);
  }

  body.outpost-real-page-preview #inventory .inventory-detail-panel {
    --inventory-dossier-pad: 18px;
    grid-auto-rows: max-content;
    align-content: start;
    padding: 0 var(--inventory-dossier-pad) 18px;
    border-left: 1px solid var(--op-line) !important;
    background:
      linear-gradient(180deg, var(--op-surface-soft), transparent 210px),
      var(--op-bg) !important;
  }

  /* Record identity --------------------------------------------------- */
  body.outpost-real-page-preview #inventory .inventory-detail-kicker {
    position: sticky;
    top: 0;
    z-index: 7;
    min-height: 36px;
    background: var(--op-bg);
    font-size: 8px;
    letter-spacing: .11em;
  }

  body.outpost-real-page-preview #inventory .inventory-detail-hero {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 13px;
    min-height: 94px;
    padding: 13px 0;
  }

  body.outpost-real-page-preview #inventory .inventory-detail-hero .selected-item-art {
    width: 68px;
    height: 68px;
    min-height: 68px;
    border-color: var(--op-line-faint);
    background: color-mix(in srgb, var(--op-surface-strong) 72%, transparent);
  }

  body.outpost-real-page-preview #inventory .inventory-detail-hero h3 {
    font-size: 19px;
    font-weight: 620;
    line-height: 1.06;
  }

  body.outpost-real-page-preview #inventory .inventory-detail-hero p {
    margin-top: 6px;
    font: 8px/1.45 var(--op-font-mono);
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  /* Primary command -------------------------------------------------- */
  body.outpost-real-page-preview #inventory .selected-item-action-bar {
    top: 36px;
    margin: 0 calc(var(--inventory-dossier-pad) * -1);
    padding: 9px var(--inventory-dossier-pad);
    border-top: 0;
    border-bottom: 1px solid var(--op-line);
    background: color-mix(in srgb, var(--op-bg) 94%, transparent);
    backdrop-filter: blur(8px);
  }

  body.outpost-real-page-preview #inventory .inventory-primary-action {
    min-height: 42px !important;
    border: 1px solid var(--op-text);
    border-radius: 0;
    color: var(--op-bg);
    background: var(--op-text);
    font: 650 11px/1 var(--op-font-ui);
    letter-spacing: .035em;
  }

  body.outpost-real-page-preview #inventory .inventory-primary-action:is(:hover, :focus-visible):not(:disabled) {
    color: var(--op-bg);
    background: var(--op-accent);
    transform: none;
  }

  /* Quick facts ------------------------------------------------------ */
  body.outpost-real-page-preview #inventory .selected-detail-stats:not(.item-action-contract) {
    order: 4;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    margin: 12px 0 0;
  }

  body.outpost-real-page-preview #inventory .selected-detail-stats:not(.item-action-contract) span {
    min-height: 56px;
    padding: 8px 10px;
  }

  body.outpost-real-page-preview #inventory .selected-detail-stats:not(.item-action-contract) b {
    font-size: 15px;
  }

  /* Effect is the first reading block after the command. */
  body.outpost-real-page-preview #inventory .inventory-detail-effect {
    order: 5;
    margin-top: 12px;
    padding: 13px 14px;
    border: 0;
    border-left: 2px solid var(--op-line-strong);
    background: var(--op-surface-soft);
  }

  body.outpost-real-page-preview #inventory .inventory-detail-effect p {
    color: var(--op-text);
    font-size: 12px;
    line-height: 1.45;
  }

  body.outpost-real-page-preview #inventory .inventory-detail-more {
    order: 6;
    padding: 11px 0;
  }

  /* Runtime contract ------------------------------------------------- */
  body.outpost-real-page-preview #inventory .item-action-contract {
    order: 7;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
  }

  body.outpost-real-page-preview #inventory .item-action-contract span {
    min-height: 62px;
    padding: 8px;
  }

  body.outpost-real-page-preview #inventory .item-action-contract b {
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.25;
  }

  body.outpost-real-page-preview #inventory .inventory-use-quantity,
  body.outpost-real-page-preview #inventory .inventory-use-unsupported {
    order: 8;
  }

  body.outpost-real-page-preview #inventory .selected-item-secondary-actions {
    order: 9;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
  }

  body.outpost-real-page-preview #inventory .selected-item-secondary-actions button {
    min-height: 36px;
    padding: 7px 8px;
    font: 8px/1.25 var(--op-font-mono);
    letter-spacing: .055em;
    text-transform: uppercase;
  }

  body.outpost-real-page-preview #inventory .inventory-action-note {
    order: 10;
    margin: 12px 0 0;
    padding: 10px 0 0;
    border-top: 1px solid var(--op-line-faint);
    font-size: 9px;
    line-height: 1.45;
  }
}

/* High-legibility retains the same hierarchy without clipping labels. */
@media (min-width: 821px) {
  body.outpost-real-page-preview[data-text-size="huge"] #inventory .inventory-content-grid {
    grid-template-columns: 154px minmax(0, 1fr) clamp(372px, 30vw, 430px);
  }

  body.outpost-real-page-preview[data-text-size="huge"] #inventory .inventory-detail-hero h3 {
    font-size: 23px;
  }

  body.outpost-real-page-preview[data-text-size="huge"] #inventory .inventory-detail-effect p {
    font-size: 15px;
  }
}

/* Narrow and mobile layouts keep the dossier in normal document flow. */
@media (max-width: 1040px) and (min-width: 821px) {
  body.outpost-real-page-preview #inventory .inventory-content-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  body.outpost-real-page-preview #inventory .inventory-filter-rail {
    display: none;
  }

  body.outpost-real-page-preview #inventory .inventory-main {
    border-left: 0;
  }
}

@media (max-width: 820px) {
  body.outpost-real-page-preview #inventory .inventory-detail-panel {
    background: var(--op-bg) !important;
  }

  body.outpost-real-page-preview #inventory .item-action-contract {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.outpost-real-page-preview #inventory .inventory-primary-action {
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.outpost-real-page-preview #inventory .inventory-primary-action {
    transition: none;
  }
}
