/* HavenBound shared base: tokens, reset, form controls, buttons.
   Theme files (public.css, admin.css) override the tokens and layout. */
:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --text: #2b2420;
  --muted: #6f625a;
  --border: #eadfd3;
  --primary: #e8833a;
  --primary-hover: #cf6d27;
  --primary-text: #ffffff;
  --accent: #2f8f83;
  --link: #b8571a;
  --danger: #b3261e;
  --danger-bg: #fdeceb;
  --radius: 14px;
  --shadow: 0 2px 6px rgba(60, 40, 20, .06), 0 10px 30px rgba(60, 40, 20, .08);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

a { color: var(--link); }
h1, h2 { line-height: 1.2; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

input, select, textarea, button {
  font: inherit;
  color: inherit;
}

input, select, textarea {
  width: 100%;
  padding: .65rem .8rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
}
/* A checkbox/radio has a small fixed native size; the width:100% above would otherwise stretch
   its layout box across the whole row, shoving any label text that follows off to the far side. */
input[type="checkbox"], input[type="radio"] {
  width: auto; padding: 0; border-radius: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}
textarea { resize: vertical; min-height: 6rem; }

/* Pill-shaped (999px), not var(--radius)-derived, so every plain button has the same fully
   rounded shape regardless of --radius differing between the admin and public themes -- the one
   button style across the whole site (see .add-button/.btn/#authLink, the equivalent anchor-
   styled "button" classes, which share this same 999px radius for the same reason). */
button {
  cursor: pointer;
  padding: .65rem 1.1rem;
  font-weight: 700;
  color: var(--primary-text);
  background: var(--primary);
  border: 0;
  border-radius: 999px;
  transition: background .15s, transform .05s;
}
button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }

.error, #error, #caseError { color: var(--danger); min-height: 1.2em; }
.brand { display: flex; align-items: center; gap: .6rem; }
.brand h1 { margin: 0; }
.back { display: inline-block; margin-top: 1rem; font-size: .95rem; }

/* Icon-only "back to X" navigation link (notes.ftl, chat.ftl, login.ftl, report.ftl) -- distinct
   from .back above, which is "Submit another case" on thanks.ftl, not a back-navigation link. */
.back-link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; margin-top: 1rem;
  border-radius: var(--radius, 12px); color: var(--text); text-decoration: none;
}
.back-link:hover { background: var(--accent); color: var(--primary); }

/* Icons (nav-icons.ftl's navIcon macro): each is its own externalized file under
   static/icons/NAME.svg, applied as a CSS mask rather than an <img> -- that's what lets
   background-color: currentColor (and so the element's own color, e.g. on hover/active/
   recolored-per-bubble) repaint the icon, which a plain <img> of an external SVG cannot do. */
.nav-icon {
  display: inline-block; width: 22px; height: 22px; flex: none;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.icon-pets { -webkit-mask-image: url(/assets/icons/pets.svg); mask-image: url(/assets/icons/pets.svg); }
.icon-cases { -webkit-mask-image: url(/assets/icons/cases.svg); mask-image: url(/assets/icons/cases.svg); }
.icon-chats { -webkit-mask-image: url(/assets/icons/chats.svg); mask-image: url(/assets/icons/chats.svg); }
.icon-partners { -webkit-mask-image: url(/assets/icons/partners.svg); mask-image: url(/assets/icons/partners.svg); }
.icon-users { -webkit-mask-image: url(/assets/icons/users.svg); mask-image: url(/assets/icons/users.svg); }
.icon-groups { -webkit-mask-image: url(/assets/icons/groups.svg); mask-image: url(/assets/icons/groups.svg); }
.icon-gear { -webkit-mask-image: url(/assets/icons/gear.svg); mask-image: url(/assets/icons/gear.svg); }
.icon-audit { -webkit-mask-image: url(/assets/icons/audit.svg); mask-image: url(/assets/icons/audit.svg); }
.icon-bell { -webkit-mask-image: url(/assets/icons/bell.svg); mask-image: url(/assets/icons/bell.svg); }
.icon-back { -webkit-mask-image: url(/assets/icons/back.svg); mask-image: url(/assets/icons/back.svg); }
.icon-edit { -webkit-mask-image: url(/assets/icons/edit.svg); mask-image: url(/assets/icons/edit.svg); }
.icon-trash { -webkit-mask-image: url(/assets/icons/trash.svg); mask-image: url(/assets/icons/trash.svg); }
.icon-leave { -webkit-mask-image: url(/assets/icons/leave.svg); mask-image: url(/assets/icons/leave.svg); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Server-rendered forms in headers should flow inline */
.header-actions form { display: inline; margin: 0; }
.disabled { opacity: .45; }
