/* --- components.css --- */

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 500;
    color: var(--color-text-primary);
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    color: var(--color-primary-contrast);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: var(--drop-shadow-glow);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--color-primary-contrast);
}

.btn-secondary {
    color: var(--primary-color);
    background-color: transparent;
    border-color: var(--primary-color);
    box-shadow: none;
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
}

/* Cards */
.card {
    background-color: var(--surface-translucent);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow), var(--shadow-glow);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.18), var(--shadow-glow);
}

.card-body {
    padding: calc(var(--spacing-unit) * 3);
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
    height: 100%;
}

.card.product-card .card-body,
.card.adoption-card .card-body {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
    height: 100%;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-unit);
}

.card-tagline {
    color: var(--color-text-secondary);
    margin-top: -4px;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    font-size: 1rem;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-unit);
    margin-top: auto;
}

.card.product-card .card-actions,
.card.adoption-card .card-actions {
    margin-top: auto;
    width: 100%;
    flex-direction: column;
}

.card.product-card .card-actions .btn,
.card.adoption-card .card-actions .btn {
    width: 100%;
    text-align: center;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.price-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    margin-top: 12px;
    font-weight: 700;
    color: var(--primary-color);
    border: 1px solid var(--panelBorder);
    border-radius: 999px;
    background: var(--accent-soft-08);
    max-width: 100%;
    text-align: center;
    white-space: normal;
}

.price-tag a {
    color: var(--primary-color);
    text-decoration: none;
}

.price-tag a:hover {
    text-decoration: underline;
}

.callout {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--color-muted-border);
    background: var(--accent-soft-08);
    box-shadow: var(--shadow);
}

.callout.key {
    background: var(--accent-soft-12);
}

.callout.info {
    background: var(--accent-soft-08);
}

.callout.plain {
    background: rgba(0,0,0,0.04);
}

.callout ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.diagram-card {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    border: 1px dashed var(--color-muted-border);
    background: rgba(0,0,0,0.05);
    overflow-x: auto;
}

.diagram-card pre {
    margin: 0;
    font-family: "Courier New", monospace;
    color: var(--color-text-primary);
}

/* Dropdown Menu */
.nav-item-dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    list-style: none;
    padding: var(--spacing-unit) 0;
    margin: 0;
    min-width: 200px;
    z-index: 1001;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.nav-item-dropdown.is-open .dropdown-menu {
    display: block;
}

.dropdown-menu li a {
    display: block;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
    color: var(--text-color);
    font-weight: 400;
}

.dropdown-menu li a:hover {
    background-color: var(--light-gray-color);
}

.dropdown-menu li a.disabled {
    color: #999;
    pointer-events: none;
    background-color: transparent;
}

@media (max-width: 991.98px) {
    .dropdown-menu {
        position: static;
        border: none;
        box-shadow: none;
        width: 100%;
    }
}


/* Forms */
.form-group {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-unit);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: calc(var(--spacing-unit) * 1.5);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    line-height: 1.5;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

.error-message {
    color: #dc3545;
    font-size: 0.875em;
    display: none;
}

.form-success {
    color: #28a745;
    font-weight: 500;
    margin-top: var(--spacing-unit);
}

.form-recaptcha {
    margin: calc(var(--spacing-unit) * 2) 0;
}


/* Modal */
.modal {
    display: none;
}
.modal.is-open {
    display: block;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-container {
    background: var(--background-color);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slide-down 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--spacing-unit) * 2);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close::before {
    content: '\00d7';
}

.modal-content {
    padding: calc(var(--spacing-unit) * 3);
}

.modal-footer {
    padding: calc(var(--spacing-unit) * 2);
    border-top: 1px solid var(--border-color);
    text-align: right;
}

@keyframes slide-down {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Tags / badges */
.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft-14);
    color: var(--color-text-primary);
    border: 1px solid var(--color-muted-border);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.badge-tag:hover,
.badge-tag:focus-visible {
    background: var(--accent-soft-24);
    box-shadow: var(--drop-shadow-glow);
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* Pills */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft-12);
    color: var(--color-text-primary);
    border: 1px solid var(--color-muted-border);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.pill--store {
    background: var(--accent-soft-14);
    border-color: var(--panelBorder);
    color: var(--color-text-primary);
}

.pill--free {
    background: var(--accent-soft-12);
    border-color: var(--panelBorder);
    color: var(--secondary-color);
    font-weight: 700;
    padding-left: 5px;
    margin-left: 6px;
}

.pill--dependency {
    background: var(--accent-soft-14);
    border-color: var(--panelBorder);
    color: var(--color-text-primary);
    font-weight: 700;
    padding-left: 6px;
    padding-right: 10px;
    margin-left: 6px;
}

.eyebrow .pill {
    text-transform: none;
    letter-spacing: 0.02em;
}

.flow-steps {
    list-style: none;
    margin: calc(var(--spacing-unit) * 3) 0 0;
    padding: 0;
    display: flex;
    gap: calc(var(--spacing-unit) * 3);
    align-items: stretch;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.flow-step {
    flex: 1 1 0;
    min-width: 0;
    background: var(--surface-translucent);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: calc(var(--spacing-unit) * 3);
    position: relative;
}

.flow-step__head {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.flow-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--color-primary-contrast);
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.flow-step__title {
    margin: 0;
    font-size: 1.05rem;
}

.flow-step__desc {
    margin: 0;
    color: var(--color-text-secondary);
}

.flow-step:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    font-weight: 700;
    font-size: 1.1rem;
}

@media (max-width: 900px) {
    .flow-steps {
        flex-direction: column;
        gap: calc(var(--spacing-unit) * 2.5);
    }

    .flow-step:not(:last-child)::after {
        content: "↓";
        right: 50%;
        left: 50%;
        top: auto;
        bottom: -18px;
        transform: translate(-50%, 0);
    }
}

/* Global focus helpers */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* Preview gate overlay */
html.gate-locked body {
    overflow: hidden;
}

html.gate-locked .site-header,
html.gate-locked main,
html.gate-locked .site-footer {
    display: none;
}

.preview-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.65));
    backdrop-filter: blur(6px);
    z-index: 2000;
}

html.gate-locked .preview-overlay {
    display: flex;
}

.preview-panel {
    width: min(640px, 100%);
    background: var(--surface-color);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow), var(--shadow-glow);
    padding: calc(var(--spacing-unit) * 4);
    text-align: center;
}

.preview-panel h1 {
    margin: 0 0 calc(var(--spacing-unit) * 2) 0;
}

.preview-panel p {
    color: var(--color-text-secondary);
    margin: 0 0 calc(var(--spacing-unit) * 1.5) 0;
}

.preview-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-soft-12);
    border: 1px solid var(--color-muted-border);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 1.5);
    margin-top: calc(var(--spacing-unit) * 3);
}

.preview-contact {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.preview-contact:hover {
    color: var(--color-link);
    text-decoration: underline;
}

.bypass-toggle {
    position: fixed;
    bottom: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-color);
    color: var(--color-text-primary);
    box-shadow: var(--shadow), var(--shadow-glow);
    cursor: pointer;
    z-index: 1600;
    font-weight: 600;
}

.bypass-toggle:hover {
    text-decoration: none;
    background: var(--accent-soft-12);
}

.bypass-toggle .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow: 0 0 0 4px var(--accent-soft-14);
}

.bypass-toggle small {
    color: var(--color-text-secondary);
}

@media (max-width: 600px) {
    .preview-panel {
        padding: calc(var(--spacing-unit) * 3);
    }
}
