/* Conduit prototype styling — protective register, calm, plain.
   No marketing puffery, no urgency-mongering, no emoji. */

/* Palette: federal navy primary, white field, Old Glory red accent.
   --error stays a reserved red for warnings/emergencies. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #dde3ee;
  --text: #0b1b33;
  --text-soft: #51607a;
  --primary: #0a3161;
  --primary-deep: #07203f;
  --primary-soft: #e7edf8;
  --accent: #b31942;
  --warn-bg: #fff6d6;
  --warn-text: #5c4b00;
  --warn-border: #d6b94a;
  --ok: #2d6a4f;
  --error: #7a1b1b;
  --error-bg: #f9e7e7;
  --token: #2a3140;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

.prototype-banner {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-bottom: 2px solid var(--warn-border);
  padding: 0.6em 1em;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header.site {
  background: var(--primary-deep);
  color: white;
  padding: 1em 2em;
  border-top: 3px solid var(--accent);
}

/* How-to / instructions panel (red/white/blue) */
.howto {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  padding: 1em 1.3em;
  margin: 1.2em 0;
}
.howto h3 { display: flex; align-items: center; gap: 0.5em; margin: 0 0 0.5em; color: var(--primary-deep); }
.howto h3::before {
  content: ""; flex: none; width: 22px; height: 14px; border-radius: 2px; border: 1px solid var(--border);
  background:url("/static/flag.svg") center/cover no-repeat;
}
.howto ol { margin: 0; padding-left: 1.3em; }
.howto li { margin: 0.35em 0; color: var(--text-soft); }
.howto li strong { color: var(--text); }

header.site a { color: white; text-decoration: none; }
header.site h1 { margin: 0; font-weight: 600; letter-spacing: 0.04em; font-size: 1.4rem; }
header.site h1 a:hover { text-decoration: underline; }
header.site .tagline { color: #b8c8d0; font-size: 0.85rem; margin-top: 0.2em; }

nav.site {
  background: var(--primary);
  padding: 0.5em 2em;
}
nav.site a {
  color: white;
  text-decoration: none;
  margin-right: 1.5em;
  font-size: 0.95rem;
  padding: 0.3em 0;
  display: inline-block;
}
nav.site a:hover { border-bottom: 2px solid white; }
nav.site .nav-right { float: right; }

main {
  max-width: 960px;
  margin: 2em auto;
  padding: 0 1.5em;
}

h2 { color: var(--primary-deep); margin-top: 1.5em; }
h3 { color: var(--primary); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5em;
  margin: 1em 0;
}

.card h3 { margin-top: 0; }
.card .meta { color: var(--text-soft); font-size: 0.9rem; }

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5em;
  margin: 2em 0;
}

.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5em;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s;
}
.role-card:hover { border-color: var(--primary); }
.role-card h3 { color: var(--primary-deep); margin-top: 0; }
.role-card p { color: var(--text-soft); margin-bottom: 0; }

button, .button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6em 1.2em;
  font-size: 1rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  margin-right: 0.5em;
}
button:hover, .button:hover { background: var(--primary-deep); }

button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--primary);
}
button.secondary:hover, .button.secondary:hover {
  background: var(--primary-soft);
}

button.danger, .button.danger {
  background: var(--error);
}

form .field { margin-bottom: 1em; }
form label { display: block; font-weight: 600; margin-bottom: 0.3em; color: var(--text); }
form input[type="text"], form select, form textarea {
  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 1rem;
  font-family: inherit;
}
form textarea { min-height: 120px; resize: vertical; }
form .help { color: var(--text-soft); font-size: 0.85rem; margin-top: 0.3em; }

.flash {
  padding: 0.8em 1.2em;
  border-radius: 3px;
  margin: 1em 0;
}
.flash.success { background: #e7f3ec; color: var(--ok); border: 1px solid #b3d9c0; }
.flash.error { background: var(--error-bg); color: var(--error); border: 1px solid #d4a3a3; }

.token {
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 0.9em;
  background: var(--primary-soft);
  padding: 0.15em 0.5em;
  border-radius: 3px;
  color: var(--token);
}

.case-handle {
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 1.1rem;
  background: var(--primary-soft);
  padding: 0.5em 0.8em;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid var(--border);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.5em 0.8em;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data th {
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.8em 1em;
  margin: 0.6em 0;
}
.message .from { font-weight: 600; color: var(--primary); font-size: 0.9rem; }
.message .ts { color: var(--text-soft); font-size: 0.8rem; margin-left: 0.6em; }
.message .content { margin-top: 0.4em; white-space: pre-wrap; }
.message.sealed { background: #f0eee9; }
.message.sealed .content { color: var(--text-soft); font-style: italic; }
.message.purged { background: #f0eee9; border-style: dashed; }
.message.purged .content { color: var(--text-soft); font-style: italic; }
.message .expires-at { font-size: 0.75rem; color: var(--text-soft); margin-top: 0.4em; }
.destruct-field select { width: auto; min-width: 180px; }

.badge {
  display: inline-block;
  padding: 0.15em 0.6em;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary-deep);
}
.badge.urgent { background: #f9e7c4; color: var(--accent); }
.badge.emergency { background: var(--error-bg); color: var(--error); }
.badge.closed { background: #e0e0e0; color: var(--text-soft); }

footer.site {
  margin-top: 4em;
  padding: 2em;
  background: var(--primary-deep);
  color: #b8c8d0;
  text-align: center;
  font-size: 0.85rem;
}
footer.site a { color: white; }

.compartment-note {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  padding: 0.8em 1.2em;
  margin: 1em 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: 0.4em 0; border-bottom: 1px solid var(--border); }
ul.plain li:last-child { border-bottom: none; }

/* --- Active nav item --- */
nav.site a.active { border-bottom: 2px solid white; font-weight: 600; }

/* --- Role strip: "You are acting as..." --- */
.rolestrip {
  padding: 0.5em 2em;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.rolestrip.responder { background: #eef3ec; border-bottom-color: #b3d9c0; }
.rolestrip.messenger { background: var(--primary-soft); border-bottom-color: #b9cdd6; }

/* --- Team pill (friendly current-team label) --- */
.team-pill {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-deep);
  border-radius: 12px;
  padding: 0.1em 0.7em;
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Return code with copy button --- */
.case-handle {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  flex-wrap: wrap;
}
.copy-btn {
  font-size: 0.8rem;
  padding: 0.35em 0.9em;
  margin: 0;
}

/* --- Guided tour steps --- */
.card.guided { border-left: 4px solid var(--primary); }
ol.steps { list-style: none; padding: 0; margin: 1em 0 0; counter-reset: none; }
ol.steps > li {
  display: flex;
  gap: 0.9em;
  padding: 0.9em 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
ol.steps > li:last-child { border-bottom: none; }
ol.steps .step-n {
  flex: 0 0 auto;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
ol.steps .button { margin-top: 0.5em; }

.compartment-note.warn {
  background: var(--warn-bg);
  border-left-color: var(--warn-border);
  color: var(--warn-text);
}

/* ------------------------------------------------------------------ */
/* Responsive — phones and narrow windows                              */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
  header.site { padding: 0.9em 1.2em; }
  header.site h1 { font-size: 1.25rem; }

  /* Nav wraps instead of overflowing; tap targets get room. */
  nav.site {
    padding: 0.3em 1.2em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2em 1em;
  }
  nav.site a { margin-right: 0; padding: 0.5em 0; }
  nav.site .nav-right { float: none; width: 100%; }

  .rolestrip { padding: 0.5em 1.2em; }
  main { margin: 1.2em auto; padding: 0 1.2em; }
  .card { padding: 1.1em; }

  /* Bigger tap targets on phones. */
  button, .button { padding: 0.7em 1.2em; }
  .destruct-field select { width: 100%; min-width: 0; }

  /* Tables collapse into stacked cards; the data-label becomes the row label. */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr {
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 0 0 0.9em;
    padding: 0.4em 0.8em;
    background: var(--surface);
  }
  table.data td {
    border-bottom: 1px solid var(--border);
    padding: 0.5em 0;
    display: flex;
    justify-content: space-between;
    gap: 1em;
    text-align: right;
  }
  table.data td:last-child { border-bottom: none; }
  table.data td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--primary-deep);
    text-align: left;
    flex: 0 0 auto;
  }
  /* Rows without a data-label (none here) keep default alignment. */
  table.data td:not([data-label]) { display: block; text-align: left; }
}
