.arhs-cg{
  --gap:14px;
  --radius:16px;
  --shadow:0 6px 18px rgba(0,0,0,.08);
  --shadow-hover:0 10px 26px rgba(0,0,0,.12);
  --bg:#fff;
  --muted:#555;
  --accent:var(--secondary) /* voted state */
}

.arhs-cg-header{
  margin:10px auto;
  color:var(--muted);
}

/* header text area for dates & limits */
.arhs-cg-header .arhs-cg-info{
  font-size:.95rem;
  color:var(--muted);
}

/* votes-left stays on the right if room */
.arhs-cg-header .votes-left{
  margin:0 auto;
  white-space:nowrap;
}

.arhs-cg-masonry{column-count:1; column-gap: var(--gap)}
@media(min-width:600px){.arhs-cg-masonry{column-count:2}}
@media(min-width:900px){.arhs-cg-masonry{column-count:3}}

.arhs-card{
  break-inside:avoid;
  position:relative;
  margin:0 0 var(--gap);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow:var(--shadow);
  background:var(--bg);
  transition:box-shadow .2s ease, transform .2s ease;
}
.arhs-card:hover{
  box-shadow:var(--shadow-hover);
  transform:translateY(-2px);
}

.arhs-card img{
  width:100%;
  height:auto;
  display:block;
  transition:transform .25s ease;
}
.arhs-card:hover img{
  transform:scale(1.01);
}

/* Vote button: we DO NOT set background so your theme color shows */
.arhs-vote{
  position:absolute;
  right:10px;
  bottom:10px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:999px;
  padding:10px 14px;
  font-weight:700;
  line-height:1;
  box-shadow:0 6px 16px rgba(0,0,0,.12);
  cursor:pointer;
  user-select:none;
  transition:
    transform .15s ease,
    color .15s ease,
    border-color .15s ease,
    box-shadow .15s ease;
}
.arhs-card:hover .arhs-vote{ transform:translateY(-2px); }
.arhs-vote:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

/* Voted state (keeps your bg) adds border + better contrast */
.arhs-card[data-voted="1"] .arhs-vote{
  border-color:var(--accent);
  color:#fff;
  box-shadow:0 8px 18px rgba(var(--secondary-hex),.35);
}

/* Loading/disabled state */
.arhs-vote[disabled],
.arhs-vote.is-loading{
  cursor:default;
  opacity:.85;
  box-shadow:0 4px 12px rgba(0,0,0,.08);
  transform:none !important;
}

/* Inline spinner while voting */
.arhs-spinner{
  display:inline-block;
  width:16px;
  height:16px;
  margin-right:8px;
  vertical-align:-3px;
  border-radius:50%;
  border:2px solid currentColor;
  border-right-color:transparent;
  animation:arhs-spin .65s linear infinite;
}
@keyframes arhs-spin{ to { transform: rotate(360deg); } }

/* Error toast (bigger, red) — only on failures */
.arhs-toast{
  position:fixed;
  left:50%;
  bottom:24px;
  transform:translateX(-50%);
  background:#b00020;
  color:#fff;
  padding:14px 18px;
  border-radius:12px;
  font-weight:700;
  font-size:1rem;
  opacity:0;
  transition:opacity .2s, transform .2s;
  z-index:9999;
  pointer-events:none;
  box-shadow:0 10px 24px rgba(176,0,32,.35);
}
.arhs-toast.show{
  opacity:1;
  transform:translateX(-50%) translateY(-4px);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .arhs-card,
  .arhs-card img,
  .arhs-vote,
  .arhs-toast{
    transition:none !important;
  }
}


.arhs-count{
  position:absolute;
  left:10px;
  bottom:10px;
  background:rgba(var(--primary-hex),.75);
  color:#fff;
  font-size:.9rem;
  font-weight:600;
  padding:7px 22px;
  border-radius:999px;
  box-shadow:0 4px 10px rgba(0,0,0,.15);
  user-select:none;
  transition:background .2s ease, transform .15s ease;
}
.arhs-card:hover .arhs-count{
  background:rgba(0,0,0,.9);
  transform:translateY(-2px);
}

/* Lightbox */
.arhs-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  grid-template-areas: "prev img next" "caption caption caption";
  grid-template-columns: 60px 1fr 60px;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.arhs-lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

/* backdrop always behind */
.arhs-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  z-index: 0;
}

/* elements above */
.arhs-lightbox-img,
.arhs-lightbox-prev,
.arhs-lightbox-next,
.arhs-lightbox-close,
.arhs-lightbox-caption {
  z-index: 1;
}

/* responsive, larger on big screens */
.arhs-lightbox-img {
  grid-area: img;
  max-width: 96vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  border-radius: 10px;
  transition: transform .3s ease;
}
.arhs-lightbox.open .arhs-lightbox-img:hover {
  transform: scale(1.01);
}

/* caption */
.arhs-lightbox-caption {
  grid-area: caption;
  color: #fff;
  padding: 12px 16px 18px;
  text-align: center;
  max-width: 92vw;
  font-size: 1rem;
}

/* common button style */
.arhs-lightbox-close, 
.arhs-lightbox-prev, 
.arhs-lightbox-next {
    border-radius: 25%;
    border: none;
    color: #fff;
    background: rgba(var(--secondary-hex),.80);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    line-height: 1;
    transition: background .2s ease, transform .2s ease;
    padding: 5px 30px 10px;
    z-index: 99;
}

.arhs-lightbox-close:hover,
.arhs-lightbox-prev:hover,
.arhs-lightbox-next:hover {
  background: rgba(var(--secondary-hex),1);
  transform: scale(1.1);
}

/* close button */
.arhs-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* prev/next navigation */
.arhs-lightbox-prev,
.arhs-lightbox-next {
  position: fixed;
  top: 25%;
}

.arhs-lightbox-prev { left: 24px; }
.arhs-lightbox-next { right: 24px; }


/* Post-vote popup */
.arhs-popup {
  position: fixed;
  inset: 0;
  z-index: 100000; /* above lightbox */
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.arhs-popup.open {
  opacity: 1;
  pointer-events: auto;
}

/* dim background */
.arhs-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

.arhs-popup-content{
  text-align: center;
  position: relative;
  display: block;
  height: 100%;
}

/* the box that grows from button to center */
.arhs-popup-box {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%,-20%) translate(var(--dx,0), var(--dy,0)) scale(.2);
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .28s ease;
  opacity: 0;
  max-width: min(680px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: #fff;
  color: #111;
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(0,0,0,.35);
  padding: 80px 40px;
  width: 100vw;
  height: 100vh;
}


/* final state */
.arhs-popup.open .arhs-popup-box {
  transform: translate(-50%,-20%) translate(0,0) scale(1);
  opacity: 1;
}

/* close button */
.arhs-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.08);
  color: #111;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.arhs-popup-close:hover { background: rgba(0,0,0,.14); }

/* content area */
.arhs-popup-content > :first-child { margin-top: 0; }
.arhs-popup-content img { max-width: 100%; height: auto; border-radius: 8px; }
