.sd-map {
    --sd-ink: #282b29;
    --sd-muted: #555e59;
    --sd-paper: #fffefb;
    --sd-border: #dcded4;
    --sd-place: #11695e;
    --sd-campus: #762e43;
    margin: 0 0 24px;
    overflow: hidden;
    border: 1px solid var(--sd-border);
    border-radius: 16px;
    background: var(--sd-paper);
    color: var(--sd-ink);
    font-size: 1rem;
    line-height: 1.55;
    scroll-margin-top: 80px;
    isolation: isolate;
    container-type: inline-size;
}

.sd-map [hidden] { display: none !important; }
.sd-map :focus-visible { outline: 2px solid var(--sd-campus); outline-offset: 3px; }

.sd-map__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 16px 18px;
}

.sd-map h4, .sd-map h5, .sd-map h6 { margin: 0; color: var(--sd-ink); }
.sd-map h4 { font-size: 1.3rem; font-weight: 700; }
.sd-map h5 { font-size: 1.2rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.sd-map h6 { font-size: 0.93rem; font-weight: 700; }
.sd-map p { margin: 0; }
.sd-map__header p, .sd-map__picker label { font-size: 0.875rem; color: var(--sd-muted); }
.sd-map__picker { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.sd-map__picker label { flex: none; font-weight: 600; }

.sd-map__picker select, .sd-map__overview {
    min-height: 40px;
    padding: 6px 10px;
    border: 1px solid var(--sd-border);
    border-radius: 8px;
    background: var(--sd-paper);
    color: var(--sd-ink);
    font: inherit;
    font-size: 0.875rem;
}

.sd-map__picker select { min-width: 0; width: min(235px, 100%); }
.sd-map__body { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(246px, 1fr); border-block: 1px solid var(--sd-border); }
.sd-map__viewport { position: relative; min-width: 0; min-height: 480px; background: #dde8e5; }
.sd-map__canvas { position: absolute; inset: 0; z-index: 0; background: #dde8e5; }
.sd-map__canvas .leaflet-tile-pane { filter: saturate(0.72); }
.sd-map__canvas .leaflet-tooltip { font-size: 0.8rem; }
.sd-map__canvas .leaflet-control-attribution a { text-decoration: none; }
.sd-map__map-message { position: absolute; inset: 38% 10px auto; margin: 0; text-align: center; color: var(--sd-muted); pointer-events: none; }

.sd-map__overview {
    position: absolute;
    z-index: 1;
    top: 10px;
    right: 10px;
    box-shadow: 0 2px 6px #202e2d20;
    cursor: pointer;
}

.sd-map__overview:hover, .sd-map__overview:focus-visible { background: #f3efe7; }
.sd-map__pin {
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--sd-place);
    color: #fff;
    box-shadow: 0 1px 6px #2037336e;
}

.sd-map__pin::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.sd-map__pin--campus { border-radius: 14px; background: var(--sd-campus); font-weight: 700; font-size: 0.78rem; white-space: nowrap; }
.sd-map__pin--campus::before { content: none; }
.sd-map__pin--selected { background: var(--sd-campus); box-shadow: 0 0 0 3px var(--sd-campus), 0 2px 8px #2037338c; }
.sd-map__pin--selected::before { width: 7px; height: 7px; }
.sd-map__card { min-width: 0; border-left: 1px solid var(--sd-border); }

.sd-map__photo {
    border-bottom: 1px solid var(--sd-border);
}

.sd-map p.sd-map__photo-empty {
    display: grid;
    place-items: center;
    min-height: 4.5rem;
    background: #f0f2eb;
    color: var(--sd-muted);
    font-size: 0.875rem;
}

.sd-map__photo-preview {
    position: relative;
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: #edf0ea;
    color: var(--sd-ink);
    font: inherit;
    text-align: center;
    cursor: zoom-in;
}

.sd-map__photo-preview:focus-visible { outline-offset: -4px; }

.sd-map__photo-image {
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 0.875rem;
}

.sd-map__photo-preview .sd-map__photo-image {
    aspect-ratio: 4 / 3;
    max-height: 17rem;
}

.sd-map__photo-image img {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
}

.sd-map__photo-preview img { object-fit: cover; }

.sd-map__photo-enlarge {
    position: absolute;
    inset: auto 0.5rem 0.5rem auto;
    padding: 0.25rem 0.55rem;
    border-radius: 0.35rem;
    background: var(--sd-paper);
    color: var(--sd-ink);
    font-size: 0.875rem;
    font-weight: 700;
    pointer-events: none;
}

.sd-map__photo-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.sd-map__photo-nav button, .sd-map__photo-close {
    min-height: 2.75rem;
    padding: 0.25rem 0.65rem;
    border: 0;
    border-radius: 0.35rem;
    background: var(--sd-paper);
    color: var(--sd-place);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.sd-map__photo-nav button:hover, .sd-map__photo-close:hover { background: #edf0ea; }
.sd-map__photo-previous { justify-self: start; }
.sd-map__photo-next { justify-self: end; }
.sd-map__photo-count { color: var(--sd-muted); font-variant-numeric: tabular-nums; }

.sd-map__photo-dialog {
    position: fixed;
    inset: 0;
    width: min(calc(100% - 1.5rem), 70rem);
    max-width: none;
    max-height: calc(100% - 1.5rem);
    margin: auto;
    padding: 0;
    border: 1px solid var(--sd-border);
    border-radius: 0.75rem;
    background: var(--sd-paper);
    color: var(--sd-ink);
    overscroll-behavior: contain;
}

.sd-map__photo-dialog::backdrop { background: #141a17cc; }

.sd-map__photo-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0.75rem;
}

.sd-map__photo-dialog .sd-map__photo-image {
    height: min(68vh, 48rem);
    height: min(68dvh, 48rem);
    background: #202823;
    color: #fff;
}

.sd-map__details { padding: 16px; }
.sd-map p.sd-map__description { margin-top: 8px; font-size: 0.9375rem; line-height: 1.6; }
.sd-map__directions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--sd-border); }
.sd-map ol.sd-map__steps { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.sd-map .sd-map__steps li { margin: 0; padding: 0; display: flex; align-items: start; gap: 8px; white-space: normal; font-size: 0.875rem; }
.sd-map__line {
    flex: none;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--sd-line-color, #e8ece5);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
}
.sd-map__line--walk { color: #334c42; }
.sd-map p.sd-map__route-note { margin-top: 8px; color: var(--sd-muted); font-size: 0.875rem; }
.sd-map a.sd-map__directions-link { display: inline-block; margin-top: 10px; font-weight: 700; font-size: 0.875rem; }
.sd-map__footer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 9px 16px; color: var(--sd-muted); font-size: 0.8125rem; }
.sd-map__footer span { display: inline-flex; align-items: center; gap: 5px; }
.sd-map__key { width: 9px; height: 9px; border-radius: 50%; }
.sd-map__key--campus { background: var(--sd-campus); }
.sd-map__key--place { background: var(--sd-place); }
.sd-map__key--walk { width: 17px; height: 0; border-top: 2px dashed var(--sd-muted); border-radius: 0; }
.sd-map noscript p { padding: 8px 16px; }

@container (max-width: 630px) {
    .sd-map__body { grid-template-columns: minmax(0, 1fr); }
    .sd-map__viewport { min-height: 390px; }
    .sd-map__card { border-left: 0; border-top: 1px solid var(--sd-border); }
}

@container (max-width: 385px) {
    .sd-map__viewport { min-height: 352px; }
}
