/* ============================================================================
 * contracts.css — shared application UI contracts
 * ============================================================================
 * Loaded after the token/reset foundation and before shell/page styles.
 * Selectors intentionally include established compatibility names so server-
 * and script-generated markup can use the same primitives without a rewrite.
 * Page styles should contain only page-specific refinements.
 * ============================================================================ */

main { position: relative; z-index: 1; }

/* ===== Page headers ===== */
header,
.verify-header,
.page-header {
    background: transparent;
    color: var(--text-strong);
    padding: 5rem var(--page-gutter) 4rem;
    position: relative;
    text-align: center;
    overflow: hidden;
}
.header-content,
.page-header-content {
    position: relative;
    z-index: 2;
    max-width: 820px;
    margin: 0 auto;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.85rem;
    border-radius: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-strong);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}
.eyebrow i { font-size: 0.7rem; }
h1,
.verify-title,
.page-title {
    font-size: clamp(1.9rem, 7vw, 4rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text-strong);
    text-transform: uppercase;
    margin-bottom: 1rem;
    overflow-wrap: break-word;
    hyphens: auto;
}
.description,
.page-description {
    font-size: 1.15rem;
    color: var(--text-dim);
    max-width: 620px;
    margin: 0 auto 2rem;
    line-height: 1.65;
}
.doc-dates {
    font-size: 0.85rem;
    color: var(--text-dim);
    opacity: 0.75;
    margin: -1.25rem auto 2rem;
    max-width: 620px;
    letter-spacing: 0.01em;
}
.doc-dates time { font-variant-numeric: tabular-nums; }
.description code,
.verify-header code {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    padding: 0.12rem 0.45rem;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.88em;
    color: var(--text);
}
.header-logo-wrap { display: none; }
.header-buttons,
.page-actions,
.action-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.back-home,
.page-chrome { display: none !important; }

/* ===== Actions and links ===== */
.button,
.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1.4rem;
    text-decoration: none;
    font-weight: 600;
    transition: all var(--duration-normal) ease;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}
.button.primary,
.action-button.primary {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}
.button.primary:hover,
.action-button.primary:hover { background: transparent; color: var(--accent); }
.button.secondary,
.action-button.secondary {
    background: transparent;
    color: var(--text-strong);
    border-color: var(--border-strong);
}
.button.secondary:hover,
.action-button.secondary:hover {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}
.button:focus-visible,
.action-button:focus-visible {
    outline: 2px solid var(--text-strong);
    outline-offset: 2px;
}
.button:disabled,
.action-button:disabled { cursor: not-allowed; opacity: 0.6; }
.inline-link { color: var(--indigo); text-decoration: none; font-weight: 600; }
.inline-link:hover { color: var(--text-strong); text-decoration: underline; }

/* ===== Surfaces and layouts ===== */
.docs-main { padding: 1rem var(--page-gutter) 4rem; max-width: var(--content-docs); margin: 0 auto; }
.article-main { padding: 1rem var(--page-gutter) 4rem; max-width: var(--content-article); margin: 0 auto; }
.verify-card,
.surface-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
}
.article-body {
    background: var(--surface);
    padding: 2rem 2.25rem 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.article-body h2 { font-size: 1.3rem; color: var(--text-strong); margin-top: 1.75rem; margin-bottom: 0.65rem; font-weight: 700; letter-spacing: -0.01em; }
.article-body h2:first-child { margin-top: 0; }
.article-body p, .article-body li { color: var(--text); font-size: 0.96rem; line-height: 1.75; }
.article-body ul, .article-body ol { margin: 0.6rem 0 1rem 1.4rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body code {
    background: var(--bg-2);
    color: var(--text);
    padding: 0.12rem 0.4rem;
    border-radius: 5px;
    font-family: var(--mono);
    font-size: 0.86em;
    border: 1px solid var(--border);
}
.article-body pre {
    background: var(--bg);
    color: #e2e8f0;
    padding: 1.1rem 1.3rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 0.85rem 0 1.25rem;
    border: 1px solid var(--border);
}
.article-body pre code { background: transparent; color: inherit; padding: 0; font-size: 0.82rem; line-height: 1.65; border: none; }
.article-body a.inline-link { color: var(--indigo); text-decoration: none; font-weight: 600; border-bottom: 1px dashed var(--border-strong); }
.article-body a.inline-link:hover { border-bottom-style: solid; color: var(--text-strong); }

/* ===== Native FAQ / disclosure contract ===== */
.article-body details.faq-item {
    margin: 0 0 0.75rem;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--duration-normal) ease, background-color var(--duration-normal) ease;
}
.article-body details.faq-item:hover,
.article-body details.faq-item[open] { border-color: var(--border-strong); }
.article-body details.faq-item summary {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    color: var(--text-strong);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}
.article-body details.faq-item summary::-webkit-details-marker { display: none; }
.article-body details.faq-item summary::after { content: "+"; flex: 0 0 auto; color: var(--text-dim); font-size: 1.35rem; font-weight: 400; line-height: 1; }
.article-body details.faq-item[open] summary::after { content: "−"; }
.article-body details.faq-item summary:focus-visible { outline: 2px solid var(--text-strong); outline-offset: -3px; border-radius: var(--radius); }
.article-body details.faq-item > p,
.article-body details.faq-item > div { margin: 0; padding: 0 1.2rem 1rem; color: var(--text-dim); }
.article-body details.faq-item > div > p { margin: 0; }

/* ===== Forms ===== */
:where(.form-field, .field, .tool-field, .restrict-field) {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
:where(.form-field, .field, .tool-field, .restrict-field) label {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
}
:where(.form-control, .form-field input, .field input, .field select, .field textarea) {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-strong);
    padding: 0.7rem 0.85rem;
    font: inherit;
}
:where(.form-control, .form-field input, .field input, .field select, .field textarea):focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: var(--focus-ring);
}
.field-hint,
.form-hint { color: var(--text-faint); font-size: 0.78rem; }

/* ===== Tables ===== */
.table-wrap,
.article-table-wrap,
.compare-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}
.table-wrap:focus-visible,
.article-table-wrap:focus-visible,
.compare-table-wrap:focus-visible,
pre:focus-visible {
    outline: 2px solid var(--text-strong);
    outline-offset: 2px;
}
.compare-table-wrap { margin: 0.6rem 0 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.data-table,
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td,
.compare-table th, .compare-table td { padding: 0.7rem 0.85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.data-table th,
.compare-table th { background: var(--surface-2); color: var(--text-strong); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.data-table tbody tr:last-child td,
.compare-table tbody tr:last-child td { border-bottom: none; }
.compare-table td:first-child { color: var(--text-strong); font-weight: 600; width: 28%; }
.compare-table code { background: rgba(255,255,255,0.05); border: 1px solid var(--border); padding: 0.05rem 0.35rem; border-radius: 4px; font-family: var(--mono); font-size: 0.82em; }

/* ===== Badges, tabs, empty states, and results ===== */
.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.18rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
}
.badge.success, .status-badge.success { color: #86efac; background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.3); }
.badge.error, .status-badge.error { color: #fca5a5; background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }
.tabs,
.tab-list { display: flex; gap: 2px; }
.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.9rem;
}
.result-panel {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

/* ===== Feedback and script-generated markup ===== */
.flash-banner {
    max-width: 900px;
    margin: 1rem auto 0;
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.10);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.feedback { padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.feedback.success { color: #86efac; border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.10); }
.feedback.error { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.10); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: var(--z-modal);
    animation: modal-fade-in 0.18s ease;
}
@keyframes modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-modal);
    animation: modal-pop 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.85rem; }
.modal-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(239, 68, 68, 0.12); color: var(--error); display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.modal-head h3 { color: var(--text-strong); font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-body { color: var(--text-dim); font-size: 0.92rem; line-height: 1.6; margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; }
.modal-actions .dash-btn { padding: 0.6rem 1.1rem; font-size: 0.88rem; }

.toast-stack { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 0.6rem; max-width: 380px; pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1.1rem; color: var(--text); font-size: 0.88rem; box-shadow: var(--shadow-float); display: flex; align-items: center; gap: 0.6rem; pointer-events: auto; cursor: pointer; animation: toast-in 0.22s cubic-bezier(0.4, 0, 0.2, 1); }
.toast.leaving { animation: toast-out 0.18s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
.toast i { font-size: 1rem; flex-shrink: 0; }
.toast.info i { color: var(--indigo); }
.toast.success { border-color: rgba(16, 185, 129, 0.3); }
.toast.success i { color: var(--success); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }
.toast.error i { color: var(--error); }

/* ===== Script-generated markup =====
 * These stable global classes are emitted by public browser scripts. Keep
 * them in the always-linked contract layer rather than a tree-shaken module. */
.verify-extra-spaced { margin-top: 0.6rem; }
.verify-permalink { font-family: var(--mono); font-size: 0.9em; }
.verify-share-link { display: inline-block; font-family: var(--mono); font-size: 0.85em; margin: 0 0.6rem 0.3rem 0; }
.dash-help-flush { margin-top: 0; }
.modal-card-wide { max-width: 920px; width: 95vw; }
.modal-body-tight { margin: 0 0 8px; }
.modal-actions-end { justify-content: flex-end; margin-bottom: 8px; }
.webhook-deliveries-scroll { max-height: 60vh; overflow: auto; }
.delivery-detail { margin: 0 0 6px; }
.delivery-detail-title { margin: 8px 0 4px; }
.delivery-code {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font: 0.75rem/1.6 var(--mono);
    max-height: 30vh;
    overflow: auto;
    padding: 0.75rem;
}
.delivery-response-code { max-height: 20vh; }
.delivery-error-code { background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
.transparency-date { color: var(--text-strong); font-family: var(--mono); }
.transparency-published { color: var(--text-dim); font-size: 0.82rem; }
.transparency-action { text-align: right; }
.transparency-root { font-family: var(--mono); font-size: 0.78rem; word-break: break-all; }

/* Accessibility helper is also used by generated controls. */
.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; }
[hidden] { display: none !important; }

@media (max-width: 768px) {
    header, .verify-header, .page-header { padding: 3rem 1.25rem 2.5rem; }
    .description, .page-description { font-size: 1rem; }
    .header-buttons .button { width: 100%; max-width: 320px; justify-content: center; }
}
@media (max-width: 640px) {
    header, .verify-header, .page-header { padding: 2.75rem 1rem 2.5rem; }
    .description, .page-description { font-size: 1.02rem; }
    .header-buttons .button { width: 100%; justify-content: center; }
    .article-body details.faq-item summary { padding: 0.9rem 1rem; font-size: 0.96rem; }
    .article-body details.faq-item > p,
    .article-body details.faq-item > div { padding-right: 1rem; padding-left: 1rem; }
}
@media (max-width: 600px) {
    .verify-card, .surface-card { padding: 1.25rem; }
    .toast-stack { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}
@media (max-width: 380px) {
    .description, .page-description { font-size: 0.95rem; }
    h1, .verify-title, .page-title { font-size: 1.7rem; }
}
@media (hover: none) and (pointer: coarse) {
    .button, .action-button { min-height: 48px; }
    .inline-link, .article-body a { padding-block: 0.15rem; }
}