/* ═══════════════════════════════════════════════════════════════════════
   SlumpOS additions to honey.css - the pack says "extend honey.css only by
   adding a class, with a comment". These are kept in a second file so
   honey.css stays byte-identical to docs/brand/honey/pack/tokens/honey.css
   (a test holds that) and a new pack version drops in. Every rule here
   names why the pack's own classes did not cover it. No colour, size or
   radius is invented: everything reads the custom properties.
   ═══════════════════════════════════════════════════════════════════════ */

/* Base reset and page frame: the pack styles a frame it was rendered in; the
   app owns the whole document. One column of at most 1080px, as the reference
   screens are drawn. */
* { box-sizing: border-box; }
html { background: var(--honey-cream); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
main.app-body { width: 100%; max-width: 1080px; margin: 0 auto; flex: 1; }
h1 { font-weight: 400; margin: 0; }
p { margin: 0 0 12px; }
form { margin: 0; }

/* The app bar carries the resident's name outside the nav items, so it stays
   on a phone when the items move to the tab bar. */
.app-nav__user { text-decoration: none; }
.app-nav__user.is-active { color: var(--text-on-dark); }
.app-nav--bare { justify-content: flex-start; }

/* The tab bar is a phone device: hidden until the one breakpoint. */
.tabbar { display: none; z-index: 2; }
.tabbar__item { text-decoration: none; }
@media (max-width: 720px) { .tabbar { display: flex; } }

/* Stacked cards in one column of a grid, and a row of buttons: the pack
   gives buttons their own top margin, so the wrapper only wraps. */
.stack > .card + .card { margin-top: 16px; }
.grid-2 + .card, .card + .card { margin-top: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 0 8px; }
.actions .btn { margin-right: 0; }
.actions form { display: inline; }

/* Rows whose left side is a link: the row is the control. */
.row__l a, a.row__l, a.row__s { text-decoration: none; }
.row__r .badge { justify-content: flex-end; }
.num { font-variant-numeric: tabular-nums; }

/* Dates are rendered twice - in full and abbreviated with the weekday kept -
   and the breakpoint chooses (PORTAL_SPEC 6). */
.d-short { display: none; }
@media (max-width: 720px) { .d-full { display: none; } .d-short { display: inline; } }

/* Segments are radio groups: the input sits inside the option label, hidden
   but focusable, and :has() paints the checked option the way .is-on does. */
.seg__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg__opt { position: relative; }
.seg__opt:has(input:checked) { background: var(--honey-midnight); color: var(--text-on-dark); }
.seg__opt:has(input:focus-visible) { outline: 2px solid var(--honey-midnight); outline-offset: -3px; }

/* Bare form controls Django renders without a class (the sign-in field, the
   check-in textarea, the inspection signature) read exactly as .input. */
input[type=text], input[type=email], input[type=tel], textarea {
  width: 100%; min-height: var(--touch); border: var(--rule); border-radius: var(--radius);
  background: var(--honey-white); padding: 12px 14px; font-family: var(--font-brand);
  font-size: var(--fs-body); color: var(--text); line-height: 1.5;
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 1; }
input[type=text]:focus, input[type=email]:focus, input[type=tel]:focus, textarea:focus {
  border-color: var(--honey-midnight); outline: 2px solid var(--honey-midnight); outline-offset: 2px;
}
input[type=file] { font-family: var(--font-brand); font-size: var(--fs-secondary); width: 100%; min-height: var(--touch); padding: 10px 0; }
input[type=radio], input[type=checkbox] { width: 18px; height: 18px; margin: 0 8px 0 0; vertical-align: -3px; }
.field__error { border-left: 2px solid var(--text-secondary); padding: 4px 12px; margin: 8px 0 0; font-size: var(--fs-secondary); color: var(--text); }
.field__error p { margin: 0; }
.field__note { font-size: var(--fs-secondary); color: var(--text-secondary); margin-top: 6px; line-height: 1.6; }
.field__value { font-size: var(--fs-body); color: var(--text); min-height: var(--touch); display: flex; align-items: center; }
.field--choice { display: flex; align-items: center; min-height: var(--touch); font-size: var(--fs-body); color: var(--text); text-transform: none; letter-spacing: 0; }

/* The thread: resident and operator messages with timestamps (PORTAL_SPEC 4.4).
   The pack draws it; it names no class, so these are the row's tones. */
.thread__msg { padding: 12px 0; border-bottom: var(--rule); }
.thread__msg:last-of-type { border-bottom: none; }
.thread__who { font-size: var(--fs-body); color: var(--text-strong); }
.thread__org { color: var(--text-secondary); margin-left: 6px; }
.thread__body { margin: 4px 0; }
.thread__when { font-size: var(--fs-secondary); color: var(--text-secondary); }
.photos a { display: inline-block; width: 64px; height: 64px; background: var(--honey-stone); border-radius: var(--radius); overflow: hidden; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* The message as a block inside a card needs no top margin when it is first. */
.msg p { margin: 0; }
.msg--top { margin: 0 0 18px; }

/* Footer: address and the resident line, in the secondary tone. */
.app-footer { width: 100%; max-width: 1080px; margin: 0 auto; padding: 24px var(--gutter) 48px; border-top: var(--rule); font-size: var(--fs-secondary); color: var(--text-secondary); line-height: 1.8; }
.app-footer address { font-style: normal; }
.app-footer a { color: var(--text-secondary); }
@media (max-width: 720px) { .app-footer { padding: 24px var(--gutter-mobile) 96px; } }

/* Sign-in: the one dark screen (PORTAL_SPEC 4.1). */
html:has(body.dark) { background: var(--honey-midnight); }
body.dark { background: var(--honey-midnight); color: var(--text-on-dark); }
body.dark main.app-body { display: flex; align-items: center; justify-content: center; }
.signin { width: 100%; max-width: 440px; }
.signin .thc-wordmark { font-size: 20px; }
.signin .thc-descriptor { font-size: 20px; color: var(--text-on-dark); }
.signin .card { margin-top: 28px; }
.signin .card, .signin .card p, .signin .card .card__sub { color: var(--text); }
.signin .card .card__sub { color: var(--text-secondary); }
.signin__after { font-size: var(--fs-secondary); color: var(--text-on-dark-2); margin-top: 18px; line-height: 1.7; }
.signin__after a { color: var(--text-on-dark); }
body.dark .app-footer { border-top-color: rgba(248,245,239,.12); color: var(--text-on-dark-2); }
body.dark .app-footer a { color: var(--text-on-dark-2); }

/* Two findings from the axe run on 2026-10-07, both the pack's to fix upstream
   and overridden here until it does (recorded in docs/portal-matrix.md):
   - honey.css removes the underline from every link, so a link inside running
     text is told apart by colour alone (WCAG 1.4.1, axe link-in-text-block).
     Links in prose keep their underline; links that are controls (nav, tab
     bar, rows, buttons) stay as the pack draws them.
   - .field__hint at opacity .8 over the 65% tone is Midnight at 52% - 3.4:1
     on white, under AA. The hint reads at the secondary tone, full opacity. */
p a, .alert a, .card__sub a, .h1-sub a, .field__note a, .signin__after a, .thread__body a, .msg a, .row__s a {
  text-decoration: underline; text-underline-offset: .15em;
}
.field__hint { opacity: 1; }

/* A third pack finding (2026-10-07): `.honey a { color: var(--text-strong) }`
   outranks `.app-nav__item`, `.tabbar__item` and `.btn--primary` whenever
   those are links, so on Midnight they paint Midnight on Midnight - the nav,
   the resident's name and the primary button's text disappeared in the first
   render. The pack's own classes restated at the specificity a link needs. */
.honey a.app-nav__item { color: var(--text-on-dark-2); }
.honey a.app-nav__item.is-active { color: var(--honey-amber); }
.honey a.app-nav__user { color: var(--text-on-dark-2); }
.honey a.app-nav__user.is-active { color: var(--text-on-dark); }
.honey a.tabbar__item { color: var(--text-secondary); }
.honey a.tabbar__item.is-active { color: var(--text-strong); }
.honey a.btn--primary { color: var(--text-on-dark); }
.honey a.btn--secondary { color: var(--text-strong); }
.honey a.btn--destructive { color: var(--text-secondary); }
.honey a.btn:hover, .honey a.app-nav__item:hover, .honey a.tabbar__item:hover { text-decoration: none; }

/* A form's first field sits under the card label at the pack's 20px, whether
   it is a .field or a fieldset of segments. */
.card__label + form > .field:first-child, .card__label + form > fieldset:first-child { margin-top: 20px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }

/* The sign-in screen carries its own wordmark lockup (PORTAL_SPEC 4.1); the
   bare app bar would put a second one above it. */
body.dark .app-nav--bare { display: none; }
