/* SCREEN SIZE DISCLAIMER
   Shown below 800 px only in "message" mode (see NARROW_DEFAULT in the .qmd header,
   or add ?narrow=message to the address). The default "stack" mode is at the end of this file. */
#screensize {
  display: none;
}

@media (max-width: 799.98px) {
  html.narrow-message #desktop-dashboard {
    display: none;
  }

  html.narrow-message #screensize {
    display: block;
    padding: 2rem;
    text-align: center;
    font-size: 1.2rem;
  }
}

/* DINOT FONT */

@font-face {
  font-family: "DINOT";
  src: url("DINOT-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DINOT";
  src: url("DINOT-Bold.otf") format("opentype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DINOT";
  src: url("DINOT-Italic.otf") format("opentype");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}



/* Quarto dashboard typography */
body,
.navbar,
.navbar-brand,
.navbar-nav,
.nav-link,
.card,
.card-body,
.valuebox,
.quarto-dashboard,
.dashboard-page {
  font-family: "DINOT", Arial, sans-serif;
}


/* Datawrapper typography */
div[id^="datawrapper-vis-"] {
  font-family: initial;
}

div[id^="datawrapper-vis-"] * {
  font-family: inherit;
}

/* FORMAT TEXT BOXES - no outline */
.page-text-card {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
}

.page-text-card .card-body {
  padding: 0.25rem 0 !important;
}

/* MENU FORMATTING */

/* Top menu bar */
.navbar {
  background-color: #ffc425 !important;
}

/* All menu items */
.navbar-nav .nav-link {
  color: white !important;
}

/* Currently selected page */
.navbar-nav .nav-link.active {
  background-color: #ffd984 !important;
  color: black !important;
  border-radius: 5px;
}

/* Navbar text color*/
.navbar-brand,
.navbar-nav .nav-link {
  color: black !important;
}

/* Dashboard title in upper-left: black on gold (about 13:1 contrast; WCAG AA needs 4.5:1).
   Line 1 is the title, line 2 the subtitle ("NJ DASHBOARD"), both set in the .qmd YAML. */
.navbar-title,
.navbar-title-text,
.navbar-title-text a {
  font-size: clamp(0.95rem, 1.6vw, 1.45rem) !important;  /* scales so one line fits beside the menu */
  font-weight: 400 !important;
  font-family: "DINOT", Arial, sans-serif !important;
  color: #000 !important;
  line-height: 1.1 !important;
}

.navbar-title-text a {
  white-space: nowrap;
  /* slightly heavier than Regular: the DINOT files have only Regular and Bold,
     so a hairline outline in the text colour thickens the letters a touch */
  -webkit-text-stroke: 0.6px currentColor;
}

/* keep "NEW JERSEY DASHBOARD" under the title at every width */
.navbar-title {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
}

.navbar-subtitle {
  display: block !important;
  font-family: "DINOT", Arial, sans-serif !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.06em;
  line-height: 1.2 !important;
  color: #000 !important;
  opacity: 1 !important;
}

/* Vertically center everything in top navigation bar */
.navbar-container {
  display: flex !important;
  align-items: center !important;
}

/* Vertically center logo + dashboard title */
.navbar-brand-container {
  display: flex !important;
  align-items: center !important;
}



/* Vertically center individual menu links */
.navbar-nav .nav-link {
  display: flex !important;
  align-items: center !important;
}

/* FORMAT HOME PAGE */
/* control report cover */
.report-cover {
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.report-cover img {
  display: block;
  width: 250px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Allow text cards to expand with their content */
.page-text-card {
  flex: 0 0 auto !important;
  height: auto !important;
  overflow: visible !important;
}

/* ABOUT PAGE TEXT CARDS:
   grow naturally instead of becoming scrollable dashboard cards */
/* Let About-page cards grow naturally */
.page-text-card {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
}

.page-text-card > .card-body {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  flex: none !important;
}

/* Report cover */
.report-cover {
  display: block;
  position: static;
  width: 100%;
  text-align: center;
  clear: both;
  margin: 1.5rem 0;
}

.report-cover img {
  display: block;
  position: static;
  width: 250px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* VALUE BOXES */

/* Make the whole value box use a tighter icon/text layout */
.valuebox {
  overflow: hidden;
}

/* Main content area */
.valuebox .value-box-area {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;

  /* Reduce excess internal spacing */
  padding: 1rem !important;
  gap: 0.25rem !important;

  /* Important: allow contents to shrink inside the box */
  min-width: 0 !important;
  width: 100% !important;
}

/* Reduce space reserved for icon */
.valuebox .value-box-icon {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 0 0.5rem 0 !important;
  padding: 0 !important;
}

/* Control icon size */
.valuebox .value-box-icon i,
.valuebox .value-box-icon svg {
  font-size: 3rem !important;
  width: auto !important;
  height: auto !important;
}

/* Title */
.valuebox .value-box-title {
  text-align: center !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;

  font-size: 1.15rem !important;
  line-height: 1.15 !important;

  white-space: normal !important;
  overflow: visible !important;
}

/* Numeric value */
.valuebox {
  container-type: inline-size;
}

.valuebox .value-box-value {
  font-size: clamp(2.25rem, 13cqw, 4rem) !important;
  line-height: 1 !important;
}

.valuebox .value-box-title {
  font-size: clamp(1rem, 4.5cqw, 1.4rem) !important;
  line-height: 1.15 !important;
}

.valuebox {
  grid-template-columns: 1fr !important;
}

.valuebox .value-box-icon {
  position: static !important;
}

/* TAB STYLING */

/* Remove the outer border/outline around the tabs */
.panel-tabset .nav-tabs {
  border-bottom: none !important;
}

/* Style all tabs */
.panel-tabset .nav-tabs .nav-link {
  color: black !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Keep tab text black on hover/focus */
.panel-tabset .nav-tabs .nav-link:hover,
.panel-tabset .nav-tabs .nav-link:focus {
  color: black !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Active tab */
.panel-tabset .nav-tabs .nav-link.active {
  color: black !important;
  background-color: #8dc3dd !important;
  border: none !important;
}

/* Rounded tabs on every page: separate rounded rectangles, like the Datawrapper pills */
.panel-tabset .nav-tabs {
  gap: 6px;
  margin-bottom: 0.75rem;
}

.panel-tabset .nav-tabs .nav-link {
  border-radius: 8px !important;
  background-color: #eef5f9 !important;
  padding: 8px 16px;
  font-weight: 600;
}

.panel-tabset .nav-tabs .nav-link.active {
  background-color: #8dc3dd !important;
}

/* Make tabset fill the available dashboard height */
.panel-tabset {
  height: 100%;
  min-height: 0;
}

/* Tab content fills remaining space below tabs */
.panel-tabset .tab-content {
  height: calc(100% - 57px);
  min-height: 0;
}

/* Each individual tab fills that space */
.panel-tabset .tab-pane {
  height: 100%;
  min-height: 0;
}

/* DATAWRAPPER LAYOUT */

.dw-viz-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 32px;
  row-gap: 24px;
  width: 100%;
  margin: 0;
}

@media (max-width: 991.98px) {
  .dw-viz-row { grid-template-columns: minmax(0, 1fr) !important; }
}

/* Youth Disconnection: the charts sit in a 75 percent column beside the value boxes,
   so map and table stack sooner (each would be about 325 px wide at 1,024 px). */
@media (max-width: 1199.98px) {
  #youth-disconnection .dw-viz-row { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ...and once stacked, keep the value boxes at their own height at the top of their column
   instead of stretching down beside the taller charts (800-1,199 px; phones have their own rule). */
@media (min-width: 800px) and (max-width: 1199.98px) {
  #youth-disconnection .bslib-grid:has(> .valuebox) {
    grid-template-rows: none !important;
    grid-auto-rows: max-content !important;
    align-content: start;
  }

  #youth-disconnection .valuebox {
    min-height: 200px;
  }
}

.dw-viz-col-map,
.dw-viz-col-table {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.dw-viz-row iframe {
  display: block;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  margin: 0;
  border:  none;
}

/* FORMAT DATA DOWNLOAD BUTTON */
.data-download-btn {
  display: inline-block;
  width: auto;
  background-color: #ffc425;
  border: none;
  color: #000;
  box-shadow: none;
  outline: none;
}

.data-download-btn:hover,
.data-download-btn:focus,
.data-download-btn:active {
  background-color: #e6ad00;
  border: none;
  color: #000;
  box-shadow: none;
  outline: none;
}


/* REMOVE OUTER ROUNDED FRAME AROUND EVERY PAGE
   Quarto wraps the whole #desktop-dashboard div in one card; flatten it. */
.card:has(> .card-body > #desktop-dashboard) {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}



/* TOP MENU: equal-width, centered menu items so spacing is even */

/* Always reserve the scrollbar's space. Without this, short pages (no scrollbar)
   are a few pixels wider than long ones, which changes how menu labels wrap. */
html {
  overflow-y: scroll;
}

/* Applies only when the menu sits in a row (768 px and up). Below that, Quarto
   collapses the menu behind a button and the items stack. */
@media (min-width: 768px) {
  .navbar-nav {
    flex: 1 1 auto;
  }

  .navbar-nav .nav-item {
    flex: 1 1 0;
    min-width: min-content;  /* never narrower than the longest word */
  }

  .navbar-nav .nav-link {
    justify-content: center;
    text-align: center;
    padding-left: 0.4rem !important;
    padding-right: 0.4rem !important;
  }

  /* keep the title from crowding the menu */
  .navbar-brand-container {
    flex: 0 1 auto;
    max-width: 30%;
  }
}

/* "TABLE TO COME" PLACEHOLDER (right-hand column) */
.table-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto !important;
  height: 200px !important;
  margin: 4rem 1rem 0 1rem;
  border: 1px dashed #c8c8c8;
  border-radius: 4px;
  color: #6b6b6b;
  font-style: italic;
}


/* WORK-IN-PROGRESS NOTE (e.g., Youth Disconnection > District) */
.dev-note {
  display: inline-block;
  flex: 0 0 auto !important;   /* don't stretch to fill the column */
  align-self: flex-start;
  margin: 0.25rem 0 0.5rem 0;
  padding: 4px 10px;
  border-radius: 4px;
  background-color: #fff3cd;
  border: 1px solid #ffc425;
  font-size: 0.85rem;
  color: #333;
}


/* SCHOOL DISTRICT EXPLORER (School Performance, Challenges to Development) */
.explorer-card,
.explorer-card .card-body {
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

.explorer-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 210px);
  min-height: 620px;
  border: 0;
}

/* HIDE CARD "EXPAND" (FULL-SCREEN) BUTTONS EVERYWHERE */
.bslib-full-screen-enter,
.bslib-full-screen-exit {
  display: none !important;
}


/* CARD BORDERS: none on any page. Value boxes keep their own styling. */
.dashboard-page .card:not(.valuebox) {
  border: none !important;
  box-shadow: none !important;
}

/* SOURCE LINE CARD (Youth Disconnection): dark gray like a Datawrapper source line.
   #4a5562 on white is about 7.6:1, above WCAG AA's 4.5:1 for small text. */
.source-card,
.source-card b {
  color: #4a5562;
}

.source-card {
  font-size: 0.85rem;
}


/* ABOUT PAGE */

/* Rows take the height of their content (Quarto gives every row an equal share otherwise) */
#about > .bslib-grid {
  grid-template-rows: none !important;
  grid-auto-rows: max-content !important;
  row-gap: 1.5rem;
}

/* About the Teams: one block per team, logo above the name */
.team-block {
  margin-top: 1.25rem;
}

.team-block .team-logo {
  display: block;
  height: auto;
  margin-bottom: 0.6rem;
}

.team-logo-moa {
  width: 260px;
  max-width: 100%;
}

.team-logo-oyc {
  width: 90px;
}



/* NARROW SCREENS: PHONE LAYOUT ("stack" mode, the default)
   One column; each map above its table; tabs wrap; explorer at phone height. */
@media (max-width: 799.98px) {
  /* every dashboard row and column becomes one column, at natural height */
  html.narrow-stack .quarto-dashboard .bslib-grid {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    gap: 1rem;
  }

  /* plain block layout: the dashboard's flex sizing would squeeze charts to nothing */
  html.narrow-stack .quarto-dashboard .html-fill-container:not(.bslib-grid):not(.dw-viz-row):not(.valuebox):not(.value-box-grid):not(.tab-pane),
  html.narrow-stack .quarto-dashboard .card-body {
    display: block !important;
  }

  html.narrow-stack .quarto-dashboard .html-fill-container,
  html.narrow-stack .quarto-dashboard .card,
  html.narrow-stack .quarto-dashboard .card-body,
  html.narrow-stack .panel-tabset,
  html.narrow-stack .panel-tabset .tab-content,
  html.narrow-stack .panel-tabset .tab-pane {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  html.narrow-stack .quarto-dashboard-content,
  html.narrow-stack .dashboard-page {
    overflow: visible !important;
  }

  html.narrow-stack #screensize {
    display: none !important;
  }

  /* map above table */
  html.narrow-stack .dw-viz-row {
    grid-template-columns: 1fr !important;
  }

  /* tabs wrap onto more lines instead of running off the screen */
  html.narrow-stack .panel-tabset .nav-tabs {
    flex-wrap: wrap !important;
  }

  html.narrow-stack .panel-tabset .nav-tabs .nav-link {
    padding: 6px 12px;
  }

  html.narrow-stack .table-placeholder {
    margin: 1rem 0 0 0;
    height: 120px !important;
  }

  /* explorer: tall enough to use, short enough to scroll past */
  html.narrow-stack .explorer-frame {
    height: 85vh;
    min-height: 520px;
  }

  /* value boxes: one row each, not a third of the screen each */
  html.narrow-stack .valuebox {
    min-height: 0 !important;
  }

}

/* Below 800 px (either mode): smaller title that can wrap */
@media (max-width: 799.98px) {
  /* menu button to the right of the title */
  .navbar-container {
    flex-wrap: wrap !important;
  }

  .navbar-brand-container {
    flex: 1 1 0;
    min-width: 0;
  }

  .navbar-toggler {
    order: 2;
    margin-left: 0.5rem;
    border-color: rgba(0, 0, 0, 0.4) !important;
  }

  .navbar-toggler-icon {
    filter: invert(1);  /* dark icon on gold */
  }

  #dashboard-collapse {
    order: 3;
    flex-basis: 100%;
  }

  .navbar-title,
  .navbar-title-text,
  .navbar-title-text a {
    font-size: 1.1rem !important;
  }

  .navbar-title-text a {
    white-space: normal;
  }

  .navbar-subtitle {
    font-size: 0.75rem !important;
  }
}


/* Version B: one centered reading column, modeled on measureofamerica.org report pages */
.about-b-body,
.about-b-card > .card-body,
.about-b-download {
  display: block !important;  /* Quarto makes these flex boxes; the cover float needs block layout */
}

.about-b-body {
  max-width: 860px;
  margin: 0 auto;
}

.about-b-title {
  font-size: 2rem;
  font-weight: 400;
  margin: 0.5rem 0 0.75rem 0;
}

.about-b-links {
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  margin-bottom: 1.25rem;
}

.about-b-links a {
  color: #000;
  text-decoration: underline;
}

.about-b-links span {
  margin: 0 0.4rem;
}

/* small cover, text wraps beside it, then runs full width beneath */
.about-b-cover-link {
  float: left;
  width: 170px;
  margin: 0.25rem 1.25rem 0.75rem 0;
}

.about-b-cover {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.about-b-heading {
  clear: both;
  font-size: 1.05rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 2rem 0 0.75rem 0;
}

.about-b-download {
  clear: both;
  margin-top: 2rem;
  padding: 0.25rem 1.25rem 1.25rem 1.25rem;
  background: #fff8e1;
  border-left: 4px solid #ffc425;
  border-radius: 4px;
}

.about-b-download .about-b-heading {
  margin-top: 1rem;
}

@media (max-width: 799.98px) {
  .about-b-title {
    font-size: 1.5rem;
  }

  .about-b-cover-link {
    width: 120px;
  }
}

/* MID WIDTHS (768-1199 px): title on its own line, menu on a full-width row beneath */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .navbar-container {
    flex-wrap: wrap !important;
  }

  .navbar-brand-container {
    flex: 1 1 100%;
    max-width: 100% !important;
    padding-top: 0.35rem;
  }

  #dashboard-collapse {
    flex-basis: 100%;
  }

  .navbar-nav .nav-link {
    font-size: clamp(0.85rem, 1.45vw, 1rem);
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
  }
}


/* TEXT LINKS: black text with a gold underline; on hover or keyboard focus the link
   gets a gold highlight (#FFC528). Gold text on white would be about 1.6:1, too faint
   to read, so the highlight goes behind black text instead. Menu, tabs, buttons, and
   the cover image keep their own styling. */
.dashboard-page a:not(.btn):not(.nav-link):not(.about-b-cover-link) {
  color: #000;
  text-decoration: underline;
  text-decoration-color: #FFC528;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: background-color 0.15s ease;
}

.dashboard-page a:not(.btn):not(.nav-link):not(.about-b-cover-link):hover,
.dashboard-page a:not(.btn):not(.nav-link):not(.about-b-cover-link):focus-visible {
  color: #000;
  background-color: #FFC528;
  text-decoration-color: #FFC528;
}

/* PHONES: tighter tabs so the longest tab rows don't wrap to four lines */
@media (max-width: 799.98px) {
  html.narrow-stack .panel-tabset .nav-tabs { gap: 4px; }
  html.narrow-stack .panel-tabset .nav-tabs .nav-link { padding: 4px 10px; font-size: 0.85rem; }
}

/* GEOGRAPHY SWITCH ("View by: County | Legislative District"); added by the header script.
   Joined buttons, distinct from the tabs and the Datawrapper pills. */
.geo-switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
}

.geo-switch-label {
  color: #596775;
}

.geo-switch-buttons {
  display: inline-flex;
}

.geo-switch button {
  border: 1px solid #596775;
  background: #ffffff;
  color: #1f2933;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.3;
  padding: 4px 12px;
  cursor: pointer;
}

.geo-switch button:first-child {
  border-radius: 4px 0 0 4px;
}

.geo-switch button + button {
  border-left: none;
  border-radius: 0 4px 4px 0;
}

.geo-switch button[aria-pressed="true"] {
  background: #163761;
  border-color: #163761;
  color: #ffffff;
}

.geo-switch button[aria-disabled="true"]:not([aria-pressed="true"]) {
  color: #8a96a3;
  cursor: not-allowed;
}

.geo-switch button:focus-visible {
  outline: 2px solid #FFC528;
  outline-offset: 2px;
}

.geo-note {
  margin: 0 0 0 0.25rem;
  font-size: 0.85rem;
  color: #4a5562;
}

.dw-viz-row.geo-hidden,
.geo-note[hidden] {
  display: none !important;
}

@media (max-width: 799.98px) {
  .geo-switch {
    flex-wrap: wrap;
  }

  .geo-switch-buttons {
    display: flex;
    width: 100%;
  }

  .geo-switch button {
    flex: 1 1 0;
  }

  .geo-note {
    flex-basis: 100%;   /* on phones the note goes under the buttons */
    margin: 0;
  }
}
