@import "../variables/variables";

:root {
    --toggle-button-height-min: 72px;
    --toggle-button-width-min: 72px;
    --toggle-button-width-max: 342px;
    --toggle-button-list-width-min: 224px;
    --toggle-button-list-width-max: 342px;
    --toggle-button-gallery-width-min: 168px;
    --toggle-button-gallery-width-max: 342px;
}

.toggle-button {
    background-color: var(--color-background-primary);
    border: 1px solid var(--color-stroke-default);
    border-radius: var(--spacing-100);
    box-shadow: 0 0 0 1px transparent;
    color: var(--color-foreground-primary);
    display: inline-flex;
    font-size: var(--font-size-default);
    justify-content: center;
    margin-right: var(--spacing-100);
    margin-top: auto;
    max-width: var(--toggle-button-width-max);
    min-height: var(--toggle-button-height-min);
    min-width: var(--toggle-button-width-min);
    padding: 0 var(--spacing-200);
    vertical-align: top;

    &:focus-visible {
        outline-offset: 1px;
        outline-style: outset;
        outline-width: 2px;
    }
}

.toggle-button[aria-disabled="true"],
.toggle-button[disabled] {
    border-color: var(--color-stroke-disabled);
}

.toggle-button * {
    pointer-events: none;
}

.toggle-button[aria-pressed="true"] {
    background-color: var(--color-background-secondary);
    border: 1px solid var(--color-stroke-strong);
    box-shadow: 0 0 0 1px var(--color-stroke-strong);
    font-weight: bold;
}
.toggle-button[aria-disabled="true"][aria-pressed="true"],
.toggle-button[disabled][aria-pressed="true"] {
    border-color: var(--color-stroke-disabled);
    box-shadow: 0 0 0 1px var(--color-stroke-disabled);
}

.toggle-button:not([aria-disabled="true"], [disabled]):hover {
    background-color: var(--state-layer-hover);
}

.toggle-button:not([aria-disabled="true"], [disabled]):active {
    background-color: var(--state-layer-pressed);
}

.toggle-button__content {
    align-self: center;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.toggle-button__icon {
    margin-bottom: var(--spacing-200);
    margin-right: var(--spacing-200);
    margin-top: var(--spacing-200);
}

.toggle-button__image-container {
    align-self: center;
    margin-bottom: var(--spacing-200);
    margin-right: var(--spacing-200);
    margin-top: var(--spacing-200);
}

.toggle-button__image-container svg.icon {
    height: 100%;
}

.toggle-button__image-container img {
    height: 100%;
    max-height: 56px;
    max-width: 56px;
}

.toggle-button__image {
    display: inline-block;
    height: 56px;
    width: 56px;
}

.toggle-button__title {
    font-size: var(--font-size-medium);
    font-weight: bold;
    line-height: var(--font-size-large-2);
    margin-bottom: var(--spacing-50);
    margin-top: var(--spacing-200);
}

.toggle-button__title:only-child {
    margin-bottom: var(--spacing-200);
}

.toggle-button[aria-disabled="true"] .toggle-button__title,
.toggle-button[disabled] .toggle-button__title {
    color: var(--color-foreground-disabled);
}

.toggle-button
    .toggle-button__content:only-child
    .toggle-button__title:only-child {
    font-weight: bold;
    margin-bottom: auto;
    margin-top: auto;
    text-align: center;
    width: 100%;
}

.toggle-button:not([aria-pressed="true"])
    .toggle-button__content:only-child
    .toggle-button__title:only-child {
    font-weight: normal;
}

.toggle-button__subtitle {
    color: var(--color-foreground-secondary);
    line-height: var(--font-size-large-1);
    margin-bottom: var(--spacing-200);
}

.toggle-button[aria-disabled="true"] .toggle-button__subtitle,
.toggle-button[disabled] .toggle-button__subtitle {
    color: var(--color-foreground-disabled);
}

.toggle-button__subtitle p {
    margin: 0;
}

.toggle-button[aria-pressed="true"] .toggle-button__subtitle {
    color: var(--color-foreground-primary);
    font-weight: normal;
}

.toggle-button[aria-disabled="true"][aria-pressed="true"]
    .toggle-button__subtitle,
.toggle-button[disabled][aria-pressed="true"] .toggle-button__subtitle {
    color: var(--color-foreground-disabled);
}

/* Layout Themes */
.toggle-button--list-layout {
    justify-content: left;
    max-width: var(--toggle-button-list-width-max);
    min-width: var(--toggle-button-list-width-min);
}

.toggle-button--list-layout .toggle-button__image-container,
.toggle-button--list-layout .toggle-button__content:not(:only-child) {
    align-self: self-start;
}

.toggle-button--gallery-layout {
    flex-direction: column;
    justify-content: left;
    max-width: var(--toggle-button-gallery-width-max);
    min-width: var(--toggle-button-gallery-width-min);
}

.toggle-button--gallery-layout .toggle-button__content {
    align-self: self-start;
}

.toggle-button--gallery-layout .toggle-button__image-container,
.toggle-button--gallery-layout .toggle-button__icon {
    margin-bottom: 0;
    margin-right: 0;
    text-align: left;
}

.toggle-button--gallery-layout .toggle-button__image-container {
    padding-bottom: 60%;
    position: relative;
    text-align: center;
    width: 100%;
}

.toggle-button--gallery-layout .toggle-button__image {
    bottom: 0;
    height: 100%;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
}

.toggle-button[aria-disabled="true"] .toggle-button__icon,
.toggle-button[aria-disabled="true"] .toggle-button__image,
.toggle-button[disabled] .toggle-button__icon,
.toggle-button[disabled] .toggle-button__image {
    filter: grayscale(1);
    opacity: 0.5;
}

.toggle-button--gallery-layout .toggle-button__image-container img {
    height: 100%;
    max-height: 200px;
    max-width: initial;
}

.toggle-button--gallery-layout .toggle-button__icon ~ .toggle-button__content {
    align-self: flex-start;
}
