/*
   CakeDC Blog redesign (scoped).
   Namespaced under .cdc-blog / .cdc-article so it loads alongside the global
   custom2.css bundle without a specificity war. Tokens here are the single
   source of truth and mirror docs/design-guidelines.md.
*/

.cdc-blog {
    /* Brand */
    --cdc-blue: #2f89af;
    --cdc-blue-2: #2faccc;
    --cdc-blue-deep: #1c5f7d;   /* link/title blue, AA on white */
    --cdc-coral: #ff665b;
    --cdc-coral-deep: #d8453a;  /* coral for text, AA on white */

    /* Ink and surfaces */
    --cdc-ink: #22323b;         /* headings on white */
    --cdc-body: #404041;        /* body copy */
    --cdc-muted: #5f6b71;       /* meta, AA on white */
    --cdc-page: #f6f7f4;        /* gallery background */
    --cdc-surface: #ffffff;
    --cdc-beige: #f5f5f1;
    --cdc-mist: #eaf3f7;
    --cdc-border: #e6e8e3;

    /* Shape and motion */
    --cdc-radius: 14px;
    --cdc-shadow: 0 1px 2px rgba(20, 45, 60, .05), 0 8px 24px rgba(20, 45, 60, .06);
    --cdc-shadow-h: 0 16px 36px rgba(20, 45, 60, .15);
    --cdc-ease: cubic-bezier(.2, .7, .3, 1);

    background: var(--cdc-page);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--cdc-body);
    padding: 0 0 32px;
}

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

.cdc-blog__wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 44px 20px 8px;
}

/* Shared bits */
.cdc-meta {
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--cdc-muted);
    margin: 0 0 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.cdc-meta__dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; }
.cdc-meta__tag { color: var(--cdc-coral-deep); }

.cdc-byline { font-size: 13px; color: var(--cdc-muted); }

.cdc-readmore {
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .03em;
    color: var(--cdc-blue-deep);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.cdc-readmore svg { transition: transform .2s var(--cdc-ease); }

/* Media (image or branded placeholder) */
.cdc-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--cdc-mist); }
.cdc-media__img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s var(--cdc-ease);
}
.cdc-media--ph { display: grid; place-items: center; background: linear-gradient(135deg, #f3f5f1 0%, #e7f1f6 100%); }
.cdc-media--ph::after {
    content: "";
    width: 56%;
    max-width: 168px;
    aspect-ratio: 123.88 / 32.73;
    background: url(/img/logo.svg) center / contain no-repeat;
    opacity: .5;
}
.cdc-media--ph.cdc-ph-1 { background: linear-gradient(135deg, #eef4ee 0%, #e4edf4 100%); }
.cdc-media--ph.cdc-ph-2 { background: linear-gradient(135deg, #f4f1ea 0%, #e8f1f4 100%); }

/* Featured card */
.cdc-feature {
    display: block;
    background: var(--cdc-surface);
    border: 1px solid var(--cdc-border);
    border-radius: var(--cdc-radius);
    overflow: hidden;
    box-shadow: var(--cdc-shadow);
    text-decoration: none;
    color: inherit;
    margin: 0 0 28px;
    transition: box-shadow .25s var(--cdc-ease), transform .25s var(--cdc-ease);
}
.cdc-feature:hover { box-shadow: var(--cdc-shadow-h); transform: translateY(-3px); }
.cdc-feature:hover .cdc-media__img { transform: scale(1.04); }
.cdc-feature:hover .cdc-readmore svg { transform: translateX(3px); }
.cdc-feature__body { padding: 26px 24px 28px; }
.cdc-feature__title {
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    color: var(--cdc-ink);
    font-size: 25px;
    line-height: 1.22;
    margin: 0 0 12px;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
}
.cdc-feature__excerpt { font-size: 16px; line-height: 1.65; color: var(--cdc-body); margin: 0 0 20px; max-width: 68ch; }
.cdc-feature__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (min-width: 768px) {
    .cdc-feature { display: grid; grid-template-columns: 1.08fr 1fr; align-items: stretch; }
    .cdc-feature .cdc-media { aspect-ratio: auto; height: 100%; min-height: 330px; }
    .cdc-feature__body { padding: 44px 40px; align-self: center; }
    .cdc-feature__title { font-size: 33px; }
}

/* Card grid */
.cdc-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 640px) { .cdc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .cdc-grid { grid-template-columns: repeat(3, 1fr); } }

.cdc-card {
    background: var(--cdc-surface);
    border: 1px solid var(--cdc-border);
    border-radius: var(--cdc-radius);
    overflow: hidden;
    box-shadow: var(--cdc-shadow);
    transition: box-shadow .25s var(--cdc-ease), transform .25s var(--cdc-ease);
}
.cdc-card:hover { box-shadow: var(--cdc-shadow-h); transform: translateY(-4px); }
.cdc-card:hover .cdc-media__img { transform: scale(1.05); }
.cdc-card:hover .cdc-readmore svg { transform: translateX(3px); }

.cdc-card__link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.cdc-card__body { display: flex; flex-direction: column; flex: 1 1 auto; padding: 20px 20px 22px; }
.cdc-card__title {
    font-family: 'Raleway', sans-serif;
    font-weight: 700;
    color: var(--cdc-ink);
    font-size: 19px;
    line-height: 1.3;
    margin: 0 0 10px;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cdc-card__excerpt {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--cdc-body);
    margin: 0 0 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cdc-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--cdc-border);
}

/* Focus (keyboard) */
.cdc-card__link:focus-visible,
.cdc-feature:focus-visible {
    outline: 3px solid var(--cdc-blue);
    outline-offset: 3px;
    border-radius: var(--cdc-radius);
}

/* Empty state */
.cdc-empty { text-align: center; padding: 80px 20px; }
.cdc-empty h2 { font-family: 'Raleway', sans-serif; color: var(--cdc-ink); margin: 0 0 8px; }
.cdc-empty p { color: var(--cdc-muted); margin: 0; }

/* Pagination (restyle Bootstrap markup) */
.cdc-blog .pagination {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 8px; list-style: none; padding: 0; margin: 48px 0 8px;
}
.cdc-blog .pagination > li { display: inline-flex; }
.cdc-blog .pagination > li > a,
.cdc-blog .pagination > li > span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; height: 44px; padding: 0 14px;
    border: 1px solid var(--cdc-border); border-radius: 10px;
    background: var(--cdc-surface); color: var(--cdc-blue-deep);
    font-family: 'Raleway', sans-serif; font-weight: 600; font-size: 14px;
    text-decoration: none; transition: background .2s, border-color .2s, color .2s;
}
.cdc-blog .pagination > li > a:hover { background: var(--cdc-mist); border-color: var(--cdc-blue); color: var(--cdc-blue-deep); }
.cdc-blog .pagination > .active > a,
.cdc-blog .pagination > .active > span { background: var(--cdc-blue); border-color: var(--cdc-blue); color: #fff; }
.cdc-blog .pagination > .disabled > a,
.cdc-blog .pagination > .disabled > span { opacity: .4; pointer-events: none; }

/* Article page */
.cdc-article {
    --cdc-blue: #2f89af; --cdc-blue-2: #2faccc; --cdc-blue-deep: #1c5f7d;
    --cdc-coral: #ff665b; --cdc-coral-deep: #d8453a;
    --cdc-ink: #22323b; --cdc-body: #404041; --cdc-muted: #5f6b71;
    --cdc-page: #f6f7f4; --cdc-surface: #ffffff; --cdc-beige: #f5f5f1; --cdc-mist: #eaf3f7; --cdc-border: #e6e8e3;
    --cdc-radius: 14px;
    --cdc-shadow: 0 1px 2px rgba(20, 45, 60, .05), 0 8px 24px rgba(20, 45, 60, .06);
    --cdc-shadow-h: 0 16px 36px rgba(20, 45, 60, .15);
    --cdc-ease: cubic-bezier(.2, .7, .3, 1);
    background: var(--cdc-page);
    color: var(--cdc-body);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.cdc-article *, .cdc-article *::before, .cdc-article *::after { box-sizing: border-box; }

/* Hero */
.cdc-article__hero { background: linear-gradient(90deg, var(--cdc-blue) 0%, var(--cdc-blue-2) 100%); padding: 118px 20px 70px; }
.cdc-article__hero-inner { max-width: 1180px; margin: 0 auto; }
.cdc-article__crumb {
    display: inline-flex; align-items: center; gap: 7px;
    color: #fff; font-family: 'Raleway', sans-serif; font-weight: 600;
    font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
    text-decoration: none; opacity: .92; margin-bottom: 16px;
}
.cdc-article__crumb:hover { color: #fff; opacity: 1; text-decoration: underline; }
.cdc-article__title { color: #fff; font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 30px; line-height: 1.18; margin: 0; padding: 0; text-transform: none; letter-spacing: normal; max-width: 22ch; }
@media (min-width: 768px) { .cdc-article__title { font-size: 44px; } }
@media (max-width: 767px) { .cdc-article__hero-inner { padding-right: 72px; } /* clear the fixed "we bake" ribbon */ }

/* Layout */
.cdc-article__layout { max-width: 1180px; margin: 0 auto; padding: 0 20px 56px; display: grid; grid-template-columns: 1fr; gap: 40px; }
@media (min-width: 992px) { .cdc-article__layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 56px; align-items: start; } }
.cdc-article__main { min-width: 0; }

/* Cover image */
.cdc-article__cover {
    display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
    border-radius: var(--cdc-radius); box-shadow: var(--cdc-shadow);
    margin: -48px 0 28px; position: relative; z-index: 2; background: var(--cdc-mist);
}
@media (max-width: 767px) { .cdc-article__cover { margin: -34px 0 22px; } }

/* Toolbar (byline and share) */
.cdc-article__toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 26px; padding-bottom: 22px; border-bottom: 1px solid var(--cdc-border); }
.cdc-article__cover + .cdc-article__toolbar { margin-top: 0; }
.cdc-byline-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cdc-avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--cdc-blue), var(--cdc-blue-2)); color: #fff; font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 18px; }
.cdc-byline-row__name { font-family: 'Raleway', sans-serif; font-weight: 700; color: var(--cdc-ink); font-size: 15px; line-height: 1.2; }
.cdc-byline-row__meta { color: var(--cdc-muted); font-size: 13px; line-height: 1.3; margin-top: 2px; }

/* Share */
.cdc-share { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cdc-share__label { font-family: 'Raleway', sans-serif; font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cdc-muted); margin-right: 2px; }
.cdc-share a, .cdc-share button {
    -webkit-appearance: none; appearance: none; cursor: pointer;
    width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--cdc-border); border-radius: 50%; background: var(--cdc-surface); color: var(--cdc-blue-deep);
    transition: background .2s, border-color .2s, color .2s, transform .2s var(--cdc-ease);
    position: relative; text-decoration: none;
}
.cdc-share a:hover, .cdc-share button:hover { background: var(--cdc-blue); border-color: var(--cdc-blue); color: #fff; transform: translateY(-2px); }
.cdc-share a:focus-visible, .cdc-share button:focus-visible { outline: 3px solid var(--cdc-blue); outline-offset: 2px; }
.cdc-share svg { width: 18px; height: 18px; }
.cdc-share__copy.is-copied { background: var(--cdc-blue); border-color: var(--cdc-blue); color: #fff; }
.cdc-share__copy.is-copied::after { content: "Copied!"; position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--cdc-ink); color: #fff; font-size: 12px; font-family: 'Roboto', sans-serif; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }

/* Prose (article body) */
.cdc-prose { max-width: 760px; font-family: 'Source Sans Pro', sans-serif; font-size: 18px; line-height: 1.75; color: var(--cdc-body); }
.cdc-prose > *:first-child { margin-top: 0; }
.cdc-prose p { margin: 0 0 1.2em; }
.cdc-prose h2 { font-family: 'Raleway', sans-serif; font-weight: 700; color: var(--cdc-ink); font-size: 27px; line-height: 1.25; margin: 1.9em 0 .55em; }
.cdc-prose h3 { font-family: 'Raleway', sans-serif; font-weight: 700; color: var(--cdc-ink); font-size: 21px; line-height: 1.3; margin: 1.7em 0 .5em; }
.cdc-prose h4 { font-family: 'Raleway', sans-serif; font-weight: 700; color: var(--cdc-ink); font-size: 18px; margin: 1.5em 0 .5em; }
.cdc-prose h2, .cdc-prose h3, .cdc-prose h4 { padding: 0; text-transform: none; letter-spacing: normal; }
.cdc-prose a { color: var(--cdc-blue-deep); text-decoration: underline; text-underline-offset: 2px; }
.cdc-prose a:hover { color: var(--cdc-coral-deep); }
.cdc-prose ul, .cdc-prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.cdc-prose li { margin: .4em 0; }
.cdc-prose img { max-width: 100%; height: auto; border-radius: 10px; margin: 1.4em 0; }
.cdc-prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--cdc-coral); color: var(--cdc-ink); font-size: 20px; font-style: italic; line-height: 1.6; }
.cdc-prose blockquote p:last-child { margin-bottom: 0; }
.cdc-prose hr { border: 0; border-top: 1px solid var(--cdc-border); margin: 2em 0; }
.cdc-prose :not(pre) > code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: var(--cdc-mist); color: var(--cdc-blue-deep); padding: .15em .45em; border-radius: 6px; }
/* Container styling for code blocks; leave token colors to Prism/highlight.js */
.cdc-prose pre { margin: 1.6em 0; padding: 18px 20px; border-radius: 10px; border: 1px solid var(--cdc-border); overflow-x: auto; font-size: 14px; line-height: 1.55; -webkit-overflow-scrolling: touch; }
.cdc-prose pre:not([class*="language-"]) { background: #f6f8fa; }
.cdc-prose pre code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: transparent !important; padding: 0; font-size: inherit; }
.cdc-prose table { width: 100%; border-collapse: collapse; margin: 1.6em 0; font-size: 15px; display: block; overflow-x: auto; }
.cdc-prose th, .cdc-prose td { border: 1px solid var(--cdc-border); padding: 9px 12px; text-align: left; }
.cdc-prose th { background: var(--cdc-beige); font-family: 'Raleway', sans-serif; }
.cdc-prose .mermaid { margin: 1.6em 0; }

/* Article footer */
.cdc-article__foot { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--cdc-border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cdc-backlink { font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 14px; color: var(--cdc-blue-deep); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.cdc-backlink:hover { color: var(--cdc-coral-deep); }

/* Aside (Read next) */
.cdc-article__aside { min-width: 0; }
@media (min-width: 992px) { .cdc-article__aside { position: sticky; top: 96px; } }
.cdc-aside__title { font-family: 'Raleway', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 14px; color: var(--cdc-ink); margin: 0 0 6px; }
.cdc-aside__rule { height: 3px; width: 44px; background: var(--cdc-coral); border-radius: 2px; margin: 0 0 6px; }
.cdc-rn { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--cdc-border); text-decoration: none; color: inherit; align-items: flex-start; }
.cdc-rn:hover .cdc-rn__title { color: var(--cdc-blue-deep); }
.cdc-rn:focus-visible { outline: 3px solid var(--cdc-blue); outline-offset: 3px; border-radius: 8px; }
.cdc-rn__thumb { flex: none; width: 88px; height: 64px; border-radius: 8px; overflow: hidden; background: var(--cdc-mist); }
.cdc-rn__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cdc-rn__thumb--ph { display: grid; place-items: center; background: linear-gradient(135deg, #f3f5f1, #e7f1f6); }
.cdc-rn__thumb--ph::after { content: ""; width: 72%; aspect-ratio: 123.88 / 32.73; background: url(/img/logo.svg) center / contain no-repeat; opacity: .5; }
.cdc-rn__body { min-width: 0; }
.cdc-rn__meta { font-family: 'Raleway', sans-serif; font-weight: 600; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--cdc-muted); margin: 0 0 5px; }
.cdc-rn__title { font-family: 'Raleway', sans-serif; font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--cdc-ink); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cdc-blog *, .cdc-blog *::before, .cdc-blog *::after,
    .cdc-article *, .cdc-article *::before, .cdc-article *::after { transition: none !important; }
    .cdc-card:hover, .cdc-feature:hover { transform: none; }
    .cdc-card:hover .cdc-media__img, .cdc-feature:hover .cdc-media__img { transform: none; }
    .cdc-share a:hover, .cdc-share button:hover { transform: none; }
}
