/* Walking Footy control standard. This layer deliberately wins over legacy
   unlayered !important skin rules without escalating selector specificity.
   Keep functional visibility (hidden/d-none) and native media controls intact. */
@layer wf-controls {
  :root {
    --wf-control-min: 48px;
    --wf-control-radius: 8px;
    --wf-control-font: 16px;
  }
  :where(button, input[type="submit"], input[type="reset"], input[type="button"],
      .btn, a.button, a.fl-button, .gp-button, .gp summary, .wf-follow-btn,
      .profile-action-btn, .wf-footy-toggle-btn, .wf-card-friend-btn, .page-link),
  input[type="file"]::file-selector-button {
    --wf-control-bg: #242424;
    --wf-control-ink: #e0cba2;
    --wf-control-border: #8c7c59;
    box-sizing: border-box !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--wf-control-min) !important;
    min-width: var(--wf-control-min) !important;
    max-width: 100%;
    height: auto !important;
    padding: 12px 16px !important;
    border: 1px solid var(--wf-control-border) !important;
    border-radius: var(--wf-control-radius) !important;
    background-color: var(--wf-control-bg) !important;
    background-image: none !important;
    color: var(--wf-control-ink) !important;
    font-family: Mulish, system-ui, sans-serif !important;
    font-size: var(--wf-control-font) !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
    text-align: center;
    white-space: normal !important;
    overflow-wrap: anywhere;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
    cursor: pointer;
    transition: filter .15s ease, outline-color .15s ease;
  }
  :where(.btn-primary, .btn-success, .btn-hero-gold, .wf-primary, .wf-accept,
      .wf-safety-primary, .wf-card-friend-btn, .gp-button:not(.gp-secondary),
      .gp summary, .gp-nav a[aria-current="page"], .wf-feed .btn[type="submit"],
      #newBarBtn, .wf-footy-toggle-btn.is-active, .wf-post-type-option.is-selected,
      input[type="submit"], button[type="submit"]:not(.btn-outline-secondary):not(.btn-outline-light):not(.btn-outline-success)) {
    --wf-control-bg: #d1bb90;
    --wf-control-ink: #171717;
    --wf-control-border: #d1bb90;
  }
  :where(.btn-danger, .btn-outline-danger, .wf-danger, .wf-safety-danger, .wf-safety-trigger) {
    --wf-control-bg: #302021;
    --wf-control-ink: #f3b3b7;
    --wf-control-border: #a3656b;
  }
  /* Older feed markup calls these success buttons, but they open views. */
  :where(.wf-feed .js-toggle-comments, .wf-feed .js-toggle-replies, .wf-feed .js-view-likes) {
    --wf-control-bg: #242424;
    --wf-control-ink: #e0cba2;
    --wf-control-border: #8c7c59;
  }
  :where(.btn-link, .nav-link, .accordion-button, .ql-toolbar button) {
    --wf-control-bg: transparent;
    --wf-control-border: transparent;
  }
  :where(.nav-link.active, .btn-check:checked + .btn, .page-item.active .page-link) {
    --wf-control-bg: #d1bb90;
    --wf-control-ink: #171717;
    --wf-control-border: #d1bb90;
  }
  :where(button, input[type="submit"], input[type="reset"], input[type="button"],
      .btn, a.button, a.fl-button, .gp-button, .gp summary, .wf-follow-btn,
      .profile-action-btn, .wf-footy-toggle-btn, .wf-card-friend-btn, .page-link):hover {
    filter: brightness(1.12);
  }
  :where(button, input[type="submit"], input[type="reset"], input[type="button"],
      .btn, a.button, a.fl-button, .gp-button, .gp summary, .wf-follow-btn,
      .profile-action-btn, .wf-footy-toggle-btn, .wf-card-friend-btn, .page-link):focus-visible {
    outline: 3px solid #f3dba7 !important;
    outline-offset: 3px !important;
  }
  :where(button:disabled, input:disabled, .btn.disabled, [aria-disabled="true"]:where(button, .btn, a.button, .wf-card-friend-btn)) {
    opacity: .55 !important;
    filter: none !important;
    cursor: default !important;
  }
  :where(.wf-safety-trigger, .wf-safety-close, .btn-close, .navbar-toggler, .ql-toolbar button) {
    width: var(--wf-control-min) !important;
    height: var(--wf-control-min) !important;
    flex-shrink: 0;
    padding: 12px !important;
  }
  .btn-close {
    /* Explicit cross keeps contrast in both the gold modal header and dark body. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath stroke='%23e0cba2' stroke-width='2' stroke-linecap='round' d='m6 6 12 12M18 6 6 18'/%3E%3C/svg%3E") !important;
    background-size: 24px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    filter: none !important;
    opacity: 1 !important;
  }
  .wf-safety-close { font-size: 24px !important; }
  .accordion-button { justify-content: flex-start; text-align: left; }
  .wf-safety-dialog .wf-safety-menu button { justify-content: flex-start; text-align: left; }
  .ql-toolbar button { border-width: 0 !important; }
  .ql-toolbar .ql-stroke { stroke: #e0cba2 !important; }
  .ql-toolbar .ql-fill { fill: #e0cba2 !important; }
  .ql-toolbar button.ql-active { background-color: #343025 !important; outline: 1px solid #d1bb90; }
  .ql-toolbar .ql-picker { min-height: 48px; }
  .ql-toolbar .ql-picker-label { display: flex; align-items: center; min-height: 48px; }
  input[type="file"]::file-selector-button { margin-inline-end: 8px; }
  input[type="file"]:focus-visible::file-selector-button { outline: 3px solid #f3dba7; outline-offset: 3px; }
  :where(.btn-group, .btn-toolbar, .modal-footer, .wf-notification-footer, .wf-footy-hero-actions) {
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn-group > .btn { margin: 0 !important; }
  .input-group > .btn { flex-shrink: 0; }
  .wf-safety-trigger svg { width: 20px; height: 20px; }

  /* Content searches reserve a full button column; the input takes the rest.
     Legacy width:100% inputs and mobile buttons must not squeeze each other. */
  .wf-content-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
  }
  .wf-content-toolbar > :first-child { flex: 1 1 300px; min-width: 0; }
  .wf-content-controls {
    display: flex;
    flex: 1 1 440px;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px !important;
    min-width: 0;
    max-width: 640px;
  }
  .wf-content-search {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: stretch;
    gap: 8px !important;
    flex: 1 1 280px;
    min-width: 0 !important;
    margin: 0 !important;
  }
  .wf-content-search input[type="search"] {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 12px !important;
    border-radius: 8px !important;
    font-size: var(--wf-control-font) !important;
    line-height: 1.35 !important;
  }
  .wf-content-search > .btn {
    width: auto !important;
    min-width: 96px !important;
    margin: 0 !important;
    white-space: nowrap !important;
    overflow-wrap: normal;
  }
  .wf-news-category-section { margin: 24px 0 !important; }
  .wf-news-category-section .wf-news-cats-label { margin-bottom: 12px !important; }
  .wf-news-filters { display: flex !important; flex-wrap: wrap; gap: 8px !important; }
  .wf-news-filters .wf-news-category {
    display: inline-flex !important;
    gap: 8px !important;
    --wf-control-bg: #1b1b1b;
    --wf-control-border: #75674d;
    --wf-control-ink: #e0cba2;
    margin: 0 !important;
    overflow-wrap: normal;
  }
  .wf-news-filters .wf-news-category[aria-current="page"] {
    --wf-control-bg: #d1bb90;
    --wf-control-border: #d1bb90;
    --wf-control-ink: #171717;
  }
  .wf-news-filters .wf-news-category[aria-current="page"]::before {
    content: '\2713';
    font-weight: 700;
  }
  /* News list hierarchy and card rhythm. Article detail styles remain scoped
     separately in news.php. Keep flyer artwork contained, rather than cropped. */
  .wf-news-page {
    max-width: 1200px !important;
    padding: 36px 24px !important;
    font-size: 16px;
  }
  .wf-news-page .wf-content-toolbar {
    align-items: flex-start !important;
    margin-bottom: 24px !important;
    gap: 24px;
  }
  .wf-news-page .wf-content-controls { flex: 1 1 480px; max-width: 560px; }
  .wf-news-heading h1 {
    margin: 0 0 8px !important;
    font-size: 32px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    color: #e0cba2;
  }
  .wf-news-heading p { margin: 0; font-size: 16px; line-height: 1.6; color: #c4bfb4; }
  .wf-news-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin: 0 !important;
  }
  .wf-news-grid::before, .wf-news-grid::after { display: none !important; }
  .wf-news-grid > div { min-width: 0; width: auto !important; padding: 0 !important; margin: 0 !important; }
  .wf-news-page .wf-news-card {
    border: 1px solid #75674d !important;
    border-radius: 12px !important;
    background: #131313 !important;
    overflow: hidden;
    height: 100%;
  }
  .wf-news-page .wf-news-card .ratio {
    aspect-ratio: 4 / 3;
    background: #0b0b0b !important;
    border-bottom: 1px solid #514733 !important;
  }
  .wf-news-page .wf-news-card .ratio::before { padding-top: 0 !important; }
  .wf-news-page .wf-news-card-body { padding: 20px !important; gap: 10px; }
  .wf-news-page .wf-news-title { margin: 0 !important; line-height: 1.4; }
  .wf-news-page .wf-news-title a { font-size: 20px !important; font-weight: 600; line-height: 1.4; }
  .wf-news-page .wf-news-date { font-size: 14px; margin: 0 !important; color: #c4bfb4; }
  .wf-news-page .wf-news-summary { font-size: 16px; line-height: 1.6; margin: 0 0 6px !important; color: #ddd7ca; }
  .wf-news-page .wf-news-read { align-self: flex-start; }
  @media (max-width: 991px) {
    .wf-news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }
  @media (max-width: 600px) {
    .wf-news-page { padding: 24px 16px !important; }
    .wf-news-heading h1 { font-size: 28px !important; }
    .wf-news-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .wf-news-page .wf-content-controls { max-width: none; }
  }

  /* The tournament filter previously squeezed two w-100 buttons into col-md-2.
     Reserve space for the actions instead of splitting short words. */
  #tournament-search-form > .row {
    display: grid !important;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) max-content;
    align-items: end !important;
    gap: 16px;
    margin: 0 !important;
  }
  #tournament-search-form > .row::before,
  #tournament-search-form > .row::after { display: none !important; }
  #tournament-search-form > .row > div {
    width: auto !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
  }
  #tournament-search-form > .row > .d-flex {
    gap: 8px !important;
    flex-wrap: wrap;
    align-items: stretch;
  }
  #tournament-search-form .btn {
    display: inline-flex !important;
    width: auto !important;
    min-width: 96px !important;
    flex: 1 1 0;
    overflow-wrap: normal;
  }
  #tournament-search-form a.btn {
    --wf-control-bg: #242424;
    --wf-control-ink: #e0cba2;
    --wf-control-border: #8c7c59;
  }
  @media (max-width: 991px) {
    #tournament-search-form > .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    #tournament-search-form > .row > .d-flex { grid-column: 1 / -1; }
  }
  @media (max-width: 600px) {
    #tournament-search-form > .row { grid-template-columns: minmax(0, 1fr); }
  }
  @media (prefers-reduced-motion: reduce) {
    :where(button, .btn, a.button, .gp-button) { transition: none; }
  }
}
