/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/* =====================================================================
   Makerique Boutique — announcement bar (optional, off by default)
   Journal-style slim top notice, rendered by template/common/header.twig
   immediately after <div id="container"> when mr_announce.enabled is true.
   Sits above the topbar / header / everything.

   Colours: the template may set inline --mr-announce-bg / --mr-announce-color
   custom properties when the admin provides them; otherwise these defaults
   (brand pink background, white text) apply. .mr-announce--hidden removes the
   bar (used by the inline dismiss script, no flash).
   ===================================================================== */

.mr-announce {
  --mr-announce-bg: var(--mr-primary, #e26d8a);
  --mr-announce-color: #fff;

  width: 100%;
  background: var(--mr-announce-bg);
  color: var(--mr-announce-color);
  font-family: var(--mr-font-body, inherit);
  font-size: .85rem;
  line-height: 1.4;
}

.mr-announce--hidden {
  display: none !important;
}

.mr-announce-inner {
  box-sizing: border-box;
  max-width: var(--mr-container, 1200px);
  margin: 0 auto;
  padding: .5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .5rem 1rem;
  text-align: center;
}

.mr-announce-text {
  margin: 0;
}

/* Optional link — inherits the bar colour, underline only on hover/focus. */
.mr-announce-link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.mr-announce-link:hover,
.mr-announce-link:focus {
  color: inherit;
  text-decoration: underline;
}

/* The link is a second item next to the message: a divider dot and a gap keep the two apart.
   On phones it drops to its own line (without the dot) instead of wrapping mid-sentence. */
.mr-announce-link {
  display: inline-block;
  margin-inline-start: .9em;
  white-space: nowrap;
}

.mr-announce-link::before {
  content: "\00B7";
  margin-inline-end: .9em;
  font-weight: 700;
  opacity: .75;
  text-decoration: none;
}

@media (max-width: 575.98px) {
  .mr-announce:not(.mr-announce--marquee) .mr-announce-link {
    display: block;
    margin: .15rem 0 0;
  }

  .mr-announce:not(.mr-announce--marquee) .mr-announce-link::before {
    content: none;
  }
}

/* Close button, pinned to the right without disturbing the centered text. */
.mr-announce-close {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  padding: .25rem .4rem;
  cursor: pointer;
  opacity: .85;
  border-radius: var(--mr-radius, 8px);
  transition: opacity var(--mr-transition, .2s ease);
}

.mr-announce-close:hover,
.mr-announce-close:focus {
  opacity: 1;
}

/* The inner needs to be positioning context for the absolute close button. */
.mr-announce {
  position: relative;
}

/* Keep centered text clear of the close button on wider screens. */
@media (min-width: 576px) {
  .mr-announce--dismissible .mr-announce-inner {
    padding-right: 2.75rem;
    padding-left: 2.75rem;
  }
}

@media (max-width: 575.98px) {
  .mr-announce {
    font-size: .8rem;
  }

  .mr-announce-inner {
    padding: .5rem 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mr-announce-close {
    transition: none;
  }
}

/* =====================================================================
   Optional effects (admin-controlled): stickiness, entrance animation,
   marquee. All are additive modifier classes — the bar renders normally
   when none are present, and every animated end-state is "visible" so an
   unsupported / reduced-motion environment never hides content.
   ===================================================================== */

/* Stickiness — pin the bar to the top of the viewport on scroll. It's the
   first child of #container, so sticky keeps it above the header. */
.mr-announce--sticky {
  position: sticky;
  top: 0;
  z-index: 1090;
}

/* Entrance / attention animations. Gated behind no-preference so
   reduced-motion users just see the static (visible) bar. */
@media (prefers-reduced-motion: no-preference) {
  .mr-announce--anim-slide {
    animation: mr-announce-slide var(--mr-transition-slow, .45s) ease both;
  }

  .mr-announce--anim-fade {
    animation: mr-announce-fade var(--mr-transition-slow, .45s) ease both;
  }

  .mr-announce--anim-pulse {
    animation: mr-announce-pulse 2.4s ease-in-out infinite;
  }

  @keyframes mr-announce-slide {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
  }

  @keyframes mr-announce-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }

  @keyframes mr-announce-pulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50%      { transform: scale(1.01); filter: brightness(1.08); }
  }
}

/* Marquee — the text track scrolls horizontally while the close button
   stays pinned outside the scrolling area. */
.mr-announce--marquee .mr-announce-inner {
  overflow: hidden;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.mr-announce--marquee .mr-announce-text {
  display: block;
  width: 100%;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .mr-announce--marquee .mr-announce-track {
    display: inline-block;
    white-space: nowrap;
    will-change: transform;
    animation: mr-announce-marquee 18s linear infinite;
  }

  .mr-announce--marquee:hover .mr-announce-track,
  .mr-announce--marquee:focus-within .mr-announce-track {
    animation-play-state: paused;
  }

  @keyframes mr-announce-marquee {
    from { transform: translateX(100%); }
    to   { transform: translateX(-100%); }
  }
}

/* Reduced motion: no scroll — show the text statically. */
@media (prefers-reduced-motion: reduce) {
  .mr-announce--marquee .mr-announce-track {
    display: inline;
    white-space: normal;
  }
}
