/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Arial', sans-serif;
    background: white;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
}

/* Leaf-ometer wrapper */
.leafometer-wrapper {
    position: relative;
    width: 300px;
}

/* Leaf-ometer container */
#leafometer {
    position: relative;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: #fff;
    overflow: visible;
    z-index: 1;
}

/* Background image */
#leafometer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Needle positioning */
#leafometer svg {
    position: absolute;
    top: 45%;
    left: 52%;
    transform-origin: center bottom;
    transform: translate(-50%, -50%);
    z-index: 100;
    transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

/* Bounce animation keyframes */
@keyframes needleBounce {
    0% {
        transform: translate(-50%, -50%) rotate(var(--start-angle));
    }
    20% {
        transform: translate(-50%, -50%) rotate(calc(var(--target-angle) + 5deg));
    }
    40% {
        transform: translate(-50%, -50%) rotate(calc(var(--target-angle) - 3deg));
    }
    60% {
        transform: translate(-50%, -50%) rotate(calc(var(--target-angle) + 2deg));
    }
    80% {
        transform: translate(-50%, -50%) rotate(calc(var(--target-angle) - 1deg));
    }
    100% {
        transform: translate(-50%, -50%) rotate(var(--target-angle));
    }
}

/* Bounce class for animation */
#leafometer svg.bouncing {
    animation: needleBounce 0.8s ease-out forwards;
}

/* Needle positions based on step classes (275-295 degree range) */
#leafometer.step10 svg {
    transform: translate(-50%, -50%) rotate(275deg);
}

#leafometer.step20 svg {
    transform: translate(-50%, -50%) rotate(277deg);
}

#leafometer.step30 svg {
    transform: translate(-50%, -50%) rotate(280deg);
}

#leafometer.step40 svg {
    transform: translate(-50%, -50%) rotate(283deg);
}

#leafometer.step50 svg {
    transform: translate(-50%, -50%) rotate(285deg);
}

#leafometer.step60 svg {
    transform: translate(-50%, -50%) rotate(287deg);
}

#leafometer.step70 svg {
    transform: translate(-50%, -50%) rotate(290deg);
}

#leafometer.step80 svg {
    transform: translate(-50%, -50%) rotate(292deg);
}

#leafometer.step90 svg {
    transform: translate(-50%, -50%) rotate(300deg);
}

#leafometer.step100 svg {
    transform: translate(-50%, -50%) rotate(325deg);
}

/* Dropdown styling */
.leafometer__options {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 15px;
    border: 2px solid #2c5530;
    border-radius: 25px;
    background: #fff;
    color: #2c5530;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    z-index: 200;
    min-width: 200px;
    text-align: center;
    display: block;
}

.leafometer__options:hover {
    background: #2c5530;
    color: #fff;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.leafometer__options:focus {
    border-color: #4a7c59;
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    #leafometer {
        width: 250px;
        height: 250px;
    }
    
    .leafometer__options {
        font-size: 12px;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    #leafometer {
        width: 200px;
        height: 200px;
    }
    
    .leafometer__options {
        bottom: -35px;
        font-size: 11px;
    }
}
/* Example */
.big-title { font-size: clamp(18px, 2.2rem, 40px); }
.container { max-width: 520px; margin: 24px auto; padding: 0 12px; }
body { min-height: 0; }
.viewport-center {
  min-height: 0;            /* instead of 100vh */
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0;
}
/* === EMBED MODE OVERRIDES === */
html, body {
    height: auto !important;
    overflow: visible !important;  /* so dropdown isn’t clipped */
  }
  
  body {
    display: block !important;     /* avoid flex centering side-effects if used */
  }
  
  .container {
    height: auto !important;       /* if it was 100vh anywhere */
    min-height: 0 !important;
  }
  
  .leafometer-wrapper {
    margin: 24px auto;             /* simple centering */
    max-width: 520px;              /* adjust as you like */
  }
  /* --- LEAFOMETER iframe overrides --- */

/* 1) Never clip inside the iframe */
html, body { height:auto !important; overflow:visible !important; }

/* 2) Wrapper: give it space for the dropdown so it's not outside the box */
.leafometer-wrapper {
  position: relative;
  overflow: visible !important;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 72px;          /* room for the select */
}

/* 3) Center the gauge and nudge it slightly right for visual balance */
#leafometer {
  margin: 0 auto;                /* true center */
  display: block;
  transform: translateX(12px);   /* tiny right nudge; tweak 8–16px to taste */
}

/* 4) Dropdown: keep it *inside* the wrapper and centered */
.leafometer__options {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px !important;       /* was negative; keeps it inside */
  z-index: 10;                   /* above the graphic */
}

/* Optional: reduce dropdown width on narrow screens */
@media (max-width: 480px) {
  .leafometer__options { max-width: 260px; width: 90%; }
}
/* center stack and nudge gauge slightly LEFT */
#leafometer {
  display: block;
  margin: 0 auto;
  transform: translateX(-10px);   /* try -8 to -14px to taste */
}

/* raise the needle to sit higher on the dial */
#leafometer svg {
  display: block;
  margin: -26px auto 0;           /* negative top margin lifts it up */
  /* if it still needs more: increase the magnitude to -30/-34 etc. */
}
