/* assesr prototype — base styles.
   Placeholder branding for now; the Roco Legal styling pass comes later. */

:root {
  --ink: #1c2733;
  --muted: #5b6b7b;
  --paper: #f7f9fb;
  --card: #ffffff;
  --line: #dfe6ed;
  --accent: #0f5e59;
  --accent-ink: #ffffff;
  --warn-bg: #fdf6e7;
  --warn-line: #e8d9ad;
  --ok-bg: #eef7f6;
}

* { box-sizing: border-box; }

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

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 720px; }

/* header + language switcher */

.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 500; margin-left: 6px; font-size: 0.85rem; }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.lang-switch button {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}
.lang-switch button.active { background: var(--accent); color: var(--accent-ink); }

/* main content */

/* main carries class "wrap", whose .wrap { padding: 0 20px } would win
   against a plain element selector — so the page-level padding lives on
   main.wrap. Bottom air: footer stays >=200px below the content. */
main.wrap { padding: 32px 20px 200px; }
.hero h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 12px; }
.lead { font-size: 1.1rem; margin: 0 0 8px; }
.muted { color: var(--muted); }

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 22px 0;
}
.notice h2 { margin: 0 0 6px; font-size: 1.05rem; }
.notice p { margin: 0; }

.resume { border-color: var(--accent); background: var(--ok-bg); }
.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* our own class name (.cards collides with the mirrored bridge theme's
   .cards { height: 60px } rule, which squashed the option cards under
   the injected footer) */
.start-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 26px;
}
.start-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.start-card h2 { margin: 0; font-size: 1.2rem; }
.start-card p { margin: 0; color: var(--muted); flex: 1; }

/* buttons */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.secondary.danger { color: #b3402a; border-color: #b3402a; }

.linklike {
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}

/* footer */

.site-footer { border-top: 1px solid var(--line); background: var(--card); }
.site-footer .wrap {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 16px;
  padding-bottom: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--muted); }

.hidden { display: none !important; }

@media (max-width: 560px) {
  .hero h1 { font-size: 1.5rem; }
}

/* shared Roco footer additions */

.assesr-footer-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: 0.85rem;
}
.assesr-footer-bar a { color: inherit; }

/* assessment page */

.assessment-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  margin-top: 8px;
  align-items: start;
}
@media (max-width: 860px) {
  .assessment-layout { grid-template-columns: 1fr; }
  .assessment-side { position: static; }
}

/* keep the progress ring and risk-area tiles in view while scrolling
   through the questions (align-items:start on the grid lets the sticky
   item move independently of the taller question column) */
.assessment-side { position: sticky; top: 24px; }

.progress-box { position: relative; width: 120px; margin: 0 auto 8px; }
.progress-ring { display: block; width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-bg, .ring-fg { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.3s; }
.ring-pct {
  /* overlay only the ring svg (120px), not the label below it — when the
     label wraps to two lines the number must stay centred in the circle */
  position: absolute; top: 0; left: 0;
  width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.progress-box p { margin: 4px 0 0; font-size: 0.8rem; }

.areas-title { font-size: 0.95rem; margin: 18px 0 8px; }
.area-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.area-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: color-mix(in srgb, var(--accent) calc(var(--fill, 0) * 55%), var(--card));
}
.area-tile.complete { border-color: var(--accent); }
.tile-name { font-size: 0.76rem; line-height: 1.2; }
.tile-count { font-size: 0.9rem; font-weight: 700; }

.block-header h1 { font-size: 1.4rem; margin: 0 0 6px; }
.block-header p { margin: 0 0 6px; font-size: 0.95rem; }

fieldset.question {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 14px;
  position: relative;
  scroll-margin-top: 16px;
}
/* legends straddle the fieldset border by default, so the question number
   and text end up outside the card. Keep the legend for screen readers,
   visually hidden, and show the question title as a normal paragraph
   inside the box. */
fieldset.question legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.q-title { font-weight: 600; margin: 0 0 8px; }
.qid { color: var(--muted); font-weight: 400; margin-right: 4px; }
.q-note { margin: 2px 0 8px; font-size: 0.88rem; }

.options { display: flex; flex-direction: column; gap: 6px; }
.options label { display: flex; gap: 8px; align-items: baseline; cursor: pointer; }
.options textarea {
  width: 100%;
  font: inherit;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap table, .options table { width: 100%; border-collapse: collapse; }
.table-wrap th, .options th,
.table-wrap td, .options td {
  border: 1px solid var(--line);
  padding: 6px;
  text-align: left;
  font-size: 0.85rem;
}
.options input[type="text"] { width: 100%; border: 0; font: inherit; background: transparent; }

.actions { display: flex; gap: 10px; margin: 18px 0 6px; flex-wrap: wrap; }
.btn.small { padding: 6px 10px; font-size: 0.85rem; }
.saved-note { font-size: 0.85rem; }

.notice.stop { border-color: #b3591f; background: #fdf0e7; }

/* results screen */

#done h1 { font-size: 1.6rem; margin: 0 0 8px; }
#done h2 { font-size: 1.15rem; margin: 26px 0 8px; }
.results-quadrant {
  display: flex;
  gap: 28px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}
.results-quadrant svg { width: 100%; max-width: 340px; height: auto; }
.quadrant-legend { font-size: 0.9rem; color: var(--muted); flex: 1; min-width: 200px; }
.quadrant-legend p { margin: 4px 0; }
.quadrant-position { font-size: 1.05rem; color: var(--ink); }
.quadrant-position strong { color: var(--ink); }

.area-row {
  display: grid;
  grid-template-columns: minmax(130px, 190px) 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.area-row:last-child { border-bottom: 0; }
.area-name { font-weight: 600; }
.area-meta { font-size: 0.8rem; color: var(--muted); }
.meter-row { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--muted); }
.meter-label { width: 76px; text-align: right; }
.meter { flex: 1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter-val { width: 34px; }
.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.low { background: var(--ok-bg); }
.chip.med { background: var(--warn-bg); }
.chip.high { background: #fdeae7; border-color: #e8b4aa; }

.priority-list { list-style: none; padding: 0; margin: 0; }
.priority-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.priority-list li:last-child { border-bottom: 0; }
.priority-list .area-name { display: inline-block; min-width: 130px; }

@media print {
  .site-header, .lang-switch, footer, .no-print { display: none !important; }
  main.wrap { padding-top: 0; padding-bottom: 0; }
  body { background: #fff; }
}

/* visualization gallery */

#done h3 { font-size: 1rem; margin: 22px 0 2px; }
.viz-caption { font-size: 0.85rem; margin: 0 0 10px; }
.viz-box { margin: 0 0 6px; }
.viz-box svg { max-width: 100%; height: auto; }
.viz-legend { font-size: 0.8rem; color: var(--muted); margin: 6px 0 0; }

.gauge-banner {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}
.gauge-banner svg { width: 180px; }
.gauge-label { font-size: 1.4rem; font-weight: 700; }

table.heatmap, table.ladder, table.register { border-collapse: collapse; margin: 4px 0 8px; }
table.heatmap th, table.heatmap td,
table.ladder th, table.ladder td,
table.register th, table.register td {
  border: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 0.85rem;
  text-align: left;
}
table.heatmap td, table.ladder td { text-align: center; min-width: 64px; }
table.heatmap th[scope=row], table.ladder th[scope=row], table.register td:first-child { white-space: nowrap; }
table.ladder td.on { background: var(--ok-bg); font-weight: 700; }
table.register { width: 100%; }

.gap-row {
  display: grid;
  grid-template-columns: minmax(130px, 190px) 1fr;
  gap: 14px;
  align-items: center;
  padding: 6px 0;
}
.gap-bar {
  position: relative;
  height: 14px;
  background: var(--line);
  border-radius: 7px;
  overflow: hidden;
}
.gap-bar span:first-child { display: block; height: 100%; background: var(--accent); }
.gap-bar .min {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 70%;
  border-left: 2px dashed #b3402a;
}

.priority-list .cons {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 2px;
}
