/* ============================================================
   Niggly Stuff: styles.css
   Modern, calm, mobile-first. Theming via CSS custom properties.
   ============================================================ */

:root {
  /* Palette: crisp cool neutrals with a fresh teal-to-emerald accent */
  --bg: #f7f9fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --line: #e6ebf1;

  --accent: #14b8a6;         /* teal */
  --accent-2: #22c55e;       /* emerald (gradient end) */
  --accent-dark: #0d9488;
  --accent-soft: #e6faf6;
  --grad: linear-gradient(135deg, #14b8a6 0%, #22c55e 100%);

  --warn: #b45309;
  --warn-soft: #fef3e2;

  /* Type */
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Shape & depth */
  --radius: 18px;
  --radius-lg: 24px;
  --radius-sm: 999px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 32px -12px rgba(15, 23, 42, 0.18);
  --shadow-accent: 0 10px 24px -10px rgba(20, 184, 166, 0.55);

  --maxw: 1120px;

  /* ==========================================================
     "Deed & Ledger" design tokens — new visual system.
     Added here first; layout is migrated onto them in later
     commits. Fonts: Bricolage Grotesque (display), Inter (UI),
     IBM Plex Mono (labels).
     ========================================================== */
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --dl-ink: #132A45;
  --dl-ink-70: rgba(19, 42, 69, 0.68);
  --dl-ink-50: rgba(19, 42, 69, 0.5);
  --dl-paper: #FFFFFF;
  --dl-card: #FFFFFF;
  --dl-brass: #1D5C96;          /* primary accent / active states / CTA */
  --dl-brass-deep: #164A7A;
  --dl-clay: #8A3B33;           /* "coming soon" flag colour only */
  --dl-line: #D9D4C4;
  --dl-rule: #CDC6B2;

  /* Category tint tokens — bg tint, badge tint, badge ink.
     Mockup's three, plus three extended muted hues:
     career = violet, health = rose, everyday = amber.
     Any category without a token falls back to neutral. */
  --tint-legal-estate: rgba(29, 92, 150, 0.05);
  --tint-legal-estate-badge: rgba(29, 92, 150, 0.12);
  --tint-legal-estate-deep: #164A7A;

  --tint-financial-admin: rgba(176, 129, 46, 0.07);
  --tint-financial-admin-badge: rgba(176, 129, 46, 0.15);
  --tint-financial-admin-deep: #8A631E;

  --tint-housing-tenancy: rgba(51, 97, 92, 0.06);
  --tint-housing-tenancy-badge: rgba(51, 97, 92, 0.14);
  --tint-housing-tenancy-deep: #234A46;

  --tint-career: rgba(109, 74, 178, 0.06);
  --tint-career-badge: rgba(109, 74, 178, 0.14);
  --tint-career-deep: #4C3184;

  --tint-health-wellbeing: rgba(190, 60, 118, 0.06);
  --tint-health-wellbeing-badge: rgba(190, 60, 118, 0.13);
  --tint-health-wellbeing-deep: #963059;

  --tint-everyday-admin: rgba(184, 120, 30, 0.07);
  --tint-everyday-admin-badge: rgba(184, 120, 30, 0.15);
  --tint-everyday-admin-deep: #8A5A16;

  /* Neutral grey-blue default for any future category with no token */
  --tint-default: rgba(19, 42, 69, 0.05);
  --tint-default-badge: rgba(19, 42, 69, 0.1);
  --tint-default-deep: #3A5470;
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--dl-ink);
  background: var(--dl-paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--dl-brass); }
img, svg { max-width: 100%; }

.mono { font-family: var(--font-mono); letter-spacing: 0.06em; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--dl-brass);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--dl-brass);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--dl-paper);
  border-bottom: 1px solid var(--dl-rule);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--dl-ink);
}
.brand__mark { display: inline-flex; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
  letter-spacing: 0.01em;
  color: var(--dl-ink);
}
.brand__name span { color: var(--dl-brass-deep); font-weight: 700; }

.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav a {
  text-decoration: none;
  color: var(--dl-ink-70);
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}
.site-nav a:hover { color: var(--dl-brass-deep); }
.site-nav a.cta {
  color: #fff;
  background: var(--dl-brass);
  padding: 10px 20px;
  border-radius: 3px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.site-nav a.cta:hover { background: var(--dl-brass-deep); color: #fff; }

/* ---------- Hero ---------- */
.hero { border-bottom: 1px solid var(--dl-rule); }
.hero__inner {
  padding-top: 34px;
  padding-bottom: 26px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: end;
}
.eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--dl-brass-deep);
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--dl-brass);
  display: inline-block;
  flex: none;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.6vw, 2.3rem);
  line-height: 1.16;
  letter-spacing: -0.01em;
  max-width: 18ch;
}
.hero__title em { font-style: normal; color: var(--dl-brass-deep); font-weight: 600; }
.hero__subtitle {
  margin-top: 16px;
  font-size: 0.95rem;
  color: var(--dl-ink-70);
  line-height: 1.55;
  max-width: 46ch;
}

/* ---------- Search ---------- */
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1.5px solid var(--dl-ink);
  padding-bottom: 12px;
  transition: border-color 0.15s ease;
}
.search:focus-within { border-color: var(--dl-brass); }
.search__label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.search__icon {
  color: var(--dl-ink-50);
  pointer-events: none;
  display: inline-flex;
  flex: none;
}
.search:focus-within .search__icon { color: var(--dl-brass); }
.search__input {
  width: 100%;
  border: none;
  background: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--dl-ink);
}
.search__input::placeholder { color: var(--dl-ink-50); }

/* ---------- Filters (single slim strip) ---------- */
.filters { border-bottom: 1px solid var(--dl-rule); }
.filters__inner {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding-top: 15px;
  padding-bottom: 15px;
}
.filters__label {
  font-size: 0.66rem;
  text-transform: uppercase;
  color: var(--dl-ink-50);
  font-weight: 600;
  white-space: nowrap;
}
.filter-divider { width: 1px; height: 20px; background: var(--dl-rule); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--dl-ink-70);
  background: transparent;
  border: 1px solid var(--dl-rule);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.05s ease;
}
.chip:hover { border-color: var(--dl-brass); color: var(--dl-ink); }
.chip:active { transform: scale(0.97); }
/* Dots retired in Deed & Ledger pills; kept in the DOM, hidden here. */
.chip__dot { display: none; }
.chip[aria-pressed="true"] {
  background: var(--dl-brass);
  border-color: var(--dl-brass);
  color: #fff;
  font-weight: 500;
}

.filters__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.result-count { color: var(--dl-ink-50); font-size: 0.8rem; font-weight: 500; white-space: nowrap; }
.clear-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dl-brass);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.clear-btn:hover { color: var(--dl-ink); }

/* ---------- Tile grid ---------- */
.directory { padding-top: 26px; padding-bottom: 60px; }
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 640px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

.tile {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--tint-default);
  border: 1px solid var(--dl-rule);
  padding: 22px 22px 20px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--dl-line); }

/* Dog-eared corner: a paper-coloured triangle folded off the top-right. */
.tile::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent var(--dl-paper) transparent transparent;
}

/* Per-category tints (driven by the first category via cat-<key>) */
.tile.cat-legal-estate    { background: var(--tint-legal-estate); }
.tile.cat-financial-admin { background: var(--tint-financial-admin); }
.tile.cat-housing-tenancy { background: var(--tint-housing-tenancy); }
.tile.cat-career          { background: var(--tint-career); }
.tile.cat-health-wellbeing{ background: var(--tint-health-wellbeing); }
.tile.cat-everyday-admin  { background: var(--tint-everyday-admin); }

.tab {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tint-default-deep);
  background: var(--tint-default-badge);
  padding: 4px 9px;
  border-radius: 2px;
  margin-bottom: 14px;
}
.tile.cat-legal-estate    .tab { color: var(--tint-legal-estate-deep);    background: var(--tint-legal-estate-badge); }
.tile.cat-financial-admin .tab { color: var(--tint-financial-admin-deep); background: var(--tint-financial-admin-badge); }
.tile.cat-housing-tenancy .tab { color: var(--tint-housing-tenancy-deep); background: var(--tint-housing-tenancy-badge); }
.tile.cat-career          .tab { color: var(--tint-career-deep);          background: var(--tint-career-badge); }
.tile.cat-health-wellbeing .tab{ color: var(--tint-health-wellbeing-deep);background: var(--tint-health-wellbeing-badge); }
.tile.cat-everyday-admin  .tab { color: var(--tint-everyday-admin-deep);  background: var(--tint-everyday-admin-badge); }

.tile__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.25;
  margin-bottom: 10px;
  padding-right: 12px;
}
.tile__desc {
  font-size: 0.84rem;
  color: var(--dl-ink-70);
  line-height: 1.5;
  margin-bottom: 18px;
  flex-grow: 1;
}
.tile-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--dl-rule);
  padding-top: 12px;
}
.persona-tags {
  font-size: 0.6875rem;
  color: var(--dl-ink-50);
  line-height: 1.4;
}

.go {
  width: 30px; height: 30px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--dl-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dl-ink);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.go:hover, .go:focus-visible { background: var(--dl-brass); border-color: var(--dl-brass); color: #fff; }

/* "Coming soon" treatment: muted tile, dashed action, no external link. */
.tile.soon { opacity: 0.6; }
.tile.soon::after { display: none; }
.go--soon { border-style: dashed; }
.go--soon:hover, .go--soon:focus-visible {
  background: transparent;
  color: var(--dl-ink);
  border-color: var(--dl-ink);
}
.soon-flag {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dl-clay);
  z-index: 1;
}

/* Toast notification */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  background: var(--dl-ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  padding: 13px 20px;
  border-radius: 3px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast--show { opacity: 1; transform: translate(-50%, 0); }

.empty-state {
  text-align: center;
  color: var(--dl-ink-50);
  padding: 48px 0;
  font-size: 1.05rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 3px;
  padding: 13px 26px;
  cursor: pointer;
}
.btn--primary {
  background: var(--dl-brass);
  color: #fff;
  border: none;
  transition: background 0.14s ease;
}
.btn--primary:hover { background: var(--dl-brass-deep); }

/* ---------- About & Suggest ---------- */
.about, .suggest { padding: 56px 0; border-top: 1px solid var(--dl-rule); }
.about__inner, .suggest__inner { max-width: 62ch; }
.about h2, .suggest h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 1.9rem);
  letter-spacing: -0.01em;
  font-weight: 600;
  margin-bottom: 14px;
}
.about p + p { margin-top: 14px; }
.about p, .suggest p { color: var(--dl-ink-70); font-size: 1rem; }
.suggest {
  background: var(--tint-legal-estate);
  border-top-color: var(--dl-rule);
}
.suggest p { margin-bottom: 22px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--dl-rule);
  padding: 28px 0;
  background: var(--dl-paper);
}
.site-footer__inner { color: var(--dl-ink-50); font-size: 0.9rem; }

/* ---------- Responsive: tablet & mobile ---------- */
@media (max-width: 900px) {
  header.site-header .site-header__inner { min-height: 60px; }
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 28px;
    padding-bottom: 24px;
  }
  .hero__title { max-width: 22ch; }
  .hero__subtitle { max-width: 60ch; }
  /* Search sits under the lead; keep the underline field full width. */
  .hero__search { width: 100%; }
}

@media (max-width: 640px) {
  /* Filter strip: each group label on its own line, pills wrapping below,
     dividers dropped and the count/clear on their own row. */
  .filters__label { width: 100%; margin-top: 2px; }
  .filter-divider { display: none; }
  .filters__meta { margin-left: 0; width: 100%; justify-content: space-between; margin-top: 4px; }
  .hero__title { font-size: clamp(1.75rem, 7.5vw, 2.1rem); }
  .site-nav { gap: 16px; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
