/* ========================================
   INTERACTIVE HYDROGEN ATOM
   ======================================== */

.hatom {
    --hatom-ink: #173e31;
    --hatom-green: #277c59;
    --hatom-mint: #a7e7c7;
    --hatom-radius: 112px;

    position: relative;
    z-index: 2;
    width: min(100%, 370px);
    margin: 20px auto 100px;
    padding: 22px;
    color: var(--hatom-ink);
    background: rgb(249 252 246 / 92%);
    border: 1px solid #d9e5d8;
    border-radius: 26px;
    box-shadow: 0 20px 55px rgb(23 62 49 / 8%);
    font-family: inherit;
}

.hatom,
.hatom *,
.hatom *::before,
.hatom *::after {
    box-sizing: border-box;
}

.hatom .hatom__heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.hatom .hatom__eyebrow {
    color: var(--hatom-green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.hatom .hatom__symbol {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.hatom .hatom__symbol small {
    margin-left: 3px;
    color: #78937e;
    font-size: 11px;
    vertical-align: super;
}

/* Interactive drawing */

.hatom .hatom__stage {
    position: relative;
    width: 100%;
    height: 290px;
}

.hatom .hatom__halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 245px;
    height: 245px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgb(115 201 150 / 25%) 0%,
        rgb(115 201 150 / 8%) 48%,
        transparent 72%
    );
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.hatom .hatom__orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(var(--hatom-radius) * 2);
    height: calc(var(--hatom-radius) * 2);
    border: 1px dashed #95b9a0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.hatom .hatom__nucleus {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    border: 1px solid #428e67;
    border-radius: 50%;
    background: radial-gradient(
        circle at 30% 25%,
        #bdeed0,
        #4eab78 58%,
        #2c7855
    );
    box-shadow:
        0 9px 24px rgb(39 124 89 / 20%),
        inset 0 2px 5px rgb(255 255 255 / 45%);
    color: #123c29;
    font-size: 29px;
    font-weight: 800;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.hatom .hatom__nucleus sup {
    font-size: 16px;
}

.hatom .hatom__nucleus-label {
    position: absolute;
    top: calc(50% + 48px);
    left: 50%;
    color: #5c7b65;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Electron: large hit area, small visible particle */

.hatom .hatom__electron {
    appearance: none;
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: grab;
    touch-action: none;
    user-select: none;
    transform: translate(-50%, -50%);
    z-index: 3;
}

.hatom .hatom__electron > span {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border: 2px solid #e6fff4;
    border-radius: 50%;
    background: #245f48;
    box-shadow:
        0 0 0 5px rgb(60 146 104 / 12%),
        0 4px 12px rgb(23 62 49 / 18%);
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

.hatom .hatom__electron:hover > span {
    background: #358b61;
}

.hatom .hatom__electron.is-dragging {
    cursor: grabbing;
}

.hatom .hatom__electron-label {
    position: absolute;
    right: 0;
    bottom: 6px;
    color: #5c7b65;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
    pointer-events: none;
}

/* Controls */

.hatom .hatom__controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 9px;
}

.hatom .hatom__play,
.hatom .hatom__reset {
    appearance: none;
    min-height: 40px;
    padding: 10px 15px;
    border: 1px solid #d0dfd0;
    border-radius: 999px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.hatom .hatom__play {
    background: var(--hatom-ink);
    color: #fff;
}

.hatom .hatom__play:hover {
    background: var(--hatom-green);
}

.hatom .hatom__reset {
    background: transparent;
    color: var(--hatom-ink);
}

.hatom .hatom__reset:hover {
    background: #e9f2e7;
}

.hatom .hatom__help {
    margin: 15px 0 0;
    color: #58715e;
    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

.hatom .hatom__disclaimer {
    margin: 8px 0 0;
    color: #7a8c7a;
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}

.hatom button:focus-visible {
    outline: 3px solid #c3983f;
    outline-offset: 4px;
}

@media (max-width: 420px) {
    .hatom {
        --hatom-radius: 96px;
        padding: 18px;
    }

    .hatom .hatom__stage {
        height: 260px;
    }
}