/*
 * "Continue with Google / Facebook" — Include/inc_social_login.php
 *
 * Self-contained on purpose. The same markup is dropped into three different design
 * systems ( the hn-* homepage card, the .eduui login card, the au-* sign-up form ), so
 * nothing here inherits from any of them beyond the font: everything else is stated.
 *
 * Colours are stated as literal values rather than brand tokens for the same reason —
 * a token that exists on one of those three pages and not the others would render the
 * buttons differently depending on where you found them.
 */

.oex-social {
    margin-top: 20px;
}

/* Caption sitting on a rule. The rule is drawn with a border on the pseudo-elements
   rather than a background line behind the text, so it never shows through a
   translucent card. */
.oex-social-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.2;
}

.oex-social-divider::before,
.oex-social-divider::after {
    content: "";
    flex: 1 1 auto;
    border-top: 1px solid #e2e5ea;
}

.oex-social-divider > span {
    flex: 0 0 auto;
}

/* Two providers sit side by side and one fills the width. Below 380px they stack:
   "Facebook" plus its icon does not fit in half of a small phone without the label
   truncating, and a login button whose label is cut off is a login button people
   hesitate over. */
.oex-social-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.oex-social-buttons.is-single {
    grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 380px) {
    .oex-social-buttons {
        grid-template-columns: minmax(0, 1fr);
    }
}

.oex-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid #d7dbe0;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.oex-social-btn:hover,
.oex-social-btn:focus {
    background: #f8f9fb;
    border-color: #b9c0c9;
    color: #1f2937;
    text-decoration: none;
}

.oex-social-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* The label is allowed to shrink and clip before the icon does, so a narrow card never
   produces a button with no mark on it. */
.oex-social-btn > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.oex-social-btn-icon {
    flex: 0 0 auto;
    font-size: 17px;
    line-height: 1;
}

.oex-social-btn--google .oex-social-btn-icon {
    color: #4285f4;
}

.oex-social-btn--facebook .oex-social-btn-icon {
    color: #1877f2;
}

/* Waiting on a popup window or on the phone's own Google/Facebook sign-in.
   The spinner REPLACES the provider mark rather than joining it, so the button does not
   change width and the row does not reflow while somebody is looking at another window. */
.oex-social-btn-spin {
    display: none;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, .15);
    border-top-color: #6b7280;
    border-radius: 50%;
    animation: oex-social-spin .8s linear infinite;
}

.oex-social-btn.is-busy {
    pointer-events: none;
    opacity: .75;
}

.oex-social-btn.is-busy .oex-social-btn-icon { display: none; }
.oex-social-btn.is-busy .oex-social-btn-spin { display: block; }

@keyframes oex-social-spin {
    to { transform: rotate(360deg); }
}

/* prefers-reduced-motion: the spin is decoration, but the busy state is information —
   so the animation stops and the mark stays visibly changed. */
@media (prefers-reduced-motion: reduce) {
    .oex-social-btn-spin { animation: none; border-top-color: #6b7280; }
}

@media (prefers-color-scheme: dark) {
    /* Only applied where the host page has actually opted into a dark ground. Both
       auth layouts render light today, so this is here for the card that ends up on a
       dark template rather than a theme this block imposes. */
    .hn-body[data-hn-theme="dark"] .oex-social-btn,
    .oex-social[data-oex-social-dark="1"] .oex-social-btn {
        background: #1f2430;
        border-color: #39404f;
        color: #e8eaf0;
    }
}
