/* ContentWave aggregator — "Premium Lift" design layer.
   Loaded after Tailwind (CDN) in components/layouts/main.blade.php.
   Uses the theme variables declared in the layout (--color-*). */

[hidden] { display: none !important; }

:root { --cw-ease: cubic-bezier(.2, .7, .2, 1); --cw-ease-io: cubic-bezier(.65, 0, .35, 1); --cw-band: #17201f; --cw-band-ink: #efe9de; --cw-band-muted: #b9b0a0; --cw-card: #fffdf9; }
.dark { --cw-band: #0f1615; --cw-card: #1d1a17; }

/* Cross-document page transitions (progressive enhancement) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

.cw-kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.cw-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.cw-more { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.cw-meta { font-size: 13px; color: var(--color-text-faint); }
.cw-scroll-x { scrollbar-width: none; -ms-overflow-style: none; }
.cw-scroll-x::-webkit-scrollbar { display: none; }

/* ---------- Ticker ---------- */
.cw-ticker { background: var(--cw-band); color: var(--cw-band-ink); font-size: 13px; overflow: hidden; }
.cw-ticker-mask { overflow: hidden; flex: 1; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.cw-ticker-track { display: flex; gap: 48px; white-space: nowrap; width: max-content; animation: cw-marquee 60s linear infinite; }
.cw-ticker:hover .cw-ticker-track, .cw-ticker:focus-within .cw-ticker-track { animation-play-state: paused; }
.cw-ticker a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
@keyframes cw-marquee { to { transform: translateX(-50%); } }
.cw-live { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .12em; font-size: 11px; color: #ff9b73; flex-shrink: 0; }
.cw-live .cw-dot { background: #ff7a4d; animation: cw-pulse 1.8s ease-out infinite; }
@keyframes cw-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 122, 77, .6); } 100% { box-shadow: 0 0 0 10px rgba(255, 122, 77, 0); } }

/* ---------- Header ---------- */
.cw-header { background: color-mix(in srgb, var(--color-background) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.cw-logo-wave path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: cw-draw 1.4s .2s var(--cw-ease-io) forwards; }
@keyframes cw-draw { to { stroke-dashoffset: 0; } }
.cw-navlink { position: relative; padding: 6px 0; font-size: 13px; font-weight: 600; }
.cw-navlink::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--color-primary); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--cw-ease-io); }
.cw-navlink:hover::after { transform: scaleX(1); transform-origin: left; }
.cw-search-btn { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--cw-card); color: var(--color-text-faint); font-size: 13px; min-width: 240px; }
.cw-kbd { margin-left: auto; font-size: 11px; border: 1px solid var(--color-border); border-radius: 6px; padding: 1px 6px; }
.cw-iconbtn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--cw-card); color: var(--color-text); display: inline-flex; align-items: center; justify-content: center; transition: border-color .25s, color .25s; }
.cw-iconbtn:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* Section pills */
.cw-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--color-border); font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--cw-card); color: var(--color-text); transition: background .25s, color .25s, border-color .25s, transform .25s; }
.cw-pill:hover { transform: translateY(-1px); background: var(--c, var(--color-text)); border-color: var(--c, var(--color-text)); color: #fff; }
.cw-pill:hover .cw-dot { background: #fff !important; }
.cw-pill .cw-pill-n { font-size: 11px; font-weight: 600; color: var(--color-text-faint); transition: color .25s; }
.cw-pill:hover .cw-pill-n { color: rgba(255, 255, 255, .8); }
.cw-pill.is-active { background: var(--color-text); color: var(--color-background); border-color: var(--color-text); animation: cw-pop .35s var(--cw-ease); }
.cw-pill.is-active .cw-pill-n { color: var(--color-border-light); }
@keyframes cw-pop { 50% { transform: scale(1.06); } }

/* Full-screen menu sheet */
.cw-sheet { position: fixed; inset: 0; z-index: 80; background: var(--cw-band); color: var(--cw-band-ink); display: flex; flex-direction: column; padding: 16px 20px; overflow-y: auto; }
.cw-sheet-link { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid #2c3634; font-family: 'Newsreader', Georgia, serif; font-size: 30px; font-weight: 500; font-style: italic; }
.cw-sheet-item { opacity: 0; transform: translateX(24px); transition: opacity .45s, transform .45s var(--cw-ease); }
.cw-sheet.is-open .cw-sheet-item { opacity: 1; transform: none; }

/* ---------- Covers (used when an article has no featured image) ---------- */
.cw-cover { position: relative; overflow: hidden; border-radius: 16px; background: var(--c, #1f5f66); isolation: isolate; }
.cw-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cw-cover .cw-wv { position: absolute; left: 0; top: 0; width: 200%; height: 100%; animation: cw-drift 22s linear infinite; transition: scale 1.2s var(--cw-ease); }
.cw-cover .cw-wv-b { animation-duration: 34s; animation-direction: reverse; opacity: .6; }
@keyframes cw-drift { to { transform: translateX(-50%); } }
.cw-mono { position: absolute; right: 7%; bottom: -12%; font-family: 'Newsreader', Georgia, serif; font-style: italic; color: rgba(255, 255, 255, .16); line-height: 1; pointer-events: none; transition: transform .8s var(--cw-ease); }
.cw-chip { position: absolute; left: 16px; top: 16px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .94); color: #211d18; border-radius: 999px; padding: 5px 11px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; z-index: 1; }
.js .cw-cover.cw-wipe { clip-path: inset(0 100% 0 0 round 16px); transition: clip-path 1.2s var(--cw-ease-io), box-shadow .45s; }
.js .cw-cover.cw-wipe.is-in { clip-path: inset(0 0 0 0 round 16px); }

/* ---------- Cards ---------- */
.cw-card { display: flex; flex-direction: column; gap: 14px; transition: transform .45s var(--cw-ease); }
.cw-card:hover { transform: translateY(-4px); }
.cw-card .cw-cover { transition: box-shadow .45s; }
.cw-card:hover .cw-cover { box-shadow: 0 18px 40px -18px rgba(33, 29, 24, .45); }
.cw-card:hover .cw-mono { transform: translate(-14px, -18px) rotate(-6deg); }
.cw-card:hover .cw-wv { scale: 1 1.35; }
.cw-hl { background-image: linear-gradient(var(--color-primary), var(--color-primary)); background-size: 0 2px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .5s var(--cw-ease-io); }
.cw-card:hover .cw-hl, .cw-row:hover .cw-hl, .cw-hl-host:hover .cw-hl { background-size: 100% 2px; }
.cw-arrow { display: inline-block; transition: transform .3s; }
.cw-card:hover .cw-arrow, .cw-more:hover .cw-arrow, .cw-btn:hover .cw-arrow, .cw-next:hover .cw-arrow, .cw-writer:hover .cw-arrow { transform: translateX(4px); }
.cw-btn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 22px; border-radius: 999px; background: var(--color-primary); color: #fff; font-weight: 600; font-size: 14px; }
.dark .cw-btn { color: #0e1a1b; }

/* ---------- Reveal on scroll (JS adds .is-in) ---------- */
.js .cw-rv { opacity: 0; transform: translateY(18px); }
.js .cw-rv.is-in { opacity: 1; transform: none; transition: opacity .9s var(--cw-ease), transform .9s var(--cw-ease); transition-delay: var(--d, 0ms); }
.cw-wd { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; }
.cw-wd > span { display: inline-block; transform: translateY(105%); animation: cw-wordup .9s var(--cw-ease) forwards; animation-delay: var(--d, 0ms); }
@keyframes cw-wordup { to { transform: none; } }

/* ---------- The Wire ---------- */
.cw-wire-item { display: grid; grid-template-columns: 14px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--color-border); }

/* ---------- Trending band ---------- */
.cw-band { background: var(--cw-band); color: var(--cw-band-ink); }
.cw-num { font-family: 'Newsreader', Georgia, serif; font-size: 64px; line-height: .9; color: transparent; -webkit-text-stroke: 1px #6f8f8c; transition: color .4s, -webkit-text-stroke-color .4s; }
.cw-row:hover .cw-num { color: #5fb3bb; -webkit-text-stroke-color: #5fb3bb; }
.cw-band .cw-hl { background-image: linear-gradient(#5fb3bb, #5fb3bb); }
.cw-spot { position: relative; isolation: isolate; }
.cw-spot::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(260px circle at var(--x, 50%) var(--y, 50%), rgba(95, 179, 187, .22), transparent 60%); opacity: var(--o, 0); transition: opacity .3s; }

/* ---------- Section spotlights ---------- */
.cw-topic { display: inline-flex; height: 30px; align-items: center; padding: 0 12px; border-radius: 999px; background: var(--color-surface); font-size: 12px; font-weight: 600; color: var(--color-text-muted); }

/* ---------- Writers ---------- */
.cw-writer { display: flex; gap: 14px; align-items: center; padding: 18px; border: 1px solid var(--color-border); border-radius: 16px; background: var(--cw-card); transition: border-color .3s, transform .3s; }
.cw-writer:hover { border-color: var(--color-primary); transform: translateY(-2px); }
.cw-av { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-family: 'Newsreader', Georgia, serif; font-size: 18px; flex-shrink: 0; object-fit: cover; box-shadow: 0 0 0 3px var(--color-background), 0 0 0 5px var(--ring, var(--color-primary)); }

/* ---------- Footer ---------- */
.cw-footer a { color: var(--cw-band-muted); transition: color .2s; }
.cw-footer a:hover { color: var(--cw-band-ink); }

/* ---------- Category ---------- */
.cw-hero-band { position: relative; overflow: hidden; background: var(--c, #1f5f66); color: #fff; }
.cw-hero-band .cw-wv { position: absolute; left: 0; top: 0; width: 200%; height: 100%; animation: cw-drift 26s linear infinite; }
.cw-hero-band .cw-wv-b { animation-duration: 40s; animation-direction: reverse; }
.cw-hero-band h1 { animation: cw-tracking 1.4s var(--cw-ease) both; }
@keyframes cw-tracking { from { letter-spacing: .04em; opacity: 0; filter: blur(6px); } to { letter-spacing: -.03em; opacity: 1; filter: none; } }
.cw-fpill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--color-border); font-size: 13px; font-weight: 600; background: var(--cw-card); white-space: nowrap; transition: all .25s; }
.cw-fpill:hover { border-color: var(--c, var(--color-primary)); color: var(--c, var(--color-primary)); }
.cw-fpill.is-active { background: var(--color-text); color: var(--color-background); border-color: var(--color-text); animation: cw-pop .35s var(--cw-ease); }
.cw-fpill .cw-fpill-n { font-size: 11px; color: var(--color-text-faint); }
.cw-fpill.is-active .cw-fpill-n { color: var(--color-border-light); }
.cw-tabs { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--color-surface); }
.cw-tab { height: 36px; padding: 0 16px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--color-text-muted); display: inline-flex; align-items: center; transition: background .25s, color .25s; }
.cw-tab.is-active { background: var(--cw-card); color: var(--color-text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.cw-pg { min-width: 42px; height: 42px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--color-border); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; background: var(--cw-card); }
.cw-pg.is-active { background: var(--color-text); color: var(--color-background); border-color: var(--color-text); }
.cw-pg.is-disabled { opacity: .4; }
.cw-loadmore { width: 100%; height: 50px; border-radius: 999px; border: 1px solid var(--color-text); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; }
.cw-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--color-border); border-top-color: var(--color-text); animation: cw-sp .8s linear infinite; }
@keyframes cw-sp { to { transform: rotate(360deg); } }
.cw-sk { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--color-surface) 0%, var(--color-background) 50%, var(--color-surface) 100%); background-size: 200% 100%; animation: cw-shimmer 1.3s linear infinite; }
@keyframes cw-shimmer { to { background-position: -200% 0; } }

/* ---------- Article ---------- */
.cw-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; background: var(--color-primary); box-shadow: 0 0 12px var(--color-primary); z-index: 100; transform-origin: left; transform: scaleX(var(--p, 0)); }
@supports (animation-timeline: scroll()) {
    .cw-progress { animation: cw-grow linear both; animation-timeline: scroll(root); }
    @keyframes cw-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    .cw-shrink { animation: cw-shrink linear both; animation-timeline: scroll(root); animation-range: 0 160px; }
    @keyframes cw-shrink { to { box-shadow: 0 10px 24px -18px rgba(0, 0, 0, .45); } }
}
.article-body { counter-reset: cw-h2; font-family: 'Archivo', system-ui, sans-serif; }
.article-body > p { font-size: 1.1875rem; line-height: 1.75; margin-bottom: 1.625rem; color: var(--color-text); }
.article-body > p:first-of-type::first-letter { font-family: 'Newsreader', Georgia, serif; float: left; font-size: 5.25rem; line-height: .82; padding: .5rem .75rem 0 0; color: var(--color-primary); font-weight: 500; }
.article-body > h2 { counter-increment: cw-h2; font-family: 'Newsreader', Georgia, serif; font-size: 2rem; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; margin: 3.5rem 0 1.125rem; color: var(--color-text); scroll-margin-top: 6rem; }
.article-body > h2::before { content: counter(cw-h2, decimal-leading-zero); display: block; font-family: 'Archivo', system-ui, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--color-primary); margin-bottom: 10px; }
.article-body > h3 { font-family: 'Newsreader', Georgia, serif; font-size: 1.375rem; font-weight: 600; margin: 2.5rem 0 1rem; color: var(--color-text); scroll-margin-top: 6rem; }
.article-body > blockquote { font-family: 'Newsreader', Georgia, serif; font-style: italic; font-size: 1.375rem; line-height: 1.45; border: 1px solid var(--color-border); border-radius: 16px; background: var(--cw-card); padding: 1.5rem 1.625rem; margin: 2rem 0; color: var(--color-text); }
.article-body > ul, .article-body > ol { margin: 0 0 1.75rem; padding: 0; }
.article-body > ul { list-style: none; }
.article-body > ol { padding-left: 1.5rem; }
.article-body > ul > li { position: relative; padding-left: 28px; }
.article-body > ul > li::before { content: ""; position: absolute; left: 4px; top: .8em; width: 10px; height: 2px; background: var(--color-primary); }
.article-body li { font-size: 1.125rem; line-height: 1.7; margin-bottom: .625rem; color: var(--color-text); }
.article-body img { width: 100%; margin: 2rem 0; border-radius: 12px; }
.article-body a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article-body a:hover { text-decoration-thickness: 2px; }
.article-body strong { font-weight: 700; color: var(--color-text); }
.article-body table { width: 100%; border-collapse: collapse; margin: 2rem 0; font-size: .95rem; display: block; overflow-x: auto; }
.article-body th, .article-body td { border-bottom: 1px solid var(--color-border); padding: .625rem .75rem; text-align: left; }
.article-body pre { background: var(--cw-band); color: var(--cw-band-ink); padding: 1rem 1.25rem; border-radius: 12px; overflow-x: auto; margin: 1.5rem 0; font-size: .875rem; }
/* FAQ accordion (built by contentwave.js from h3 + answer pairs) */
.cw-faq details { border-top: 1px solid var(--color-border); }
.cw-faq details:last-of-type { border-bottom: 1px solid var(--color-border); }
.cw-faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 0; font-family: 'Newsreader', Georgia, serif; font-size: 1.25rem; font-weight: 600; color: var(--color-text); }
.cw-faq summary::-webkit-details-marker { display: none; }
.cw-faq summary::after { content: "+"; font-family: 'Archivo', sans-serif; font-size: 22px; color: var(--color-primary); transition: transform .35s var(--cw-ease); flex-shrink: 0; }
.cw-faq details[open] summary::after { transform: rotate(45deg); }
.cw-faq details > :not(summary) { font-size: 1.0625rem !important; color: var(--color-text-muted) !important; margin: 0 0 1.125rem !important; animation: cw-fadeup .45s var(--cw-ease); }
@keyframes cw-fadeup { from { opacity: 0; transform: translateY(-6px); } }
/* Table of contents */
.cw-toc a { display: block; padding: 7px 0 7px 16px; border-left: 2px solid var(--color-border); font-size: 13.5px; line-height: 1.35; color: var(--color-text-faint); transition: color .25s, border-color .25s; }
.cw-toc a:hover { color: var(--color-text); }
.cw-toc a.is-active { color: var(--color-text); border-left-color: var(--color-primary); font-weight: 600; }
.cw-toc-m { border: 1px solid var(--color-border); border-radius: 12px; background: var(--cw-card); overflow: hidden; }
.cw-toc-m .cw-acc { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--cw-ease); }
.cw-toc-m.is-open .cw-acc { grid-template-rows: 1fr; }
.cw-toc-m .cw-acc > div { overflow: hidden; }
.cw-toc-m .cw-chev { transition: transform .35s var(--cw-ease); }
.cw-toc-m.is-open .cw-chev { transform: rotate(180deg); }
.cw-tagchip { display: inline-flex; height: 32px; align-items: center; padding: 0 13px; border-radius: 999px; background: var(--color-surface); font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); transition: background .25s, color .25s; }
.cw-tagchip:hover { background: var(--color-text); color: var(--color-background); }
.cw-next { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 28px 32px; border-radius: 20px; background: var(--cw-band); color: var(--cw-band-ink); }
.cw-dock { position: fixed; left: 16px; right: 16px; bottom: 12px; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--cw-band); color: var(--cw-band-ink); box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .55); transition: transform .5s var(--cw-ease), opacity .5s; }
.cw-dock.is-hidden { transform: translateY(140%); opacity: 0; }
.cw-dock button, .cw-dock a { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; color: var(--cw-band-ink); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
    .js .cw-rv, .js .cw-cover.cw-wipe { opacity: 1; transform: none; clip-path: none; }
    .cw-wd > span { transform: none; }
    .cw-logo-wave path { stroke-dashoffset: 0; }
}
html:not(.dark) .cw-cluster-accent { --color-primary: var(--cluster); }
