/* The officers' section: the login card, the section nav, and the Kanban board.
   Palette comes from theme-switcher.css's --mofa-* tokens so all four themes,
   including festival-noir, carry through. No link anywhere here is underlined,
   in any state — DUH/rules/presentation.md. */

/* ---- the floor's width ------------------------------------------------
   The vendored one-column template pins #content to a 640px article measure.
   The officers' floor is a set of tools — a nav, tiles, a board, wide tables —
   so it takes the wrapper's full width instead, the way the landing page does. */
.one-column #content:has(.officers-nav) {
  width: auto;
  margin: 0 20px 36px;
}

#content:has(.officers-nav) .entry-content *,
#content:has(.officers-nav) .entry-content *::before,
#content:has(.officers-nav) .entry-content *::after {
  box-sizing: border-box;
}

/* ---- the section nav ----------------------------------------------------
   Two parts: the tools (tabs), and who is signed in with Log out. On a desktop
   they share one bar and the tabs wrap; on a phone the tabs are one row that
   scrolls sideways, so the bar never grows taller than a thumb's reach. */
.officers-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 8px;
  background: var(--mofa-highlight, #e6ddcf);
}

.officers-nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
}

.officers-nav__links a,
.officers-nav__links a:hover,
.officers-nav__links a:focus,
.officers-nav__links a:active,
.officers-nav__links a:visited {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  color: var(--mofa-accent, #645e53);
}

.officers-nav__links a:hover,
.officers-nav__links a:focus-visible {
  border-color: var(--mofa-line, #cac1b3);
  background: var(--mofa-surface, #f2e6d2);
  color: var(--link-hover, var(--mofa-brand, #bb0000));
}

/* The page you are on: filled and outlined, not only a colour change. */
.officers-nav__links a.is-current {
  border-color: var(--mofa-brand, #bb0000);
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
}

/* Who is signed in sits on a slim line above the tabs at every width, so the
   tabs keep the whole row and never wrap around it. */
.officers-nav__account {
  order: -1;
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0 0.25rem;
}

.officers-nav__who {
  font-size: 0.85em;
  line-height: 1.3;
  color: var(--mofa-muted, #625c51);
}

.officers-nav__who strong {
  color: var(--mofa-text, #28231a);
}

.officers-nav__logout {
  margin: 0;
}

.officers-nav__logout button {
  min-height: 2.5rem;
  white-space: nowrap;
}

/* Festival Noir's brand red measures 3.16:1 on its own dark ground; its
   --link-hover (#ff4947, 4.51:1) is the red that reads there as text. */
body[data-theme="festival-noir"] .officers-tile__label {
  color: var(--link-hover, #ff4947);
}

/* ---- the home page's tool tiles ---------------------------------------- */
.entry-content ul.officers-tiles {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.75rem;
}

.entry-content ul.officers-tiles li {
  margin: 0;
}

.officers-tile,
.officers-tile:visited {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-left: 4px solid var(--mofa-brand, #bb0000);
  border-radius: 6px;
  background: var(--mofa-surface, #f2e6d2);
  text-decoration: none;
  color: var(--mofa-text, #28231a);
}

.officers-tile:hover,
.officers-tile:focus-visible,
.officers-tile:active {
  text-decoration: none;
  border-color: var(--link-hover, var(--mofa-brand, #bb0000));
  background: var(--mofa-highlight, #e6ddcf);
  color: var(--mofa-text, #28231a);
}

.officers-tile__label {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--mofa-brand, #bb0000);
}

.officers-tile:hover .officers-tile__label,
.officers-tile:focus-visible .officers-tile__label {
  color: var(--link-hover, var(--mofa-brand, #bb0000));
}

.officers-tile__blurb {
  font-size: 0.9em;
  line-height: 1.4;
  color: var(--mofa-muted, #625c51);
}

/* ---- Markdown tables on the floor ---------------------------------------
   router.js gives every cell its column heading as data-label. A desktop sees
   an ordinary table; a phone (below) sees each row as a labelled card. */
.officers-table {
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 1.5rem;
}

#content .officers-table table.officers-table__table {
  width: 100%;
  margin: 0;
}

.officers-nav__logout button,
.kb-btn,
.officers-login__form button {
  font: inherit;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
  cursor: pointer;
}

.officers-nav__logout button:hover,
.kb-btn:hover,
.officers-login__form button:hover {
  border-color: var(--mofa-brand, #bb0000);
  color: var(--mofa-brand, #bb0000);
}

.officers-login {
  max-width: 34rem;
}

.officers-login__form {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.officers-login__form input,
.officers-login__form select {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
}

.officers-login__form input:focus-visible,
.officers-login__form select:focus-visible,
.officers-login__form button:focus-visible {
  outline: 2px solid var(--mofa-brand, #bb0000);
  outline-offset: 1px;
}

.officers-login__error {
  color: var(--mofa-brand, #bb0000);
  font-weight: 700;
}

.officers-unresolved {
  border-bottom: 0;
  color: var(--mofa-muted, #625c51);
  font-style: italic;
}

.officers-index {
  margin: 0 0 2rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 6px;
  background: var(--mofa-surface, #f2e6d2);
}

.officers-index > summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* A summary laid out as flex loses its marker; draw one, turned when open. */
.officers-index > summary {
  list-style: none;
}
.officers-index > summary::-webkit-details-marker {
  display: none;
}
.officers-index > summary::before {
  content: "\25B8";
  display: inline-block;
  width: 1em;
  color: var(--mofa-muted, #625c51);
  transition: transform 0.15s ease;
}
.officers-index[open] > summary::before {
  transform: rotate(90deg);
}

.officers-index__count {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--mofa-muted, #625c51);
}

.officers-index h3 {
  margin: 1rem 0 0.4rem;
}

.entry-content .officers-index ul {
  columns: 3 14rem;
  column-gap: 2rem;
  margin: 0;
  padding-left: 1.1rem;
}

.officers-index li {
  break-inside: avoid;
  margin: 0 0 0.3rem;
}

.officers-index a,
.officers-index a:hover,
.officers-index a:focus,
.officers-index a:active,
.officers-index a:visited {
  text-decoration: none;
  font-weight: 600;
}

/* Twenty Ten paints headings near-black, which vanishes on Festival Noir. */
#content:has(.officers-nav) .entry-content h2,
#content:has(.officers-nav) .entry-content h3,
#content:has(.officers-nav) .entry-content h4 {
  color: var(--mofa-text, #28231a);
}

.officers-home > h2 {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--mofa-line, #cac1b3);
}

/* ----- the board ------------------------------------------------------- */

.kb-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.75rem;
}

.kb-status {
  color: var(--mofa-muted, #625c51);
  font-size: 0.9em;
}

.kb-status.is-error {
  color: var(--mofa-brand, #bb0000);
  font-weight: 700;
}

.kb-board {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  overflow-x: auto;
  padding: 0 0 1rem;
}

.kb-col {
  flex: 0 0 17.5rem;
  max-width: 17.5rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 6px;
  background: var(--mofa-highlight, #e6ddcf);
  padding: 0.6rem;
}

.kb-col.is-over {
  border-color: var(--mofa-brand, #bb0000);
}

.kb-col__title {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.kb-col__count {
  color: var(--mofa-muted, #625c51);
  font-weight: 400;
  font-size: 0.85em;
}

.kb-col__actions {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}

.kb-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 2rem;
}

.entry-content .kb-cards li.kb-card {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  margin: 0 0 0.45rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  cursor: grab;
  line-height: 1.35;
}

.kb-card.is-dragging {
  opacity: 0.45;
}

.kb-card.is-over {
  border-top: 3px solid var(--mofa-brand, #bb0000);
}

.kb-card.done .kb-text {
  opacity: 0.55;
  text-decoration: line-through;
}

.kb-check {
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

.kb-text {
  flex: 1 1 auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.kb-tag {
  color: var(--mofa-brand, #bb0000);
  font-weight: 700;
}

.kb-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--mofa-muted, #625c51);
  font: inherit;
  cursor: pointer;
  padding: 0 0.2rem;
}

.kb-card__tools {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

/* Shown only where dragging cannot work — no mouse, or a phone-width window. */
.kb-move {
  display: none;
  max-width: 7.5rem;
  min-height: 2.25rem;
  font: inherit;
  font-size: 0.85em;
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
}

@media (hover: none), (max-width: 640px) {
  .kb-move {
    display: block;
  }
  /* Checkbox and text on the first line; Move to… and × on a line under them. */
  .entry-content .kb-cards li.kb-card {
    flex-wrap: wrap;
    cursor: default;
  }
  .entry-content .kb-cards li.kb-card .kb-text {
    flex: 1 1 0;
    min-width: 0;
  }
  .kb-card__tools {
    flex: 1 0 100%;
    justify-content: space-between;
    align-items: center;
  }
  .kb-move {
    max-width: none;
    flex: 1 1 auto;
  }
}

.kb-remove:hover {
  color: var(--mofa-brand, #bb0000);
}

.kb-edit {
  width: 100%;
  min-height: 4.5rem;
  font: inherit;
  padding: 0.4rem;
  border: 1px solid var(--mofa-brand, #bb0000);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
}

.kb-add {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.kb-add input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
}

.kb-help {
  color: var(--mofa-muted, #625c51);
  font-size: 0.9em;
}

@media (max-width: 980px) {
  .one-column #content:has(.officers-nav) {
    margin: 0 12px 36px;
  }
}

@media (max-width: 640px) {
  /* The public site's red menu took the whole first screen before any officer
     tool showed. On this floor it keeps every item but packs three to a row. */
  body:has(.officers-nav) #access #menu-main-menu {
    grid-template-columns: repeat(3, 1fr);
  }
  body:has(.officers-nav) #access .menu-item:nth-child(2n) {
    border-right: 1px solid rgb(0 0 0 / 16%);
  }
  body:has(.officers-nav) #access .menu-item:nth-child(3n) {
    border-right: 0;
  }
  body:has(.officers-nav) #access a {
    min-height: 44px;
    padding: 6px 8px;
    font-size: 12px;
  }

  /* The nav: who and Log out on the first line, the tabs as one sideways row. */
  /* nowrap matters: a wrapping column flexbox sizes each line to its content,
     and the tab row's content is 700px wide — it pushed Log out off-screen. */
  .one-column #content:has(.officers-nav) {
    margin: 0 0 36px;
  }
  .officers-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.4rem;
  }
  .officers-nav__account {
    order: -1;
    justify-content: space-between;
    margin-left: 0;
    padding: 0 0.25rem;
  }
  .officers-nav__links {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* A fade on the right edge says there is more to swipe to. */
    mask-image: linear-gradient(to right, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    padding-right: 2rem;
  }
  .officers-nav__links::-webkit-scrollbar {
    display: none;
  }
  .officers-nav__links a {
    scroll-snap-align: start;
    min-height: 44px;
  }

  .entry-content ul.officers-tiles {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .officers-tile {
    padding: 0.7rem 0.75rem;
  }
  .officers-tile__label {
    font-size: 1em;
  }

  .entry-content .officers-index ul {
    columns: 1;
  }
  .officers-index li a {
    display: inline-block;
    padding: 0.3rem 0;
  }

  /* Each table row becomes a card: the heading of each cell printed beside it. */
  #content .officers-table table.officers-table__table,
  #content .officers-table__table tbody,
  #content .officers-table__table tr,
  #content .officers-table__table td {
    display: block;
    width: 100%;
  }
  #content .officers-table__table {
    border: 0;
  }
  #content .officers-table__table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  #content .officers-table__table tr {
    margin: 0 0 0.75rem;
    border: 1px solid var(--mofa-line, #cac1b3);
    border-radius: 6px;
    background: var(--mofa-surface, #f2e6d2);
    overflow: hidden;
  }
  #content .officers-table__table td {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0.6rem;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-top: 1px solid var(--mofa-line, #cac1b3);
    word-break: break-word;
  }
  #content .officers-table__table td:first-child {
    border-top: 0;
    background: var(--mofa-highlight, #e6ddcf);
    font-weight: 700;
  }
  #content .officers-table__table td::before {
    content: attr(data-label);
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--mofa-muted, #625c51);
  }
  /* A cell that only says "—" adds a line and no information. */
  #content .officers-table__table td:empty {
    display: none;
  }

  /* The board: one column fills the screen, and the next peeks in to say
     there is more to swipe to. */
  .kb-board {
    scroll-snap-type: x mandatory;
    gap: 0.6rem;
  }
  .kb-col {
    flex-basis: 85%;
    max-width: 85%;
    scroll-snap-align: start;
  }
  .kb-toolbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .kb-btn,
  .kb-add button {
    min-height: 44px;
  }
  .kb-remove {
    min-width: 44px;
    min-height: 44px;
  }

  /* The theme dock is fixed to the bottom of a phone; leave room under the
     last line so it never sits on top of it. */
  #content:has(.officers-nav) {
    padding-bottom: 4.5rem;
  }
}

/* ---- members ----------------------------------------------------------
   The roster. Same tokens as the rest of this floor, so the four palettes
   carry through; no underlined link, no colour doing a job on its own. The
   tables are wide — six columns of contact detail — so each one scrolls
   inside its own box rather than making the page scroll sideways. */

.members-summary {
  color: var(--mofa-muted, #625c51);
  font-size: 0.95em;
}

.members-flash {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-left-width: 4px;
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
  color: var(--mofa-text, #28231a);
}

/* The bad case is marked by the word in it and by a heavier rule, not by a
   colour alone. */
.members-flash--bad {
  border-left-width: 6px;
  border-left-style: double;
  font-weight: 600;
}

.members-add {
  margin: 0 0 1.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 4px;
  background: var(--mofa-surface, #f2e6d2);
}

.members-add > summary {
  cursor: pointer;
  font-weight: 600;
}

.members-form {
  margin: 0.8rem 0 0;
  display: grid;
  gap: 0.6rem 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.members-form__row {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.members-form__row label {
  font-size: 0.9em;
  color: var(--mofa-muted, #625c51);
}

.members-form input,
.members-form select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 3px;
  background: var(--mofa-page, #fbf6ec);
  color: var(--mofa-text, #28231a);
  font: inherit;
  font-size: 1rem; /* 16px keeps iOS Safari from zooming the page on focus */
}

.members-form__actions {
  margin: 0;
  grid-column: 1 / -1;
  align-self: end;
}

.members-form button {
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--mofa-line, #cac1b3);
  border-radius: 3px;
  background: var(--mofa-page, #fbf6ec);
  color: var(--mofa-text, #28231a);
  font: inherit;
  cursor: pointer;
}

.members-form button:hover,
.members-form button:focus-visible {
  border-color: var(--mofa-text, #28231a);
}

.members-help {
  margin: 0.8rem 0 0;
  color: var(--mofa-muted, #625c51);
  font-size: 0.9em;
}

.members-count {
  margin-left: 0.4rem;
  font-size: 0.75em;
  font-weight: 400;
  color: var(--mofa-muted, #625c51);
}

.members-scroll {
  overflow-x: auto;
}

.members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.members-table th,
.members-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--mofa-line, #cac1b3);
  text-align: left;
  vertical-align: top;
}

.members-table th {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mofa-muted, #625c51);
}

/* Six columns of contact detail do not fit the article column, and squeezing
   them breaks a phone number across three lines. The table keeps its natural
   width and scrolls inside .members-scroll instead. */
.members-table {
  min-width: 44rem;
}

.members-cell--name {
  white-space: nowrap;
  font-weight: 600;
}

.members-cell--phone {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.members-cell--email {
  word-break: break-word;
}

@media (max-width: 640px) {
  .members-form {
    grid-template-columns: 1fr;
  }
  .members-table {
    font-size: 0.9em;
    min-width: 38rem;
  }
}
