/* =============================================================================
   Base — resets, typography, containers. Layers on top of legacy theme CSS.
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.ce-modern {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    overflow-x: hidden;
}

.ce-modern h1,
.ce-modern h2,
.ce-modern h3,
.ce-modern h4,
.ce-modern h5,
.ce-modern h6,
.ce-modern .font-heading {
    font-family: var(--font-heading);
    color: black;
    line-height: var(--lh-snug);
    font-weight: var(--fw-bold);
    margin-top: 0;
}

.ce-modern h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
.ce-modern h2 { font-size: var(--fs-2xl); }
.ce-modern h3 { font-size: var(--fs-xl); }
.ce-modern h4 { font-size: var(--fs-lg); }
.ce-modern h5 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.ce-modern h6 { font-size: var(--fs-base); font-weight: var(--fw-semibold); }

.ce-modern p {
    margin: 0 0 var(--space-4);
    color: var(--color-text);
}

.ce-modern a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}

.ce-modern a:hover {
    color: var(--color-link-hover);
}

.ce-modern img {
    max-width: 100%;
    height: auto;
}

/* Accessible focus */
.ce-modern a:focus-visible,
.ce-modern button:focus-visible,
.ce-modern input:focus-visible,
.ce-modern textarea:focus-visible,
.ce-modern select:focus-visible,
.ce-modern [tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: var(--radius-sm);
}

/* Skip link */
.ce-modern .skip-link.screen-reader-text {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100000;
    padding: var(--space-3) var(--space-5);
    background: var(--color-primary);
    color: #fff;
    border-radius: 0 0 var(--radius-sm) 0;
}

.ce-modern .skip-link.screen-reader-text:focus {
    left: 0;
}

/* Container helper */
.ce-container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}

/* Section rhythm */
.ce-section {
    padding-block: var(--section-y);
}

.ce-section--alt {
    background-color: var(--color-bg-alt);
}

.ce-section__head {
    text-align: center;
    max-width: 720px;
    margin: 0 auto var(--space-7);
}

.ce-section__eyebrow {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: var(--space-2);
}

.ce-section__title {
    margin: 0 0 var(--space-3);
}

.ce-section__title::after {
    content: "";
    display: block;
    width: 56px;
    height: 3px;
    background: var(--color-primary);
    border-radius: var(--radius-pill);
    margin: var(--space-3) auto 0;
}

.ce-section__head--left {
    text-align: left;
    margin-inline: 0;
}

.ce-section__head--left .ce-section__title::after {
    margin-inline: 0;
}

.ce-section__lead {
    color: var(--color-text-muted);
    font-size: var(--fs-md);
}

/* Simple responsive grids */
.ce-grid {
    display: grid;
    gap: var(--space-5);
}

@media (min-width: 640px) {
    .ce-grid--2 { grid-template-columns: repeat(2, 1fr); }
    .ce-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 992px) {
    .ce-grid--3 { grid-template-columns: repeat(3, 1fr); }
    .ce-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.ce-grid--home-projects {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .ce-grid--home-projects { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 639px) {
    .ce-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
