/* =================================================================
   Calculators / Related-cards section
   Used on: homepage, converter pages (related), calculator pages
   Add this to /assets/css/style.css
   ================================================================= */

/* Section wrapper — gives the cards proper container, padding, heading */
.calc-section {
    padding: var(--space-12) 0;
    background: var(--color-surface);
}
.calc-section--subtle {
    background: var(--color-surface-subtle);
}
.calc-section .container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-5);
}

.calc-section__head {
    text-align: center;
    max-width: 640px;
    margin: 0 auto var(--space-8);
}
.calc-section__head h2 {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-2);
    color: var(--color-text);
}
.calc-section__head p {
    margin: 0;
    color: var(--color-text-subdued);
    font-size: 16px;
    line-height: 1.55;
}

/* Card grid — auto-fills, responsive */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

/* Individual card */
.related-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    text-decoration: none !important;
    color: var(--color-text) !important;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    position: relative;
}
.related-card:hover {
    border-color: var(--color-text);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none !important;
}
.related-card h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}
.related-card h3::after {
    content: "→";
    font-weight: 400;
    color: var(--color-text-subdued);
    transition: transform .15s, color .15s;
}
.related-card:hover h3::after {
    transform: translateX(3px);
    color: var(--color-text);
}
.related-card p {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-subdued);
    line-height: 1.5;
}

/* Optional: badge in the corner of the card (e.g. "New", "Free") */
.related-card__badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--color-text);
    color: var(--color-primary-text);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* "Related: X" inline link at bottom of converter pages */
.related-inline {
    margin: var(--space-8) auto 0;
    max-width: var(--container-narrow);
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--color-text-subdued);
}
.related-inline strong {
    color: var(--color-text);
    font-weight: 600;
}
.related-inline a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}
.related-inline a:hover {
    text-decoration: underline;
}
.related-inline__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--color-text);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.related-inline__icon svg {
    width: 16px;
    height: 16px;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .calc-section { padding: var(--space-8) 0; }
    .calc-section__head { margin-bottom: var(--space-6); }
    .related-grid { grid-template-columns: 1fr; gap: var(--space-3); }
    .related-card { padding: var(--space-4); }
}