/* Approved Drift.org control system. Loaded after route styles by apply-design-system.py.
   Compatibility aliases keep existing behaviour while every route uses the same tokens. */

/* Enclosing decoration is removed; section dividers and flow connectors remain. */
:is(button, input, select, textarea, dialog, .country, .lawyer-card,
  .pricing-card, .help-search, .help-category, .product-film, .team-row,
  .team-handoff, .romy-widget, .romy-preferences, .romy-beta,
  .chat-sources a, .flow-node, .flow-service, .guide-picker a) {
  border:0 !important;
}
.home-page .dl-next span, .home-page .trust-row summary::after { border:0 !important; }
.romy-widget .romy-guide-step::before, .romy-widget #romy-form { border:0 !important; }
.help-article :is(td,th) { border:0; }

/* Primary actions: one common geometry, fill, label and icon treatment. */
:is(.drift-button, .directory-content .button, #demo-dialog .button,
  .lawyer-primary, .lawyer-secondary, .home-page .dl-next,
  .menu-toggle, .docs-search-open, .docs-menu,
  .category-filter button, #clear-filters,
  .romy-starters button, .romy-quick-replies button,
  .romy-data button, #romy-summary-review) {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:var(--control-gap) !important;
  min-height:var(--control-height) !important;
  padding:10px var(--control-padding) !important;
  border:0 !important;
  border-radius:var(--radius-pill) !important;
  background:var(--ink) !important;
  color:#fff !important; /* Keep primary labels independent of section text colours. */
  font-family:var(--font) !important;
  font-size:var(--control-font-size) !important;
  font-weight:500 !important;
  line-height:1.4 !important;
  letter-spacing:-.02em;
  text-decoration:none !important;
  text-align:center;
  white-space:normal;
  max-width:100%;
  cursor:pointer;
  transition:background var(--motion-fast),color var(--motion-fast);
}
:is(.drift-button, .directory-content .button, #demo-dialog .button,
  .lawyer-primary, .home-page .dl-next):hover {
  background:var(--charcoal-hover) !important;
}
:is(.drift-button, .directory-content .button, .lawyer-primary,
  .lawyer-secondary, .home-page .dl-next) svg {
  width:20px !important; height:20px !important; flex:none;
}
.home-page .dl-next span {
  width:20px; height:20px; background:transparent; border-radius:0;
  color:inherit; flex:none;
}

/* Alternative actions and navigation controls use ivory, never an outline. */
:is(.drift-button--light, .drift-button.directory-link, .lawyer-secondary,
  .menu-toggle, .docs-search-open, .docs-menu,
  .directory-content #reset, .directory-content #previous-page,
  .directory-content #next-page, .category-filter button,
  .romy-starters button, .romy-quick-replies button,
  .romy-data button, #romy-summary-review) {
  background:var(--ivory) !important;
  color:var(--ink) !important;
}
:is(.drift-button--light, .drift-button.directory-link, .lawyer-secondary,
  .menu-toggle, .docs-search-open, .docs-menu,
  .directory-content #reset, .directory-content #previous-page,
  .directory-content #next-page, .category-filter button,
  .romy-starters button, .romy-quick-replies button,
  .romy-data button, #romy-summary-review):hover {
  background:var(--ivory-hover) !important;
}
#services .category-filter button[aria-pressed="true"] {
  background:var(--ink) !important; color:var(--inverse) !important;
}
:is(.drift-button,.button,#previous-page,#next-page,.lawyer-primary,.lawyer-secondary,.dl-next,
  .category-filter button,.romy-starters button,.romy-quick-replies button):disabled {
  background:var(--ivory) !important; color:#85867f !important;
  opacity:1 !important; cursor:not-allowed; transform:none;
}

/* Text navigation stays unboxed. */
:is(.text-link,.text-button,.lawyer-full-profile) {
  border:0 !important; background:transparent;
  font-weight:500; text-underline-offset:5px;
}

/* Fields have a clear surface. Checks, radios and file uploads retain native affordances. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]),
select, textarea {
  border:0 !important;
  border-radius:var(--radius-small) !important;
  background:var(--surface) !important;
  color:var(--ink);
  font-family:var(--font);
  font-size:16px !important;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]),select {
  min-height:var(--control-height) !important;
}
.directory-content .filters :is(input,select) { height:var(--control-height) !important; }
::placeholder { color:var(--muted); opacity:1; }
/* The input is part of these larger controls, rather than a second box. */
.help-search input, .romy-widget #romy-form textarea {
  background:transparent !important; border-radius:0 !important;
}
.romy-widget #romy-form textarea { min-height:24px !important; }
.help-search { background:var(--surface); }

/* Utility icon buttons keep a 44px target; primary submit icons use charcoal. */
:is(.dialog-bar button,.lawyer-dialog-close,.docs-search-close,
  #dialog-close,.romy-icon) {
  border:0 !important; border-radius:50% !important;
  min-width:44px; min-height:44px; color:var(--ink);
}
:is(.dialog-bar button,.lawyer-dialog-close,.docs-search-close,#dialog-close):hover,
.romy-icon:hover { background:var(--ivory) !important; }
.romy-widget #romy-form .romy-send, .help-search button {
  background:var(--ink) !important; color:var(--inverse) !important;
  border:0 !important; border-radius:50%;
}
.romy-widget #romy-form .romy-send:hover, .help-search button:hover {
  background:var(--charcoal-hover) !important;
}

/* White cards on the original warm paper, with ivory only for secondary surfaces. */
.lawyer-card, .romy-widget .lawyer-card, .plain-card, .help-category,
.flow-node { background:var(--surface) !important; color:var(--ink); }
.flow-node { border-radius:var(--radius); }
.flow-service { background:var(--ivory); }
.flow-service:hover { background:var(--ivory-hover); }
.guide-picker a[aria-current] { background:var(--ivory-hover); color:var(--ink); }
.spotlight.romy-widget, .lawyer-dialog, .lawyer-dialog-bar,
.romy-summary-dialog, .docs-search-dialog { background:var(--paper); }
.spotlight.romy-widget.minimised, .romy-widget #romy-form,
.romy-widget .romy-preferences { background:var(--surface); }
.romy-widget.minimised #romy-form { background:transparent; }
.romy-widget .chat-message.user, .chat-sources a { background:var(--ivory); color:var(--ink); }
.chat-sources a:hover { background:var(--ivory-hover); }
.romy-widget .romy-guide-step::before { background:var(--ivory); color:var(--muted); }
.romy-widget .romy-guide-step.is-current::before { background:var(--ink); color:var(--inverse); }
.romy-widget .romy-preferences select { background:var(--ivory) !important; }
.romy-widget .romy-data #romy-delete { color:#912e2e !important; }

/* The menu retains its existing responsive visibility. */
.site-shell .menu-toggle { display:none !important; }
@media(max-width:1100px) { .site-shell .menu-toggle { display:inline-flex !important; } }
@media(min-width:1101px) and (max-width:1280px) {
  html:has(link[href="/assets/pathways/discovery.css"]) .site-shell .menu-toggle { display:inline-flex !important; }
}
@media(max-width:650px) {
  .lawyer-card-actions { flex-wrap:wrap; }
  .lawyer-card-actions > * { flex:1 1 auto; }
  .directory-content .listing-actions { gap:12px; }
  .directory-content .availability-block { min-width:0; flex:1 1 220px; }
}

/* Focus is functional keyboard feedback, not decorative framing. */
:is(button,a,input,select,textarea,summary):focus-visible {
  outline:3px solid var(--ink) !important; outline-offset:4px;
}
@media(prefers-reduced-motion:reduce) {
  :is(button,a,input,select,textarea) { transition:none !important; }
}
