/* =========================================================
   CLEAN MOBILE HEADER
   Desktop is untouched.
   ========================================================= */

@media (max-width:768px){

  /* Hide the entire production desktop/shared header */
  .psd-shared-header{
    display:none !important;
  }


  /* =======================================================
     HEADER SHELL
     ======================================================= */

  .psd-mobile-clean-header{
    position:relative;

    display:grid;

    grid-template-columns:
      60px
      minmax(0,1fr)
      56px;

    grid-template-rows:
      54px
      20px;

    column-gap:7px;
    row-gap:1px;

    align-items:center;

    width:100%;
    max-width:100%;

    padding:
      7px
      8px
      5px;

    box-sizing:border-box;

    background:#f6f8fa;

    border-bottom:
      1px solid #aebdca;

    z-index:10000;
  }


  /* =======================================================
     LOGO
     ======================================================= */

  .psd-mobile-clean-logo-wrap{
    grid-column:1;
    grid-row:1 / 3;

    align-self:start;

    display:flex;
    flex-direction:column;
    align-items:center;

    width:60px;

    text-decoration:none;
  }

  .psd-mobile-clean-logo{
    width:54px !important;
    height:54px !important;

    max-width:none !important;

    object-fit:contain;

    padding:3px;

    box-sizing:border-box;

    border-radius:15px;

    background:#080c11;

    box-shadow:
      0 5px 15px
      rgba(210,153,34,.32);
  }

  .psd-mobile-clean-home{
    margin-top:2px;

    font-family:
      Georgia,
      "Times New Roman",
      serif;

    font-size:9px;
    line-height:1;

    color:#74500d;
  }


  /* =======================================================
     GOLD AI-BUILT BANNER
     SMALLER / RIGHT OF LOGO / TEXT CENTERED
     ======================================================= */

  .psd-mobile-clean-ai-banner{
    grid-column:2;
    grid-row:1;

    justify-self:end;

    position:relative;
    top:3px;

    width:230px;
    max-width:100%;

    min-height:22px;

    display:flex;
    align-items:center;
    justify-content:center;

    padding:3px 7px;

    box-sizing:border-box;

    border:
      1px solid
      rgba(210,153,34,.38);

    border-radius:999px;

    background:
      linear-gradient(
        90deg,
        #fffdf3,
        #fff6cf,
        #fffdf3
      );

    background-size:220% 100%;

    box-shadow:
      0 4px 14px
      rgba(210,153,34,.17);

    color:#74500d;

    font-family:
      Georgia,
      "Times New Roman",
      serif;

    /*
      Deliberately much smaller
      than the previous mobile banner.
    */
    font-size:7px;
    font-weight:500;

    letter-spacing:.25px;

    line-height:1;

    text-align:center;

    white-space:nowrap;

    overflow:hidden;

    animation:
      psd-mobile-gold-dance
      4.5s ease-in-out infinite;
  }


  /* =======================================================
     MENU BUTTON
     ======================================================= */

  .psd-mobile-clean-menu-button{
    grid-column:3;
    grid-row:1;

    justify-self:end;
    align-self:start;

    margin-top:1px;

    width:54px;
    height:30px;

    padding:0 5px;

    border:
      1px solid
      rgba(210,153,34,.55);

    border-radius:999px;

    background:
      linear-gradient(
        180deg,
        #f4c640,
        #806009
      );

    color:#111;

    font-size:9px;
    font-weight:900;

    cursor:pointer;

    box-shadow:
      0 4px 10px
      rgba(0,0,0,.20);
  }


  /* =======================================================
     GLOBAL MARKET LINE
     REAL ELEMENT — CENTERED + ANIMATED
     ======================================================= */

  .psd-mobile-clean-global-line{
    grid-column:2 / 4;
    grid-row:2;

    justify-self:center;
    align-self:center;

    width:100%;

    text-align:center;

    font-family:
      Georgia,
      "Times New Roman",
      serif;

    font-size:11px;
    font-weight:700;

    line-height:1;

    white-space:nowrap;


    /*
      Moving rainbow text.
      Because this is now a REAL element,
      the animation is no longer fighting
      the old ::after pseudo-element.
    */
    background:
      linear-gradient(
        90deg,
        #d84d9e 0%,
        #7b57e2 18%,
        #198fca 36%,
        #17a476 54%,
        #d39c22 72%,
        #d84d9e 90%,
        #7b57e2 100%
      );

    background-size:
      280% 100%;

    -webkit-background-clip:text;
    background-clip:text;

    -webkit-text-fill-color:
      transparent;

    color:transparent;

    animation:
      psd-mobile-global-rainbow
      4s linear infinite;
  }


  /* =======================================================
     MENU PANEL
     ======================================================= */

  .psd-mobile-clean-menu{
    display:none;

    position:absolute;

    left:8px;
    right:8px;

    top:
      calc(100% + 4px);

    max-height:
      calc(100dvh - 95px);

    overflow-y:auto;
    overflow-x:hidden;

    padding:8px;

    border:
      1px solid #9cafbf;

    border-radius:12px;

    background:#fff;

    box-shadow:
      0 18px 46px
      rgba(0,0,0,.28);

    z-index:100001;
  }

  .psd-mobile-clean-menu.open{
    display:grid;

    grid-template-columns:
      1fr 1fr;

    gap:6px;
  }

  .psd-mobile-clean-menu a,
  .psd-mobile-clean-menu button{
    display:flex;

    align-items:center;
    justify-content:flex-start;

    width:100%;
    min-width:0;
    min-height:38px;

    margin:0;
    padding:8px 9px;

    box-sizing:border-box;

    border:
      1px solid #c1ced9;

    border-radius:8px;

    background:#f7fafc;
    color:#081521;

    text-decoration:none;
    text-align:left;

    font-family:
      "Inter",
      "Segoe UI",
      Arial,
      sans-serif;

    font-size:10px;
    font-weight:700;

    line-height:1.15;
  }

  .psd-mobile-clean-menu a[href*="market-pulse"],
  .psd-mobile-clean-menu a[href*="market-intelligence"]{
    border-color:#d29922;
    background:#fff9e8;
  }


  /* =======================================================
     DARK MODE
     ======================================================= */

  body.dark-mode
  .psd-mobile-clean-header{
    background:#0d131d;
    border-bottom-color:#273445;
  }

  body.dark-mode
  .psd-mobile-clean-ai-banner{
    background:#111927;
    color:#ffd780;
  }

  body.dark-mode
  .psd-mobile-clean-menu{
    background:#101721;
    border-color:#334155;
  }

  body.dark-mode
  .psd-mobile-clean-menu a,
  body.dark-mode
  .psd-mobile-clean-menu button{
    background:#18212e;
    color:#fff;
    border-color:#334155;
  }
}


/* =========================================================
   SMALLER IPHONES
   ========================================================= */

@media (max-width:390px){

  .psd-mobile-clean-header{
    grid-template-columns:
      55px
      minmax(0,1fr)
      51px;

    column-gap:5px;

    padding-left:6px;
    padding-right:6px;
  }

  .psd-mobile-clean-logo-wrap{
    width:55px;
  }

  .psd-mobile-clean-logo{
    width:50px !important;
    height:50px !important;
  }

  .psd-mobile-clean-ai-banner{
    width:205px;
    font-size:6.5px;
  }

  .psd-mobile-clean-menu-button{
    width:50px;
    height:29px;
    font-size:8.5px;
  }

  .psd-mobile-clean-global-line{
    font-size:10px;
  }
}


/* =========================================================
   320px PHONES
   ========================================================= */

@media (max-width:340px){

  .psd-mobile-clean-ai-banner{
    width:175px;
    font-size:5.75px;
  }

  .psd-mobile-clean-global-line{
    font-size:9px;
  }

  .psd-mobile-clean-menu.open{
    grid-template-columns:1fr;
  }
}


/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes psd-mobile-gold-dance{

  0%,
  100%{
    background-position:0% 50%;
    box-shadow:
      0 4px 14px
      rgba(210,153,34,.14);
  }

  50%{
    background-position:100% 50%;
    box-shadow:
      0 4px 18px
      rgba(210,153,34,.27);
  }
}


@keyframes psd-mobile-global-rainbow{

  0%{
    background-position:0% 50%;
  }

  100%{
    background-position:280% 50%;
  }
}

/* =========================================================
   GOLD DANCING BANNER — SIZE ONLY
   Position intentionally unchanged.
   ========================================================= */

@media (max-width:768px){

  .psd-mobile-clean-ai-banner{
    width:250px !important;
    min-height:27px !important;

    padding:4px 9px !important;

    font-size:8.5px !important;
    line-height:1.1 !important;
  }
}

@media (max-width:390px){

  .psd-mobile-clean-ai-banner{
    width:220px !important;
    min-height:26px !important;

    font-size:8px !important;
  }
}

/* =========================================================
   BASE REFINEMENT 1 — GLOBAL MARKET LINE CENTERED
   ========================================================= */

@media (max-width:768px){

  .psd-mobile-clean-global-line{
    position:absolute !important;

    left:50% !important;
    bottom:7px !important;

    transform:translateX(-50%) !important;

    width:max-content !important;
    max-width:calc(100% - 20px) !important;

    text-align:center !important;

    white-space:nowrap !important;
  }
}


/* =========================================================
   BASE REFINEMENT 2 — RESTORE GOLD BANNER DANCE
   Same visible motion style as desktop.
   ========================================================= */

@media (max-width:768px){

  .psd-mobile-clean-ai-banner{
    animation:
      psd-mobile-clean-banner-dance 3.2s ease-in-out infinite,
      psd-mobile-clean-banner-shine 2.1s ease-in-out infinite !important;

    transform-origin:center !important;

    will-change:
      transform,
      filter,
      box-shadow !important;
  }
}


@keyframes psd-mobile-clean-banner-dance{

  0%,
  100%{
    transform:translateY(0) rotate(0deg);
  }

  25%{
    transform:translateY(-2px) rotate(-.25deg);
  }

  50%{
    transform:translateY(1px) rotate(0deg);
  }

  75%{
    transform:translateY(-2px) rotate(.25deg);
  }
}


@keyframes psd-mobile-clean-banner-shine{

  0%,
  100%{
    box-shadow:
      0 0 10px rgba(210,153,34,.18);

    filter:brightness(1);
  }

  50%{
    box-shadow:
      0 0 25px rgba(240,183,47,.55),
      inset 0 0 12px rgba(255,215,128,.12);

    filter:brightness(1.12);
  }
}

@media (max-width:768px){
  .psd-mobile-clean-ai-banner{
    font-size:10.5px !important;
  }
}

@media (max-width:390px){
  .psd-mobile-clean-ai-banner{
    font-size:10px !important;
  }
}

@media (max-width:768px){
  .psd-mobile-clean-ai-banner{
    font-size:11.5px !important;
  }
}

@media (max-width:390px){
  .psd-mobile-clean-ai-banner{
    font-size:11px !important;
  }
}

/* Locked base refinement — Global Market line 2px left only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 2px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Tiny final alignment nudge — Global Market line only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 4px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Final tiny alignment nudge — Global Market line only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 8px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Final alignment — Global Market line only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 11px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Final alignment — Global Market line only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 12px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Final alignment — Global Market line only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 13px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Final alignment — Global Market line only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    left:calc(50% - 14px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Approved base — colorful banner vertical position only */
@media (max-width:768px){

  .psd-mobile-clean-global-line{
    bottom:8px !important;
    left:calc(50% - 14px) !important;
    transform:translateX(-50%) !important;
  }
}

@media (max-width:768px){

  .psd-mobile-clean-global-line{
    bottom:9px !important;
    left:calc(50% - 14px) !important;
    transform:translateX(-50%) !important;
  }
}

/* Approved base — shift both banners 5px left only */
@media (max-width:768px){

  .psd-mobile-clean-ai-banner{
    right:5px !important;
  }

  .psd-mobile-clean-global-line{
    bottom:9px !important;
    left:calc(50% - 19px) !important;
    transform:translateX(-50%) !important;
  }
}

/* =========================================================
   FINAL REMOVE MOBILE LEARNING BANNER
   ========================================================= */

@media (max-width:768px){

  .psd-learning-label,
  .header-pill.psd-learning-label,
  .psd-shared-header .psd-learning-label{
    display:none !important;
    visibility:hidden !important;
    width:0 !important;
    height:0 !important;
    min-width:0 !important;
    min-height:0 !important;
    margin:0 !important;
    padding:0 !important;
    border:0 !important;
    overflow:hidden !important;
    pointer-events:none !important;
  }
}
