/*
 * Daniel Kafka Klinik — component refresh 1.0 (24 October 2026)
 * Load LAST. Presentation only: no new palette, assets, fonts, JS, or workflows.
 * Existing button/chip background, text, and selected-state colours are inherited.
 * All shadow/focus accents use existing tokens. Remove this link to roll back.
 */
:root {
  --control-radius: 12px;
  --control-pill-radius: 999px;
  --control-speed: 160ms;
  --control-ease: cubic-bezier(.2, .7, .3, 1);
}

/* Actions: a quiet surface at rest, small physical feedback when used. */
.button {
  min-height: 46px;
  min-width: 44px;
  max-width: 100%;
  padding: 11px 18px;
  gap: 10px;
  border-radius: var(--control-radius);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .005em;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform var(--control-speed) var(--control-ease),
              box-shadow var(--control-speed) var(--control-ease),
              background-color var(--control-speed) ease,
              border-color var(--control-speed) ease;
}
.button .icon { flex-shrink: 0; }
.button.secondary, .button.subtle { box-shadow: none; }

/* Preserve ALL existing meanings and palettes of filter states. */
.chip-button, .v08-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  padding: 9px 15px;
  border-radius: var(--control-pill-radius);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
  transition: transform var(--control-speed) var(--control-ease),
              box-shadow var(--control-speed) var(--control-ease),
              background-color var(--control-speed) ease,
              border-color var(--control-speed) ease;
}
/* An empty, decorative CSS tick: aria-pressed remains the semantic state.
   Reserve its space even when unselected, so selection never shifts a chip. */
.chip-button::before, .v08-chip::before {
  content: "";
  display: block;
  width: 9px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  flex: 0 0 9px;
  transform: translateY(-1px) rotate(-45deg);
  opacity: 0;
  transition: opacity var(--control-speed) ease;
}
.chip-button[aria-pressed="true"]::before,
.v08-chip[aria-pressed="true"]::before { opacity: 1; }
.chip-button[aria-pressed="true"], .v08-chip[aria-pressed="true"] {
  box-shadow: var(--shadow);
}
/* Non-interactive tags stay visually lighter; no hover or pointer affordance. */
.chip, .status-pill {
  border-radius: var(--control-pill-radius);
  padding-inline: 10px;
}
.filter-chips, .v08-chips { gap: 8px; }

/* Textual inputs only; retain native semantics, validation and date/select UI.
   This excludes hidden fields and checkbox/radio/range/button-like input types. */
:is(#main, #site-header) :is(
  input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"],
            [type="color"], [type="button"], [type="submit"], [type="reset"]),
  select, textarea
) {
  border-radius: var(--control-radius);
  min-height: 46px;
  padding: 11px 14px;
  line-height: 1.5;
  font-weight: 400;
  box-shadow: inset 0 1px 2px var(--border);
  transition: border-color var(--control-speed) ease,
              box-shadow var(--control-speed) ease,
              outline-offset var(--control-speed) ease;
}
:is(#main, #site-header) textarea {
  min-height: 120px;
  resize: vertical;
}
:is(#main, #site-header) select { padding-inline-end: 28px; }
:is(#main, #site-header) :is(input, select, textarea):focus {
  /* Keep the existing focus colour; add only breathing room. */
  outline-offset: 3px;
  box-shadow: var(--shadow);
}
/* Invalid state is intentional, not a wall of errors on first page load. */
:is(#main, #site-header) :is(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--danger);
}
@supports selector(input:user-invalid) {
  #main :is(input, select, textarea):user-invalid { border-color: var(--danger); }
}
:is(#main, #site-header) :is(input, select, textarea):disabled {
  cursor: not-allowed;
  box-shadow: none;
}
:is(#main, #site-header) :is(input, textarea)[readonly] {
  box-shadow: none;
}

/* Native checkbox / radio indicators: crisp, predictable, and not simulated. */
#main input:is([type="checkbox"], [type="radio"]) {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--blue);
  box-shadow: none;
  vertical-align: middle;
}
:is(.check-label, .check-inline, .v08-confirm, .v07-ack,
    .v08-check-grid label, .filter-toggles label) {
  min-height: 44px;
  padding-block: 6px;
}
.contact-choice {
  border-radius: var(--control-radius);
  transition: box-shadow var(--control-speed) ease,
              border-color var(--control-speed) ease;
}
.contact-choice:has(input:checked) { box-shadow: var(--shadow); }
.contact-choice:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

/* File selection is still local-only. This changes the native button, not upload. */
#main input[type="file"] {
  padding: 7px;
  font-size: 13px;
  overflow: hidden;
  cursor: pointer;
}
#main input[type="file"]::file-selector-button {
  min-height: 36px;
  margin-inline-end: 12px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--pale-blue);
  color: var(--link);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--control-speed) ease;
}

/* Small controls: bookmarks, header search, disclosure handles and calendar. */
.save-button, .menu-toggle {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  padding: 9px;
  transition: transform var(--control-speed) var(--control-ease),
              box-shadow var(--control-speed) ease;
}
.save-button { gap: 7px; }
#site-header .header-search input {
  padding: 10px 46px 10px 12px;
  min-height: 44px;
  font-size: 11px;
}
#site-header .header-search button {
  top: 50%;
  right: 4px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
}
#main details > summary {
  min-height: 44px;
  padding-block: 10px;
  border-radius: 6px;
  text-underline-offset: 4px;
}
.v08-event-marker {
  border-radius: 7px;
  min-height: 28px;
  transition: box-shadow var(--control-speed) ease;
}
.v08-event-title {
  min-height: 44px;
  border-radius: 6px;
  text-underline-offset: 4px;
}

/* Apply lift only on an accurate pointer, never as a sticky touchscreen state. */
@media (hover: hover) and (pointer: fine) {
  :is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle):not(:disabled):not([aria-disabled="true"]):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
  }
  :is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle):not(:disabled):not([aria-disabled="true"]):active {
    transform: translateY(0) scale(.985);
    box-shadow: none;
  }
  .contact-choice:hover, .v08-event-marker:hover,
  #main input[type="file"]:hover::file-selector-button {
    box-shadow: var(--shadow);
  }
  #main details > summary:hover { text-decoration: underline; }
}
:is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle):disabled,
:is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle)[aria-disabled="true"] {
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}
:is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle):focus-visible {
  outline-offset: 3px;
}

/* Mobile/tablet controls grow, but page grids and information architecture do not. */
@media (pointer: coarse), (max-width: 600px) {
  .button, .chip-button, .v08-chip, .save-button, .menu-toggle {
    min-height: 48px;
  }
  #main :is(
    input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="range"],
              [type="color"], [type="button"], [type="submit"], [type="reset"]),
    select, textarea
  ) {
    font-size: 16px;
    min-height: 48px;
  }
  .chip-button, .v08-chip { padding-inline: 13px; }
  .filter-chips, .v08-chips { gap: 8px; }
}

/* Honour both the OS preference and the site's explicit reading preference.
   Remove translation/scaling too, not merely transition duration. */
@media (prefers-reduced-motion: reduce) {
  :is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle) {
    transform: none !important;
    transition: none !important;
  }
  :is(.chip-button, .v08-chip)::before { transition: none !important; }
}
:root[data-motion="reduced"] :is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle) {
  transform: none !important;
  transition: none !important;
}
:root[data-motion="reduced"] :is(.chip-button, .v08-chip)::before { transition: none !important; }

/* Let the user agent supply system colours; never opt out of high-contrast mode. */
@media (forced-colors: active) {
  :is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle, .contact-choice),
  #main :is(input, select, textarea) { box-shadow: none; }
  :is(.chip-button, .v08-chip)[aria-pressed="true"] { outline: 2px solid; outline-offset: 2px; }
}
@media print {
  :is(.button, .chip-button, .v08-chip, .save-button, .menu-toggle, .contact-choice),
  #main :is(input, select, textarea) { box-shadow: none !important; transform: none !important; }
}
