/* netword-shared/css/frame.css
 *
 * The frame every room wears: the rail, the menu and the main area. Its markup
 * is netword-shared/js/frame.js.
 *
 * EVERY COLOUR IS A TOKEN, WRITTEN ONCE, IN THE BLOCKS BELOW. Nothing else in
 * this sheet names a colour; it names a token. netword-shared/test/frame.test.js
 * holds that, and netword-app/test/darkTheme.test.js excepts this one sheet by
 * name from the App's colour scan because the App never loads it.
 *
 * EACH ROOM HAS A DARK COLOUR AND A PALE COLOUR, AND THEY LIVE HERE ONLY. The
 * frame names the room on the page's root as data-room; one block per room
 * holds its two colours and nothing else. With no room named, or a name with no
 * block, the frame draws as Home. The page is the room's pale colour; cards,
 * windows and panels are white; text is black; the room's dark colour is for
 * headings and the frame's marks. The gold is the same in every room.
 *
 * NO FONT IS FETCHED FROM ANOTHER SITE. Inter and Cormorant Garamond draw where
 * they are installed; elsewhere the system sans-serif and Georgia draw.
 */

:root {
  --frame-text: #000000;
  --frame-gold: #8a6d24;
  --frame-gold-light: #c5a45b;
  --frame-card: #ffffff;
  --frame-line: #d8d8dd;
  --frame-line-strong: #b2b3ba;
  --frame-quiet: #55565d;
  --frame-good: #1f5a2c;
  --frame-good-ground: #e6f1e8;
  --frame-radius-control: 8px;
  --frame-radius-card: 10px;
  --frame-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --frame-title: "Cormorant Garamond", Georgia, serif;
}

/* ── Each room's two colours ──────────────────────────────────────────── */

:root,
:root[data-room="home"] {
  --frame-dark: #101e2d;
  --frame-pale: #f3f5f8;
}

:root[data-room="portal"] {
  --frame-dark: #2d1c10;
  --frame-pale: #f8f5f2;
}

:root[data-room="studio"] {
  --frame-dark: #231f20;
  --frame-pale: #f5f4f4;
}

:root[data-room="market"] {
  --frame-dark: #102b2d;
  --frame-pale: #f1f6f6;
}

:root[data-room="apps"] {
  --frame-dark: #1e102d;
  --frame-pale: #f5f3f8;
}

:root[data-room="accounting"] {
  --frame-dark: #102d1e;
  --frame-pale: #f2f7f4;
}

/* ── The page ─────────────────────────────────────────────────────────── */

html,
body {
  margin: 0;
  background: var(--frame-pale);
  color: var(--frame-text);
  font-family: var(--frame-body);
  font-size: 14px;
  line-height: 1.4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:focus-visible {
  outline: 2px solid var(--frame-gold);
  outline-offset: 2px;
}

.frame__skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 10;
  padding: 12px 16px;
  min-height: 44px;
  background: var(--frame-card);
  color: var(--frame-dark);
  border: 1px solid var(--frame-line-strong);
  border-radius: var(--frame-radius-control);
}

.frame__skip:focus {
  top: 8px;
}

.frame {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

/* ── The rail ─────────────────────────────────────────────────────────── */

.frame__rail {
  background: var(--frame-card);
  border-right: 1px solid var(--frame-line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.frame__logo {
  width: 172px;
  max-width: 100%;
}

.frame__logo-image {
  display: block;
  width: 172px;
  max-width: 100%;
  height: auto;
}

.frame__room {
  color: var(--frame-dark);
  font-family: var(--frame-title);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
}

.frame__menu-button {
  display: none;
}

.frame__panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.frame__who {
  margin: 0;
  font-size: 12px;
  color: var(--frame-quiet);
  overflow-wrap: anywhere;
}

.frame__group + .frame__group {
  margin-top: 16px;
}

.frame__group-head {
  margin: 0 0 6px;
  font-family: var(--frame-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--frame-gold);
}

.frame__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.frame__item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--frame-card);
  border-radius: var(--frame-radius-control);
  color: var(--frame-dark);
  text-decoration: none;
}

a.frame__item:hover {
  border-color: var(--frame-line);
}

.frame__item[aria-current="page"] {
  background: var(--frame-dark);
  color: var(--frame-card);
  font-weight: 700;
}

.frame__item--plain {
  color: var(--frame-quiet);
}

.frame__note {
  font-size: 12px;
  color: var(--frame-quiet);
}

.frame__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--frame-line);
}

.frame__room-link,
.frame__sign-out {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--frame-radius-control);
  color: var(--frame-dark);
}

.frame__room-link--plain {
  color: var(--frame-quiet);
}

/* Who is signed in, and the one button that signs them out. The button is a
 * form's, so it wears the room link's shape with the browser's own button
 * look taken off. */
.frame__address {
  margin: 8px 0 0;
  padding: 0 10px;
  font-size: 12px;
  color: var(--frame-quiet);
  overflow-wrap: anywhere;
}

.frame__sign-out-form {
  margin: 0;
}

.frame__sign-out {
  width: 100%;
  border: 1px solid var(--frame-line-strong);
  background: var(--frame-card);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* ── The main area ────────────────────────────────────────────────────── */

.frame__main {
  background: var(--frame-pale);
  padding: 24px;
  min-width: 0;
}

.frame__title {
  margin: 0 0 16px;
  color: var(--frame-dark);
  font-family: var(--frame-title);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.2;
}

.frame__cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 16px;
}

.frame__card {
  background: var(--frame-card);
  border: 1px solid var(--frame-line);
  border-radius: var(--frame-radius-card);
  padding: 16px;
  overflow-wrap: anywhere;
}

.frame__card-title {
  margin: 0 0 4px;
  color: var(--frame-dark);
  font-family: var(--frame-title);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.2;
}

.frame__card-line {
  margin: 0 0 12px;
  color: var(--frame-quiet);
}

.frame__card-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--frame-line-strong);
  border-radius: var(--frame-radius-control);
  color: var(--frame-dark);
  text-decoration: none;
}

.frame__card-link:hover {
  border-color: var(--frame-dark);
}

.frame__card-note {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-style: italic;
  color: var(--frame-quiet);
}

/* ── Below 720px: a top bar and a Menu panel ─────────────────────────── */

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

  .frame__rail {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--frame-line);
    gap: 0;
  }

  .frame__bar {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .frame__logo,
  .frame__logo-image {
    width: auto;
    max-width: 172px;
    max-height: 40px;
  }

  .frame__room {
    font-size: 20px;
  }

  .frame__menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0 14px;
    font: inherit;
    font-weight: 600;
    background: var(--frame-card);
    color: var(--frame-dark);
    border: 1px solid var(--frame-line-strong);
    border-radius: var(--frame-radius-control);
  }

  .frame__menu-button[aria-expanded="true"] {
    background: var(--frame-dark);
    color: var(--frame-card);
  }

  .frame__panel {
    display: none;
    padding: 12px 0 16px;
  }

  .frame__panel[data-open="true"] {
    display: flex;
  }

  .frame__item,
  .frame__room-link,
  .frame__sign-out,
  .frame__card-link,
  .frame__card-note {
    min-height: 44px;
  }
}
