/* Student Feedback — student QR page.
   Mobile-first, one stylesheet, no web fonts: the page is opened from a poster
   on campus mobile data, so every byte here has to earn its place.

   Colour rules that are not obvious from the values:
   • #DF1B22 (the LUC red) is only ~4.6:1 against white, so it is used for large
     text and decoration only. Small text and button fills use #B01218, which is
     ~7.2:1 against white — WCAG AA with room to spare.
   • Status is never carried by colour alone: every pill and every star also
     carries a word or a different glyph. */

:root {
  color-scheme: light;

  --brand: #DF1B22;          /* large text, rules, decoration */
  --brand-strong: #B01218;   /* small text on light, button fills */
  --brand-tint: #FCEAEA;

  --bg: #FAF7F6;
  --surface: #FFFFFF;
  --surface-sunk: #F4EFEE;
  --ink: #221F1F;
  --ink-soft: #5A5352;
  --line: #E3D9D7;

  --field-bg: #FFFFFF;
  /* 3.7:1 against the field fill — a control's boundary has to be visible to
     count as a control (WCAG 1.4.11), and a hairline grey is not. */
  --field-line: #8C8280;

  --ok: #16653A;
  --ok-tint: #E6F2EA;
  --warn: #7A4E00;
  --warn-tint: #FAF0DC;
  --info: #1A4C7E;
  --info-tint: #E6EEF7;

  --focus: #1A4C7E;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(34, 31, 31, .06), 0 6px 20px rgba(34, 31, 31, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --brand: #FF9089;
    --brand-strong: #C2151C;   /* still paired with white text: ~6.2:1 */
    --brand-tint: #3A1C1D;

    --bg: #171415;
    --surface: #211D1E;
    --surface-sunk: #2A2526;
    --ink: #F4EFEE;
    --ink-soft: #C0B6B4;
    --line: #3C3334;

    --field-bg: #2A2526;
    --field-line: #7E7172;   /* 3.1:1 against the dark field fill */

    --ok: #8BDDAD;
    --ok-tint: #17301F;
    --warn: #EFC27A;
    --warn-tint: #33280F;
    --info: #9FC6EE;
    --info-tint: #16283A;

    --focus: #9FC6EE;
    --shadow: none;
  }
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  padding: 0 16px 48px;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

h1, h2, h3 { line-height: 1.25; }
p { margin: 0 0 12px; }

a { color: var(--brand-strong); }
@media (prefers-color-scheme: dark) { a { color: var(--brand); } }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 0 0 var(--radius) 0;
  z-index: 10;
}
.skip-link:focus { left: 0; }

/* ── Masthead ─────────────────────────────────────────────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 34rem;
  margin: 0 auto;
  padding: 20px 0 14px;
}

.masthead-logo {
  width: 56px;
  height: 56px;
  flex: none;
  object-fit: contain;
  border-radius: 10px;
}

.masthead-campus {
  margin: 0;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-soft);
}

.masthead-title {
  margin: 0;
  font-size: 1.75rem;      /* large text, so the brand red is allowed here */
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--brand);
}
.masthead-title span { color: var(--ink); font-weight: 700; }

.notice {
  max-width: 34rem;
  margin: 0 auto 14px;
  padding: 12px 14px;
  background: var(--info-tint);
  color: var(--info);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: .9375rem;
}

main { display: block; max-width: 34rem; margin: 0 auto; outline: none; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface-sunk);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.tab {
  flex: 1 1 0;
  min-height: 44px;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* The selected tab is not signalled by colour alone. */
.tab[aria-selected="true"]::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--brand-strong);
  vertical-align: 1px;
}

/* Three tabs have to share a 320px phone. The modifier is added by app.js only
   when the board tab exists, so the two-tab layout keeps its roomier labels. */
.tabs-3 .tab {
  padding: 10px 4px;
  font-size: .875rem;
  line-height: 1.2;
}
.tabs-3 .tab[aria-selected="true"]::before {
  width: 6px;
  height: 6px;
  margin-right: 5px;
  vertical-align: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 22px;
  box-shadow: var(--shadow);
}
.panel:focus-visible { outline-offset: -3px; }

.lede { color: var(--ink-soft); font-size: .9375rem; margin-bottom: 18px; }

/* ── Fields ───────────────────────────────────────────────────────────────── */

.field { margin-bottom: 18px; }

label, .label {
  display: block;
  margin-bottom: 6px;
  font-size: .9375rem;
  font-weight: 650;
}

.opt { font-weight: 400; color: var(--ink-soft); }

input, select, textarea {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--ink);
  font-family: inherit;
  /* 16px exactly: anything smaller makes iOS Safari zoom in on focus and never
     zoom back out, pushing the send button off screen for the rest of the visit. */
  font-size: 16px;
  line-height: 1.4;
  min-height: 44px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 2px), calc(100% - 14px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

textarea { resize: vertical; min-height: 140px; }

input[type="file"] {
  padding: 10px;
  background: var(--surface-sunk);
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.hint {
  margin: 6px 0 0;
  font-size: .8125rem;
  color: var(--ink-soft);
}
.hint-strong { color: var(--ink); }

.subfields {
  margin: -4px 0 18px;
  padding: 14px 14px 2px;
  background: var(--surface-sunk);
  border-radius: var(--radius);
}

/* ── Anonymous / named toggle ─────────────────────────────────────────────── */

.toggle {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1 1 0;
  min-height: 46px;
  padding: 10px 8px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--field-bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* Checkmark as well as fill, so the chosen mode is not colour-only — getting
   this wrong means a student cannot tell whether they are about to send a name. */
.toggle-btn[aria-pressed="true"] {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #FFFFFF;
}
.toggle-btn[aria-pressed="true"]::before { content: "✓ "; }

/* ── How the student hears back ───────────────────────────────────────────── */

/* A fieldset is the right grouping for a radio set; its default border, padding
   and min-width are not. min-width: 0 in particular — a fieldset defaults to
   min-content width, which stops the rows inside it shrinking on a 320px
   phone. */
.notify {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.notify legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: .9375rem;
  font-weight: 650;
}

/* The row, not the dot, is the tap target: a 22px radio on a phone is a miss
   waiting to happen, and the label fills the rest of the row. */
.radio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  margin-bottom: 8px;
  background: var(--field-bg);
  border: 1px solid var(--field-line);
  border-radius: 10px;
}

.radio input[type="radio"] {
  /* Undoes the block-level `input` rule above — a radio is a dot, not a
     full-width field — and restores the native control the browser draws. */
  appearance: auto;
  -webkit-appearance: radio;
  flex: none;
  display: inline-block;
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  accent-color: var(--brand-strong);
}

.radio label {
  flex: 1 1 auto;
  margin: 0;
  /* Vertical padding rather than height, so a label that wraps to two lines on
     a narrow phone grows the row instead of spilling out of it. */
  padding: 11px 0;
  /* 16px like every other control: anything smaller and iOS zooms on focus. */
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}

/* The chosen row is tinted and outlined as well as dotted, so the answer to
   "am I about to be messaged?" does not rest on a 22px native mark. :has() is
   a progressive enhancement — where it is unsupported the dot still says. */
.radio:has(input:checked) {
  background: var(--brand-tint);
  border-color: var(--brand-strong);
  /* A second inner hairline instead of a 2px border — a thicker border would
     reflow the row by a pixel as the student moves between the options. */
  box-shadow: inset 0 0 0 1px var(--brand-strong);
}

.notify .hint { margin-top: 10px; }

/* ── Selected files ───────────────────────────────────────────────────────── */

.filelist {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.filelist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 12px;
  margin-bottom: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: .875rem;
}
.file-size { flex: none; font-size: .8125rem; color: var(--ink-soft); }

.file-remove {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-strong);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.file-remove:hover { background: var(--brand-tint); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  background: var(--brand-strong);
  color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--field-line);
  color: var(--brand-strong);
}
@media (prefers-color-scheme: dark) { .btn-secondary { color: var(--brand); } }

.btn-quiet {
  width: 100%;
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  font-weight: 600;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.fineprint {
  margin: 14px 0 0;
  font-size: .8125rem;
  color: var(--ink-soft);
}

/* ── Messages ─────────────────────────────────────────────────────────────── */

.msg {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: .9375rem;
}
.msg-error { background: var(--brand-tint); color: var(--brand-strong); }
.msg-ok { background: var(--ok-tint); color: var(--ok); }
@media (prefers-color-scheme: dark) { .msg-error { color: var(--brand); } }

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
}
.banner p { margin: 0; flex: 1 1 14rem; }
.banner-error { background: var(--brand-tint); color: var(--brand-strong); }
@media (prefers-color-scheme: dark) { .banner-error { color: var(--brand); } }
.banner .btn { flex: none; }

.warn-box {
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--warn-tint);
  color: var(--warn);
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: .9375rem;
  text-align: left;
}

/* ── Confirmation ─────────────────────────────────────────────────────────── */

.done { text-align: center; }

.done-tick {
  margin: 0 auto 8px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ok-tint);
  color: var(--ok);
  font-size: 30px;
  line-height: 56px;
}

.done h2 { margin: 0 0 8px; font-size: 1.375rem; }
.done h2:focus-visible { outline-offset: 4px; }
.done-lede { color: var(--ink-soft); font-size: .9375rem; }

.ref-label {
  margin: 18px 0 4px;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.refcode {
  margin: 0;
  padding: 14px 10px;
  background: var(--brand-tint);
  border: 2px dashed var(--brand-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: clamp(1.75rem, 9vw, 2.5rem);   /* large text: legible across the room */
  font-weight: 800;
  letter-spacing: .06em;
  font-variant-ligatures: none;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}

.done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.done-actions .btn { flex: 1 1 10rem; }

/* What will happen next. Informational blue, not the amber of the warning below
   it — being told the outcome is good news; the code is still the thing to
   keep. Left-aligned inside the centred confirmation, because it is a sentence
   to read rather than a heading to glance at. */
.done-notify {
  margin: 16px 0 0;
  padding: 12px 14px;
  background: var(--info-tint);
  color: var(--info);
  border: 1px solid currentColor;
  border-radius: 10px;
  font-size: .9375rem;
  text-align: left;
}

/* ── Tracking result ──────────────────────────────────────────────────────── */

.result-head { margin: 22px 0 10px; font-size: 1.25rem; }
.result-head span { font-variant-ligatures: none; letter-spacing: .04em; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 14px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .9375rem;
  font-weight: 700;
  background: var(--info-tint);
  color: var(--info);
}
.pill-mark { font-size: 1rem; line-height: 1; }

.pill-new { background: var(--info-tint); color: var(--info); }
.pill-in_progress { background: var(--warn-tint); color: var(--warn); }
.pill-escalated { background: var(--warn-tint); color: var(--warn); }
.pill-resolved { background: var(--ok-tint); color: var(--ok); }
.pill-closed { background: var(--surface-sunk); color: var(--ink-soft); }

.meta { margin: 0 0 18px; }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.meta dt { flex: 1 1 9rem; font-size: .875rem; color: var(--ink-soft); }
.meta dd { flex: 2 1 12rem; margin: 0; font-size: .9375rem; font-weight: 600; }

.resolution {
  padding: 12px 14px;
  background: var(--ok-tint);
  color: var(--ink);
  border-left: 4px solid var(--ok);
  border-radius: 0 10px 10px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 20px;
  border-left: 2px solid var(--line);
}

.timeline li { position: relative; padding: 0 0 18px 8px; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -27px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand-strong);
  border: 2px solid var(--surface);
}
.timeline time { display: block; font-size: .75rem; color: var(--ink-soft); }
.timeline .entry { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Rating ───────────────────────────────────────────────────────────────── */

.rate {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.rate h3 { margin: 0 0 10px; font-size: 1rem; }

.stars { display: flex; gap: 4px; }

.star {
  min-width: 48px;          /* comfortably over the 44px minimum tap target */
  min-height: 48px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
/* Selected stars change glyph (☆ → ★) as well as colour. */
.star.on { color: #9A6400; }
@media (prefers-color-scheme: dark) { .star.on { color: #F0C24A; } }
.star:disabled { cursor: default; opacity: 1; }

/* ── Public board ─────────────────────────────────────────────────────────── */

.board-head { margin: 0 0 8px; font-size: 1.25rem; }
.board-head:focus-visible { outline-offset: 4px; }

/* The sentence the whole feature rests on: it is what makes filing a report
   feel worth doing. It sits above the entries, not in the fineprint. */
.board-promise {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: var(--info-tint);
  color: var(--info);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: .875rem;
}

.board-filter { margin-bottom: 16px; }

.board-status { margin: 12px 0; color: var(--ink-soft); font-size: .9375rem; }

.board-list { list-style: none; margin: 0; padding: 0; }

.board-item {
  padding: 14px 14px 4px;
  margin-bottom: 14px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.board-item-title {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

.board-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.board-tag {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .8125rem;
  overflow-wrap: anywhere;
}
.board-tag-label { color: var(--ink-soft); }

/* "You said" and "We did" are told apart by their labels, never by the tint
   alone — the same rule the status pills follow. */
.board-block {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 0 10px 10px 0;
}
.board-block-said { background: var(--surface); border-left: 4px solid var(--line); }
.board-block-did { background: var(--ok-tint); border-left: 4px solid var(--ok); }

.board-block-label {
  margin: 0 0 4px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.board-block-did .board-block-label { color: var(--ok); }

.board-block-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.board-empty {
  margin: 8px 0 4px;
  padding: 20px 16px;
  background: var(--surface-sunk);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.board-empty p { margin: 0 0 10px; font-size: .9375rem; color: var(--ink-soft); }
.board-empty .board-empty-title { margin-bottom: 6px; font-weight: 700; color: var(--ink); }

.board-empty-actions { display: flex; justify-content: center; }
.board-empty-actions .btn { flex: 0 1 16rem; }

.board-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.board-pager .btn { flex: 0 0 auto; padding: 12px 14px; }

/* The summary takes its own line above the two buttons at every width. A
   three-across row wraps unpredictably on a 320px phone — previous ends up
   alone on one line and next beside the summary on the other. */
.board-pager-summary {
  flex: 1 0 100%;
  order: -1;
  margin: 0;
  text-align: center;
  font-size: .8125rem;
  color: var(--ink-soft);
}

.board-count {
  margin: 16px 0 0;
  font-size: .8125rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  max-width: 34rem;
  margin: 26px auto 0;
  font-size: .8125rem;
  color: var(--ink-soft);
  text-align: center;
}
.footer p { margin: 0 0 6px; }
.footer-dim { opacity: .8; }

/* The staff link. Set apart from the student copy above it by a rule and a
   little space, so it reads as "not for you" at a glance without being
   hidden — a 44px tap target, because an SRC officer opens it on a phone too. */
.footer-staff {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .8125rem;
}
.footer-staff a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  padding: 0 4px;
  color: var(--brand-strong);
  font-weight: 600;
}
.footer-staff a:hover { text-decoration: underline; }


/* ── Motion ───────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .btn, .tab, .toggle-btn { transition: background-color .15s ease, color .15s ease, filter .15s ease; }
  .done, #trackResult, .board-item { animation: rise .2s ease-out both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}

@media (min-width: 30rem) {
  body { padding-left: 24px; padding-right: 24px; }
  .card { padding: 24px 22px 26px; }
}
