/* =========================================================================
   HomeReadyKits — main.css
   Design tokens, reset, base typography, layout, utilities
   ========================================================================= */

/* ---- Design tokens ---- */
:root {
    /* Brand */
    --color-primary:        #2d5f3f;  /* forest green — calm, prepared */
    --color-primary-dark:   #1e4429;
    --color-primary-light:  #4a7c59;
    --color-accent:         #c47e3e;  /* warm amber — CTAs */
    --color-accent-dark:    #a6672e;
    --color-alert:          #b94a48;  /* used sparingly for warnings */

    /* Neutrals */
    --color-ink:            #1a2028;
    --color-ink-muted:      #4a5562;
    --color-ink-subtle:     #7a8591;
    --color-rule:           #e5ddd0;
    --color-rule-soft:      #efe9dc;
    --color-bg:             #fbfaf7;  /* warm off-white */
    --color-bg-alt:         #f2ede4;  /* cream */
    --color-surface:        #ffffff;
    --color-surface-alt:    #fdfcf9;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --fs-xs:   0.8125rem;     /* 13px */
    --fs-sm:   0.9375rem;     /* 15px */
    --fs-md:   1.0625rem;     /* 17px */
    --fs-lg:   1.25rem;
    --fs-xl:   1.5rem;
    --fs-2xl:  2rem;
    --fs-3xl:  2.5rem;
    --fs-4xl:  clamp(2.25rem, 4.5vw + 1rem, 3.75rem);
    --lh-tight: 1.15;
    --lh-snug:  1.35;
    --lh-body:  1.65;

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 3rem;
    --sp-8: 4rem;
    --sp-9: 6rem;

    /* Layout */
    --container-max: 1200px;
    --container-pad: clamp(1rem, 3vw, 2rem);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(26, 32, 40, 0.05), 0 1px 3px rgba(26, 32, 40, 0.06);
    --shadow-md: 0 4px 8px rgba(26, 32, 40, 0.06), 0 8px 20px rgba(26, 32, 40, 0.08);
    --shadow-lg: 0 10px 24px rgba(26, 32, 40, 0.10), 0 24px 48px rgba(26, 32, 40, 0.10);

    /* Motion */
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --dur-fast: 140ms;
    --dur-base: 240ms;

    /* Focus ring */
    --focus: 0 0 0 3px rgba(45, 95, 63, 0.35);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-md);
    line-height: var(--lh-body);
    color: var(--color-ink);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }

img, svg, video { max-width: 100%; height: auto; display: block; }
img { font-style: italic; }  /* makes broken images more obvious in dev */

a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--color-primary-dark); }
a:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--color-ink);
    line-height: var(--lh-tight);
    margin: 0 0 var(--sp-4);
    letter-spacing: -0.01em;
    font-weight: 700;
}
h1 { font-size: var(--fs-4xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25rem; }
li { margin-bottom: var(--sp-2); }
li > ul, li > ol { margin-top: var(--sp-2); margin-bottom: 0; }

blockquote {
    margin: var(--sp-5) 0;
    padding: var(--sp-4) var(--sp-5);
    border-left: 4px solid var(--color-accent);
    background: var(--color-bg-alt);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--color-ink-muted);
    font-style: italic;
}

hr {
    border: 0;
    border-top: 1px solid var(--color-rule);
    margin: var(--sp-6) 0;
}

code, kbd, samp, pre {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
}

button { font-family: inherit; cursor: pointer; }

:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---- Utility classes ---- */
.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;
}

.skip-link {
    position: absolute;
    top: -40px; left: 8px;
    background: var(--color-primary);
    color: #fff;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-sm);
    z-index: 1000;
    text-decoration: none;
}
.skip-link:focus { top: 8px; color: #fff; }

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding-inline: var(--container-pad);
}

.section {
    padding-block: clamp(3rem, 6vw, 5rem);
}
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section--alt { background: var(--color-bg-alt); }
.section--dark {
    background: var(--color-primary-dark);
    color: #fff;
}
.section--dark h1, .section--dark h2, .section--dark h3 { color: #fff; }
.section--dark a { color: #ffd9a8; }
.section--dark a:hover { color: #fff; }

.text-center { text-align: center; }
.eyebrow {
    display: inline-block;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-primary);
    margin-bottom: var(--sp-3);
}
.lead {
    font-size: var(--fs-lg);
    color: var(--color-ink-muted);
    max-width: 62ch;
}
.muted { color: var(--color-ink-muted); }

/* Reveal-on-scroll */
[data-reveal] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}
[data-reveal].is-revealed {
    opacity: 1;
    transform: none;
}

/* Grids */
.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--cats { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Prose (long-form body copy inside articles) */
.prose {
    max-width: 72ch;
    margin-inline: auto;
    font-size: var(--fs-md);
}
.prose h2 { margin-top: var(--sp-7); font-size: var(--fs-2xl); }
.prose h3 { margin-top: var(--sp-6); font-size: var(--fs-xl); }
.prose img { border-radius: var(--radius-md); margin: var(--sp-5) 0; }
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--sp-5) 0;
}
.prose th, .prose td {
    text-align: left;
    padding: var(--sp-3);
    border-bottom: 1px solid var(--color-rule);
}
.prose th { background: var(--color-bg-alt); font-weight: 700; }

/* Body state: lock scroll when mobile nav open */
body.nav-open { overflow: hidden; }
