/*
 * HFTKernel theme switch and Solarized Light.
 * Solarized palette: https://ethanschoonover.com/solarized/
 * Existing dark-theme component rules remain in theme-hftcloud-green.css.
 * Control layout and narrow-width wrapping are shared; palette overrides require data-theme.
 */

.theme-switch {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 2px;
    width: fit-content;
    padding: 3px;
    border: 1px solid var(--hk-border);
    border-radius: 11px;
    color: var(--hk-text-secondary);
    background: var(--hk-bg-alt);
    font: inherit;
    line-height: 1;
    white-space: nowrap;
}

.theme-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 36px;
    min-height: 36px;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--hk-text-secondary);
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
}

.theme-option svg {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-option:hover {
    color: var(--hk-text);
    background: var(--hk-surface-hover);
}

.theme-option[aria-pressed="true"] {
    color: #001007;
    background: var(--hk-accent);
    border-color: var(--hk-accent);
}

.theme-option:focus-visible {
    outline: 2px solid var(--hk-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--hk-focus-ring);
}

.theme-option:disabled {
    color: var(--hk-text-muted);
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.nav-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.legal-language-switcher,
.download-language,
.appearance-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.appearance-controls { margin-bottom: 20px; }

.legal-language-switcher .language-switcher,
.download-language .language-switcher,
.appearance-controls .language-switcher {
    width: auto;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 5px;
    margin: 0;
    padding-top: 0;
    border-top: 0;
    white-space: normal;
}

@media (max-width: 1160px) {
    .nav > .theme-switch {
        align-self: center;
        margin: 12px 0 4px;
    }
}

@media (max-width: 520px) {
    .nav-actions { gap: 6px; }
    .nav-actions .theme-option { padding-inline: 8px; }
    .nav-actions .theme-option > span { display: none; }
    .nav .theme-option > span { display: inline; }
}

/* A single 1fr track otherwise keeps a long translated word's min-content
   width. Permit the narrow hero to shrink and wrap, without clipping it. */
@media (max-width: 640px) {
    .hero-grid,
    .page-hero-grid { grid-template-columns: minmax(0, 1fr); }

    .hero-grid > *,
    .page-hero-grid > * { min-width: 0; }

    .hero h1,
    .page-hero h1,
    .legal-page h1,
    .legal-page h2 {
        overflow-wrap: anywhere;
        hyphens: auto;
    }

    .legal-page h1,
    .legal-page h2 {
        min-width: 0;
        max-width: 100%;
    }

    .hero-actions > .btn {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}

/* Solarized base3/base2 paper, base02/base03 ink, green and blue accents. */
html[data-theme="light"] {
    color-scheme: light;

    --hk-bg: #fdf6e3;
    --hk-bg-alt: #eee8d5;
    --hk-surface: #fdf6e3;
    --hk-surface-raised: #eee8d5;
    --hk-surface-hover: #eee8d5;
    --hk-border: #93a1a1;
    --hk-border-strong: #586e75;
    --hk-border-active: #073642;
    --hk-accent: #073642;
    --hk-accent-hover: #002b36;
    --hk-accent-muted: #073642;
    --hk-accent-subtle: rgba(133, 153, 0, .12);
    --hk-text: #073642;
    --hk-text-secondary: #073642;
    --hk-text-muted: #586e75;
    --hk-text-code: #073642;
    --hk-warning: #cb4b16;
    --hk-danger: #dc322f;
    --hk-focus-ring: rgba(38, 139, 210, .20);
    --hk-shadow: 0 16px 48px rgba(0, 43, 54, .08);
    --hk-glow: 0 0 24px rgba(133, 153, 0, .07);

    /* Legacy component tokens use the same selected palette. */
    --ink: var(--hk-text);
    --ink-soft: var(--hk-text-secondary);
    --muted: var(--hk-text-muted);
    --line: var(--hk-border);
    --line-dark: var(--hk-border-strong);
    --surface: var(--hk-surface);
    --surface-soft: var(--hk-bg-alt);
    --surface-blue: var(--hk-surface-raised);
    --night: var(--hk-bg);
    --night-soft: var(--hk-surface);
    --night-card: var(--hk-surface-raised);
    --accent: var(--hk-accent);
    --accent-dark: var(--hk-accent-muted);
    --accent-light: var(--hk-text-code);
    --success: var(--hk-accent-muted);
    --success-bg: var(--hk-accent-subtle);
    --shadow: var(--hk-shadow);

    color: var(--hk-text);
    background: var(--hk-bg);
}

html[data-theme="light"] ::selection {
    color: #002b36;
    background: #93a1a1;
}

html[data-theme="light"] a {
    text-decoration-color: rgba(7, 54, 66, .42);
}

html[data-theme="light"] a:hover {
    text-decoration-color: #002b36;
}

html[data-theme="light"] .site-header {
    background: rgba(253, 246, 227, .96);
    box-shadow: 0 10px 30px rgba(0, 43, 54, .06);
}

html[data-theme="light"] .theme-option[aria-pressed="true"] {
    color: #002b36;
    background: #859900;
    border-color: #586e75;
}

html[data-theme="light"] .hero,
html[data-theme="light"] .page-hero {
    background:
        radial-gradient(circle at 82% 18%, rgba(133, 153, 0, .08), transparent 30%),
        radial-gradient(circle at 8% 82%, rgba(42, 161, 152, .05), transparent 34%),
        linear-gradient(135deg, #fdf6e3 0%, #fdf6e3 56%, #eee8d5 100%);
}

html[data-theme="light"] .hero::after,
html[data-theme="light"] .page-hero::after {
    background-image:
        linear-gradient(rgba(88, 110, 117, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(88, 110, 117, .055) 1px, transparent 1px);
}

html[data-theme="light"] .results-section,
html[data-theme="light"] .contact-section,
html[data-theme="light"] .section-dark,
html[data-theme="light"] .docs-verification,
html[data-theme="light"] .changelog-cta {
    background: linear-gradient(145deg, #eee8d5, #fdf6e3 62%, #eee8d5);
}

html[data-theme="light"] .changelog-cta h2 {
    color: var(--hk-text);
}

html[data-theme="light"] .hero-stat-grid div,
html[data-theme="light"] .contact-benefits div {
    background: rgba(253, 246, 227, .72);
    border-color: var(--hk-border);
}

html[data-theme="light"] .page-summary-card,
html[data-theme="light"] .profile-request-deliverables,
html[data-theme="light"] .verification-gates {
    background: rgba(253, 246, 227, .88);
    border-color: var(--hk-border);
}

html[data-theme="light"] .profile-request-block {
    background:
        radial-gradient(circle at 90% 12%, rgba(133, 153, 0, .09), transparent 34%),
        linear-gradient(140deg, #fdf6e3, #eee8d5);
}

html[data-theme="light"] .outcome-card::after {
    border-color: rgba(88, 110, 117, .08);
}

/* Explicit terminal, form and standalone surfaces in the dark stylesheet. */
html[data-theme="light"] .hero-install-terminal,
html[data-theme="light"] .terminal-command-wrap,
html[data-theme="light"] .install-command,
html[data-theme="light"] pre,
html[data-theme="light"] .code-block,
html[data-theme="light"] .resource-page pre,
html[data-theme="light"] .jitter-guide-page .jt-example pre,
html[data-theme="light"] .profile-block,
html[data-theme="light"] .verification-code {
    background: #eee8d5;
}

html[data-theme="light"] .resource-page pre {
    box-shadow: inset 0 1px 0 rgba(253, 246, 227, .75);
}

html[data-theme="light"] .terminal-titlebar,
html[data-theme="light"] .profile-block-head {
    background: #fdf6e3;
}

html[data-theme="light"] .docs-toolbar {
    background: rgba(253, 246, 227, .96);
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] .lead-form input,
html[data-theme="light"] .lead-form textarea,
html[data-theme="light"] .docs-search-wrap {
    background: #fdf6e3;
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .lead-form input:focus,
html[data-theme="light"] .lead-form select:focus,
html[data-theme="light"] .lead-form textarea:focus {
    background: #fdf6e3;
}

html[data-theme="light"] .docs-search-wrap input,
html[data-theme="light"] .docs-search-wrap input:focus {
    background: transparent;
}

html[data-theme="light"] input:-webkit-autofill,
html[data-theme="light"] input:-webkit-autofill:hover,
html[data-theme="light"] input:-webkit-autofill:focus,
html[data-theme="light"] textarea:-webkit-autofill,
html[data-theme="light"] select:-webkit-autofill {
    -webkit-text-fill-color: var(--hk-text);
    box-shadow: 0 0 0 1000px #fdf6e3 inset;
}

html[data-theme="light"] input[aria-invalid="true"],
html[data-theme="light"] select[aria-invalid="true"],
html[data-theme="light"] textarea[aria-invalid="true"] {
    box-shadow: 0 0 0 3px rgba(220, 50, 47, .14);
}

html[data-theme="light"] .site-footer {
    background: #eee8d5;
}

/* Solarized green surfaces use base03 ink for strong button contrast. */
html[data-theme="light"] .btn,
html[data-theme="light"] .button-primary,
html[data-theme="light"] .privacy-consent__button--primary,
html[data-theme="light"] body > .wrap > .card > a {
    color: #002b36;
    background: #859900;
    border-color: #586e75;
    box-shadow: 0 8px 24px rgba(0, 43, 54, .08);
}

html[data-theme="light"] .btn:hover,
html[data-theme="light"] .btn:active,
html[data-theme="light"] .button-primary:hover,
html[data-theme="light"] .button-primary:active,
html[data-theme="light"] .privacy-consent__button--primary:hover,
html[data-theme="light"] .privacy-consent__button--primary:focus-visible,
html[data-theme="light"] body > .wrap > .card > a:hover {
    color: #fdf6e3;
    background: #073642;
    border-color: #073642;
}

html[data-theme="light"] .btn-secondary,
html[data-theme="light"] .button-secondary {
    color: var(--hk-text);
    background: transparent;
    border-color: var(--hk-border-strong);
    box-shadow: none;
}

html[data-theme="light"] .btn-secondary:hover,
html[data-theme="light"] .button-secondary:hover {
    color: var(--hk-text);
    background: var(--hk-accent-subtle);
    border-color: var(--hk-border-active);
}

html[data-theme="light"] .btn:disabled {
    color: var(--hk-text-muted);
    background: var(--hk-surface-raised);
    border-color: var(--hk-border);
    box-shadow: none;
}

html[data-theme="light"] .check-list li::before,
html[data-theme="light"] body > .wrap > .card .mark {
    color: #002b36;
    background: #859900;
}

/* Retint the original green-only decorative borders and halos. */
html[data-theme="light"] .release-verified,
html[data-theme="light"] .release-status,
html[data-theme="light"] .release-latest-badge,
html[data-theme="light"] .release-marker small,
html[data-theme="light"] .release-index small,
html[data-theme="light"] .outcome-number,
html[data-theme="light"] .measurement-icon,
html[data-theme="light"] .package-profile-symbol,
html[data-theme="light"] .tool-pill,
html[data-theme="light"] .measurement-card .tool-pill,
html[data-theme="light"] .format-badge,
html[data-theme="light"] .package-badge,
html[data-theme="light"] .parameter-guidance,
html[data-theme="light"] body > .wrap > .panel .summary span,
html[data-theme="light"] body > .wrap > .panel .component {
    border-color: rgba(88, 110, 117, .35);
}

html[data-theme="light"] .release-verified {
    box-shadow: 0 0 18px rgba(133, 153, 0, .08);
}

html[data-theme="light"] .icon-container,
html[data-theme="light"] .feature-icon {
    background: rgba(133, 153, 0, .12);
    border-color: rgba(88, 110, 117, .35);
}

html[data-theme="light"] .availability-badge.is-ready::before,
html[data-theme="light"] .profile-request-deliverables li::before,
html[data-theme="light"] .release-improvements li::before,
html[data-theme="light"] .release-detail li::before {
    box-shadow: 0 0 0 4px rgba(133, 153, 0, .14);
}

html[data-theme="light"] .release-detail ol li::before {
    box-shadow: none;
}

html[data-theme="light"] .availability-badge.is-custom::before {
    box-shadow: 0 0 0 3px rgba(88, 110, 117, .12);
}

html[data-theme="light"] .release-entry.is-latest .release-marker::after {
    box-shadow: 0 0 0 1px var(--hk-border-active), 0 0 0 6px rgba(133, 153, 0, .14);
}

html[data-theme="light"] .parameter-card {
    box-shadow: 0 8px 27px rgba(0, 43, 54, .07);
}

html[data-theme="light"] .parameter-caution {
    background: rgba(181, 137, 0, .07);
    border-color: rgba(203, 75, 22, .50);
}

html[data-theme="light"] .package-family-mark {
    color: #002b36;
}

html[data-theme="light"] .package-matrix-table tbody tr:nth-child(odd) > * {
    background: rgba(238, 232, 213, .55);
}

html[data-theme="light"] .package-matrix-table tbody tr:hover > * {
    background: #eee8d5;
}

/* Preserve source logo assets; dark ink makes their light lettering readable. */
html[data-theme="light"] .brand-logo,
html[data-theme="light"] .brand:hover .brand-logo,
html[data-theme="light"] .brand:focus-visible .brand-logo,
html[data-theme="light"] .legal-brand:hover .brand-logo,
html[data-theme="light"] .legal-brand:focus-visible .brand-logo,
html[data-theme="light"] .terminal-brand-logo,
html[data-theme="light"] .download-brand,
html[data-theme="light"] body > .wrap > .card .logo {
    filter: grayscale(1) brightness(.30);
}

html[data-theme="light"] .release-brand-mark,
html[data-theme="light"] .page-summary-brand img {
    background: #073642;
    box-shadow: 0 0 18px rgba(0, 43, 54, .08);
}

/* Privacy controls share the palette; no third-party widget is recolored. */
html[data-theme="light"] .privacy-consent__panel {
    background: rgba(253, 246, 227, .98);
    box-shadow: 0 24px 90px rgba(0, 43, 54, .18);
}

html[data-theme="light"] .privacy-settings-button {
    background: rgba(253, 246, 227, .96);
    box-shadow: 0 12px 34px rgba(0, 43, 54, .10);
}

/* Standalone pages have their own higher-specificity language-link rules. */
html[data-theme="light"] .download-language .language-switcher a,
html[data-theme="light"] body > .wrap > .card .language-switcher a {
    color: var(--hk-text-muted);
    background: transparent;
    box-shadow: none;
}

html[data-theme="light"] .download-language .language-switcher .is-active,
html[data-theme="light"] body > .wrap > .card .language-switcher .is-active {
    color: var(--hk-accent);
}

html[data-theme="light"] .download-language .language-switcher span,
html[data-theme="light"] body > .wrap > .card .language-switcher span {
    color: var(--hk-border-strong);
}

@media (max-width: 1160px) {
    html[data-theme="light"] .nav {
        box-shadow: 0 30px 60px rgba(0, 43, 54, .15);
    }
}

@media (max-width: 760px) {
    html[data-theme="light"] .package-matrix-table tbody tr:nth-child(odd) > * {
        background: transparent;
    }
}
