/* CROCHETSBYEA DESIGN SYSTEM */

/* 1. Tokens */
:root {
    --cb-bg: #FFFFFF;
    --cb-bg-secondary: #FAF9F6;
    --cb-cream: #F5F1EA;
    --cb-text: #292725;
    --cb-text-secondary: #716C66;
    --cb-terracotta: #C77B5A;
    --cb-terracotta-dark: #B86749;
    --cb-sage: #8A9A7B;
    --cb-border: #E7E1D9;

    /* Darker terracotta keeps small text and white button labels above 4.5:1. */
    --cb-terracotta-ink: #A4553B;
    --cb-font-heading: "DM Serif Display", Georgia, serif;
    --cb-font-body: "DM Sans", Arial, Helvetica, sans-serif;
    --cb-type-h1: 32px;
    --cb-type-h2: 26px;
    --cb-type-h3: 22px;
    --cb-type-body: 17px;
    --cb-type-ui: 14px;
    --cb-leading-body: 1.7;
    --cb-leading-heading: 1.2;
    --cb-container-width: 1240px;
    --cb-reading-width: 760px;
    --cb-gutter: 16px;
    --cb-space-xs: 4px;
    --cb-space-sm: 8px;
    --cb-space-md: 16px;
    --cb-space-lg: 24px;
    --cb-space-xl: 32px;
    --cb-space-2xl: 48px;
    --cb-radius-sm: 4px;
    --cb-radius: 8px;
    --cb-shadow: 0 2px 12px rgb(41 39 37 / 5%);
}

/* 2. Typography */
body {
    background-color: var(--cb-bg);
    color: var(--cb-text);
    font-family: var(--cb-font-body);
    font-size: var(--cb-type-body);
    line-height: var(--cb-leading-body);
    font-weight: 400;
}

h1,
h2,
.home-cat,
#content-side h1,
#last-posts h2,
#related-posts h2,
#main-category h2,
.content :is(h1, h2) {
    font-family: var(--cb-font-heading);
    font-weight: 400;
    line-height: var(--cb-leading-heading);
}

h1,
#content-side h1,
.content h1 {
    font-size: var(--cb-type-h1);
}

h2,
.content h2 {
    font-size: var(--cb-type-h2);
}

h3,
.content h3 {
    font-family: var(--cb-font-body);
    font-size: var(--cb-type-h3);
    line-height: 1.35;
}

.content p,
.content ul li,
.content ol li,
.cb-prose {
    font-size: var(--cb-type-body);
    line-height: var(--cb-leading-body);
}

/* Keep legacy navigation and modal sizing while their components await migration. */
.navbar,
.modal,
.writer {
    font-size: var(--cb-type-ui);
    line-height: 1.42857143;
}

/* 3. Global elements */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

a {
    color: var(--cb-terracotta-ink);
}

a:hover,
a:focus-visible {
    color: var(--cb-text);
}

.cb-prose a,
.content article a {
    color: var(--cb-terracotta-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.cb-prose a:hover,
.content article a:hover {
    color: var(--cb-text);
    text-decoration-thickness: 2px;
}

.cb-image--card,
.cb-image--feature {
    display: block;
    width: 100%;
    object-fit: cover;
}

.cb-image--card {
    aspect-ratio: 4 / 3;
}

.cb-image--feature {
    aspect-ratio: 16 / 9;
}

/* 4. Containers: opt in without changing Bootstrap grid widths. */
.cb-container {
    width: 100%;
    max-width: var(--cb-container-width);
    margin-inline: auto;
    padding-inline: var(--cb-gutter);
}

.cb-reading-width {
    width: 100%;
    max-width: var(--cb-reading-width);
    min-width: 0;
    margin-inline: auto;
}

/* 5. Spacing: opt-in stacks do not add space to existing page sections. */
.cb-stack > * + * {
    margin-block-start: var(--cb-stack-gap, var(--cb-space-md));
}

/* 6. Buttons: component migration will adopt these classes separately. */
.cb-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--cb-space-sm);
    min-height: 44px;
    max-width: 100%;
    padding: 10px var(--cb-space-lg);
    border: 1px solid transparent;
    border-radius: var(--cb-radius);
    font-family: var(--cb-font-body);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.cb-button--primary {
    background-color: var(--cb-terracotta-ink);
    color: var(--cb-bg);
}

.cb-button--primary:hover,
.cb-button--primary:focus-visible {
    background-color: var(--cb-text);
    color: var(--cb-bg);
    text-decoration: none;
}

.cb-button--secondary {
    background-color: var(--cb-bg);
    border-color: var(--cb-border);
    color: var(--cb-text);
}

.cb-button--secondary:hover,
.cb-button--secondary:focus-visible {
    background-color: var(--cb-bg-secondary);
    border-color: var(--cb-text-secondary);
    color: var(--cb-text);
    text-decoration: none;
}

.cb-button:disabled,
.cb-button[aria-disabled="true"] {
    cursor: not-allowed;
}

/* Primary UI icons use the existing Font Awesome kit. */
:is(.cb-button, .cb-icon-button, .cb-home-more, .cb-discovery-home, .page-numbers) > :is(.fa, .fab),
:is(.cb-home-empty-row, .cb-archive-explore, .cb-discovery-links, .cb-article-share-controls, .cb-article-sidebar) :is(a, button) > :is(.fa, .fab),
.cb-breadcrumb-icon,
.cb-reading-icon {
    display: inline-block;
    width: 1em;
    flex: 0 0 auto;
    font-size: 16px;
    line-height: 1;
    text-align: center;
    vertical-align: middle;
    color: inherit;
}
.cb-icon-button .fa,
.cb-discovery-search button .fa { font-size: 21px; }

/* 7. Accessibility */
*,
* {
    outline: none !important;
}

:is(a, button, input, select, textarea, [tabindex]):focus-visible,
.btn:focus-visible,
.navbar-toggle:focus-visible,
.form-control:focus-visible {
    box-shadow: none;
}

/* Keep keyboard cues on shared recovery, trust and discussion controls. */
.cb-site-footer a:focus-visible,
.cb-prose a:focus-visible,
.cb-article-comments a:focus-visible,
.cb-article-comments .comment-form-cookies-consent:has(input:focus-visible) label {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.cb-not-found .cb-discovery-search input[type="search"]:focus-visible,
.cb-article-comments :is(input:not([type="checkbox"]), textarea):focus-visible {
    border-color: var(--cb-text);
}

.cb-not-found .cb-discovery-search button:focus-visible,
.cb-article-comments .submit:focus-visible {
    background-color: var(--cb-terracotta-ink);
    border-color: var(--cb-terracotta-ink);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 8. Responsive foundation: fixed type steps avoid viewport-scaled text. */
@media (min-width: 768px) {
    :root {
        --cb-type-h1: 42px;
        --cb-type-h2: 30px;
        --cb-type-h3: 24px;
        --cb-type-body: 18px;
        --cb-gutter: 24px;
    }
}

@media (min-width: 1200px) {
    :root {
        --cb-type-h1: 46px;
        --cb-type-h2: 34px;
        --cb-gutter: 32px;
    }
}
