/*
 * Copyright (c) 2026 Edward Boggis-Rolfe. All rights reserved.
 *
 * Additions to the mock-ups' console.css for the live console: the
 * connection state and the live changes column.
 */

.connection {
  margin-left: auto;
  color: var(--muted);
}

.connection.up {
  color: var(--signal);
}

.connection.down {
  color: var(--refusal);
}

.layout {
  grid-template-columns: 220px minmax(0, 1fr) 280px;
}

.activity {
  border-left: 1px solid var(--divider);
  padding: 24px 16px;
  font-size: 13px;
}

.activity h2 {
  margin-top: 0;
}

.activity ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity li {
  border-bottom: 1px solid var(--divider);
  padding: 6px 0;
  color: var(--muted);
}

.activity li strong {
  color: var(--ink);
  font-weight: 600;
}

.activity li.fresh {
  animation: fresh 2s ease-out;
}

@keyframes fresh {
  from {
    background: var(--signal-tint);
  }
  to {
    background: transparent;
  }
}

.accounts {
  margin: 0;
  padding-left: 18px;
}

.status {
  min-height: 1.5em;
}

.status.error {
  color: var(--refusal);
}

.status.ok {
  color: var(--signal);
}

td .actions,
td button {
  margin: 0;
}

/* The enclave attestation button and dialog. */
.attestation-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.attestation-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
}

.attestation-dot.ok {
  background: var(--signal);
}

.attestation-dot.warn {
  background: var(--amber);
}

.attestation-dot.bad {
  background: var(--refusal);
}

button.link {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--signal);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}

dialog.attestation {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

dialog.attestation::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

dialog.attestation > header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}

dialog.attestation h2 {
  margin: 0;
}

dialog.attestation h3 {
  margin: 20px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

#attestation-body {
  padding: 4px 20px 20px;
}

.attestation .summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}

.attestation code.measure {
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.attestation ul.limitations {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.attestation ul.limitations li {
  margin-bottom: 6px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .activity {
    display: none;
  }
}

/* ---- Compact layout -------------------------------------------------------
 * Wide screens are unchanged: these controls are hidden there. Below 760px the
 * navigation and the live changes become drawers opened from the header, the
 * banner shrinks to one line, tables become cards of labelled values and
 * forms take the full width. */

html {
  background: var(--ground);
}

.menu-button,
.activity-button,
.short-label {
  display: none;
}

.banner-toggle {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  cursor: default;
}

.activity-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--signal);
  color: var(--ground);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  /* One line of banner; tapping "Development" shows the rest. */
  .review-banner {
    flex-wrap: nowrap;
    padding: 6px 16px;
    font-size: 12px;
  }

  .banner-toggle {
    cursor: pointer;
    text-decoration: underline dotted;
  }

  .review-banner #banner-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body.banner-open .review-banner {
    flex-wrap: wrap;
  }

  body.banner-open .review-banner #banner-text {
    white-space: normal;
  }

  .review-banner .connection {
    flex: none;
    margin-left: 0;
  }

  /* Header: menu, wordmark, attestation and live changes on one row; who and
   * where on the next, small. */
  .top {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 10px 16px;
  }

  .top .wordmark {
    margin-right: auto;
    font-size: 18px;
  }

  .menu-button,
  .activity-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 10px;
    font-size: 13px;
  }

  .top .context,
  .top .who {
    order: 10;
    margin: 0;
    font-size: 12px;
  }

  .top .who {
    flex-basis: 100%;
  }

  .attestation-button {
    padding: 6px 10px;
  }

  .long-label {
    display: none;
  }

  .short-label {
    display: inline;
  }

  /* One column; navigation and live changes slide over the page. */
  .layout {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  nav.side,
  .activity {
    display: block;
    position: fixed;
    /* Below the header, whose buttons open and close the drawers. */
    top: var(--drawer-top, 0);
    bottom: 0;
    z-index: 30;
    width: min(300px, 85vw);
    overflow-y: auto;
    padding-top: 16px;
    background: var(--surface);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease;
  }

  nav.side {
    left: 0;
    border-right: 1px solid var(--divider);
    border-bottom: none;
    transform: translateX(-105%);
  }

  .activity {
    right: 0;
    border-left: 1px solid var(--divider);
    transform: translateX(105%);
  }

  body.nav-open nav.side,
  body.activity-open .activity {
    transform: none;
  }

  /* Dim the page behind an open drawer; tapping a header button closes it. */
  body.nav-open main,
  body.activity-open main {
    opacity: 0.35;
    pointer-events: none;
  }

  nav.side a {
    padding: 10px 20px;
  }

  main {
    padding: 16px 16px 40px;
  }

  h1 {
    font-size: 21px;
  }

  /* Tables become cards: one per row, each value labelled by its column. */
  table.cards,
  table.cards tbody,
  table.cards tr,
  table.cards td {
    display: block;
    width: 100%;
  }

  table.cards {
    overflow: visible;
  }

  table.cards thead {
    display: none;
  }

  table.cards tr {
    margin-bottom: 10px;
    padding: 6px 12px;
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    background: var(--surface);
  }

  table.cards td {
    display: grid;
    grid-template-columns: 34% minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid var(--divider);
    overflow-wrap: anywhere;
  }

  table.cards td > * {
    justify-self: start;
  }

  table.cards td:last-child {
    border-bottom: none;
  }

  table.cards td::before {
    content: attr(data-label);
    color: var(--faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  table.cards td[colspan] {
    display: block;
  }

  table.cards td[colspan]::before {
    content: none;
  }

  /* Forms take the full width. */
  .row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  input,
  select,
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: auto;
  }

  .actions {
    flex-wrap: wrap;
  }

  /* The attestation report fills the screen. */
  dialog.attestation {
    width: 100vw;
    max-width: 100vw;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
  }

  dialog.attestation dl.kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 0 0;
  }

  dialog.attestation dl.kv dt {
    margin-top: 8px;
  }
}

/* Collapsible page sections. */
details.section {
  margin: 20px 0 0;
}

details.section > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

details.section > summary::-webkit-details-marker {
  display: none;
}

details.section > summary::before {
  content: "▸";
  color: var(--faint);
  transition: transform 0.15s ease;
}

details.section[open] > summary::before {
  transform: rotate(90deg);
}

/* Policy test results. */
.test-outcome .reasons {
  margin: 6px 0 0;
  padding-left: 18px;
}

.test-outcome .reasons li {
  margin-bottom: 4px;
}
