/* ==========================================================
   Global Base Styles
   ========================================================== */
html, body {
    height: auto;
    background-color: #66AAB9;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    color: #171717;
    font-weight: 400;
}

/* ==========================================================
   Typography & Headings
   ========================================================== */
h1 {
    color: #277E96;
    font-size: 26px;
    font-weight: bold;
}
h2 {
    font-size: 16px;
    font-weight: bold;
}
h3 {
    font-size: 14px;
}
h2, h3, h4, h5, h6, h7 {
    color: #16687E;
    font-weight: bold;
}
h1 > small,
h2 > small,
h3 > small,
h4 > small,
h5 > small,
h6 > small,
h7 > small,
h8 > small,
h9 > small {
    margin-left: .7em;
    font-size: 81%;
    text-transform: none;
}

.feedback-h3 {
    font-size: 115%;
    font-weight: normal;
    margin-left: 1rem;
}
@media (max-width: 576px) {
    .feedback-h3 {
        margin-left: 0;
    }
}

/* ==========================================================
   Layout: Columns, Content Wrappers, Pages
   ========================================================== */
.content-page {
    margin: 0 auto;
    min-height: 100%;
    padding: 0;
}

.page-content-wrapper {
    margin-bottom: 3rem !important;
}
.page-content-wrapper .article {
    background: #FFFFFF;
    box-shadow: 0px 3px 6px #00000029;
    border-radius: 12px;
    padding: 3rem 5rem;
}
@media (max-width: 991.98px) {
    .page-content-wrapper {
        padding: .7rem .7rem !important;
    }
    .page-content-wrapper .article {
        padding: .4rem .7rem;
    }
}

.content-primary {
    width: 100%;
    display: inline-block;
    margin-top: 53px;
    z-index: 1;
}

.col-content-primary {
    background-color: #F8FAFB;
    border-left: 12px solid #66AAB9;
    padding: 0 1.4em;
    overflow-x: auto;
}
@media (max-width: 576px) {
    .col-content-primary {
        padding-left: 0.7em !important;
        padding-right: 0.7em !important;
    }
}

.col-aside {
    width: 148px !important;
    flex: 0 0 148px;
    ms-flex: 0 0 148px;
    height: auto;
}

.col-aside-slideout {
    position: absolute;
    top: 0;
    left: 160px;
    width: 444px;
    height: 100%;
    min-height: 100%;
    padding-top: 93px;
    background-color: #16687E;
}
.col-aside-slideout .slideout-wrapper {
    width: 444px;
    height: 100%;
}

/* ==========================================================
   Navigation (Aside + Mobile + Primary)
   ========================================================== */

footer,
.footer {
    background-color: #EFBF0F;
}

.nav-primary-mobile {
    background-color: #FFFFFF;
    border-left: 12px solid #66AAB9;
}
.nav-primary-mobile .navbar-collapse {
    background-color: #277E96;
}
.nav-primary-mobile a.nav-link {
    height: 56px;
    line-height: 56px;
    color: #FFFFFF;
    border-bottom: .1em solid #66AAB9;
    text-transform: uppercase;
    padding: 0;
    transition-duration: 350ms;
}
.nav-primary-mobile .nav-item a.nav-link:hover {
    background-color: #16687E;
}
.nav-primary-mobile a.dropdown-item:hover {
    background-color: #277E96;
}
.nav-primary-mobile .navbar-toggler[aria-expanded='true'] > .non-expanded-icon,
.nav-primary-mobile .navbar-toggler[aria-expanded='false'] > .expanded-icon {
    display: none;
}
.nav-primary-mobile .navbar-toggler[aria-expanded='false'] > .non-expanded-icon,
.nav-primary-mobile .navbar-toggler[aria-expanded='true'] > .expanded-icon {
    display: block;
}

.nav-primary .nav-link {
    font-size: 12px;
}
.nav-primary .col-aside-slideout .navbar-toggler,
.nav-primary .col-aside-slideout .navbar-toggler:focus {
    outline: none !important;
    box-shadow: none !important;
}

.nav-aside {
    background-color: #277E96;
    width: 148px !important;
    height: 100%;
    min-height: 100%;
    display: inline-block;
}
.nav-aside .brand-wrapper {
    background-color: #FFFFFF;
    height: 93px;
    width: 148px;
    line-height: 93px;
    margin: 0;
    padding: 0;
    display: block;
}
.nav-aside .nav-item,
.nav-aside-slideout .nav-item {
    height: 56px;
    line-height: 56px;
    color: #FFFFFF;
    border-bottom: .1em solid #66AAB9;
    transition-duration: 350ms;
}
.nav-aside .nav-item:hover {
    background-color: #16687E;
}
.col-aside-slideout .nav-item:hover {
    background-color: #277E96;
}
.nav-aside .nav-item .nav-link,
.nav-aside-slideout .nav-item .nav-link {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: 34px;
}
.nav-aside .nav-item .nav-link {
    font-weight: bold;
}

.navbar-brand,
.navbar-brand img,
.navbar-brand svg {
    outline: none;
    text-align: center;
}

.nav-link-wrapper {
    position: relative;
    line-height: 56px;
    vertical-align: middle;
    margin: 0 14px;
}
.nav-link-wrapper .nav-link-icon-start,
.nav-link-wrapper .nav-link-icon-end {
    display: inline-block;
    height: 40px;
    width: 40px;
    line-height: 40px;
    text-align: center;
    vertical-align: middle;
}

.nav-aside-end {
    display: flex;
    position: absolute;
    right: 1.5em;
    top: 0;
}

/* ==========================================================
   Buttons (Primary, App, Fitbit, Breathing, etc.)
   ========================================================== */

.btn-primary-app,
.nav-link.btn.active,
.text-bg-primary {
    color: #fff;
    background-color: #277E96;
    border-color: #66AAB9;
}
.btn-primary-app:hover,
.btn-primary-app:active {
    color: #fff;
    background-color: #16687E;
    border-color: #277E96;
}

.btn.breathing {
    transition: background-color .5s ease-in-out;
}
.breathing {
    animation-duration: 8s;
    animation-iteration-count: infinite;
    animation-direction: normal;
    animation-timing-function: ease-in;
}

/* FitBit Button + Breathing Animation */
.btn-fitbit {
    background-color: #EFBF0F;
    color: #000;
}
.breathing-fitbit {
    animation-name: breathing-button-fitbit;
}
@keyframes breathing-button-fitbit {
    from, 15%, 25% {
        background-color: #EFBF0F;
    }
    50%, 75% {
        background-color: #EFBFFF;
    }
    90%, to {
        background-color: #EFBF0F;
    }
}

/* ==========================================================
   Forms & Input Elements
   ========================================================== */
.form-check.form-switch .form-check-input:checked {
    background-color: #16687E;
    border-color: #277E96;
}

.input-set-wrapper {
    margin: 0;
    border-radius: .375rem;
    border: 1px solid #dee2e6;
}

.form-error {
    margin-top: .5rem;
    transition: transform 0.4s ease-in-out;
}
.form-error.invalid-feedback {
    display: block !important;
}

.alias-test-output.is-valid,
.alias-test-output.is-invalid {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* ==========================================================
   Cards & Media Thumbnails
   ========================================================== */

.card-img-top {
    height: 211px;
    max-height: 211px;
}

.admin-controls .card-img-top svg,
.admin-controls .card-img-top img {
    max-height: 179px;
}
.admin-controls .card-img-top svg {
    fill: #277E96;
    transition: fill 0.15s ease-in-out;
}
.admin-controls .card-img-top:hover svg,
.admin-controls .card-img-top:focus svg,
.admin-controls .card-img-top svg:focus {
    fill: #16687E;
}

.admin-controls .card,
.admin-controls .card .list-group-item {
    position: inherit; /* Fixes overlay bugs */
}

/* ==========================================================
   Table Utility Classes
   ========================================================== */

.table .bt  { border-top-width: 1px; }
.table .bb  { border-bottom-width: 1px; }
.table .bl  { border-left-width: 1px; }
.table .br  { border-right-width: 1px; }

.table .bb-0,
.table tr.bb-0 > td,
.table tr.bb-0 > th {
    border-bottom-width: 0 !important;
}

/* ==========================================================
   UX/UI Visibility Helpers
   ========================================================== */

.visible-on-row-hover {
    opacity: 0;
    visibility: hidden;
    transition: visibility .1s linear, opacity .1s linear;
}
tr:hover .visible-on-row-hover,
tr:focus .visible-on-row-hover {
    opacity: 1;
    visibility: visible;
}

.hover-parent .show-on-parent-hover {
    opacity: 0;
    visibility: hidden;
    transition: visibility .1s linear, opacity .1s linear;
}
.hover-parent:hover .show-on-parent-hover,
.hover-parent:focus .show-on-parent-hover {
    opacity: .7;
    visibility: visible;
}

/* ==========================================================
   Base Card Styling (Alias Cards)
   ========================================================== */

.card.alias-card {
    position: relative;
    z-index: 5;
    border: 1px solid #dee2e6;
    background-color: #fff;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075); /* Bootstrap's shadow-sm */
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

/* Prevent layout jump during animation */
.alias-card {
    border: 2px solid transparent !important;
}

/* ==========================================================
   Flash Animation Keyframes
   ========================================================== */

@keyframes flashFadeSuccess {
    0%, 60% { background-color: #d1e7dd; border-color: #198754; }
    100%    { background-color: #fff;    border-color: #dee2e6; }
}
@keyframes flashFadeError {
    0%, 60% { background-color: #f8d7da; border-color: #dc3545; }
    100%    { background-color: #fff;    border-color: #dee2e6; }
}
@keyframes flashFadeWarning {
    0%, 60% { background-color: #fff3cd; border-color: #ffc107; }
    100%    { background-color: #fff;    border-color: #dee2e6; }
}
@keyframes flashFadeInfo {
    0%, 60% { background-color: #cff4fc; border-color: #0dcaf0; }
    100%    { background-color: #fff;    border-color: #dee2e6; }
}

/* ==========================================================
   Flash Application Styles
   ========================================================== */

.card.card-flash-success { animation-name: flashFadeSuccess; }
.card.card-flash-error   { animation-name: flashFadeError; }
.card.card-flash-warning { animation-name: flashFadeWarning; }
.card.card-flash-info    { animation-name: flashFadeInfo; }

.card-flash-success,
.card-flash-error,
.card-flash-warning,
.card-flash-info {
    animation-duration: 2s;
    animation-fill-mode: both;
    animation-timing-function: ease-in-out;
    transition: all 0.4s ease-in-out;
}

.card.card-flash-success {
    border: 2px solid #198754 !important;
    background-color: #d1e7dd !important;
}
.card.card-flash-error {
    border: 2px solid #dc3545 !important;
    background-color: #f8d7da !important;
}
.card.card-flash-warning {
    border: 2px solid #ffc107 !important;
    background-color: #fff3cd !important;
}
.card.card-flash-info {
    border: 2px solid #0dcaf0 !important;
    background-color: #cff4fc !important;
}

/* Optional glowing outline */
.card.card-flash-glow {
    box-shadow:
        0 0 0.25rem 0.15rem rgba(0, 0, 0, 0.1),
        0 0 0.75rem 0.3rem currentColor !important;
}

/* Improve readability of card headers during flash */
.card-flash-success .card-header,
.card-flash-error .card-header,
.card-flash-warning .card-header,
.card-flash-info .card-header {
    color: #000 !important;
}

/* ==========================================================
   Flip Fade Text/Icon Utility (e.g. status indicators)
   ========================================================== */

.fade-flip {
    --flip-duration: 4s;
    --fade-window : .35s;
    display: inline-grid;
    place-items: center;
    vertical-align: middle;
    line-height: 1;
}
.fade-flip > .face {
    grid-area: 1 / 1;
    opacity: 0;
    transition: opacity var(--fade-window) linear;
}
.fade-flip > .text-face {
    animation: showText var(--flip-duration) infinite;
}
.fade-flip > .icon-face {
    animation: showIcon var(--flip-duration) infinite;
}

/* Alignment */
.fade-flip.text-start  > .face { justify-self: start;  text-align: left; }
.fade-flip.text-center > .face { justify-self: center; text-align: center; }
.fade-flip.text-end    > .face { justify-self: end;    text-align: right; }
.fade-flip.text-start  > .icon-face,
.fade-flip.text-end    > .icon-face { justify-self: center; text-align: center; }

/* Variants */
.fade-flip.slow {
    --flip-duration: 8s;
    --fade-window : .70s;
}
.fade-flip.fast {
    --flip-duration: 2s;
    --fade-window : .175s;
}

/* Optional pause hook */
.fade-flip.flip-paused > .face {
    animation-play-state: paused;
}

@keyframes showText {
    0%, 75%, 100% { opacity: 1; }
    25%, 50%      { opacity: 0; }
}
@keyframes showIcon {
    0%, 25%, 100% { opacity: 0; }
    50%, 75%      { opacity: 1; }
}

/* ==========================================================
   Charting Colors & Labels
   ========================================================== */

.chart-axis {
    border: 0 solid #A5A5A5;
}
.chart-labels {
    color: #8E8E8E;
    font-size: 10px;
}
.chart-level {
    border: 4px dotted #2A8AA4;
}

/* Static color tokens - I have absolutely no idea what these are anymore, but I'm keeping them in */
color-normal-1 { background-color: #66AAB9; }
color-caution-1 { background-color: #EFBF0F; }
.color-normal-1 { background-color: #66AAB9; }
.color-caution-1 { background-color: #EFBF0F; }

/* Chart container */
.health-chart {
    padding: 0 3rem;
    min-height: 240px;
    height: 240px;
    max-height: 300px;
}
@media (max-width: 576px) {
    .health-chart {
        padding-right: .25rem;
        padding-left: .25rem;
    }
}

/* ==========================================================
   Utility & Layout Classes
   ========================================================== */

.position-inherit {
    position: inherit !important;
}
.cursor-pointer {
    cursor: pointer;
}
.no-arrow.dropdown-toggle::before {
    display: none !important;
    margin: 0;
    padding: 0;
}
.d-svg-block > svg {
    display: block;
}

.no-scrollbar {
    overflow-x: hidden !important;
}
.collapse.show .no-scrollbar {
    overflow-x: auto !important;
}

/* Consistent tab height across alias cards */
.consistent-height .tab-content {
    display: flex;
}
.consistent-height .tab-content > .tab-pane {
    display: block;        /* override bootstrap’s display:none */
    visibility: hidden;    /* preserve layout */
    margin-right: -100%;
    width: 100%;
}
.consistent-height .tab-content > .active {
    visibility: visible;
}

/* Responsive header alignment inside cards */
.alias-card .card-header {
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
}
@media (min-width: 576px) {
    .alias-card .card-header {
        flex-direction: row;
        align-items: center;
    }
}

/* ==========================================================
   Misc UI Elements
   ========================================================== */

#debug-panel {
    box-shadow: 0px 3px 6px #00000029;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 3rem;
    margin-bottom: 4rem;
}

.card-link,
.study-row a {
    text-decoration: none !important;
}

.phone-num {
    font-family: sans-serif;
}

/* Drop Zone Styling */
#delete-drop-zone {
    border: 2px dashed #dc3545;
    border-radius: 4px;
    padding: 1rem;
    text-align: center;
    margin-top: 2rem;
    color: #dc3545;
    font-weight: bold;
}

/* Circular callouts */
.circle {
    border-radius: 100%;
    background-color: #EFBF0F;
    color: #000000;
    width: 130px;
    height: 130px;
    margin: 20px auto;
    font-weight: bold;
    display: block;
}
.circle > p {
    line-height: 130px;
    text-align: center;
    font-size: 52px;
    font-weight: 300;
    vertical-align: center; /* invalid but keeping it */
}
.circle.decimal > p {
    font-size: 42px;
}
/* ALTERNATE */
/*
.circle {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 100%;
    background-color: #EFBF0F;
    color: #000000;
    width: 130px;
    height: 130px;
    margin: 20px auto;
    font-weight: bold;
}
.circle > p {
    line-height: 1;
    font-size: 52px;
    font-weight: 300;
}
 */

/* ==========================================================
   Animation Delay Utilities
   ========================================================== */
.animation-delay-1  { animation-delay: 1s; }
.animation-delay-2  { animation-delay: 2s; }
.animation-delay-3  { animation-delay: 3s; }
.animation-delay-4  { animation-delay: 4s; }
.animation-delay-5  { animation-delay: 5s; }
.animation-delay-10 { animation-delay: 10s; }
.animation-delay-15 { animation-delay: 15s; }
.animation-delay-20 { animation-delay: 20s; }
.animation-delay-30 { animation-delay: 30s; }
.animation-delay-40 { animation-delay: 40s; }
.animation-delay-50 { animation-delay: 50s; }
.animation-delay-60 { animation-delay: 60s; }

/* =======================
   Accordion Image Rules
   ======================= */
.accordion-body {
    overflow: hidden;              /* Prevent images from popping out */
    position: relative;            /* Contain floats, just in case */
}

.accordion-body img {
    max-width: 100%;
    height: auto;
    display: block;
    /* Remove margin/padding here to avoid interfering with custom classes */
}

/* ===== UTILITY CLASSES ===== */

/* Full width image (only if you want it to be full width) */
.img-w-100 {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin-bottom: 1rem;
}

/* Float left (opt-in) */
.img-float-left {
    float: left !important;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    display: block;
    max-width: 100%;
}

@media (min-width: 600px) {
    .img-float-left {
        max-width: 350px;
    }
}

/* Float right (opt-in) */
.img-float-right {
    float: right !important;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    display: block;
    max-width: 100%;
}

@media (min-width: 600px) {
    .img-float-right {
        max-width: 350px;
    }
}

/* Clearfix helper if needed for floated images after text */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================
   Brand Icons (Fitbit, etc.)
   ========================================================== */

.fitbit-icon {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5rem;
    margin-top: -.4rem;
}

.fitbit-icon svg {
    width: 24px;
    height: 24px;
    fill: #00B0B9;
}

.jumbotron {
    background: #FFFFFF;
    box-shadow: 0px 3px 6px #00000029;
    border-radius: 12px;
    margin-bottom: 1.5rem !important;
    padding: 1.5rem 1rem; /* if not explicitly set, add this */
}
.chart-card {
    padding: 1rem;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0px 3px 6px #00000029;
}

/* ==========================================================
   Page Alerts & Header Wrapper
   ========================================================== */

.page-header-wrapper {
    position: relative;
    z-index: 1;
    min-height: 3rem; /* Ensures content below stays in place */
    margin-bottom: 1rem;
}

/* ========================================
   Page Alert Stack & Transitions
   ======================================== */
.page-alert {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; /* space between alerts */
}

.page-alert > .alert {
    pointer-events: auto;
    width: fit-content;
    max-width: 99%;
    transition:
        opacity 0.4s ease,
        transform 0.3s ease,
        margin 0.3s ease;
}

.alert.fade {
    opacity: 0;
    transform: translateY(-0.75rem);
}

.alert.fade.show {
    opacity: 1;
    transform: translateY(0);
}


@keyframes fadeInAlert {
    0% {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
.alert-next-dismiss {
    outline: 2px dashed #ff9800;
    outline-offset: 2px;
    animation: fadeOutline 1s ease-in-out 0s 3;
}

@keyframes fadeOutline {
    0% { outline-color: #ff9800; }
    50% { outline-color: #ffc107; }
    100% { outline-color: #ff9800; }
}

/* ========================================
   Data Viewer - Tabbed
   ======================================== */
/* ================================
   Data Viewer / Data Pre Box CSS
   ================================ */

.data-pre-box-wrap {
    position: relative;
    width: 100%;
}

.data-pre-box {
    position: relative;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
    background: #f8f9fa;
    color: #212529;
    padding: 1em 2.5em 2.2em 1em;   /* Notice more bottom padding for the copy button */
    border-radius: 0.5em;
    margin: 0;
    font-size: 1rem;
    line-height: .4rem; /* Tighter line gap */
    white-space: pre;
    overflow: auto;
    width: 100%;
    min-height: 240px;
    max-height: 500px;
}

/* Copy button - always fixed to bottom right of .data-pre-box, never overlaps text */
.data-pre-box-wrap .copy-btn {
    position: absolute;
    right: 1.4rem;
    bottom: 1.4rem;
    z-index: 3;
    display: block;
    align-items: center;
    gap: 0.5em;
    background: #6c757d;
    color: #fff;
    border: none;
    min-width: 80px;
    padding: 0.35em 1.2em 0.35em 0.8em;
    transition: transform 0.15s cubic-bezier(.57,1.65,.56,.93), background 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

/* Animate pop on "Copied!" */
.data-pre-box-wrap .copy-btn.copied {
    transform: scale(1.15) translateY(-4px);
    background: #28a745;
    color: #fff;
}

/* Icon and text smooth transitions, and allow hiding icon */
.data-pre-box-wrap .copy-btn .copy-btn-text,
.data-pre-box-wrap .copy-btn .copy-btn-icon {
    transition: color 0.2s, opacity 0.18s;
    display: inline-block;
}

.data-pre-box-wrap .copy-btn:active {
    transform: scale(0.96);
}

.data-pre-box-wrap .copy-btn .copy-btn-icon {
    font-size: 1.1em;
    margin-left: 0.3em;
}

/* Alternating bands for data lines */
.data-pre-box .line-odd,
.data-pre-box .line-even {
    display: block;
    margin: 0;
    width: 100vw;      /* Extend band width to cover scroll */
    min-width: 100%;
    box-sizing: border-box;
    padding: .8rem 0.25em;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: auto;
}
.data-pre-box .line-odd  { background: #f5f5f5; }
.data-pre-box .line-even { background: #e9ecef; }

.table-responsive { overflow-x: auto; }

.tab-content > .tab-pane {
    overflow-x: auto;
    padding: 1em;
    min-height: 260px;
}

.nav.nav-tabs.justify-content-end {
    flex-direction: row-reverse;
}
.nav.nav-tabs.justify-content-end .nav-item:last-child {
    margin-left: auto;
}

/* =========================
   DARK MODE SUPPORT
   ========================= */
/* Any ancestor .dark-mode enables dark mode on all data viewers and tables below it */
.dark-mode .data-pre-box {
    background: #23272b;
    color: #eee;
}
.dark-mode .data-pre-box .line-odd  { background: #272b30; }
.dark-mode .data-pre-box .line-even { background: #23272b; }
.dark-mode .data-pre-box .copy-btn {
    background: #495057;
    color: #eee;
}
.dark-mode .data-pre-box .copy-btn.copied {
    background: #1fd362;
    color: #23272b;
}

/* Optional: Make Bootstrap tables dark in dark mode */
.dark-mode .table {
    color: #eee;
    background: #23272b;
}
.dark-mode .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #23272b;
}
.dark-mode .table-striped > tbody > tr:nth-of-type(even) {
    background-color: #272b30;
}
.dark-mode .table th,
.dark-mode .table td {
    border-color: #444c56;
}

/* ========================================
   Modal System
   ======================================== */
.site-img-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    user-select: none;
    pointer-events: none;
    opacity: 0;
    transition: opacity 180ms cubic-bezier(.4,0,.2,1);
}
.site-img-modal.active {
    opacity: 1;
    pointer-events: auto;
}
.site-img-modal-backdrop {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88);
    z-index: 0;
    opacity: 0;
    transition: opacity 200ms cubic-bezier(.4,0,.2,1);
    pointer-events: auto;
}
.site-img-modal.active .site-img-modal-backdrop { opacity: 1; }

.site-img-modal-dialog {
    z-index: 2;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    max-width: 98vw; max-height: 98vh;
    background: transparent !important;
    transition: width 160ms cubic-bezier(.4,0,.2,1), height 160ms cubic-bezier(.4,0,.2,1);
    overflow: visible;
}
.site-img-modal-img {
    display: block;
    vertical-align: middle;
    background: #fff !important;
    max-width: 94vw; max-height: 90vh;
    width: auto; height: auto;
    margin: 0 52px;
    border-radius: 0.5rem;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45);
    opacity: 0;
    transition: opacity 220ms cubic-bezier(.4,0,.2,1);
}
.site-img-modal-img.loaded { opacity: 1; }

.site-img-modal-close {
    position: fixed;
    top: 24px; right: 24px;
    z-index: 2100;
    background: none !important;
    border: none;
    color: rgba(255,255,255,0.48);
    font-size: 2.4rem;
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    box-shadow: none;
    opacity: 1;
    cursor: pointer;
    padding: 0;
    outline: none;
    pointer-events: auto;
    transition:
        color 0.25s,
        opacity 0.8s cubic-bezier(.4,0,.2,1),
        background 0.22s,
        box-shadow 0.22s,
        top 0.3s, right 0.3s;
}
.site-img-modal-close:focus { outline: 2px solid #fff; }
.site-img-modal-close:hover,
.site-img-modal-close:active {
    color: #fff;
    background: none !important;
}
.site-img-modal-close.faded { opacity: 0.13; pointer-events: none; }
.site-img-modal-close.hide  { opacity: 0; pointer-events: none; }

/* Nav buttons (prev/next) */
.site-img-modal-prev,
.site-img-modal-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5.4rem;  /* 2x icon size (icon=2.7rem) */
    min-width: 48px;
    height: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.62);
    font-size: 2.7rem;
    z-index: 2050;
    opacity: 1;
    padding: 0;
    outline: none;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 0;
    order: 0;
    transition: opacity 0.5s cubic-bezier(.4,0,.2,1), color 0.25s, background 0.22s;
}
/* FADE OUT with .invisible, but DO NOT hide or remove from flow */
.site-img-modal-prev.invisible,
.site-img-modal-next.invisible {
    opacity: 0;
    pointer-events: none;
}
.site-img-modal-img {
    order: 1;
}
.site-img-modal-next {
    order: 2;
}

/* Responsive */
@media (max-width: 700px) {
    .site-img-modal-close { top: 10px; right: 10px; width: 36px; height: 36px; font-size: 1.55rem;}
    .site-img-modal-img { margin: 0 30px; }
    .site-img-modal-prev, .site-img-modal-next { width: 3.2rem; min-width: 32px; font-size: 1.6rem;}
}
@media (max-width: 500px) {
    .site-img-modal-close { top: 4px; right: 4px; width: 28px; height: 28px; font-size: 1.1rem;}
    .site-img-modal-img { margin: 0 14px; }
    .site-img-modal-prev, .site-img-modal-next { width: 2rem; min-width: 20px; font-size: 1.1rem;}
}

.site-img-modal-prev.faded, .site-img-modal-next.faded { opacity: 0.13; pointer-events: none; }
.site-img-modal-prev.hide,  .site-img-modal-next.hide  { opacity: 0; pointer-events: none; }

.site-img-modal-prev:focus,
.site-img-modal-next:focus,
.site-img-modal-close:focus {
    outline: 2px solid #fff;
}
.site-img-modal-prev:hover,
.site-img-modal-next:hover {
    color: #fff;
    background: rgba(24,24,24,0.14);
}

#fullscreen-modal-content {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(.4,0,.2,1);
    will-change: opacity, transform;
}
.modal-loading-spinner.hide {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
    pointer-events: none;
}

