/* The portal's layout (PLAN P2): every page usable from 360 px wide up, with
   no horizontal scroll of the page itself; a wide table or code block scrolls
   inside its own box. Caddy serves this file from /static/ (PLAN §3); it
   loads nothing from outside the portal (CLAUDE.md §5). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: #1b1b1b;
  background: #fff;
  overflow-wrap: anywhere;
}

/* The navigation wraps onto as many lines as it needs. */
header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #c8c8c8;
  background: #f4f4f4;
}

header nav form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
}

main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.25;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.1rem;
}

img,
iframe,
video {
  max-width: 100%;
}

input,
select,
textarea,
button {
  font: inherit;
  max-width: 100%;
}

/* A wide table scrolls sideways inside the box the portal puts around every
   table (the templates, and portal/catalogue/documents.py). The table keeps
   its own display, and so its semantics for a screen reader. */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
}

th,
td {
  padding: 0.25rem 0.5rem;
  border: 1px solid #c8c8c8;
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 0.5rem;
  background: #f4f4f4;
}

/* The dashboard's app cards: one column on a phone, more on a wider screen. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 0.75rem;
}

.card {
  border: 1px solid #c8c8c8;
  border-radius: 0.25rem;
  padding: 0.75rem;
}

.card h3 {
  margin-top: 0;
}

/* A Tier C app's frame, the full width of the page. */
.app-frame {
  display: block;
  width: 100%;
  min-height: 80vh;
  border: 0;
}

.document .source {
  color: #555;
  font-size: 0.9rem;
}
