/* Biological-sex picker shared by the health tools (markup: partials/health-sex-seg.blade.php).
   Everything is driven by aria-pressed, so a tool script only has to set that attribute (EtioSeg.set) and never
   writes colour classes. Colours use !important because app.css recolours text on tool pages. */
[data-ht-sex][data-ht-sex] { display: grid; gap: .5rem; }
[data-ht-sex].ht-seg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-ht-sex].ht-seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

[data-ht-sex][data-ht-sex] > button {
    display: flex; align-items: center; justify-content: center; gap: .375rem;
    min-height: 34px; padding: .5rem .75rem; border-radius: .75rem;
    font-size: .75rem; line-height: 1rem; font-weight: 600; text-align: center; cursor: pointer;
    border: 1px solid rgba(228, 228, 231, .9) !important;
    background: #f4f4f5 !important; color: #3f3f46 !important; box-shadow: none !important;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
[data-ht-sex][data-ht-sex] > button > i { font-size: 11px; color: inherit !important; }
[data-ht-sex][data-ht-sex] > button[data-sex="female"][aria-pressed="false"] > i { color: #be185d !important; }
[data-ht-sex][data-ht-sex] > button:hover { border-color: #fb7185 !important; color: #18181b !important; }
[data-ht-sex][data-ht-sex] > button:focus-visible { outline: 2px solid #f43f5e; outline-offset: 2px; }

.dark [data-ht-sex][data-ht-sex] > button {
    border-color: rgba(255, 255, 255, .1) !important; background: rgba(39, 39, 42, .8) !important; color: #d4d4d8 !important;
}
.dark [data-ht-sex][data-ht-sex] > button[data-sex="female"][aria-pressed="false"] > i { color: #ec4899 !important; }
.dark [data-ht-sex][data-ht-sex] > button:hover { border-color: #fb7185 !important; color: #fff !important; }

/* Selected */
[data-ht-sex][data-ht-sex] > button[aria-pressed="true"],
.dark [data-ht-sex][data-ht-sex] > button[aria-pressed="true"],
[data-ht-sex][data-ht-sex] > button[aria-pressed="true"]:hover {
    background: #e11d48 !important; border-color: #e11d48 !important; color: #fff !important; font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12) !important;
}
[data-ht-sex][data-ht-sex] > button[aria-pressed="true"] > i { color: #fff !important; }

@media (max-width: 639px), (pointer: coarse) and (max-width: 900px) {
    [data-ht-sex][data-ht-sex] { gap: .375rem; }
    [data-ht-sex][data-ht-sex] > button { min-height: 0; padding: .3125rem .5rem; font-size: .6875rem; border-radius: .6875rem; gap: .3rem; }
    [data-ht-sex][data-ht-sex] > button > i { font-size: 10px; }
}
