/* NeighPal components — shared by previews, design screens and the app.
   Every value comes from tokens.css; nothing here hard-codes a colour. */

.nb, .nb * { box-sizing: border-box; }
.nb { font-family: var(--font-body); color: var(--ink); -webkit-font-smoothing: antialiased; }
.nb :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Button */
.nb-btn { font: 600 15px/20px var(--font-body); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-5); border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; text-decoration: none; }
.nb-btn--primary { background: var(--action); color: var(--on-action); }
.nb-btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.nb-btn--quiet { background: var(--mint); color: var(--ink); }
.nb-btn--danger { background: var(--surface); color: var(--alert); border-color: var(--alert); }
.nb-btn--whinny { background: var(--lilac); color: var(--plum); }
.nb-btn--yard { min-height: var(--tap-yard); font-size: 17px; border-radius: var(--radius-lg); padding: 0 var(--space-6); }
.nb-btn--block { width: 100%; }
.nb-btn[disabled] { opacity: .45; cursor: default; }

/* Status chip — always a word, never colour alone */
.nb-chip { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/18px var(--font-body); padding: 4px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.nb-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.nb-chip--good { background: var(--good-tint); color: var(--good); }
.nb-chip--warn { background: var(--warn-tint); color: var(--warn); }
.nb-chip--alert { background: var(--alert-tint); color: var(--alert); }
.nb-chip--neutral { background: var(--surface-sunk); color: var(--ink-muted); }
.nb-chip--whinny { background: var(--lilac); color: var(--plum); }
.nb-chip--plain::before { display: none; }

/* Horse avatar — photo first, initial as fallback, status dot optional */
.nb-horse { position: relative; display: inline-grid; place-items: center; width: var(--avatar-md); height: var(--avatar-md); border-radius: var(--radius-md);
  background: var(--mint); color: var(--ink); font: 600 20px/1 var(--font-display); flex: none; }
.nb-horse img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.nb-horse--sm { width: var(--avatar-sm); height: var(--avatar-sm); border-radius: var(--radius-sm); font-size: 15px; }
.nb-horse--lg { width: var(--avatar-lg); height: var(--avatar-lg); border-radius: var(--radius-lg); font-size: 30px; }
.nb-horse__dot { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--surface); }
.nb-horse__dot--good { background: var(--good); } .nb-horse__dot--warn { background: var(--warn); } .nb-horse__dot--alert { background: var(--alert); }

/* Care circle — the people around one horse */
.nb-circle { display: inline-flex; align-items: center; }
.nb-person { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 700 11px/1 var(--font-body); letter-spacing: .02em;
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 2px var(--role, var(--line)); }
.nb-circle .nb-person + .nb-person { margin-left: -6px; }
.nb-person--owner { --role: var(--role-owner); } .nb-person--vet { --role: var(--role-vet); } .nb-person--farrier { --role: var(--role-farrier); }
.nb-person--yard { --role: var(--role-yard); } .nb-person--sharer { --role: var(--role-sharer); }
.nb-circle__more { margin-left: var(--space-2); font: 600 13px/18px var(--font-body); color: var(--ink-muted); }

/* Card */
.nb-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); }
.nb-card--oat { background: var(--oat); border-color: transparent; }
.nb-card--mint { background: var(--mint); border-color: transparent; }
.nb-label { font: 600 12px/16px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }

/* Care countdown — days, not percentages */
.nb-countdown { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: baseline; }
.nb-countdown__name { font: 600 15px/20px var(--font-body); }
.nb-countdown__when { font: 600 14px/20px var(--font-body); }
.nb-countdown__track { grid-column: 1 / -1; height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunk); overflow: hidden; }
.nb-countdown__fill { height: 100%; border-radius: inherit; }
.nb-countdown__meta { grid-column: 1 / -1; font: 400 13px/18px var(--font-body); color: var(--ink-muted); }
.nb-countdown--good .nb-countdown__when { color: var(--good); } .nb-countdown--good .nb-countdown__fill { background: var(--good); }
.nb-countdown--warn .nb-countdown__when { color: var(--warn); } .nb-countdown--warn .nb-countdown__fill { background: var(--warn); }
.nb-countdown--alert .nb-countdown__when { color: var(--alert); } .nb-countdown--alert .nb-countdown__fill { background: var(--alert); }

/* Story moment — one entry in a horse's day */
.nb-story { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.nb-story__media { display: block; width: 100%; height: 180px; object-fit: cover; }
.nb-story__body { padding: var(--space-3) var(--space-4) var(--space-4); display: grid; gap: var(--space-2); }
.nb-story__top { display: flex; justify-content: space-between; gap: var(--space-3); font: 400 13px/18px var(--font-body); color: var(--ink-muted); }
.nb-story__text { font: 400 16px/24px var(--font-body); }
.nb-story__actions { display: flex; gap: var(--space-2); }
.nb-react { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-muted); font: 600 13px/18px var(--font-body); cursor: pointer; }
.nb-react[aria-pressed="true"] { background: var(--oat); border-color: transparent; color: var(--heart-ink); }

/* Attention card — an exception that needs a decision */
.nb-attention { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); }
.nb-attention__text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nb-attention__title { font: 600 15px/20px var(--font-body); }
.nb-attention__why { font: 400 13px/18px var(--font-body); color: var(--ink-muted); }

/* Access level — No access / View / Edit */
.nb-access { display: inline-grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--radius-md); background: var(--surface-sunk); min-width: 252px; }
.nb-access button { font: 600 13px/18px var(--font-body); min-height: 36px; border: 0; border-radius: calc(var(--radius-md) - 4px); background: transparent; color: var(--ink-muted); cursor: pointer; }
.nb-access button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }

/* Tab bar — mobile-first navigation, same five places for every role */
.nb-tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; height: var(--tabbar-height); padding: 0 var(--space-2);
  background: var(--surface); border-radius: var(--radius-pill); box-shadow: var(--shadow-float); }
.nb-tab { display: grid; justify-items: center; gap: 2px; color: var(--ink-muted); text-decoration: none; font: 600 11px/14px var(--font-body); min-height: var(--tap-min); align-content: center; }
.nb-tab[aria-current="page"] { color: var(--ink); }
.nb-tab svg { width: 22px; height: 22px; }
.nb-tab--capture { justify-self: center; width: 56px; height: 56px; border-radius: 20px; background: var(--action); color: var(--on-action); display: grid; place-items: center; }

/* Whinny — the AI companion speaks in lilac */
.nb-whinny { background: var(--lilac); color: var(--plum); border-radius: var(--radius-lg); padding: var(--space-4); display: grid; gap: var(--space-3); }
.nb-whinny__who { display: flex; align-items: center; gap: var(--space-2); font: 600 13px/18px var(--font-body); }
.nb-whinny__text { font: 400 16px/24px var(--font-body); }
.nb-whinny__src { font: 400 12px/16px var(--font-body); opacity: .8; }

/* Nav rail — desktop navigation: same places as the tab bar, icon over label */
.nb-rail { flex: 1 1 88px; max-width: 100%; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 4px; padding: 16px 8px; box-sizing: border-box; background: var(--surface); border-right: 1px solid var(--line); }
.nb-rail__logo { width: 72px; display: grid; place-items: center; padding: 4px 0 12px; }
.nb-rail__logo img { width: 40px; height: 40px; display: block; }
.nb-rail a.nb-rail__item { position: relative; width: 72px; display: grid; justify-items: center; gap: 4px; padding: 6px 0; color: var(--ink-muted); text-decoration: none; font: 600 11px/14px var(--font-body); border-radius: var(--radius-md); }
.nb-rail__icon { width: 52px; height: 32px; border-radius: var(--radius-pill); display: grid; place-items: center; }
.nb-rail__icon svg { width: 22px; height: 22px; }
.nb-rail a.nb-rail__item[aria-current="page"] { color: var(--ink); }
.nb-rail a.nb-rail__item[aria-current="page"] .nb-rail__icon { background: var(--mint); }
.nb-rail__badge { position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: var(--alert); color: var(--surface); font: 700 11px/18px var(--font-body); text-align: center; }
.nb-rail__sep { width: 40px; height: 1px; background: var(--line); margin: 8px 16px; }
.nb-rail__capture { width: 56px; height: 56px; margin: 4px 8px 12px; border: 0; border-radius: 18px; background: var(--action); color: var(--on-action); display: grid; place-items: center; cursor: pointer; }
.nb-rail__capture svg { width: 24px; height: 24px; }

@media (max-width: 760px) {
  .nb-rail { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; align-items: center; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nb-rail__logo { width: auto; padding: 0 8px; }
  .nb-rail__logo img { width: 32px; height: 32px; }
  .nb-rail__sep { display: none; }
  .nb-rail__capture { order: 99; width: 48px; height: 48px; margin: 0 4px 0 auto; flex: none; }
  .nb-rail a.nb-rail__item { flex: none; width: 64px; }
}

/* Logo tile on dark grounds: a hairline keeps the forest tile from melting into the rail */
[data-theme="dark"] .nb-rail__logo img { border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
