/*
 * THE FULL-SCREEN VIEWER. A takeover like `Dialog surface="takeover"` — opaque, edge to edge, no
 * scrim — with a ruled toolbar over a preview area that owns its own overlays:
 * the two step controls and the rotate cluster float ON the image, so their
 * grounds are fixed dark chips rather than theme surfaces.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-file-gallery-dialog__viewport {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    z-index: var(--lotics-z-overlay);
  }

  .lotics-file-gallery-dialog__popup {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1;
    min-width: 0;
    min-height: 0;
    background-color: var(--card);
    color: var(--lotics-ink-default);
  }

  .lotics-file-gallery-dialog__toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-shrink: 0;
    gap: var(--lotics-space-8);
    padding-block: var(--lotics-space-8);
    padding-inline: var(--lotics-space-12);
    border-bottom: 1px solid var(--border);
    /* Over the preview area, so a tall render cannot paint across the bar. */
    z-index: var(--lotics-z-sticky-header);
  }

  .lotics-file-gallery-dialog__filename {
    flex-shrink: 1;
    min-width: 0;
  }

  .lotics-file-gallery-dialog__counter {
    flex-shrink: 0;
  }

  .lotics-file-gallery-dialog__spacer {
    flex: 1;
    min-width: 0;
  }

  .lotics-file-gallery-dialog__preview {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    flex: 1;
    min-width: 0;
    min-height: 0;
  }

  .lotics-file-gallery-dialog__nav {
    position: absolute;
    /* Centred by auto margins between two zero offsets — a 50% offset would be
       a second copy of the control's own height, stated as a percentage. */
    top: 0;
    bottom: 0;
    margin-block: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 0 solid transparent;
    border-radius: var(--lotics-radius-full);
    background-color: color-mix(in srgb, var(--lotics-shadow-color) 40%, transparent);
    color: var(--lotics-white);
    --lotics-icon-color: currentColor;
    appearance: none;
    cursor: pointer;
    transition: background-color var(--lotics-duration-fast) var(--lotics-ease-standard);
  }

  .lotics-file-gallery-dialog__nav:hover {
    background-color: color-mix(in srgb, var(--lotics-shadow-color) 55%, transparent);
  }

  .lotics-file-gallery-dialog__nav:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: var(--lotics-ring-width);
  }

  .lotics-file-gallery-dialog__nav[data-side="prev"] {
    left: var(--lotics-space-16);
  }

  .lotics-file-gallery-dialog__nav[data-side="next"] {
    right: var(--lotics-space-16);
  }

  .lotics-file-gallery-dialog__rotate {
    position: absolute;
    bottom: var(--lotics-space-24);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    /* The band is a positioning frame, not a target — only the cluster inside it
       takes the pointer, so the image under it stays reachable. */
    pointer-events: none;
  }

  .lotics-file-gallery-dialog__rotate-cluster {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--lotics-space-4);
    padding-block: var(--lotics-space-6);
    padding-inline: var(--lotics-space-8);
    border-radius: var(--lotics-radius-full);
    background-color: var(--lotics-scrim-strong);
    pointer-events: auto;
  }
}
