/* Diffraction gratings and spectroscopy: page-specific rules only.
   Layout, cards, sliders and teaching blocks come from ../shared/simulation.css and
   ../shared/optics-lab-theme.css. */
:root {
    --primary-color: #ea8400;
    --primary-hover: #d67300;
    --primary-light: rgba(234, 132, 0, 0.1);
    --surface-color: #ffffff;
    --surface-elevated: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

.dark-mode {
    --primary-color: #ff9d1a;
    --primary-hover: #ea8400;
    --primary-light: rgba(255, 157, 26, 0.15);
    --surface-color: #1e293b;
    --surface-elevated: #334155;
    --border-color: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
}

.tool-main [hidden] {
    display: none !important;
}

.dg-select {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

.control-note {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

.dg-n-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dg-n-row input[type="range"] {
    flex: 1 1 auto;
    min-width: 0;
}

.dg-n-row .optics-num-input {
    flex: 0 0 auto;
}

.preset-note {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 10px 0 0;
    min-height: 1.5em;
}

.dg-cursor {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 0.8rem;
    min-height: 2.6em;
    overflow-wrap: anywhere;
}

.dg-table-title {
    margin: 18px 0 6px;
    font-size: 0.95rem;
    color: var(--optics-ink, var(--text-primary));
}

.dg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.optics-data-table td.dg-missing {
    color: var(--optics-warn-ink, #9a5b00);
    font-weight: 600;
}

#zcSlider+.optics-num-wrap .optics-num-input,
#lcSlider+.optics-num-wrap .optics-num-input {
    width: 8.5em;
}

#detCanvas {
    cursor: crosshair;
}

/* related tools */
.dg-related {
    max-width: 1400px;
    margin: 24px auto 40px;
    padding: 0 16px;
    box-sizing: border-box;
}

.dg-related h2 {
    font-size: 1.15rem;
    margin: 0 0 12px;
    color: var(--optics-ink, var(--text-primary));
}

.dg-related ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: 10px;
}

.dg-related a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--optics-card-border, var(--border-color));
    background: var(--optics-card-bg, var(--surface-color));
    color: var(--optics-ink, var(--text-primary));
    text-decoration: none;
}

.dg-related a:hover {
    border-color: var(--optics-accent, var(--primary-color));
}

.dg-related a:focus-visible {
    outline: 3px solid var(--optics-focus, #6855bd);
    outline-offset: 2px;
}

.dg-related a span {
    font-size: 0.85rem;
    color: var(--optics-ink-2, var(--text-secondary));
    line-height: 1.45;
}

#readouts {
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    margin-top: 10px;
}