/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── SKIP LINK ── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--green);
    color: #FFFFFF;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    z-index: 9999;
    border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
    top: 0;
}

/* ── TOKENS ── */
:root {
    --bg:           #F2F3F1;
    --surface:      #FFFFFF;
    --surface-alt:  #EFF0EE;
    --surface-dark: #1C2420;

    --border:       #D6D8D4;
    --border-strong:#B4B8B0;

    --text-primary:   #181C1A;
    --text-secondary: #475550;
    --text-muted:     #6B7875; /* Raised from #88938D to meet 4.5:1 on white */

    --green:         #1A6442;
    --green-mid:     #1A6442; /* Raised from #2B7F57 to meet 4.5:1 on white */
    --green-light:   #E8F4ED;
    --green-border:  #B4D8C4;

    --blue-dot:      #1751A0;
    --purple-dot:    #6441C1;

    --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.09), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 16px 48px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.08);
    --t: 180ms ease;
}

/* ── BASE ── */
html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── APP SHELL ── */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── HEADER ── */
.app-header {
    background: var(--surface-dark);
    border-bottom: 3px solid var(--green);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 32px;
    height: 60px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.header-seal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-seal svg { width: 18px; height: 18px; }

.header-wordmark { min-width: 0; }

#app-title {
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.25;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-top: 1px;
}

.header-right { flex-shrink: 0; }

.header-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.06em;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}

/* ── MOBILE WARNING ── */
.mobile-warning {
    display: none;
    background: #FEFCE8;
    border-bottom: 1px solid #FDE68A;
    color: #78580A;
    padding: 9px 32px;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}
.mobile-warning svg { flex-shrink: 0; }
.mobile-warning strong { font-weight: 600; }
@media (max-width: 768px) { .mobile-warning { display: flex; } }

/* ── MAIN ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    gap: 14px;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

/* ── IMAGE VIEWER ── */
.image-viewer {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.image-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface-dark);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-md);
}

.facility-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}

/* Bottom caption bar — rendered as a real DOM element (.image-caption) for accessibility */
.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 14px;
    background: rgba(20,28,24,0.88);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.75);
    pointer-events: none;
    line-height: 1.8;
    text-transform: uppercase;
    z-index: 5;
}

/* ── HOTSPOTS ── */
.hotspots-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.hotspots-container > * { pointer-events: auto; }

.hotspot {
    position: absolute;
    cursor: pointer;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.hotspot-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--blue-dot);
    border: 2.5px solid #FFFFFF;
    box-shadow: 0 0 0 0 rgba(23,81,160,0.45), 0 3px 8px rgba(0,0,0,0.4);
    display: block;
    transition: transform var(--t), box-shadow var(--t);
    animation: pulse-blue 2.8s ease-out infinite;
}

@keyframes pulse-blue {
    0%   { box-shadow: 0 0 0 0   rgba(23,81,160,0.45), 0 3px 8px rgba(0,0,0,0.4); }
    65%  { box-shadow: 0 0 0 10px rgba(23,81,160,0),   0 3px 8px rgba(0,0,0,0.4); }
    100% { box-shadow: 0 0 0 10px rgba(23,81,160,0),   0 3px 8px rgba(0,0,0,0.4); }
}

.hotspot:hover .hotspot-dot {
    transform: scale(1.35);
    box-shadow: 0 0 0 10px rgba(23,81,160,0.15), 0 4px 14px rgba(0,0,0,0.45);
    animation: none;
}

.hotspot.purple .hotspot-dot {
    background: var(--purple-dot);
    animation-name: pulse-purple;
}

@keyframes pulse-purple {
    0%   { box-shadow: 0 0 0 0   rgba(100,65,193,0.45), 0 3px 8px rgba(0,0,0,0.4); }
    65%  { box-shadow: 0 0 0 10px rgba(100,65,193,0),   0 3px 8px rgba(0,0,0,0.4); }
    100% { box-shadow: 0 0 0 10px rgba(100,65,193,0),   0 3px 8px rgba(0,0,0,0.4); }
}

.hotspot.purple:hover .hotspot-dot {
    box-shadow: 0 0 0 10px rgba(100,65,193,0.15), 0 4px 14px rgba(0,0,0,0.45);
}

/* ── AREA (NAVIGATION) HOTSPOTS — purple ── */
.hotspot.area-hotspot .hotspot-dot {
    background: var(--purple-dot);
    animation-name: pulse-purple;
}

.hotspot.area-hotspot:hover .hotspot-dot {
    box-shadow: 0 0 0 10px rgba(100,65,193,0.15), 0 4px 14px rgba(0,0,0,0.45);
}

.hotspot-label {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20,28,24,0.92);
    color: #FFFFFF;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t), transform var(--t);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.02em;
}
.hotspot:hover .hotspot-label,
.hotspot:focus .hotspot-label,
.hotspot:focus-visible .hotspot-label {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

.hotspot:focus-visible {
    outline: 3px solid #FFFFFF;
    outline-offset: 3px;
    border-radius: 50%;
}

/* ── BACK BUTTON ── */
.back-button {
    display: none;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 500;
    padding: 7px 13px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--t), border-color var(--t), color var(--t);
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 20;
    box-shadow: var(--shadow-sm);
}
.back-button:hover,
.back-button:focus-visible {
    background: var(--green-light);
    border-color: var(--green-border);
    color: var(--green);
    outline: 2px solid var(--green);
    outline-offset: 2px;
}
.back-button svg { width: 13px; height: 13px; transition: transform var(--t); }
.back-button:hover svg { transform: translateX(-2px); }
.detail-view .back-button { display: flex; }

/* ── LOADING ── */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    position: absolute;
    inset: 0;
    background: rgba(20,28,24,0.7);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-lg);
    z-index: 30;
}
.loading-indicator.active { display: flex; }
.loading-indicator p {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase;
}
.spinner {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255,255,255,0.12);
    border-top-color: rgba(255,255,255,0.8);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── INSTRUCTIONS ── */
.instructions-panel { flex-shrink: 0; }

.instructions-inner {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    padding: 14px 22px;
}
.instruction-item + .instruction-item { border-left: 1px solid var(--border); }

.instruction-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--green-light);
    border: 1px solid var(--green-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.instruction-icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--green);
    fill: none;
    stroke-width: 2;
}

.instruction-item div:last-child { display: flex; flex-direction: column; gap: 1px; }
.instruction-item strong { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.instruction-item span  { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ── MODAL ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal[aria-hidden="false"],
.modal.active {
    pointer-events: auto;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8,12,10,0.62);
    backdrop-filter: blur(6px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 860px;
    max-height: 88vh;
    overflow: hidden;
    transform: translateY(12px);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal[aria-hidden="false"] .modal-content,
.modal.active .modal-content { transform: translateY(0); }

/* Green stripe */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--green) 0%, var(--blue-dot) 100%);
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    z-index: 10;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--t), border-color var(--t), color var(--t);
}
.modal-close:hover,
.modal-close:focus-visible {
    background: #FEE2E2;
    border-color: #FECACA;
    color: #DC2626;
    outline: 2px solid #DC2626;
    outline-offset: 2px;
}
.modal-close svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.modal-body {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 340px;
    max-height: 88vh;
    overflow: hidden;
}

.modal-gallery {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-dark);
}
.modal-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal-text-content {
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-left: 1px solid var(--border);
}

.modal-eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--green-mid);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.modal-title {
    font-size: 21px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.modal-rule {
    width: 36px;
    height: 2px;
    background: var(--green-border);
    border-radius: 2px;
    margin-bottom: 16px;
}

.modal-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.75;
    font-weight: 300;
}
.modal-description p { margin-bottom: 10px; }
.modal-description p:last-child { margin-bottom: 0; }
.modal-description strong { color: var(--text-primary); font-weight: 500; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .modal-body { grid-template-columns: 1fr; }
    .modal-gallery { height: 200px; }
    .modal-text-content { border-left: none; border-top: 1px solid var(--border); }
    .instructions-inner { flex-direction: column; }
    .instruction-item + .instruction-item { border-left: none; border-top: 1px solid var(--border); }
}
@media (max-width: 600px) {
    .header-inner { padding: 0 16px; }
    .main-content { padding: 16px; }
    .header-tag { display: none; }
    #app-title { font-size: 12px; }
}

/* ── UTILITY ── */
.hidden  { display: none !important; }
.visible { display: flex !important; }

/* ── APP SPECIFIC (from script.js interaction) ── */
.active { display: flex; }