/* ============================================================
   RCN Base — Reset + Typography
   ============================================================ */

/* === Modern reset === */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body {
    font-family: var(--rcn-font-sans);
    font-size: var(--rcn-text-base);
    line-height: var(--rcn-leading);
    color: var(--rcn-text);
    background: var(--rcn-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
button { background: none; border: none; cursor: pointer; padding: 0; }

/* === Typography (RCN-scoped to avoid breaking WPBakery pages) === */
.rcn-theme h1, .rcn h1 {
    font-size: var(--rcn-text-4xl);
    font-weight: 800;
    line-height: var(--rcn-leading-tight);
    letter-spacing: var(--rcn-tracking-tight);
    color: var(--rcn-text);
}
.rcn-theme h2, .rcn h2 {
    font-size: var(--rcn-text-3xl);
    font-weight: 800;
    line-height: var(--rcn-leading-tight);
    letter-spacing: var(--rcn-tracking-tight);
    color: var(--rcn-text);
}
.rcn-theme h3, .rcn h3 {
    font-size: var(--rcn-text-2xl);
    font-weight: 700;
    line-height: var(--rcn-leading-tight);
    letter-spacing: var(--rcn-tracking-tight);
    color: var(--rcn-text);
}
.rcn-theme h4, .rcn h4 {
    font-size: var(--rcn-text-xl);
    font-weight: 700;
    line-height: var(--rcn-leading);
    color: var(--rcn-text);
}
.rcn-theme h5, .rcn h5 {
    font-size: var(--rcn-text-lg);
    font-weight: 600;
    color: var(--rcn-text);
}
.rcn-theme h6, .rcn h6 {
    font-size: var(--rcn-text-md);
    font-weight: 600;
    color: var(--rcn-text);
}

/* === Utility helpers (use sparingly) === */
.rcn-container {
    width: 100%;
    max-width: var(--rcn-container);
    margin: 0 auto;
    padding: 0 var(--rcn-space-5);
}
.rcn-container-wide {
    width: 100%;
    max-width: var(--rcn-container-wide);
    margin: 0 auto;
    padding: 0 var(--rcn-space-5);
}
@media (min-width: 768px) {
    .rcn-container, .rcn-container-wide { padding: 0 var(--rcn-space-8); }
}

/* === Flex/Grid quick utils === */
.rcn-stack { display: flex; flex-direction: column; gap: var(--rcn-space-4); }
.rcn-row { display: flex; align-items: center; gap: var(--rcn-space-3); }
.rcn-row-wrap { display: flex; align-items: center; gap: var(--rcn-space-3); flex-wrap: wrap; }
.rcn-grid { display: grid; gap: var(--rcn-space-4); }
.rcn-grid-2 { grid-template-columns: repeat(2, 1fr); }
.rcn-grid-3 { grid-template-columns: repeat(3, 1fr); }
.rcn-grid-4 { grid-template-columns: repeat(4, 1fr); }
.rcn-spacer { flex: 1; }

@media (max-width: 768px) {
    .rcn-grid-2, .rcn-grid-3, .rcn-grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .rcn-grid-3, .rcn-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* === Text helpers === */
.rcn-text-xs { font-size: var(--rcn-text-xs); }
.rcn-text-sm { font-size: var(--rcn-text-sm); }
.rcn-text-base { font-size: var(--rcn-text-base); }
.rcn-text-lg { font-size: var(--rcn-text-lg); }
.rcn-text-xl { font-size: var(--rcn-text-xl); }
.rcn-text-muted { color: var(--rcn-text-muted); }
.rcn-text-subtle { color: var(--rcn-text-subtle); }
.rcn-text-brand { color: var(--rcn-brand); }
.rcn-text-center { text-align: center; }
.rcn-text-right { text-align: right; }
.rcn-font-mono { font-family: var(--rcn-font-mono); }
.rcn-uppercase { text-transform: uppercase; letter-spacing: var(--rcn-tracking-wide); }
.rcn-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcn-line-clamp-2 {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.rcn-line-clamp-3 {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Visibility helpers === */
.rcn-hidden { display: none !important; }
@media (max-width: 768px) {
    .rcn-hidden-mobile { display: none !important; }
}
@media (min-width: 769px) {
    .rcn-hidden-desktop { display: none !important; }
}

/* === Focus visible (accessibility) === */
.rcn :focus-visible,
.rcn-theme :focus-visible {
    outline: 2px solid var(--rcn-brand);
    outline-offset: 2px;
    border-radius: var(--rcn-radius-sm);
}

/* === Selection === */
.rcn-theme ::selection {
    background: var(--rcn-brand);
    color: white;
}

/* === Smooth scroll anchored links === */
html { scroll-behavior: smooth; }
