/* MiniCity shared pieces: buttons, text boxes, chips, status pills, boxes,
   callouts, labels, pop-ups and document pages. Built only from tokens.css.

   New code uses the short class names (.btn, .input, .chip, .pill, .box,
   .callout, .eyebrow, .modal…). Older markup is listed next to them in the
   same rule, so it all looks the same and a change here changes all of it;
   pages only add layout (margins, widths) on top. */

/* ---- buttons ----------------------------------------------------------- */

.btn,
.contrib button, .contrib-custom button, .modal-actions button, .dev button, .set-btns button,
.set-foot-acts button, .hint-actions button, .charity-prompt-acts button,
td button, .admin button.small, .seg-inline button, .btn-link, .fb-head button,
.contact-btn, .save button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-12); border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--fill-3); color: var(--text);
  font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled),
.contrib button:hover:not(:disabled), .contrib-custom button:hover:not(:disabled), .modal-actions button:hover:not(:disabled),
.set-btns button:hover:not(:disabled), .set-foot-acts button:hover:not(:disabled), .hint-actions button:hover:not(:disabled),
.charity-prompt-acts button:hover, td button:hover:not(:disabled), .admin button.small:hover:not(:disabled),
.seg-inline button:hover, .btn-link:hover, .fb-head button:hover, .contact-btn:hover, .save button:hover { background: var(--fill-5); }

/* small: table rows, admin rows, inline links styled as buttons */
.btn-sm, td button, .admin button.small, .seg-inline button, .btn-link, .fb-head button {
  padding: var(--sp-4) var(--sp-10); border-radius: var(--r-sm); font-size: var(--fs-sm);
}
td button, .admin button.small { font-size: inherit; }
/* large: the main action on a page or in a bar */
.btn-lg, .big-btn, .set-foot-acts button, .hint-actions button, .charity-prompt-acts button {
  padding: var(--sp-8) var(--sp-16); border-radius: var(--r-md); font-weight: 600;
}
.big-btn { display: inline-flex; align-items: center; gap: var(--sp-6); padding: var(--sp-10) var(--sp-16); border: 0; font: inherit; font-weight: 700; font-size: var(--fs-lg); cursor: pointer; text-decoration: none; }
.btn-block { display: flex; width: 100%; }

/* variants */
.btn-primary, button.primary, .go-btn, .big-btn.go {
  background: var(--accent) !important; border-color: var(--accent) !important; color: white !important; font-weight: 600;
}
.btn-primary:hover:not(:disabled), button.primary:hover:not(:disabled), .go-btn:hover:not(:disabled), .big-btn.go:hover:not(:disabled) { background: var(--accent-hover) !important; }
.big-btn.go { background: var(--twitch) !important; border-color: var(--twitch) !important; }
.big-btn.go:hover:not(:disabled) { background: var(--twitch-hover) !important; }
.big-btn.stop { background: var(--fill-4); color: var(--text); border: 1px solid var(--line); }
.btn-danger, button.danger-btn { border-color: var(--bad-line) !important; color: var(--bad-soft); }
.btn-danger:hover:not(:disabled), button.danger-btn:hover:not(:disabled) { background: var(--bad-tint) !important; }
.btn-danger.armed, button.danger-btn.armed { background: var(--danger) !important; color: white; border-color: var(--danger) !important; }
.btn-twitch { background: var(--twitch); border-color: transparent; color: white; font-weight: 700; }
.btn-twitch:hover:not(:disabled) { background: var(--twitch-hover); }
.btn-kick { background: var(--kick); border-color: transparent; color: var(--kick-ink); font-weight: 700; }
.ghost { background: none; border: 0; color: var(--muted); padding: var(--sp-2) var(--sp-6); border-radius: var(--r-sm); font: inherit; cursor: pointer; }
.ghost:hover { background: var(--fill-4); color: var(--text); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- text boxes, dropdowns ------------------------------------------- */

.input,
.contrib-custom input, .modal textarea, .auth-box .join-form input, .player-chip select,
:where(.admin) :where(input[type=text], input[type=search], input[type=password], input[type=number], input[type=url], input[type=date], textarea, select),
.see-as select, td input, .wn-input {
  background: var(--fill-3); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: var(--sp-6) var(--sp-8); color: var(--text); font: inherit; color-scheme: dark;
}
:where(.input, .input-lg, .admin input, .admin textarea, .modal textarea, .wrap > .card input, .wrap > .card textarea)::placeholder { color: var(--muted); opacity: 0.8; }
/* large: sign-up and city-creation forms */
.input-lg, .wrap > .card input[type="text"], .wrap > .card input[type="url"], .wrap > .card textarea, .save input {
  width: 100%; background: var(--fill-3); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--sp-8) var(--sp-10); color: var(--text); font: inherit;
}
textarea.input, .modal textarea, textarea.wn-input { resize: vertical; }

/* ---- chips: small rounded toggles and tags ----------------------------- */

.chip,
.fb-kinds button, .need-fixes button, .bp-turn button, .species .sp, .player-chips button,
.toc a, .pbar button, .prof .tabs button {
  display: inline-flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-10); border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--fill-2); color: var(--text);
  font: inherit; font-size: var(--fs-sm); text-decoration: none; cursor: pointer;
}
.chip:hover, .species .sp:hover, .toc a:hover { border-color: var(--accent-2); }
.chip.on, .fb-kinds button.on, .bp-turn button.on, .species .sp.on, .player-chips button.on {
  border-color: var(--accent-2); background: var(--accent-tint);
}

/* ---- status pills ------------------------------------------------------ */

.pill, .status, .pill-pending, .pill-ok, .pill-bad, .status-pill, .waiting-badge, .boost2 {
  display: inline-block; padding: 1px var(--sp-8); border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
}
.pill-warn, .pill-pending, .status.funding, .status.stalled, .s-pending, .waiting-badge, .boost2 { background: var(--warn-tint); color: var(--warn); }
.pill-ok, .status.built, .s-approved { background: var(--good-tint); color: var(--good); }
.pill-bad, .status.demolish, .s-declined, .s-expired { background: var(--bad-tint); color: var(--bad); }
.pill-accent, .status.repaint { background: var(--accent-tint); color: var(--accent-2); }
.pill-charity { background: var(--charity-tint); border: 1px solid var(--charity-line); color: var(--charity); }

/* ---- boxes: a bordered box inside a panel or page ---------------------- */

.box, .plaque, .land-card, .tile, .doc .two > div, .doc .summary > div, .doc .loop div, .prof .stat, .prof .a, .signup, .channel {
  background: var(--fill-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-8) var(--sp-10);
}

/* ---- callouts: a note with a coloured edge ----------------------------- */

.callout, .cap-note, .full-note, .bp-note, .doc .warn, .doc .notice, .doc .tip, .charity-note, .i-text, .wrap > .card .note {
  padding: var(--sp-8) var(--sp-10); border-radius: var(--r-md); border-left: 3px solid var(--accent-2); background: var(--fill-1);
}
.callout-warn, .cap-note, .full-note, .bp-note, .doc .warn, .doc .notice { background: var(--warn-tint); border-left-color: var(--warn); }
.callout-accent, .doc .tip { background: var(--accent-tint); border-left-color: var(--accent-2); }
.callout-charity { background: var(--charity-tint); border-left-color: var(--charity-strong); }

/* ---- small uppercase labels -------------------------------------------- */

.eyebrow, .section-label, .needs-title, .build-title, .feed-head, .set-sec, .cl-when, table.hotkeys th {
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--muted);
}
/* a card's heading on the admin page and documents: the same, one size up */
.card-title, .admin h2, .doc h2, .prof h2 {
  font-size: var(--fs-base); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--muted); margin: 0 0 var(--sp-10);
}

/* ---- links -------------------------------------------------------------- */

.link, a.link, .doc a, .prof a, .info a, .wn-modal .wn-body a, .charity-prompt a, .signin-foot a { color: var(--accent-2); }

/* ---- pop-ups ------------------------------------------------------------ */

/* Every pop-up blurs what's behind it. */
.modal-backdrop, .settings-wrap {
  position: absolute; inset: 0; background: var(--scrim);
  backdrop-filter: blur(var(--blur-scrim)); -webkit-backdrop-filter: blur(var(--blur-scrim));
}
.modal-backdrop { display: grid; place-items: center; z-index: var(--z-modal); }
.settings-wrap { z-index: var(--z-overlay); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(var(--blur-scrim)); -webkit-backdrop-filter: blur(var(--blur-scrim)); }
.modal { width: min(440px, calc(100% - 32px)); padding: var(--sp-16) var(--sp-20); }
.modal-md, .modal.bp-modal, .modal.wn-multi, .charity-modal { width: min(520px, calc(100% - 32px)); }
.modal h2 { margin: 0 0 var(--sp-4); font-size: var(--fs-xl); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-8); margin-top: var(--sp-14); }

/* ---- keyboard keys ------------------------------------------------------ */

kbd { display: inline-block; padding: 1px var(--sp-6); border-radius: var(--r-sm); border: 1px solid var(--line); border-bottom-width: 2px; background: var(--fill-3); font: var(--fs-sm) var(--font-mono); color: var(--text); }

/* ---- document pages (/guide, /privacy, /charity) ------------------------ */


.doc { max-width: 780px; margin: 0 auto; padding: 28px var(--sp-16) 64px; line-height: var(--lh-loose); font-size: var(--fs-lg); }
.doc h1 { font-size: var(--fs-2xl); margin: 0 0 var(--sp-4); }
.doc .lede { color: var(--muted); margin: 0 0 var(--sp-20); }
.doc .card { padding: var(--sp-16) var(--sp-20); margin-top: var(--sp-14); }
.doc h3 { font-size: var(--fs-lg); margin: var(--sp-16) 0 var(--sp-4); }
.doc ul, .doc ol { margin: 0; padding-left: var(--sp-20); }
.doc li { margin: var(--sp-6) 0; }
.doc li b, .doc p b { color: var(--text); }
.doc p { margin: var(--sp-8) 0; }
.doc code { background: var(--fill-4); border-radius: var(--r-sm); padding: 1px var(--sp-6); font-size: var(--fs-base); }
.doc .foot { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-20); }
.doc .two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-12); }
.doc .two > div, .doc .summary > div { padding: var(--sp-12) var(--sp-14); border-radius: var(--r-lg); }
.doc .two h3 { margin: 0 0 var(--sp-6); }
.doc .tip, .doc .warn { margin-top: var(--sp-10); padding: var(--sp-10) var(--sp-12); font-size: var(--fs-md); }
@media (max-width: 640px) { .doc .two { grid-template-columns: 1fr; } }

/* ---- small helpers, for spacing a single element in a template --------- */

.mt-0 { margin-top: 0; } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mt-10 { margin-top: var(--sp-10); } .mt-12 { margin-top: var(--sp-12); } .mt-14 { margin-top: var(--sp-14); }
.mt-16 { margin-top: var(--sp-16); } .mt-20 { margin-top: var(--sp-20); } .mb-8 { margin-bottom: var(--sp-8); } .my-8 { margin: var(--sp-8) 0; } .my-10 { margin: var(--sp-10) 0; }
.nowrap { white-space: nowrap; } .top { vertical-align: top; } .block { display: block; } .w-full { width: 100%; }
.grow { flex: 1; } .text-center { text-align: center; text-decoration: none; } .text-accent { color: var(--accent-2); } .text-warn { color: var(--warn); } .text-right { text-align: right; }
/* a sub-heading inside a card */
.subhead { margin: var(--sp-14) 0 var(--sp-6); font-size: var(--fs-md); }

/* ---- feel: hover, press, keyboard focus and motion ------------------------ */

/* Everything you can click eases between states and gives a little when pressed. */
button, .btn, .chip, a.btn-link, .contact-btn {
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
button:active:not(:disabled), .btn:active, .chip:active, a.btn-link:active { transform: var(--press); }
/* A visible ring for keyboard users only (not on mouse clicks). */
:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: var(--focus-ring); outline-offset: 0; border-color: var(--accent-2); }

/* Pop-ups fade in and grow slightly; the blur fades with them. */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal-backdrop:not([hidden]), .settings-wrap:not([hidden]), dialog[open]::backdrop { animation: fade-in var(--t-med) var(--ease-out); }
.modal-backdrop:not([hidden]) > .modal, dialog[open] { animation: pop-in var(--t-med) var(--ease-out); }

/* People who've asked their system for less motion get none. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---- hover tips: data-tip-title (first line) + data-tip, shown at once on
   hover or keyboard focus, below the element ------------------------------ */
.has-tip { position: relative; cursor: help; }
.has-tip::after {
  content: attr(data-tip-title) "\A" attr(data-tip); white-space: pre-line;
  position: absolute; top: calc(100% + 10px); left: 50%; z-index: var(--z-pop);
  width: max-content; max-width: 280px; padding: var(--sp-8) var(--sp-10);
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  color: var(--text-soft); font-size: var(--fs-sm); font-weight: 400; line-height: var(--lh); text-align: left;
  opacity: 0; pointer-events: none; transform: translate(-50%, -4px); transition: opacity var(--t-fast), transform var(--t-fast);
}
.has-tip:hover::after, .has-tip:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.has-tip:focus-visible { outline-offset: 4px; border-radius: var(--r-sm); }

/* ---- small drop-down menus (e.g. the account menu): position it, then
   show/hide with [hidden] ------------------------------------------------- */
.menu { position: absolute; z-index: var(--z-pop); display: flex; flex-direction: column; min-width: 190px; padding: var(--sp-4);
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-2); animation: pop-in var(--t-fast) var(--ease-out); }
.menu[hidden] { display: none; }
.menu > a, .menu > button { display: block; width: 100%; padding: var(--sp-8) var(--sp-10); border: 0; border-radius: var(--r-sm); background: none;
  color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.menu > a:hover, .menu > button:hover, .menu > :focus-visible { background: var(--fill-4); }

/* ---- spotlight: briefly glow to point something out ("Show me") --------- */
@keyframes spotlight { 0%, 100% { box-shadow: var(--shadow-1), 0 0 0 0 transparent; } 30%, 70% { box-shadow: var(--shadow-1), 0 0 0 3px var(--accent-2), 0 0 28px 6px var(--accent-tint-2); } }
.spotlight { animation: spotlight 1.4s var(--ease-out) 2; }
@media (prefers-reduced-motion: reduce) { .spotlight { animation: none; outline: 3px solid var(--accent-2); } }
