/* Variant 1: atmospheric photographic device cards (v13) */
.device-group-grid {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 22px;
    align-items: stretch;
}

.device-card.photo-v1-card {
    --photo-v1-base: #26382f;
    --photo-v1-soft: rgba(255,255,255,.10);
    --photo-v1-accent: #b8edc8;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    min-height: 610px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.25) !important;
    border-radius: 34px;
    color: #fff;
    background: var(--photo-v1-base) !important;
    box-shadow: 0 22px 54px rgba(14,36,28,.20) !important;
}
.device-card.photo-v1-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255,255,255,.42) !important;
    box-shadow: 0 28px 64px rgba(14,36,28,.28) !important;
}
.device-card.photo-v1-card::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    inset: 0 0 auto 0 !important;
    width: 100% !important;
    height: 70% !important;
    border-radius: inherit !important;
    background-image: var(--photo-v1-image) !important;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    pointer-events: none !important;
    z-index: -3 !important;
    opacity: 1 !important;
}
.device-card.photo-v1-card::after {
    content: "";
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(7,14,11,.16) 0%, rgba(7,14,11,.03) 28%, rgba(7,14,11,.16) 47%, var(--photo-v1-fade) 67%, var(--photo-v1-base) 82%),
        linear-gradient(90deg, rgba(0,0,0,.16), transparent 58%);
    pointer-events: none;
    z-index: -2;
    opacity: 1;
}
.device-card.photo-v1-sensor {
    --photo-v1-image: url('../assets/cards/sensor-scene.jpg');
    --photo-v1-base: #314534;
    --photo-v1-fade: rgba(43,63,48,.92);
    --photo-v1-accent: #bdf4b3;
}
.device-card.photo-v1-heater {
    --photo-v1-image: url('../assets/cards/heater-scene.jpg');
    --photo-v1-base: #603514;
    --photo-v1-fade: rgba(87,43,14,.94);
    --photo-v1-accent: #ffbf66;
}
.device-card.photo-v1-access {
    --photo-v1-image: url('../assets/cards/access-scene.jpg');
    --photo-v1-base: #213247;
    --photo-v1-fade: rgba(28,45,66,.95);
    --photo-v1-accent: #d1e2ff;
}
.device-card.photo-v1-card.inactive {
    opacity: .60;
    filter: saturate(.45);
    background: var(--photo-v1-base) !important;
}
.device-card.photo-v1-card.inactive::before { display: block !important; }
.device-card.photo-v1-card.alert-level-warning,
.device-card.photo-v1-card.alert-level-alert,
.device-card.photo-v1-card.alert-level-critical {
    background: var(--photo-v1-base) !important;
}
.device-card.photo-v1-card.alert-level-warning::before,
.device-card.photo-v1-card.alert-level-alert::before,
.device-card.photo-v1-card.alert-level-critical::before {
    width: 100% !important;
    height: 70% !important;
    background-image: var(--photo-v1-image) !important;
    border-radius: inherit !important;
}
.device-card.photo-v1-card > * { position: relative; z-index: 1; }

/* Header floats directly on the photograph. */
.photo-v1-topbar {
    display: grid;
    grid-template-columns: 58px minmax(0,1fr) auto;
    align-items: start;
    gap: 11px;
    min-height: 92px;
}
.photo-v1-device-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 50%;
    color: #fff;
    background: rgba(255,255,255,.11);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 8px 20px rgba(0,0,0,.12);
    backdrop-filter: blur(12px);
    font-size: 1.35rem;
}
.photo-v1-heading { min-width: 0; padding-top: 1px; }
.photo-v1-heading small {
    display: block;
    margin-bottom: 2px;
    color: rgba(255,255,255,.78);
    font-size: .69rem;
    font-weight: 580;
}
.photo-v1-heading strong {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 1.52rem;
    font-weight: 750;
    line-height: 1.08;
    letter-spacing: -.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 2px 12px rgba(0,0,0,.22);
}
.photo-v1-heading > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin-top: 9px;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,.23);
    border-radius: 999px;
    color: rgba(255,255,255,.92);
    background: rgba(255,255,255,.09);
    backdrop-filter: blur(10px);
    font-size: .65rem;
    white-space: nowrap;
}
.photo-v1-tools {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 126px;
}
.photo-v1-tools .icon-btn {
    width: 37px !important;
    height: 37px !important;
    border: 1px solid rgba(255,255,255,.22) !important;
    border-radius: 50% !important;
    color: white !important;
    background: rgba(255,255,255,.10) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.13) !important;
    backdrop-filter: blur(10px);
}
.photo-v1-tools .icon-btn:hover { background: rgba(255,255,255,.22) !important; }
.photo-v1-battery {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 34px;
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 999px;
    color: #fff;
    background: rgba(255,255,255,.10);
    backdrop-filter: blur(10px);
    font-size: .66rem;
}
.photo-v1-battery i { color: #b9f2b4; }
.photo-v1-battery b { font-weight: 740; }
.photo-v1-card > .alert-badge {
    align-self: flex-start;
    margin: 2px 0 5px;
    border: 1px solid rgba(255,255,255,.24);
    backdrop-filter: blur(12px);
}

/* Sensor: one dominant temperature reading; humidity and pressure are a single lower row. */
.photo-v1-sensor-reading {
    display: flex;
    flex: 1 1 auto;
    align-items: flex-end;
    min-height: 235px;
    padding: 16px 0 12px;
}
.photo-v1-main-value {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    align-items: start;
    justify-content: start;
    padding: 0;
    border: 0;
    color: #fff;
    background: transparent;
    text-align: left;
    cursor: pointer;
    text-shadow: 0 3px 22px rgba(0,0,0,.28);
}
.photo-v1-main-value strong {
    font-size: clamp(4.1rem, 8vw, 6rem);
    font-weight: 690;
    line-height: .88;
    letter-spacing: -.07em;
}
.photo-v1-main-value em {
    margin: 4px 0 0 8px;
    font-size: 2rem;
    font-style: normal;
    font-weight: 540;
}
.photo-v1-main-value small {
    grid-column: 1 / -1;
    margin-top: 12px;
    color: rgba(255,255,255,.92);
    font-size: .92rem;
    font-weight: 520;
    text-shadow: 0 2px 10px rgba(0,0,0,.28);
}
.photo-v1-sensor-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    margin-top: 8px;
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,.18);
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.photo-v1-metric {
    display: grid;
    grid-template-columns: 38px minmax(0,1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 78px;
    padding: 5px 15px;
    border: 0;
    border-right: 1px solid rgba(255,255,255,.18);
    color: #fff;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.photo-v1-metric:last-child { border-right: 0; }
.photo-v1-metric > i { color: rgba(255,255,255,.95); font-size: 1.55rem; }
.photo-v1-metric span { min-width: 0; }
.photo-v1-metric small { display: block; color: rgba(255,255,255,.76); font-size: .66rem; }
.photo-v1-metric strong { display: block; margin-top: 1px; color: #fff; font-size: 1.6rem; font-weight: 710; white-space: nowrap; }
.photo-v1-metric strong em { font-size: .78rem; font-style: normal; font-weight: 550; }
.photo-v1-metric b { display: block; margin-top: 2px; color: var(--photo-v1-accent); font-size: .58rem; font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-v1-bottom-line,
.photo-v1-system-line,
.photo-v1-access-hint {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    margin-top: 12px;
    padding: 10px 13px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 18px;
    color: rgba(255,255,255,.90);
    background: rgba(255,255,255,.07);
    backdrop-filter: blur(12px);
    font-size: .65rem;
}
.photo-v1-bottom-line > span:first-child i { color: #b9f59e; margin-right: 6px; }
.photo-v1-bottom-line > span:last-child,
.photo-v1-system-line > span:last-child,
.photo-v1-access-hint > span:last-child { color: rgba(255,255,255,.56); font-size: .56rem; white-space: nowrap; }
.photo-v1-bottom-line .stale,
.photo-v1-system-line .stale,
.photo-v1-access-hint .stale { color: #ffe0a0 !important; }

/* Heater: photo dominates upper half, then a single switch and exactly three values. */
.photo-v1-heater-photo-space { flex: 1 1 190px; min-height: 180px; }
.photo-v1-heater-switch { margin: 0 0 13px; }
.photo-v1-heater-switch .heater-photo-toggle {
    display: grid;
    grid-template-columns: 46px minmax(0,1fr) 58px;
    align-items: center;
    width: 100%;
    min-height: 78px;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.30);
    border-radius: 24px;
    color: #9b3d0d;
    background: rgba(255,248,237,.96);
    box-shadow: 0 14px 30px rgba(49,21,6,.18);
    backdrop-filter: blur(16px);
    text-align: left;
}
.photo-v1-heater-switch .heater-photo-toggle-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #d65e19;
    background: #ffe4bc;
    font-size: 1.15rem;
}
.photo-v1-heater-switch .heater-photo-toggle-label { font-size: .95rem; font-weight: 790; }
.photo-v1-heater-switch .heater-photo-toggle-switch { justify-self: end; }
.photo-v1-heater-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    padding: 13px 0 12px;
    border-top: 1px solid rgba(255,255,255,.18);
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.photo-v1-heater-metrics > button {
    display: grid;
    grid-template-rows: 26px auto auto;
    align-content: start;
    min-width: 0;
    min-height: 102px;
    padding: 5px 13px;
    border: 0;
    border-right: 1px solid rgba(255,255,255,.18);
    color: #fff;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.photo-v1-heater-metrics > button:last-child { border-right: 0; }
.photo-v1-heater-metrics i { color: #ffc36d; font-size: 1.28rem; }
.photo-v1-heater-metrics small { color: rgba(255,255,255,.73); font-size: .60rem; line-height: 1.28; }
.photo-v1-heater-metrics strong { color: #fff; font-size: 1.48rem; font-weight: 720; white-space: nowrap; }
.photo-v1-heater-metrics strong em { font-size: .72rem; font-style: normal; font-weight: 540; }
.photo-v1-system-line > i { color: #ffc36d; }
.photo-v1-system-line { grid-template-columns: auto minmax(0,1fr) auto; }

/* Access/buttons: the photo remains untouched until the large glass action tiles. */
.photo-v1-access-photo-space { flex: 1 1 230px; min-height: 220px; }
.photo-v1-access-actions .atmo-access-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 12px;
}
.photo-v1-access-actions .atmo-access-tile {
    position: relative;
    display: grid;
    grid-template-rows: 52px auto auto;
    align-items: center;
    justify-items: start;
    min-height: 150px;
    padding: 17px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 24px;
    color: #fff;
    background: rgba(255,255,255,.10);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.13), 0 14px 28px rgba(4,15,29,.18);
    backdrop-filter: blur(15px);
    text-align: left;
}
.photo-v1-access-actions .atmo-access-tile:nth-child(even) { background: rgba(118,153,205,.18); }
.photo-v1-access-actions .atmo-access-tile:hover:not(.disabled) { transform: translateY(-2px); background: rgba(255,255,255,.18); }
.photo-v1-access-actions .atmo-access-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: #fff;
    background: rgba(255,255,255,.10);
    font-size: 1.38rem;
}
.photo-v1-access-actions .atmo-access-tile strong { color: #fff; font-size: 1.05rem; font-weight: 740; }
.photo-v1-access-actions .atmo-access-tile small,
.photo-v1-access-actions .atmo-access-tile .switch-state { color: rgba(255,255,255,.70); font-size: .62rem; }
.photo-v1-access-actions .atmo-access-switch { grid-template-columns: 1fr auto; grid-template-rows: 52px auto auto; }
.photo-v1-access-actions .atmo-access-switch > input { position: absolute; opacity: 0; pointer-events: none; }
.photo-v1-access-actions .atmo-mini-switch { grid-column: 2; grid-row: 1 / 4; }
.photo-v1-access-hint { grid-template-columns: auto minmax(0,1fr) auto; border: 0; background: transparent; }
.photo-v1-access-hint > i { color: rgba(255,255,255,.84); }

@media (max-width: 900px) {
    .device-card.photo-v1-card { min-height: 570px; }
    .photo-v1-sensor-reading { min-height: 205px; }
    .photo-v1-access-photo-space { min-height: 190px; }
    .photo-v1-heater-photo-space { min-height: 155px; }
}
@media (max-width: 768px) {
    .device-group-grid { grid-template-columns: 1fr; gap: 16px; }
    .device-card.photo-v1-card { min-height: 545px; padding: 18px; border-radius: 28px; }
    .photo-v1-topbar { grid-template-columns: 50px minmax(0,1fr) auto; gap: 9px; min-height: 82px; }
    .photo-v1-device-icon { width: 48px; height: 48px; font-size: 1.1rem; }
    .photo-v1-heading strong { font-size: 1.25rem; }
    .photo-v1-heading small { font-size: .62rem; }
    .photo-v1-heading > span { margin-top: 6px; padding: 4px 8px; font-size: .58rem; }
    .photo-v1-tools { max-width: 82px; gap: 4px; }
    .photo-v1-tools .icon-btn { width: 34px !important; height: 34px !important; }
    .photo-v1-battery { padding: 5px 7px; font-size: .60rem; }
    .photo-v1-sensor-reading { min-height: 185px; padding-bottom: 8px; }
    .photo-v1-main-value strong { font-size: 4.4rem; }
    .photo-v1-main-value em { font-size: 1.55rem; }
    .photo-v1-main-value small { font-size: .80rem; }
    .photo-v1-metric { min-height: 70px; padding: 4px 10px; grid-template-columns: 30px minmax(0,1fr); }
    .photo-v1-metric > i { font-size: 1.2rem; }
    .photo-v1-metric strong { font-size: 1.3rem; }
    .photo-v1-heater-photo-space { min-height: 125px; }
    .photo-v1-heater-metrics > button { min-height: 92px; padding: 4px 8px; }
    .photo-v1-heater-metrics strong { font-size: 1.22rem; }
    .photo-v1-access-photo-space { min-height: 150px; }
    .photo-v1-access-actions .atmo-access-tile { min-height: 128px; padding: 14px; border-radius: 21px; }
    .photo-v1-access-actions .atmo-access-icon { width: 44px; height: 44px; }
}
@media (max-width: 430px) {
    .device-card.photo-v1-card { min-height: 520px; }
    .photo-v1-tools { max-width: 74px; }
    .photo-v1-battery { grid-column: auto; }
    .photo-v1-main-value strong { font-size: 4rem; }
    .photo-v1-sensor-metrics { grid-template-columns: 1fr 1fr; }
    .photo-v1-metric { padding-inline: 7px; }
    .photo-v1-metric b { display: none; }
    .photo-v1-heater-metrics small { font-size: .53rem; }
    .photo-v1-heater-metrics strong { font-size: 1.08rem; }
    .photo-v1-access-actions .atmo-access-grid { gap: 9px; }
    .photo-v1-access-actions .atmo-access-tile { min-height: 118px; padding: 12px; }
    .photo-v1-access-actions .atmo-access-tile strong { font-size: .9rem; }
    .photo-v1-bottom-line,
    .photo-v1-system-line,
    .photo-v1-access-hint { font-size: .58rem; }
}
