/* Theme switch — two-option segmented control.
   See templates/_theme_toggle.html and static/theme-init.js.
   Every colour is a token so the control themes itself. */
.theme-switch {
    display: inline-flex;
    align-items: stretch;
    padding: 2px;
    gap: 2px;
    border-radius: 999px;
    border: 1px solid var(--a-rule);
    background: var(--a-hover-bg);
}
.theme-opt {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    padding: 0.26rem 0.62rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    /* text-dim, not text-faint: the unselected option still has to be readable
       against the switch track. text-faint measured 4.38:1 there in light mode
       (the track is a 6% ink wash over the page, so it is not the page colour). */
    color: var(--a-text-dim);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease;
    -webkit-tap-highlight-color: transparent;
}
.theme-opt:hover { color: var(--a-text); }

/* The SELECTED option is the one that reads as current state. */
.theme-opt[aria-pressed="true"] {
    background: var(--a-card);
    color: var(--a-text);
    box-shadow: 0 1px 3px var(--a-shadow);
    cursor: default;
}
/* Keyboard focus must stay visible — these are real controls. */
.theme-opt:focus-visible {
    outline: 2px solid var(--a-focus);
    outline-offset: 1px;
}

/* Icons drawn in CSS: filled disc = dark, rayed disc = light. No image request,
   and they inherit the themed ink automatically. */
.theme-opt-icon {
    width: 0.8em;
    height: 0.8em;
    border-radius: 50%;
    flex-shrink: 0;
    background: currentColor;
}
.theme-opt-icon--dark {
    /* crescent: punch a hole with the surface colour */
    box-shadow: inset -0.26em -0.05em 0 0 var(--a-card);
}
.theme-opt[aria-pressed="false"] .theme-opt-icon--dark {
    box-shadow: inset -0.26em -0.05em 0 0 var(--a-page);
}
.theme-opt-icon--light {
    transform: scale(0.62);
    box-shadow: 0 0 0 0.12em var(--a-card), 0 0 0 0.19em currentColor;
}
.theme-opt[aria-pressed="false"] .theme-opt-icon--light {
    box-shadow: 0 0 0 0.12em var(--a-page), 0 0 0 0.19em currentColor;
}

@media (max-width: 1000px) {
    /* Icons carry the meaning once the nav gets tight; the words would force a
       bar wrap sooner than needed. Measured: labelled switch 134px, icon-only
       is ~62px. */
    .theme-opt-text { display: none; }
    .theme-opt { padding: 0.3rem 0.42rem; }
}

/* Auth pages (login / register / verify) have no topnav, so the switch sits in
   the card's top-right corner. Without this the pre-login pages would be the
   only place a visitor could not change theme. */
.auth-theme-corner {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 0.25rem;
}
