/* Main Container */
/* Base style: safe default for general screens */
#model-container {
    height: 85vh;
    max-height: calc(100vh - 3rem);
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* On larger screens, increase height */
@media (min-height: 900px) {
    #model-container {
        height: 88vh;
        max-height: calc(100vh - 2rem);
    }
}

/* On small screens, constrain further */
@media (max-width: 600px), (max-height: 700px) {
    #model-container {
        height: 65vh;
    }
}

/* 3D Canvas */
canvas {
    width: 100%;  /* Adjust width for responsiveness */
    height: 100%;
    display: block;
    background-color: #000;
    border: 1px solid #ccc;
}

/* Legend Panel top left of canvas*/
#legend {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(255, 255, 255, 0.85);
    padding: 10px 14px;
    border-radius: 6px;
    max-width: 250px;
    font-size: 0.9em;
    line-height: 1.4;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.legend-section {
    margin-bottom: 10px;
}

.legend-heading {
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 4px;
    color: #333;
}

.legend-body {
    color: #000;
}


/* UI Controls Panel */
#controls {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    z-index: 10;
}

.control-group {
    margin-bottom: 8px;
    text-align: left;
}

.control-group label {
    display: block;
    margin-bottom: 2px;
    font-weight: bold;
    color: #333;
}

.control-group input[type="range"] {
    width: 150px;
}

.slider-with-labels {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.slider-end-label {
  font-size: 0.85em;
  color: #666;
  width: 2.5em;
  text-align: center;
}

/* Pause Indicator */
#pause-indicator {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.8);
    /*background: #ffeb3b; */
    color: #800;
    /*color: #000; */
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 4px;
    display: none;
    /*z-index: 10; */
}

/* Data Readouts */
#data-readout {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    font-family: monospace;
    font-weight: bold;
    padding: 6px 10px;
    border-radius: 4px;
    line-height: 1.5;
    text-align: left;
}
#data-readout div {
    white-space: pre; /* preserves spacing */
}

.legend-explainer-button {
    margin-top: 6px;
    display: inline-block;
    background-color: #eee;
    border: 1px solid #bbb;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    pointer-events: auto;
    cursor: pointer;
    color: #333;
    transition: background-color 0.2s ease;
}

.legend-explainer-button:hover {
    background-color: #ddd;
}
/* Explainer Sidebar */
#explainer-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100%;
    background: #ffffff;
    box-shadow: -2px 0 6px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s ease;
    transform: translateX(0%); /* default visible state */
}

#explainer-sidebar.hidden {
    transform: translateX(100%);
}

.explainer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#close-explainer {
    background: none;
    border: none;
    font-size: 1.5em;
    float: right;
    cursor: pointer;
    color: #444;
}

.explainer-content p {
    margin-bottom: 1em;
    line-height: 1.6;
    font-size: 0.95em;
}

/* Toggle Button */
#open-explainer {
    /*position: fixed;
    top: 10px;
    right: 10px;
    z-index: 15;*/
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
}


/* Mobile overrides: This should work across a range of smaller devices — both in portrait and landscape */
@media (max-width: 600px) {
    #model-container {
        height: 60vh; /* Make the canvas a bit shorter on small screens */
    }

    #earth-canvas {
        margin: 0 auto;
        padding: 0.5rem;
        width: 90vmin;
        max-width: 100%;
    }
}

/*  Tablet overrides: in the range of 601px to 1024px. 
    Sits between base styles and the mobile query */
@media (min-width: 601px) and (max-width: 1024px) {
    #model-container {
        height: 70vh; /* Slightly taller than on phones, but not full height */
    }

    #earth-canvas {
        width: 85vmin;
        max-width: 100%;
        margin: 0 auto;
        padding: 0.5rem;
    }
}
