/* ── The logo cell and its panel (issue #339) ────────────────────────────────────────────────
   The cell is a grid area of body.lf-shell-grid (shell.css): the corner of the dock area, as
   tall as the application bar and as wide as the left zone, holding an image and nothing else.
   It is drawn in the bar's own colours because it is the bar's neighbour, not a dock zone.

   The panel is a floating, NON-modal popover: no backdrop, nothing behind it is made inert, and
   it closes on Esc, on a click outside, or on a second click on the logo. It is placed by
   core/logoPanel.ts under the cell; the rules below only dress it. */

.lf-logo-cell {
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  justify-content: center;
  /* The floor when the left zone is empty: room for the picture and its padding. */
  min-width: 3.25rem;
  /* One toolbar tall: the first row of the grid is never shorter than this. */
  min-height: var(--lf-bar-height, 2.5rem);
  max-height: var(--lf-bar-height, 2.5rem);
  background: var(--lf-theme-header-bg, #212529);
  color: var(--lf-theme-header-fg, #f8f9fa);
  position: relative;
  z-index: 1;
}

.lf-logo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0.3rem 0.5rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.lf-logo-btn:hover,
.lf-logo-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.12); }
.lf-logo-btn:focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }

.lf-logo-img {
  display: block;
  max-width: 100%;
  /* The cell is as tall as the bar; the picture is the cell less its padding. */
  max-height: calc(var(--lf-bar-height, 2.5rem) - 0.6rem);
  object-fit: contain;
  transition: opacity 0.35s ease;
}
.lf-logo-img.lf-logo-fading { opacity: 0; }

/* ── The panel ──────────────────────────────────────────────────────────────────────────── */
.lf-logo-panel {
  position: fixed;
  /* Above the dock zones and the bar, below the toast and the modal layers. */
  z-index: 1074;
  box-sizing: border-box;
  width: min(22rem, calc(100vw - 1rem));
  max-height: calc(100dvh - 1rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0 0 0.75rem;
  background: var(--lf-theme-popup-bg, #fff);
  color: var(--lf-theme-popup-fg, #212529);
  border: 1px solid var(--lf-theme-popup-border, #dee2e6);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.lf-logo-panel[hidden] { display: none; }

.lf-logo-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--lf-theme-popup-header-bg, #f1f3f5);
  color: var(--lf-theme-popup-header-fg, inherit);
  border-radius: 6px 6px 0 0;
}
.lf-logo-panel-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lf-logo-panel-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
}
.lf-logo-panel-close:hover { background: rgba(127, 127, 127, 0.2); }

.lf-logo-panel-home {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0.75rem;
  color: inherit;
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}
.lf-logo-panel-home:hover { background: rgba(127, 127, 127, 0.15); text-decoration: underline; }

.lf-logo-panel-copy {
  width: calc(100% - 1.5rem);
  border: 0;
  background: transparent;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.lf-logo-panel-copy[hidden] { display: none; }

.lf-logo-panel-about { margin: 0 0.75rem; }
.lf-logo-panel-about h3 {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}
.lf-logo-panel-about p { margin: 0 0 0.25rem; font-size: 0.9rem; }
.lf-logo-panel-version { opacity: 0.7; }

.lf-logo-panel-carousel {
  position: relative;
  margin: 0 0.75rem;
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The picture sits on the bar's colour: the default mark is white, made for it. */
  background: var(--lf-theme-header-bg, #212529);
  border-radius: 4px;
  overflow: hidden;
}
.lf-logo-panel-img {
  display: block;
  max-width: 100%;
  max-height: 14rem;
  object-fit: contain;
  transition: opacity 0.35s ease;
}
.lf-logo-panel-img.lf-logo-fading { opacity: 0; }
.lf-logo-panel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  padding: 0.5rem 0.4rem;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  cursor: pointer;
}
.lf-logo-panel-nav:hover { background: rgba(0, 0, 0, 0.65); }
.lf-logo-panel-prev { left: 0; border-radius: 0 4px 4px 0; }
.lf-logo-panel-next { right: 0; border-radius: 4px 0 0 4px; }

@media (prefers-reduced-motion: reduce) {
  .lf-logo-img,
  .lf-logo-panel-img { transition: none; }
}
