/* ResQ-R - fire-engine red + Dalmatian ink/paper, EdQuest flame accent. */
:root {
  --red:        #d11f27;
  --red-deep:   #9a0b22;
  --red-soft:   #fcebed;
  --flame:      #ff8844;
  --ink:        #1a1a1a;
  --slate:      #5b5b5e;
  --slate-soft: #8a8a8e;
  --line:       #e7e2db;
  --paper:      #ffffff;
  --canvas:     #faf7f1;

  --container: 72rem;
  --narrow: 44rem;
  --pad: clamp(1.1rem, 4vw, 2.25rem);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 6px 22px -10px rgba(0,0,0,.22);
  --shadow-lg: 0 18px 50px -22px rgba(0,0,0,.30);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --focus: 0 0 0 3px rgba(209,31,39,.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--canvas); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
img, svg { max-width: 100%; display: block; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-deep); text-decoration: underline; }
strong { font-weight: 700; }
h1, h2, h3 { line-height: 1.15; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 0 0 .6rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
       background: var(--red-soft); color: var(--red-deep); padding: .1em .35em; border-radius: 5px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.container { max-width: var(--container); margin: 0 auto; padding-inline: var(--pad); }
.container--narrow { max-width: var(--narrow); }
.muted { color: var(--slate); }
.mt-0 { margin-top: 0; } .mt-3 { margin-top: 1.25rem; } .mt-4 { margin-top: 2rem; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94);
  backdrop-filter: saturate(160%) blur(6px); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; }
.brand:hover { text-decoration: none; }
.brand__mark { height: 40px; width: auto; }
/* Stack the wordmark over a small EdQuest attribution, like the GardenCAD header. */
.brand__stack { display: inline-flex; flex-direction: column; justify-content: center; line-height: 1; }
.brand__wordmark { font-weight: 900; font-size: 1.25rem; line-height: 1; letter-spacing: -.02em; color: var(--ink); }
.brand__sub { display: block; margin-top: .16rem; font-weight: 600; font-size: .62rem;
              letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
.brand__sub strong { color: var(--red-deep); font-weight: 700; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav > a { color: var(--ink); font-weight: 600; font-size: .98rem; }
.site-nav > a:hover { color: var(--red); text-decoration: none; }
.site-nav__signin { padding: .45rem .9rem; border: 1.5px solid var(--red); border-radius: 999px; color: var(--red) !important; }
.site-nav__signin:hover { background: var(--red); color: #fff !important; text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: .4rem; }
.nav-toggle__bar { display: block; width: 24px; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; }

/* account dropdown */
.acct { position: relative; }
.acct__btn { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: .3rem .6rem .3rem .35rem; cursor: pointer; font: inherit; color: var(--ink); }
.acct__btn:hover { border-color: var(--red); }
.acct__avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.acct__name { font-weight: 600; font-size: .95rem; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct__menu { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 230px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; }
.acct__menu[hidden] { display: none; }
.acct__who { margin: .2rem .6rem .4rem; font-size: .82rem; color: var(--slate); }
.acct__item { display: block; width: 100%; text-align: left; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.acct__item:hover { background: var(--canvas); text-decoration: none; }
.acct__sep { height: 1px; background: var(--line); margin: .35rem .3rem; }
.acct__signout { color: var(--red-deep); }
.acct__signout-form { margin: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
  font: inherit; font-weight: 700; padding: .7rem 1.3rem; border-radius: 999px; border: 1.5px solid transparent;
  background: var(--red); color: #fff; text-decoration: none; transition: transform .04s ease, background .15s ease; }
.btn:hover { background: var(--red-deep); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--red); }
.btn--ghost { background: transparent; color: var(--red); border-color: var(--red); }
.btn--ghost:hover { background: var(--red-soft); color: var(--red-deep); }
.btn--sm { padding: .45rem .9rem; font-size: .9rem; }
.btn--danger { background: var(--red-deep); }
.btn--on-red { background: #fff; color: var(--red); }
.btn--on-red:hover { background: #ffeef0; color: var(--red-deep); }
.btn--ghost-invert { background: transparent; color: #fff; border-color: rgba(255,255,255,.7); }
.btn--ghost-invert:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn--block { display: flex; width: 100%; }

/* ---------- hero / sections ---------- */
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; color: var(--red); margin: 0 0 .5rem; }
.eyebrow--invert { color: rgba(255,255,255,.85); }
.accent { color: var(--red); }
.invert { color: #fff; }
.lede { font-size: 1.18rem; color: var(--slate); max-width: 40rem; }
.lede.invert { color: rgba(255,255,255,.92); }
.hero { padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(2rem, 5vw, 3rem); }
.hero--compact { padding: clamp(2rem, 5vw, 3rem) 0 1rem; }
.hero__grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 2.5rem; align-items: center; }
.hero__art img { margin-inline: auto; filter: drop-shadow(var(--shadow-lg)); }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.4rem; }
.hero__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section { padding: clamp(2.2rem, 6vw, 3.8rem) 0; }
.section--alt { background: var(--paper); border-block: 1px solid var(--line); }
.section__head { margin-bottom: 1.6rem; }
.section-title { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.section-title small { display: block; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem;
  font-weight: 800; color: var(--red); margin-bottom: .25rem; }
.section--cta { background: var(--red); color: #fff; }
.section--cta__inner { text-align: center; max-width: 44rem; margin-inline: auto; }

.prose { max-width: 44rem; color: var(--ink); }
.prose--narrow { max-width: var(--narrow); margin-inline: auto; }
.prose h2 { margin-top: 1.8rem; }
.pull { font-size: 1.3rem; font-weight: 700; color: var(--red); border-left: 4px solid var(--red); padding-left: 1rem; }
.where { margin-top: 1.5rem; }
.where__label { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 800; color: var(--red); }
.note { margin-top: 1.5rem; padding: 1rem 1.2rem; background: var(--red-soft); border-radius: var(--radius); }

/* ---------- cards / pillars / steps ---------- */
.cards { display: grid; gap: 1.2rem; grid-template-columns: 1fr; }
.cards--2 { grid-template-columns: repeat(2, 1fr); }
.cards--3 { grid-template-columns: repeat(3, 1fr); }
.cards--4 { grid-template-columns: repeat(4, 1fr); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .5rem; }
.card--soft { background: var(--canvas); box-shadow: none; }
.card__title { font-size: 1.1rem; margin: 0; }
.card__meta { color: var(--slate); font-size: .92rem; margin: 0; }
.card .btn { align-self: flex-start; margin-top: auto; }
.pillar { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.pillar__num { font-weight: 900; font-size: 1.1rem; color: #fff; background: var(--red); width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center; border-radius: 50%; margin-bottom: .6rem; }
.pillar h3 { margin: 0 0 .3rem; }
.pillar p { margin: 0; color: var(--slate); }
.steps { list-style: none; counter-reset: s; padding: 0; max-width: 46rem; display: grid; gap: 1rem; }
.steps li { counter-increment: s; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem 1.1rem 3.4rem; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 1rem; top: 1.1rem; width: 1.8rem; height: 1.8rem;
  background: var(--red); color: #fff; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.steps h3 { margin: 0 0 .25rem; }
.steps p { margin: 0; color: var(--slate); }

/* ---------- badges (pills) ---------- */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15em .6em; border-radius: 999px;
  background: var(--red-soft); color: var(--red-deep); vertical-align: middle; }
.badge--ok { background: #e3f4e7; color: #1f7a37; }
.badge--draft { background: #f0ede8; color: var(--slate); }
.role-badges { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .5rem; }
.message { padding: .7rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--paper); }
.message--success { background: #e8f6ec; border-color: #b6e0c2; }
.message--error { background: var(--red-soft); border-color: #f3c2c7; color: var(--red-deep); }
.message--warning { background: #fff6e6; border-color: #f3dca6; }
.message--info { background: #eef4fb; border-color: #cfe0f3; }

/* ---------- forms ---------- */
.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.input, input[type=text], input[type=email], input[type=url], input[type=number], input[type=date],
input[type=search], input[type=password], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
.field__help { font-size: .82rem; color: var(--slate); margin: .3rem 0 0; }
.field__error { font-size: .85rem; color: var(--red-deep); margin: .3rem 0 0; }
.field--error .input, .field--error input, .field--error select, .field--error textarea { border-color: var(--red); }
.field__check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.field__check input { width: auto; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 0 0 1.3rem; }
legend { font-weight: 800; padding: 0 .4rem; color: var(--red); }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filter-bar input[type=search] { max-width: 18rem; }
.filter-bar select { max-width: 12rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.table th, .table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--slate); }
.table tr:last-child td { border-bottom: 0; }
.table--kv th { width: 11rem; color: var(--slate); font-weight: 600; }

/* ---------- role form ---------- */
.role-fieldset { display: grid; gap: .6rem; }
.role-row { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; padding: .6rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); }
.role-row strong { display: block; }
.role-row .muted { display: block; font-size: .88rem; }
.role-row--locked { opacity: .65; }

/* ---------- badge editor ---------- */
.badge-editor { display: grid; grid-template-columns: 1fr 18rem; gap: 2rem; align-items: start; }
.badge-form { min-width: 0; }
.badge-side { display: grid; gap: 1rem; position: sticky; top: 80px; }
.badge-side__card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.badge-side__card h3 { margin: 0 0 .6rem; font-size: 1rem; }
.badge-side__art { width: 100%; height: auto; }
.proof-form { display: flex; gap: .5rem; margin: .5rem 0; flex-wrap: wrap; }
.proof-form select { flex: 1; min-width: 9rem; }
.link-danger { color: var(--red-deep); font-weight: 600; }
.resource-row { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .9rem; margin-bottom: .9rem; }
.delete { color: var(--red-deep); }

.badge-card__art { width: 140px; height: auto; margin: 0 auto .4rem; }
.badge-card__actions { display: flex; gap: .5rem; margin-top: auto; }

/* ---------- scan page ---------- */
.scan-page { background: var(--paper); }
.scan { padding: clamp(1.5rem, 5vw, 3rem) 0 3rem; }
.scan--center { text-align: center; }
.scan--center img { margin: 0 auto 1rem; }
.scan__mark { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--red);
  text-transform: uppercase; letter-spacing: .06em; font-size: .82rem; margin-bottom: 1.2rem; }
.scan__headline { margin-bottom: .4rem; }
.scan__loc { font-weight: 600; color: var(--slate); margin: 0 0 .6rem; }
.scan__h2 { font-size: 1.25rem; margin: 1.8rem 0 .6rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.scan__steps { padding-left: 1.3rem; display: grid; gap: .5rem; }
.scan__steps li { padding-left: .3rem; }
.resource-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.resource a { display: block; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem 1rem; }
.resource a:hover { border-color: var(--red); text-decoration: none; }
.resource__kind { display: inline-block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  font-weight: 800; color: var(--red); }
.resource__label { display: block; font-weight: 700; color: var(--ink); }
.resource__desc { display: block; color: var(--slate); font-size: .9rem; }
.scan__foot { margin-top: 2.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.notice { font-weight: 700; }
.preview-banner { background: #fff6e6; border-bottom: 1px solid #f3dca6; text-align: center; padding: .6rem 1rem; font-weight: 600; }

/* ---------- auth ---------- */
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.8rem; box-shadow: var(--shadow-sm); }
.auth-card form { display: grid; gap: .9rem; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #cfcfcf; margin-top: 3rem; padding: 2.5rem 0 1.6rem; }
.site-footer a { color: #fff; }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.site-footer__lockup { display: flex; align-items: center; gap: .6rem; }
.site-footer__wordmark { color: #fff; margin: 0; font-size: 1.3rem; font-weight: 900; }
.site-footer__motto { color: #fff; font-weight: 700; margin: .6rem 0 .2rem; }
.site-footer h3 { color: #fff; font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 .6rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-footer .muted { color: #9a9a9a; }
.site-footer__fine { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  border-top: 1px solid rgba(255,255,255,.12); margin-top: 2rem; padding-top: 1.2rem; font-size: .82rem; color: #9a9a9a; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cards--4 { grid-template-columns: repeat(2, 1fr); }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__art { order: -1; max-width: 18rem; margin-inline: auto; }
  .badge-editor { grid-template-columns: 1fr; }
  .badge-side { position: static; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .nav-toggle { display: block; }
  .site-nav { position: absolute; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0; padding: .5rem var(--pad); display: none; }
  .site-nav[data-open="true"] { display: flex; }
  .site-nav > a { padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .acct { width: 100%; }
  .acct__menu { position: static; box-shadow: none; border: 0; padding: 0; min-width: 0; }
  .acct__btn { display: none; }
  .acct__menu[hidden] { display: block; }
  .cards--2, .cards--3, .cards--4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .site-footer__grid { grid-template-columns: 1fr; }
}

/* ---------- Notifications (in-app "EdQuest messages") ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.notif { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; border-left: 4px solid var(--line); }
.notif--unread { border-left-color: var(--red, #d11f27); background: #fffaf6; }
.notif__title { margin: 0 0 .25rem; font-size: 1.02rem; }
.notif__meta { font-size: .82rem; margin: .35rem 0 0; }

/* ---------- Registration extras on the scan page ---------- */
.reg-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem; margin: 1rem 0; }
.reg-file { margin: 0; }
.reg-file img { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.reg-file figcaption { font-size: .82rem; color: var(--slate); margin-top: .3rem; }
.scan__register { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
