/* Shared style of the landing and manage pages, following the Université de Montpellier
   graphic charter (2023): Rouge UM #E7314B, support blue #4BC2BC, Clouds #ECF0F1,
   Wet Asphalt #31485F, Midnight Blue #273C50; Oswald for titles, Open Sans for text. */

@font-face {
  font-family: "Oswald";
  src: url("/fonts/oswald.woff2") format("woff2");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("/fonts/open-sans.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --um-red: #e7314b;
  --um-blue: #4bc2bc;
  --bg: #ecf0f1;
  --card: #ffffff;
  --text: #000000;
  --muted: #31485f;
  --border: #d3dadf;
  /* Darker red for small text on light backgrounds, where Rouge UM is too light to read. */
  --link: #b01e36;
  --chip-bg: #ffffff;
  --chip-text: #b01e36;
  --shadow: 0 6px 20px rgba(39, 60, 80, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1a2836;
    --card: #273c50;
    --text: #ecf0f1;
    --muted: #a9b8c6;
    --border: #31485f;
    --link: #ff8c9c;
    --chip-bg: #273c50;
    --chip-text: #ecf0f1;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a2836;
  --card: #273c50;
  --text: #ecf0f1;
  --muted: #a9b8c6;
  --border: #31485f;
  --link: #ff8c9c;
  --chip-bg: #273c50;
  --chip-text: #ecf0f1;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Open Sans", system-ui, sans-serif;
}
a { color: var(--link); }
h1, h2 { font-family: "Oswald", "Arial Narrow", sans-serif; font-weight: 600; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Red band at the top of every page. */
.band { background: var(--um-red); color: #ffffff; }
.band .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 28px;
}
.band h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}
.brand:focus-visible { outline: 3px solid #ffffff; outline-offset: 4px; }
.band .logo { flex: none; width: auto; height: clamp(2rem, 5vw, 2.75rem); }
.band nav { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font: 600 0.95rem/1.2 "Open Sans", system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.chip:hover { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.5); }
.chip:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
.band nav { align-items: center; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  opacity: 0.8;
  cursor: pointer;
}
.theme-toggle:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
.theme-toggle:focus-visible { opacity: 1; outline: 3px solid #ffffff; outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; }
[data-mode="light"] .icon-sun, [data-mode="dark"] .icon-moon { display: none; }

main.wrap { padding-top: 40px; padding-bottom: 56px; }
.empty { margin: 0; color: var(--muted); }

/* Landing page cards. */
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}
.apps .empty { grid-column: 1 / -1; }
.app {
  display: flex;
  gap: 20px;
  align-items: center;
  min-height: 132px;
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--um-red);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.app:hover, .app:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); }
.app:focus-visible { outline: 3px solid var(--um-blue); outline-offset: 2px; }
.app.stopped, .apps.loading .app { display: none; }
.app h2 { margin: 0; font-size: 1.4rem; line-height: 1.25; }
.app p { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }

.icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
}
.icon img { max-width: 100%; max-height: 100%; }
.initial {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--um-red);
  color: #ffffff;
  font: 600 2rem/1 "Oswald", "Arial Narrow", sans-serif;
}

/* Manage page. */
.error {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid var(--um-red);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--card);
}
.rows {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--um-red);
  border-radius: 12px;
}
.rows .empty { padding: 20px 24px; }
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
}
.row + .row { border-top: 1px solid var(--border); }
.row .icon { width: 48px; height: 48px; }
.row .initial { border-radius: 10px; font-size: 1.4rem; }
.info { flex: 1; min-width: 0; }
.info a {
  color: inherit;
  font: 600 1.15rem/1.3 "Oswald", "Arial Narrow", sans-serif;
  text-decoration: none;
}
.info a:hover { text-decoration: underline; }
.info p {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.state { flex: none; color: var(--muted); font-size: 0.9rem; }
.state::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.state.active::before { background: var(--um-blue); }
.state.failed::before { background: var(--um-red); }
.action {
  flex: none;
  min-width: 104px;
  padding: 8px 16px;
  border: 2px solid var(--link);
  border-radius: 8px;
  background: transparent;
  color: var(--link);
  font: 600 0.95rem/1.2 "Open Sans", system-ui, sans-serif;
  cursor: pointer;
}
.action:hover:not(:disabled) { background: var(--link); color: var(--card); }
.action:focus-visible { outline: 3px solid var(--um-blue); outline-offset: 2px; }
.action:disabled { cursor: default; opacity: 0.5; }
@media (max-width: 560px) {
  .row { flex-wrap: wrap; padding: 16px; }
  .info { flex-basis: calc(100% - 64px); }
  .state { flex: 1; margin-left: 64px; }
}
