/* Tuxford resources. Colours and fonts come from theme.css (generated from the brand tokens). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--charcoal);
  font: 17px/1.5 var(--font-body);
}
h1, h2, h3 { font-family: var(--font-heading); color: var(--ink); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; }
a { color: var(--blueDeep); }
a:hover { color: var(--blueDeeper); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 4rem; }
.muted, .meta { color: var(--muted); }
.meta { font-size: .88rem; margin: .25rem 0 0; display: flex; flex-wrap: wrap; gap: .1rem .4rem; align-items: center; }
.lead { font-size: 1.1rem; color: var(--body); margin: 0 0 .5rem; max-width: 62ch; }
.loading { color: var(--muted); padding: 3rem 0; text-align: center; }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: var(--blue); color: var(--white); border-bottom: 4px solid var(--gold); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 1rem; }
.brand { color: var(--white); text-decoration: none; font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; }
.brand:hover { color: var(--white); }
.diamond { width: 14px; height: 14px; background: var(--gold); transform: rotate(45deg); display: inline-block; }
nav { display: flex; align-items: center; gap: 1rem; }
nav .linkish { color: var(--white); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  padding: .55rem 1rem; border-radius: 8px;
  border: 1.5px solid var(--blue); background: var(--white); color: var(--blueDeep);
}
.btn:hover { background: var(--blueTint); color: var(--blueDeeper); }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blueDeeper); border-color: var(--blueDeeper); color: var(--white); }
.btn-light { background: var(--white); color: var(--blueDeep); border-color: var(--white); padding: .4rem .85rem; }
.btn-big { padding: .8rem 1.4rem; font-size: 1.05rem; }
.btn-small { padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled { opacity: .6; cursor: wait; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--blueDeep); text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* layout pieces */
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; padding: 2rem 0 .5rem; flex-wrap: wrap; }
.hero > div { flex: 1 1 420px; }
.crumbs { margin: 1.25rem 0 0; }
.card { background: var(--white); border: 1px solid var(--rule); border-radius: 12px; padding: 1.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.section-head h2 { margin: 0; }
.notice { padding: 1rem 1.25rem; border-radius: 8px; margin: 2rem 0; }
.notice-error { background: var(--redTint); color: var(--red); }

input, select, textarea {
  font: inherit; color: var(--charcoal); width: 100%;
  padding: .6rem .75rem; border: 1.5px solid #c9c9c9; border-radius: 8px; background: var(--white);
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: 3px solid var(--blueTint); }
input[type="search"] { max-width: 320px; }
textarea { resize: vertical; min-height: 12rem; }
label, .label { display: block; font-weight: 600; margin: 0 0 .35rem; }

/* login */
.login { max-width: 400px; margin: 4rem auto; display: grid; gap: .5rem; }
.login h1 { margin-bottom: 0; }
.login label { margin-top: .5rem; }
.login .btn { margin-top: .75rem; }
.form-error { color: var(--red); font-weight: 600; margin: .25rem 0; min-height: 1.2em; }

/* projects */
.project-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-top: 1rem; }
.project {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--white); border: 1px solid var(--rule); border-top: 4px solid var(--blue); border-radius: 10px; padding: 1rem 1.1rem;
  transition: box-shadow .15s, transform .15s;
}
.project:hover { color: inherit; box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-1px); }
.project h3 { color: var(--blueDeep); }
.project .summary { color: var(--body); font-size: .95rem; margin: 0 0 .5rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* status pills */
.pill { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; white-space: nowrap; margin-left: .25rem; }
.st-waiting { background: var(--goldTint); color: #6b5a00; }
.st-progress { background: var(--blueTint); color: var(--blueDeeper); }
.st-question { background: var(--redTint); color: var(--red); }
.st-done { background: var(--greenTint); color: var(--green); }

/* requests */
.req-list { display: grid; gap: .75rem; }
.req { background: var(--white); border: 1px solid var(--rule); border-left: 4px solid var(--blue); border-radius: 10px; padding: 1rem 1.1rem; }
.req-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.req-head h3 { margin: 0; }
.req-text { white-space: pre-wrap; color: var(--body); margin: .6rem 0 0; }
.reply { margin-top: .75rem; padding: .75rem 1rem; background: var(--greenTint); border-radius: 8px; }
.reply-question { background: var(--redTint); }
.reply-label { font-weight: 700; margin: 0 0 .25rem; }
.reply-body { white-space: pre-wrap; margin: 0; }
.req-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.req-actions:empty { display: none; }

/* files */
.files { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .5rem; }
.file { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: .75rem .9rem; }
.ficon { width: 46px; height: 46px; border-radius: 8px; display: grid; place-items: center; font: 700 .72rem var(--font-body); color: var(--white); letter-spacing: .03em; }
.k-ppt { background: #c4462a; }
.k-doc { background: #2b5fad; }
.k-xls { background: #217346; }
.k-pdf { background: #b0413e; }
.k-img { background: var(--blueDeep); }
.k-other { background: var(--muted); }
.fmain { min-width: 0; }
.fname { font-weight: 600; word-break: break-word; }
.fdesc { margin: .15rem 0 0; color: var(--body); font-size: .92rem; }
.factions { display: flex; gap: .4rem; }
.files-compact .file { padding: .5rem .75rem; }
.files-compact .ficon { width: 36px; height: 36px; font-size: .65rem; }
.group h3 { margin: 1rem 0 .25rem; font-size: .95rem; color: var(--body); }
.latest { margin-top: 1.5rem; border-top: 4px solid var(--gold); }
.latest h2 { margin-top: 0; }
.latest-title { font-weight: 600; margin: 0 0 .5rem; }
.latest details { margin-bottom: .75rem; }

/* requests timeline */
.timeline { display: grid; gap: .5rem; }
.timeline details { background: var(--white); border: 1px solid var(--rule); border-radius: 10px; padding: .75rem 1rem; }
.timeline summary { cursor: pointer; font-weight: 600; }
.req-full { margin-top: .75rem; color: var(--body); }
details summary { cursor: pointer; color: var(--blueDeep); font-weight: 600; }

/* new request form */
.form { margin-top: 1rem; display: grid; gap: 1.25rem; max-width: 760px; }
.form h1 { margin: 0; }
.choice { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; }
.choice legend { font-weight: 600; margin-bottom: .5rem; padding: 0; }
.radio { display: flex; align-items: center; gap: .6rem; font-weight: 400; border: 1.5px solid var(--rule); border-radius: 8px; padding: .6rem .8rem; cursor: pointer; margin: 0; }
.radio:has(input:checked) { border-color: var(--blue); background: var(--blueTint); }
.radio input { width: auto; margin: 0; }
.drop { border: 2px dashed #b9c9d4; border-radius: 10px; padding: 1.5rem; text-align: center; display: grid; gap: .25rem; cursor: pointer; background: var(--surface); }
.drop.over, .drop:hover { border-color: var(--blue); background: var(--blueTint); }
.pending-files { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .35rem; }
.pending-files li { display: grid; grid-template-columns: 1fr auto auto; gap: .75rem; align-items: center; padding: .4rem .6rem; background: var(--surface); border-radius: 6px; word-break: break-word; }
.pending-files progress { width: 120px; }
.form-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.done { margin-top: 3rem; max-width: 640px; }

/* file thumbnails */
.fthumb { width: 96px; height: 72px; padding: 0; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface);
  cursor: zoom-in; position: relative; overflow: hidden; display: grid; place-items: center; }
.fthumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.fthumb:hover { border-color: var(--blue); box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.fpages { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: .7rem; font-weight: 700;
  padding: 0 .35rem; border-radius: 4px; line-height: 1.5; }
.files-compact .fthumb { width: 64px; height: 48px; }

/* viewer (deliberately dark, whatever the page theme: it's for looking at pages) */
body.noscroll { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: #16191d; color: #f2f2f2; display: grid;
  grid-template-rows: auto 1fr auto auto; }
.v-top { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: #0f1114; }
.v-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.v-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-count { font-size: .85rem; color: #b5bcc4; }
.v-tools { display: flex; gap: .5rem; }
.v-btn { font: inherit; font-size: .9rem; font-weight: 600; color: #f2f2f2; background: #2a2f36; border: 1px solid #3a4049;
  border-radius: 8px; padding: .4rem .8rem; cursor: pointer; text-decoration: none; }
.v-btn:hover { background: #363c45; color: #fff; }
.v-btn-primary { background: var(--blue); border-color: var(--blue); }
.v-btn-primary:hover { background: var(--blueDeeper); }
.v-close { font-size: 1.1rem; padding: .3rem .7rem; }
.v-main { display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 0; }
.v-stage { position: relative; align-self: stretch; min-height: 0; display: grid; place-items: center; touch-action: pan-y pinch-zoom; }
.v-img { position: absolute; inset: 0; margin: auto; padding: 0; max-width: calc(100% - .5rem); max-height: calc(100% - 2rem);
  width: auto; height: auto; background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,.5); user-select: none; -webkit-user-drag: none; }
.v-loading { color: #b5bcc4; text-align: center; display: grid; gap: 1rem; justify-items: center; }
.v-nav { font-size: 2.6rem; line-height: 1; width: 56px; height: 96px; margin: 0 .5rem; color: #f2f2f2; background: rgba(255,255,255,.06);
  border: 0; border-radius: 10px; cursor: pointer; }
.v-nav:hover:not(:disabled) { background: rgba(255,255,255,.16); }
.v-nav:disabled { opacity: .2; cursor: default; }
.v-note { margin: 0; padding: .4rem 1rem; text-align: center; color: #f0d860; font-size: .9rem; }
.v-strip { display: flex; gap: .5rem; overflow-x: auto; padding: .6rem 1rem .8rem; background: #0f1114; scrollbar-color: #3a4049 transparent; }
.v-strip button { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: 5px; background: none; cursor: pointer;
  position: relative; opacity: .65; }
.v-strip button:hover { opacity: 1; }
.v-strip button[aria-selected="true"] { border-color: var(--gold); opacity: 1; }
.v-strip img { display: block; height: 64px; width: auto; border-radius: 3px; background: #fff; }
.v-strip span { position: absolute; left: 3px; bottom: 3px; font-size: .7rem; font-weight: 700; background: rgba(0,0,0,.7); color: #fff;
  padding: 0 .3rem; border-radius: 3px; }
.viewer:fullscreen { grid-template-rows: auto 1fr 0 0; }
.viewer:fullscreen .v-strip, .viewer:fullscreen .v-note { display: none; }
.viewer:fullscreen .v-img { max-width: 100%; max-height: 100%; }

/* rendered markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h2 { font-size: 1.2rem; margin: 1em 0 .4em; }
.md h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
.md p { margin: 0 0 .7em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.6em; }
.md li > p { margin: 0; }
.md blockquote { margin: 0 0 .7em; padding: .2em 0 .2em 1em; border-left: 4px solid var(--blueTint); color: var(--body); }
.md table { border-collapse: collapse; margin: 0 0 .8em; font-size: .95em; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--rule); padding: .35em .6em; text-align: left; vertical-align: top; }
.md th { background: var(--surface); }
.md code { font-size: .92em; background: var(--surface); padding: 0 .25em; border-radius: 3px; }
.md hr { border: 0; border-top: 1px solid var(--rule); margin: 1em 0; }

/* rich text editor */
.hint { font-size: .9rem; color: var(--muted); margin: -.15rem 0 .5rem; }
.draft-note { font-size: .9rem; background: var(--goldTint); padding: .4rem .7rem; border-radius: 6px; margin: 0 0 .5rem; }
.editor { border: 1.5px solid #c9c9c9; border-radius: 8px; background: var(--white); }
.editor:focus-within { border-color: var(--blue); outline: 3px solid var(--blueTint); }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: .2rem; padding: .35rem; border-bottom: 1px solid var(--rule); background: var(--surface);
  border-radius: 8px 8px 0 0; position: sticky; top: 0; z-index: 1; }
.tb { font: inherit; min-width: 2.3rem; height: 2.1rem; padding: 0 .5rem; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--charcoal); cursor: pointer; font-weight: 600; }
.tb:hover { background: var(--white); border-color: var(--rule); }
.tb[aria-pressed="true"] { background: var(--blueTint); border-color: var(--blue); color: var(--blueDeeper); }
.tb-bold { font-weight: 800; }
.tb-italic { font-style: italic; font-family: Georgia, serif; }
.tb-h { font-family: var(--font-heading); font-weight: 800; }
.tb-h3 { font-family: var(--font-heading); font-size: .85rem; }
.editor-link { display: flex; gap: .5rem; align-items: center; padding: .4rem .5rem; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.editor-link label { margin: 0; font-weight: 600; }
.editor-link input { flex: 1 1 200px; padding: .35rem .6rem; }
.editor-area { min-height: 14rem; max-height: 70vh; overflow-y: auto; padding: .7rem .9rem; outline: none; }
.editor-area.is-empty::before { content: attr(data-placeholder); color: #8a8a8a; pointer-events: none; position: absolute; }
.editor-area a { text-decoration: underline; }

@media (max-width: 640px) {
  .card { padding: 1rem; }
  .latest .file { padding: .6rem; }
  h1 { font-size: 1.5rem; }
  .file { grid-template-columns: auto 1fr; }
  .factions { grid-column: 1 / -1; }
  .ficon { width: 38px; height: 38px; }
  .fthumb { width: 72px; height: 54px; }
  .v-nav { width: 34px; height: 64px; font-size: 1.8rem; margin: 0 .15rem; }
  .v-top { flex-wrap: wrap; }
  .v-title { flex-basis: calc(100% - 3.5rem); }
  .v-tools { order: 3; width: 100%; }
  .v-strip img { height: 48px; }
  nav .btn-light { display: none; }
  .pending-files progress { width: 70px; }
}
