/* The section menus, sitting INSIDE the header bar (see
   overrides/partials/header.html) so the site controls occupy ONE stripe rather
   than a header plus a navigation bar under it.

   Colors come from Material's own custom properties so the menus follow the
   palette and the dark-mode switch instead of hard-coding a theme. */

.wood-strip {
  display: flex;
  align-items: stretch;
  /* Takes the slack between the title and the search/repo controls, and is
     allowed to shrink rather than push them off the bar. */
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0.6rem;
}

/* A <details> is not a flex item by default in every engine; make it one and
   anchor its panel. */
.wood-strip__item {
  position: relative;
  display: flex;
}

.wood-strip__button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.6rem;
  color: var(--md-primary-bg-color);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  opacity: 0.75;
  /* The default disclosure triangle is replaced by the caret below. */
  list-style: none;
}

.wood-strip__button::-webkit-details-marker { display: none; }

.wood-strip__item > summary::after {
  content: "";
  width: 0.3rem;
  height: 0.3rem;
  border-right: 0.1rem solid currentcolor;
  border-bottom: 0.1rem solid currentcolor;
  transform: translateY(-0.1rem) rotate(45deg);
  transition: transform 120ms;
}

.wood-strip__item[open] > summary::after {
  transform: translateY(0.05rem) rotate(-135deg);
}

.wood-strip__button:hover,
.wood-strip__item[open] > .wood-strip__button {
  opacity: 1;
}

/* The dropdown panel. */
.wood-menu {
  position: absolute;
  /* The header row is not full height of the bar, so the panel is pinned to the
     bar's bottom edge rather than to the button's. */
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 12rem;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0.4rem 0;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  border-radius: 0 0 0.2rem 0.2rem;
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.25);
}

.wood-menu__list { list-style: none; margin: 0; padding: 0; }

/* A nested section (Templates, Solver) is a caption plus its own indented list,
   not a second dropdown - one click should reach any page. */
.wood-menu__label {
  display: block;
  padding: 0.5rem 0.8rem 0.2rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--md-default-fg-color--light);
}

.wood-menu__group > .wood-menu__list { padding-left: 0.4rem; }

.wood-menu__link {
  display: block;
  padding: 0.35rem 0.8rem;
  font-size: 0.68rem;
  line-height: 1.3;
  color: inherit;
  text-decoration: none;
}

.wood-menu__link:hover {
  background: var(--md-default-fg-color--lightest);
  color: var(--md-accent-fg-color);
}

.wood-menu__link--active { color: var(--md-typeset-a-color); font-weight: 700; }

/* With no sidebars, the article gets the width they left behind. Material sizes
   the row for a sidebar+content layout, so the centering has to be restated on
   the row itself rather than on .md-content, which is a flex child of it. */
.md-main__inner {
  margin-top: 0;
  justify-content: center;
}

.md-content {
  max-width: 50rem;
  min-width: 0;      /* a flex child will not shrink below its content otherwise */
}


/* The header, the strip, the title and the viewer stack with NO space between
   them. Material contributes article padding, a spacer pseudo-element and the
   h1's own margins; every one of them has to be zeroed or a few pixels of white
   survive between the bar and the canvas. */
.md-header { box-shadow: none; }

.md-content__inner { padding-top: 0; }
.md-content__inner::before { display: none; }

.md-typeset h1 {
  margin-top: 0;
  margin-bottom: 0;
  /* Its own padding, so the heading is not jammed against the bar above it
     while the BLOCKS still touch. */
  padding: 0.4rem 0;
}

.wood-viewer { margin-top: 0; }


/* Same for the menu buttons: clicking one should open it, not outline it. */
.wood-strip__button:focus,
.wood-strip__button:focus-visible,
.wood-strip__item > summary:focus,
.wood-strip__item > summary:focus-visible {
  outline: none;
}
