/* =========================================================
   THLIN Utilities — visually-hidden, badges, eyebrows, section
   heads, and cross-cutting chrome (inline-edit UI, AI widget,
   back-to-top) that isn't tied to any one page.
========================================================= */

.t-visually-hidden,
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.t-skip-link {
    position: absolute;
    top: -60px; left: 1rem;
    background: var(--t-white);
    color: var(--t-blue-dark);
    padding: 0.75rem 1rem;
    border-radius: var(--t-radius-sm);
    font-weight: 700;
    z-index: 9999;
    transition: top 0.2s ease;
}
.t-skip-link:focus { top: 1rem; }

.t-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: var(--t-radius-pill);
    background: var(--t-light-blue);
    color: var(--t-blue-dark);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.t-badge--green { background: #EAF3DE; color: var(--t-green); }
.t-badge--orange { background: #F7E9D6; color: var(--t-orange); }

.t-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--t-orange);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: var(--t-space-sm);
}
.t-eyebrow::before { content: ""; width: 28px; height: 3px; border-radius: var(--t-radius-pill); background: currentColor; }
.t-eyebrow--on-dark { color: var(--t-light-blue); }

.t-section-head { max-width: 720px; margin-bottom: var(--t-space-lg); }
.t-section-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -0.02em; }
.t-section-head p { color: var(--t-text-muted); font-size: 1.05rem; margin: 0; }
.t-section-head--center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Inline editing (public site, logged-in admins only) ---------- */
.inline-edit-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10050;
    background: var(--t-white);
    border-bottom: 1px solid var(--t-border);
    box-shadow: var(--t-shadow-sm);
}
.inline-edit-bar__inner {
    max-width: min(100% - 24px, 1280px);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--t-space-md);
    flex-wrap: wrap;
}
.inline-edit-bar__message { color: var(--t-navy); font-weight: 700; font-size: 0.92rem; }
.inline-edit-bar__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.inline-edit-bar__btn {
    border: 0;
    border-radius: var(--t-radius-sm);
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    font-family: inherit;
}
.inline-edit-bar__btn--primary { background: var(--t-blue); color: var(--t-white); }
.inline-edit-bar__btn--secondary { background: var(--t-light-blue); color: var(--t-navy); }
.inline-edit-bar__btn--link { background: transparent; color: var(--t-blue); }
.inline-edit-bar__btn--cms { background: var(--t-blue); color: var(--t-white); font-weight: 800; }
.inline-edit-bar__logout { display: inline; margin: 0; }
body.has-inline-edit-bar .site-wrapper { padding-top: 58px; }

.inline-edit-enabled [data-inline-edit="true"],
.inline-edit-enabled [data-editable="true"] {
    outline: 2px dashed var(--t-orange);
    outline-offset: 5px;
    cursor: text;
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(186, 117, 23, 0.35);
    transition: background 0.2s ease, outline-color 0.2s ease;
}
.inline-edit-enabled [data-inline-edit="true"]:hover,
.inline-edit-enabled [data-editable="true"]:hover { background: rgba(186, 117, 23, 0.12); }
.inline-edit-enabled a[data-inline-edit="true"],
.inline-edit-enabled a[data-editable="true"] { pointer-events: auto; }
.inline-edit-enabled [data-editable-image="true"] { outline: 2px dashed var(--t-blue); outline-offset: 4px; cursor: pointer; }

.inline-editing-active { outline-color: var(--t-blue); background: rgba(24, 95, 165, 0.08); }

.inline-edit-toolbar {
    position: absolute;
    z-index: 10060;
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--t-navy);
    color: var(--t-white);
    border-radius: var(--t-radius-md);
    box-shadow: var(--t-shadow-lg);
}
.inline-edit-toolbar button { border: 0; border-radius: var(--t-radius-sm); padding: 6px 10px; font-weight: 700; cursor: pointer; font-family: inherit; }
.inline-edit-toolbar .save { background: var(--t-white); color: var(--t-navy); }
.inline-edit-toolbar .cancel { background: rgba(255, 255, 255, 0.18); color: var(--t-white); }

.inline-edit-toast {
    position: fixed;
    top: 68px; right: 16px;
    z-index: 10070;
    padding: 10px 14px;
    border-radius: var(--t-radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: var(--t-shadow-md);
}
.inline-edit-toast--success { background: #EAF3DE; color: #244D09; border: 1px solid rgba(59, 109, 17, 0.25); }
.inline-edit-toast--error { background: #FEE2E2; color: #991B1B; border: 1px solid rgba(153, 27, 27, 0.2); }

/* ---------- AI help widget ---------- */
.ai-help-widget { position: fixed; right: 1.25rem; bottom: 5.5rem; z-index: 56; }
.ai-help-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 1.1rem;
    border: 0; border-radius: var(--t-radius-pill);
    background: var(--t-blue);
    color: var(--t-white);
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--t-shadow-md);
}
.ai-help-toggle:hover { background: var(--t-blue-dark); }

.ai-help-panel {
    display: none;
    position: absolute;
    right: 0; bottom: calc(100% + 0.75rem);
    width: min(340px, calc(100vw - 2.5rem));
    max-height: 70vh;
    background: var(--t-white);
    border-radius: var(--t-radius-lg);
    box-shadow: var(--t-shadow-lg);
    border: 1px solid var(--t-border);
    overflow: hidden;
    flex-direction: column;
}
.ai-help-panel.is-open { display: flex; }

.ai-help-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--t-space-sm);
    padding: var(--t-space-md);
    background: var(--t-navy);
    color: var(--t-white);
}
.ai-help-header span { display: block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.ai-help-header h2 { color: var(--t-white); font-size: 1.1rem; margin: 0.2rem 0 0; }
.ai-help-header button { border: 0; background: transparent; color: var(--t-white); font-size: 1.2rem; cursor: pointer; line-height: 1; }

.ai-help-intro { padding: var(--t-space-sm) var(--t-space-md) 0; font-size: 0.88rem; color: var(--t-text-muted); margin: 0; }
.ai-help-disclaimer { padding: 0 var(--t-space-md); font-size: 0.76rem; color: var(--t-text-muted); font-style: italic; margin: 0.35rem 0 0; }

.ai-chat-box { flex: 1; overflow-y: auto; padding: var(--t-space-md); display: grid; gap: 0.6rem; min-height: 120px; }
.ai-message { padding: 0.6rem 0.85rem; border-radius: var(--t-radius-md); font-size: 0.88rem; line-height: 1.5; max-width: 90%; }
.ai-message-bot { background: var(--t-bg); color: var(--t-text); align-self: flex-start; }
.ai-message-user { background: var(--t-blue); color: var(--t-white); align-self: flex-end; margin-left: auto; }
.ai-message a { color: inherit; font-weight: 700; }

.ai-quick-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 var(--t-space-md) var(--t-space-sm); }
.ai-quick-actions button {
    border: 1px solid var(--t-border);
    background: var(--t-white);
    color: var(--t-blue-dark);
    border-radius: var(--t-radius-pill);
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.ai-quick-actions button:hover { background: var(--t-light-blue); }

.ai-help-form { display: flex; gap: 0.5rem; padding: var(--t-space-md); border-top: 1px solid var(--t-border); }
.ai-help-form input { flex: 1; padding: 0.6rem 0.8rem; border: 1px solid var(--t-border); border-radius: var(--t-radius-sm); }
.ai-help-form button { border: 0; border-radius: var(--t-radius-sm); background: var(--t-blue); color: var(--t-white); padding: 0 1rem; font-weight: 800; cursor: pointer; }
.ai-help-form button:hover { background: var(--t-blue-dark); }

@media (max-width: 640px) {
    .ai-help-widget { right: 0.75rem; bottom: 4.75rem; }
}

/* ---------- Back to top ---------- */
.t-back-to-top {
    position: fixed;
    right: 1.25rem; bottom: 1.25rem;
    z-index: 55;
    width: 46px; height: 46px;
    border-radius: 50%;
    border: 0;
    background: var(--t-blue);
    color: var(--t-white);
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--t-shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.t-back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.t-back-to-top:hover { background: var(--t-blue-dark); }
