/* AFDES Election Intelligence — open layout efficiency layer.
   Presentation only: no map, provider, feed, or result logic is changed. */

body{padding:0;background:#fff}
.engine-shell{width:100%;max-width:none;margin:0}

/* Compact operational information instead of a second site header. */
.system-strip{margin:0 0 8px;grid-template-columns:repeat(4,minmax(0,1fr));box-shadow:none;border-radius:5px;overflow:hidden}
.system-strip>div{padding:8px 12px}.strip-label{font-size:.57rem}.system-strip strong{font-size:.74rem}
.stats{gap:8px;margin:0 0 8px}.stats article{padding:10px 13px;box-shadow:none;border-radius:6px}.stat-kicker{font-size:.57rem!important}.stats strong{margin:2px 0;font-size:1.45rem}.stats span{font-size:.7rem}

/* The map owns the full available AFDES content width. */
.workspace{display:grid;grid-template-columns:1fr!important;gap:14px;margin:0!important}
.map-card{width:100%;min-width:0;background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important;overflow:visible!important}

/* Geography header: ONE compact row. */
.map-toolbar{padding:6px 0 5px;background:transparent!important;border-left:0!important;border-right:0!important;border-radius:0!important}
.map-toolbar-main{display:flex!important;align-items:flex-end!important;justify-content:flex-start!important;gap:18px!important;flex-wrap:nowrap!important}
.map-title-wrap{flex:0 0 auto!important;width:auto!important;min-width:330px!important;max-width:390px!important;margin:0!important;text-align:left!important}.map-title-wrap .map-title-line strong{font-size:clamp(1.2rem,1.5vw,1.5rem)}.map-title-wrap>#map-subtitle{font-size:.66rem}
.map-controls-inline{display:flex!important;align-items:flex-end!important;justify-content:flex-start!important;gap:8px!important;width:auto!important;margin:0!important;flex:0 0 auto!important}
.geography-layer-switch{display:grid!important;grid-template-columns:repeat(2,minmax(150px,170px))!important;gap:8px!important}
.result-geography-indicator.geography-choice{min-height:40px!important;padding:6px 9px!important}.result-geography-indicator.geography-choice>strong{font-size:.64rem!important}.result-geography-indicator.geography-choice>span:last-child{font-size:.49rem!important}
.toolbar-state-jump{position:relative;flex:0 0 235px!important;width:235px!important;min-width:235px!important;margin:0!important}.toolbar-state-jump select{min-height:40px;font-size:.64rem}
.map-layer-hint{margin:2px 0 0!important;min-height:0!important;line-height:1.1!important;font-size:.55rem!important;text-align:left!important;padding-left:348px!important}

/* Election View is intentionally untouched. */
.election-view-bar{min-height:38px;padding:5px 0;grid-template-columns:auto minmax(88px,98px) minmax(0,1fr);border-left:0!important;border-right:0!important;border-radius:0!important;background:transparent!important}.election-view-heading{font-size:.6rem}.election-cycle-select,.election-type-mobile,.election-type-button{height:29px}.election-type-button{font-size:.63rem}
.afdes-rb{grid-template-columns:62px minmax(0,1fr) 62px;gap:12px;width:min(820px,calc(100% - 24px));margin:8px auto!important;padding:7px 11px;box-shadow:none!important}.afdes-rb-logo-frame{width:52px;height:52px}.afdes-rb-logo{width:48px;height:48px}.afdes-rb-title{margin-bottom:5px;font-size:.58rem}.afdes-rb-value{font-size:.62rem}.afdes-rb-track{height:13px}.afdes-rb-caption{margin-top:5px;font-size:.62rem}

/* Map sizing authority: D3 projection only. */
.map-stage{width:100%!important;min-height:560px!important;height:min(68vh,760px)!important;margin:32px 0 38px!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:transparent!important;overflow:hidden!important}
.map-card:has(#back-us[hidden]) .map-stage{min-height:840px!important;height:min(86vh,920px)!important}
#map-svg,#map-svg>g{transform:none!important}

.map-legend{gap:9px 12px;padding:12px 0 8px;font-size:.65rem;background:transparent!important;border-left:0!important;border-right:0!important}.map-legend .legend-note{margin-top:2px!important;padding-top:4px!important}

/* Compact scrollable proxy for the state/territory selector. */
.has-compact-state-select .state-select-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;overflow:hidden!important}
.state-select-trigger{display:block;width:100%;min-height:40px;padding:0 30px 0 12px;border:1px solid #d5dde5;border-radius:6px;background:#fff;color:#14263a;font:700 .64rem/1.2 inherit;text-align:left;cursor:pointer;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.state-select-trigger::after{content:'⌄';position:absolute;right:11px;top:50%;transform:translateY(-54%);font-size:.82rem;color:#536273}
.state-select-menu{position:absolute;z-index:40;top:calc(100% + 5px);right:0;width:min(250px,86vw);max-height:260px;overflow-y:auto;padding:5px;background:#fff;border:1px solid #d5dde5;border-radius:7px;box-shadow:0 12px 28px rgba(7,24,39,.14)}
.state-select-menu[hidden]{display:none!important}
.state-select-option{display:block;width:100%;padding:8px 10px;border:0;border-radius:5px;background:transparent;color:#14263a;font-size:.72rem;font-weight:700;text-align:left;cursor:pointer}
.state-select-option:hover,.state-select-option:focus{background:#eef5f9;outline:none}.state-select-option[aria-selected="true"]{background:#e4f1f7}.state-select-option:disabled{opacity:.38;cursor:not-allowed}

/* Drawer experiment is retired: results now live below the map. */
#results-drawer-toggle,#results-drawer-close,.results-drawer-toggle,.results-drawer-close{display:none!important}

/* Small visual-centering corrections for irregular state silhouettes only. */
.state-abbr-la{transform:translate(-10px,-10px)}
.state-abbr-fl{transform:translate(8px,12px)}

/* Results are part of the page flow, never an overlay. */
.detail-card.results-card{position:static!important;inset:auto!important;transform:none!important;width:100%!important;max-width:none!important;min-height:0!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:18px 0 4px!important;background:transparent!important;border:0!important;border-top:1px solid rgba(7,24,39,.14)!important;border-radius:0!important;box-shadow:none!important;opacity:1!important;visibility:visible!important;pointer-events:auto!important}
.results-card{display:grid!important;grid-template-columns:minmax(0,1.35fr) minmax(300px,.65fr);column-gap:28px;row-gap:8px}
.results-card>.detail-topline,.results-card>h2,.results-card>#results-context,.results-card>.results-unit-control,.results-card>#results-empty,.results-card>#results-content{grid-column:1}
.results-card>.results-meta,.results-card>.results-integrity-note{grid-column:2}
.results-card>.results-meta{grid-row:1 / span 5;align-self:start;margin:0;gap:7px}.results-card>.results-integrity-note{align-self:start;margin-top:4px}
.detail-card h2{font-size:1.5rem}.results-unit-control{padding:10px}.results-unit-control select{min-height:38px}.results-empty{padding:12px}.result-candidate{padding:10px 11px}.results-meta>div{padding:8px 9px}.results-integrity-note{font-size:.6rem}
.engine-footer{padding:10px 0 0;font-size:.65rem}

@media(max-width:1180px){.map-stage{height:clamp(500px,61vw,650px)!important;margin:22px 0 28px!important}.map-card:has(#back-us[hidden]) .map-stage{min-height:560px!important;height:clamp(560px,66vw,700px)!important}.results-card{grid-template-columns:minmax(0,1.2fr) minmax(280px,.8fr)}}
@media(max-width:980px){.system-strip,.stats{grid-template-columns:repeat(2,minmax(0,1fr))}.map-stage{height:clamp(440px,61vw,560px)!important;margin:20px 0 24px!important}.map-card:has(#back-us[hidden]) .map-stage{min-height:500px!important;height:clamp(500px,68vw,620px)!important}.results-card{grid-template-columns:1fr!important}.results-card>*{grid-column:1!important;grid-row:auto!important}.results-card>.results-meta{grid-template-columns:repeat(4,minmax(0,1fr));margin-top:4px}}
@media(max-width:760px){.system-strip,.stats{margin-left:0;margin-right:0}.system-strip>div,.stats article{padding:9px 10px}.map-toolbar{padding:8px 0}.map-toolbar-main{flex-wrap:wrap!important}.map-title-wrap{min-width:0!important;max-width:none!important;width:100%!important}.map-controls-inline{display:grid!important;grid-template-columns:1fr!important;width:100%!important}.geography-layer-switch{grid-template-columns:repeat(2,minmax(0,1fr))!important}.toolbar-state-jump{width:100%!important;min-width:0!important;flex-basis:auto!important}.map-layer-hint{padding-left:0!important}.result-geography-indicator.geography-choice{min-height:42px!important}.toolbar-state-jump select,.state-select-trigger{min-height:40px}.afdes-rb{grid-template-columns:46px minmax(0,1fr) 46px;width:calc(100% - 12px);gap:7px;padding:6px}.afdes-rb-logo-frame{width:40px;height:40px}.afdes-rb-logo{width:38px;height:38px}.map-stage{min-height:0!important;height:clamp(300px,72vw,410px)!important;margin:14px 0 18px!important}.map-card:has(#back-us[hidden]) .map-stage{min-height:0!important;height:clamp(300px,72vw,410px)!important}.detail-card.results-card{padding-top:15px!important}.results-card{gap:9px}.map-legend{padding:9px 0}.engine-footer{padding:7px 0 0}.results-card>.results-meta{grid-template-columns:repeat(2,minmax(0,1fr))}.state-select-menu{max-height:220px}}
@media(max-width:520px){.system-strip,.stats{grid-template-columns:1fr}.stats strong{font-size:1.3rem}.map-title-wrap .map-title-line strong{font-size:1.08rem}.geography-layer-switch{grid-template-columns:1fr 1fr!important}.result-geography-indicator.geography-choice>span:last-child{display:none}.election-view-bar{grid-template-columns:88px minmax(0,1fr)!important}.map-stage{height:clamp(270px,76vw,350px)!important;margin:13px 0 17px!important}.map-card:has(#back-us[hidden]) .map-stage{height:clamp(270px,76vw,350px)!important}.results-meta{grid-template-columns:1fr 1fr}.result-candidate{grid-template-columns:minmax(0,1fr) auto}.engine-footer{display:grid;grid-template-columns:1fr}.state-select-menu{width:100%;max-height:210px}}
@media(max-width:390px){.geography-layer-switch{grid-template-columns:1fr!important}.election-view-bar{grid-template-columns:1fr!important}.results-card>.results-meta{grid-template-columns:1fr}.result-candidate{grid-template-columns:1fr}.result-candidate-numbers{grid-template-columns:auto auto;justify-content:start;text-align:left}.map-stage{height:clamp(250px,82vw,320px)!important}.map-card:has(#back-us[hidden]) .map-stage{height:clamp(250px,82vw,320px)!important}}

/* Desktop/tablet geography contract:
   left identity zone + deliberate gap + right-aligned controls zone. */
@media(min-width:761px){
  .map-toolbar-main{
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:flex-end!important;
    justify-content:flex-start!important;
    gap:18px!important;
    width:100%!important;
  }
  .map-back-button{flex:0 0 auto!important}
  .map-title-wrap{
    flex:0 1 430px!important;
    width:auto!important;
    min-width:300px!important;
    max-width:430px!important;
  }
  .map-controls-inline{
    display:flex!important;
    flex:0 0 auto!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:flex-end!important;
    justify-content:flex-end!important;
    gap:8px!important;
    width:auto!important;
    min-width:0!important;
    margin-left:auto!important;
  }
  .geography-layer-switch{
    display:grid!important;
    grid-template-columns:155px 165px!important;
    gap:8px!important;
    flex:0 0 auto!important;
  }
  .toolbar-state-jump{
    flex:0 0 250px!important;
    width:250px!important;
    min-width:250px!important;
  }
  .map-layer-hint{
    width:max-content!important;
    max-width:min(590px,100%)!important;
    margin:3px 0 0 auto!important;
    padding-left:0!important;
    text-align:right!important;
  }
}
