/*
 Theme Name: CHIMPMODE Handmade
 Description: Minimal custom theme with retro vibe
 Author: Alexander
 Version: 1.0
*/

/* =========================
   Global layout
   ========================= */
body{
  margin: 0;
  padding: 0;
  background: #0f0f0f;
  color: #fff;
  font-family: Arial, sans-serif;

  background-image: url("https://i.pinimg.com/originals/f6/08/ed/f608ed3caa01c87e8ba88cd4c2b4e9d4.gif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.site-footer{
  text-align: center;
}

/* Container */
.container{
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* =========================
   Sims Button Navbar
   ========================= */
.main-nav{
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.main-nav ul.nav-menu{
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.main-nav ul.nav-menu li{
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav ul.nav-menu li a{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 6px 18px;
  min-width: 90px;
  height: 28px;
  line-height: 28px;

  font-family: "Comic Sans MS", cursive;
  font-size: 16px;
  letter-spacing: 0.04em;

  color: #c0c7cb;
  text-decoration: none;

  background: transparent;
  border: 0;
  white-space: nowrap;
  cursor: pointer;

  transition: color 0.05s ease, transform 0.05s ease;
}

.main-nav ul.nav-menu li a:hover{
  color: #fff;
}

.main-nav ul.nav-menu li a:active{
  color: #0ff;
  transform: translate(2px, 2px);
}

.main-nav ul.nav-menu li a::before{
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;

  border-radius: 10px;
  background-color: #00518c;

  box-shadow:
    -1px -1px 2px 0 #000,
     1px 1px 1px 0 rgba(255,255,255,0.5),
     inset 0 0 2px 3px #062f67,
     inset 2px 1px 1px 2px #fff;
}

/* =========================
   GIF SYSTEM (same behavior everywhere)
   ========================= */

/* Page-level stage (scrolls with page) */
.page-stage{
  position: relative;
  min-height: 100vh;
}

/* Stage layers */
.gif-stage{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5; /* behind content */
}

/* Header overlay stage (gifs sit above logo/nav) */
.site-header .header-inner{
  position: relative; /* anchor the absolute overlay */
  padding: 30px 10px 20px;
}

.header-stage{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20; /* above logo/nav */
}

/* SAME RULES for gifs in both stages */
.gif-stage .gif,
.header-stage .gif{
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);

  width: var(--w, 140px);  /* you can pass px OR % in --w */
  height: auto;

  opacity: var(--o, 1);
  transform: translate(-50%, -50%) var(--t, none);

  pointer-events: none;
}

/* Optional: lock a page-level gif to the viewport (follows scroll) */
.page-stage .gif-stage .gif--fixed{
  position: fixed;
}

/* Content stacking */
.page-stage .container{
  position: relative;
  z-index: 10; /* above page gifs */
}

.site-header .logo,
.site-header .main-nav{
  position: relative;
  z-index: 10; /* below header gifs */
}

/* Retro header panel layout */
.site-header{
  margin-top: 20px;
}

.header-panel{
  background: #e9e4d3;
  color: #111;
  border: 2px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,.4);
  padding: 0 14px 8px; /* title bar now sits flush at the top */
  margin-top: 40px;
  font-family: "Comic Sans MS", cursive;
  border-radius: 6px;
  max-width: 100%;
  box-sizing: border-box;
}

.header-panel-top{
  display: grid;
  grid-template-areas:
    "new logo cd"
    "new logo cd";
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 4px;
}

.header-badge{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffeb3b;
  color: #000;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-badge--new{
  box-shadow: 0 0 6px rgba(255, 0, 0, 0.9);
  grid-area: new;
  align-self: flex-start;
}

.header-panel .logo{
  grid-area: logo;
  justify-self: center;
}

.header-cd{
  grid-area: cd;
  align-self: center;
}

.header-cd-gif{
  width: 60px;
  height: auto;
  image-rendering: pixelated;
}

.header-panel-meta{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.header-panel-meta .highlight{
  color: #ff00e5;
  font-weight: 700;
}

.header-panel-meta .dot{
  color: #555;
}

.header-panel-body{
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.header-grid-nav{
  border-right: 1px dashed rgba(0, 0, 0, 0.4);
  padding-right: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-grid-stats{
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.site-header .main-nav{
  margin-top: 8px;
}

.site-stats{
  width: 100%;
  max-width: 100%;
  border: 2px solid #000;
  background: #1e5aa7;
  color: #fff;
  padding: 6px 8px 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-sizing: border-box;
}

.site-stats-title{
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
}

.site-stats .label{
  font-size: 11px;
  margin: 4px 0;
}

.site-stats .counter-embed{
  background: #000;
  padding: 4px 6px;
  margin: 2px 0 4px;
  min-height: 24px; /* reserve space while counter loads */
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-stats .tiny{
  font-size: 10px;
  text-align: right;
  opacity: 0.9;
}

.header-panel-marquee{
  margin-top: 8px;
  border-top: 2px solid #000;
  padding-top: 4px;
  font-size: 12px;
  background: #d4cdb9;
}

.header-panel-marquee marquee{
  font-family: "Comic Sans MS", cursive;
}

/* XP-style title bar scoped to header panel only */
.cm-title-bar{
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 11px;
  background: linear-gradient(180deg,#0997ff,#0053ee 8%,#0050ee 40%,#06f 88%,#06f 93%,#005bff 95%,#003dd7 96%,#003dd7);
  color: #fff;
  text-shadow: 1px 1px #0f1089;
  padding: 3px 6px 3px 5px;
  margin: 0 0 8px; /* becomes the actual top bar of the header panel */
  border-radius: 4px 4px 0 0;
  border: 1px solid #0831d9;
  border-bottom-color: #001ea0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cm-title-bar-text{
  font-weight: 700;
  padding-left: 3px;
}

.cm-title-bar-controls{
  display: flex;
  gap: 2px;
}

.cm-title-btn{
  min-width: 18px;
  min-height: 16px;
  padding: 0;
  border: 1px solid #0831d9;
  background: #0050ee;
  box-shadow: inset -1px -1px #001ea0, inset 1px 1px #3f8dfc;
}

.cm-title-btn--close{
  background: #d20000;
  border-color: #5a0000;
}

.cm-title-btn:focus{
  outline: none;
}

/* WooCommerce-specific GIF stacking:
   - gif-stage--back: behind product listings
   - gif-stage--front: in front of product listings
*/
.woocommerce-page .page-stage .gif-stage--back{
  z-index: 2;  /* behind container (z-index:10) but above page background */
}

.woocommerce-page .page-stage .gif-stage--front{
  z-index: 30; /* above product cards but still pointer-events:none so cards are clickable */
}

/* =========================
   WooCommerce product listings
   ========================= */
.woocommerce ul.products{
  list-style: none;
  margin: 0;
  padding: 0;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;

  align-items: start;
  justify-items: center;
}

.woocommerce ul.products li.product{
  list-style: none;
  margin: 0;
  padding: 0;

  float: none;
  width: auto;
  clear: none;

  min-width: 260px;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after{
  content: none;
}

/* Card shell */
.cm-card{
  position: relative;
  background: #e9e4d3;
  border: 0;
  box-shadow: 2px 2px 0 rgba(0,0,0,.25);
  padding: 0;
  overflow: visible;
}

.cm-card > *{
  position: relative;
  z-index: 2;
}

.cm-card::before{
  content: "";
  position: absolute;
  inset: -4px;

  border: 12px solid transparent;
  border-image-source: url("https://i.pinimg.com/originals/66/66/bd/6666bdb630e6ede8e805a0c29c5adcc5.gif");
  border-image-slice: 24;

  pointer-events: none;
  z-index: -1;
}

.cm-card-topbar,
.cm-card-subbar{
  background: #1e5aa7;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  font-size: 12px;
}

.cm-card-subbar{
  background: #2f6fd0;
  font-size: 11px;
}

.cm-pill{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
}

.cm-pill--green{ background: #2ecc71; color: #0b2a16; }
.cm-pill--red{ background: #ff5a5a; color: #3b0000; }

.cm-card-imagewrap{
  display: block;
  background: #d9e7ff;
  padding: 10px;
  border-top: 2px solid #2b6cb0;
  border-bottom: 2px solid #2b6cb0;
}

.cm-card-img{
  width: 100%;
  height: auto;
  display: block;
}

.cm-card-body{
  padding: 10px;
  text-align: center;
}

.cm-card-title{
  display: block;
  color: #0033cc;
  font-weight: 800;
  text-decoration: none;
  margin: 0 0 6px 0;
}

.cm-card-price{
  color: #c0392b;
  font-weight: 800;
  margin: 0 0 10px 0;
}

/* 88x31 GIF grid (2 columns) */
.cm-card-gifs{
  display: grid;
  grid-template-columns: repeat(2, 88px);
  gap: 6px 10px;
  justify-content: center;
  margin: 10px 0;
}

.cm-card-gifs img{
  width: 88px;
  height: 31px;
  display: block;

  image-rendering: pixelated;
  object-fit: cover;
  border: 1px solid #666;
  background: #000;
}

/* Add-to-cart / Select options button */
.cm-card .button,
.cm-card a.button,
.cm-card .add_to_cart_button,
.cm-card a.add_to_cart_button{
  display: flex;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;

  margin: 8px 0 0;
  padding: 10px 12px;

  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom “status bar” vibe */
.cm-card-footer{
  background: #d9e7ff;
  border-top: 2px solid #2b6cb0;
  padding: 8px 10px;
  font-size: 12px;
  color: #333;
}

/* Reusable inline GIF block (safe on mobile)
   Usage in templates/content:
   <div class="cm-gif-inline"><img src="...gif" alt="Description of gif"></div>
*/
.cm-gif-inline{
  display: flex;
  justify-content: center;
  margin: 20px auto;
  max-width: min(320px, 90vw);
}

.cm-gif-inline img{
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  display: block;
}

/* Hide WooCommerce result count + sorting dropdown on shop archive */
.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering,
.page-title{
  display: none !important;
}

/* GIF visibility helpers: allow desktop-only / mobile-only GIFs */
.gif--desktop-only{
  display: block;
}

.gif--mobile-only{
  display: none;
}

@media (max-width: 768px){
  .gif--desktop-only{
    display: none !important;
  }

  .gif--mobile-only{
    display: block !important;
  }
}

/* =========================
   Mobile fixes (iPhone/iOS)
   ========================= */
@media (max-width: 768px){

  /* iOS Safari hates fixed backgrounds -> fake it with a fixed ::before layer */
  body{
    background-image: none;
    position: relative;
  }

  body::before{
    content: "";
    position: fixed;
    inset: 0;
    z-index: -999;

    background-image: url("https://i.pinimg.com/originals/f6/08/ed/f608ed3caa01c87e8ba88cd4c2b4e9d4.gif");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
  }

  .main-nav{
    margin-top: 12px;
  }

  .main-nav ul.nav-menu{
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }

  .main-nav ul.nav-menu li a{
    font-family: "Comic Sans MS", "Marker Felt", "Chalkboard SE", system-ui, -apple-system, sans-serif;
    font-size: 18px;
    min-width: 120px;
    height: 34px;
    line-height: 34px;
    padding: 8px 18px;
  }

  .site-header .logo img{
    max-width: 85vw;
    height: auto;
  }

  .woocommerce ul.products{
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    justify-items: center;
  }

  .woocommerce ul.products li.product{
    width: auto;
    min-width: 260px;
  }

  /* iOS frame stacking */
  .cm-card{
    position: relative;
    z-index: 0;
    overflow: visible;
  }

  .cm-card::before{
    inset: -4px;
    z-index: -1;
  }

  /* One simple rule for BOTH header + page gifs on mobile */
  .gif-stage .gif,
  .header-stage .gif{
    /* On mobile, use mobile-specific vars if provided, otherwise fall back to desktop ones */
    left: var(--x-m, var(--x, 50%));
    top: var(--y-m, var(--y, 50%));
    width: var(--w-m, min(var(--w, 140px), 32vw));
    height: auto;
    opacity: 0.95;
  }

  .site-header{
    position: relative;
    min-height: 220px;
  }

  .gif{
    will-change: transform;
    transform-origin: center center;
  }

  .header-panel{
    margin-top: 28px;
    padding: 10px 10px 8px;
  }

  .header-panel-top{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .header-panel-meta{
    flex-wrap: wrap;
    row-gap: 2px;
    font-size: 10px;
    text-align: center;
  }

  .header-panel-body{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }

  .header-grid-nav{
    border-right: 0;
    padding-right: 0;
    order: 2;
    margin-top: 8px;
  }

  .header-grid-stats{
    order: 1;
    justify-content: center;
  }

  .site-stats{
    text-align: center;
  }

  .site-stats .tiny{
    text-align: center;
  }


}
