/* WittyWriter Signature Frontend / F1-F4 — additive, scope-aware theme system.
   Loaded AFTER the existing page styles. No database or functional markup dependencies. */
html[data-ww-route]{--wwf-text:var(--ww-ink,#202943);--wwf-sub:var(--ww-muted,#68758c);--wwf-accent:var(--ww-accent,#6555d9);--wwf-tint:var(--ww-accent-soft,#f0edfc);--wwf-line:var(--ww-border,#e0e3ed);--wwf-card:var(--ww-paper,#fff);--wwf-bg:var(--ww-bg,#f7f8fc);--wwf-radius:var(--ww-user-radius,22px);--wwf-shadow:0 18px 50px rgba(29,39,78,.075)}
html[data-ww-route] body{color:var(--wwf-text)}
html[data-ww-route] :is(main,main *,footer *){box-sizing:border-box}
html[data-ww-route] main :is(a,button,input,select,textarea,summary):focus-visible{outline:3px solid var(--wwf-accent)!important;outline-offset:3px}
html[data-ww-route] main :is(h1,h2,h3){text-wrap:balance;overflow-wrap:anywhere}
html[data-ww-route] main :is(p,li){overflow-wrap:anywhere}
html[data-ww-route] main img{max-width:100%}
html[data-ww-route] main :is(input:not([type=checkbox]):not([type=radio]),select,textarea){min-height:43px;accent-color:var(--wwf-accent);border-radius:12px;border-color:var(--wwf-line);max-width:100%}
html[data-ww-route] main :is(button,[type=submit]){touch-action:manipulation}
html[data-ww-route] main :is(a,button){-webkit-tap-highlight-color:transparent}
/* Shared premium website chrome — only public surface elements, never calculator iframe internals. */
html[data-ww-route] .ww18-pearl .ww18-shell{background:color-mix(in srgb,var(--wwf-card) 93%,transparent);border-bottom:1px solid var(--wwf-line);backdrop-filter:blur(18px)}
html[data-ww-route] .ww18-pearl{box-shadow:0 8px 40px rgba(19,29,60,.065)}
html[data-ww-route] .ww3-footer{border-top-color:var(--wwf-line)}
/* Category discovery */
html[data-ww-route="categories"] .wwp-directory .wwp-shell{max-width:1510px}
html[data-ww-route="categories"] .wwp-hero{position:relative;isolation:isolate;overflow:hidden;border:1px solid var(--wwf-line)!important;border-radius:clamp(22px,3vw,34px)!important;background:radial-gradient(circle at 85% 15%,var(--wwf-tint),transparent 48%),var(--wwf-card)!important;box-shadow:var(--wwf-shadow)!important}
html[data-ww-route="categories"] .wwp-hero:after{content:"";position:absolute;right:-60px;bottom:-115px;width:280px;aspect-ratio:1;border:1px solid var(--wwf-line);border-radius:50%;pointer-events:none;opacity:.65}
html[data-ww-route="categories"] .wwp-hero :is(h1,p){color:var(--wwf-text)}
html[data-ww-route="categories"] .wwp-hero p{color:var(--wwf-sub)}
html[data-ww-route="categories"] .wwp-controls{border:1px solid var(--wwf-line);border-radius:18px;background:var(--wwf-card);padding:12px;box-shadow:0 8px 24px rgba(24,34,70,.035)}
html[data-ww-route="categories"] .wwp-category{border:1px solid var(--wwf-line)!important;border-radius:var(--wwf-radius)!important;background:var(--wwf-card)!important;box-shadow:0 9px 25px rgba(25,35,70,.04)!important;transition:transform .25s ease,box-shadow .25s ease,border-color .25s ease}
html[data-ww-route="categories"] .wwp-category:hover{transform:translateY(-5px);box-shadow:var(--wwf-shadow)!important;border-color:var(--wwf-accent)!important}
/* Individual category */
html[data-ww-route="category"] .ww4-detail{max-width:1540px}
html[data-ww-route="category"] .ww4-detail-hero{border:1px solid var(--wwf-line)!important;border-radius:30px!important;overflow:hidden;box-shadow:var(--wwf-shadow)}
html[data-ww-route="category"] .ww4-detail :is(.post-card,.page-card){border:1px solid var(--wwf-line)!important;border-radius:var(--wwf-radius)!important;background:var(--wwf-card);overflow:hidden;box-shadow:0 7px 25px rgba(24,33,65,.04);transition:transform .25s,box-shadow .25s}
html[data-ww-route="category"] .ww4-detail :is(.post-card,.page-card):hover{transform:translateY(-4px);box-shadow:var(--wwf-shadow)}
html[data-ww-route="category"] .ww4-detail :is(.post-card,.page-card) img{object-fit:cover}
/* Search and archive */
html[data-ww-route="search"] .ww4-search-page .ww4-search-hero,html[data-ww-route="archive"] .ww5-archive .ww5-hero{border:1px solid var(--wwf-line)!important;border-radius:30px!important;overflow:hidden;box-shadow:var(--wwf-shadow)!important}
html[data-ww-route="search"] .ww4-search-page .ww4-hero-search{border-radius:16px!important;box-shadow:0 12px 32px rgba(20,29,63,.065)}
html[data-ww-route="search"] .ww4-search-page :is(.ww4-result,.ww4-topic),html[data-ww-route="archive"] .ww5-archive .ww5-article-card{border:1px solid var(--wwf-line)!important;border-radius:var(--wwf-radius)!important;background:var(--wwf-card)!important;overflow:hidden;box-shadow:0 9px 24px rgba(25,33,70,.045)!important;transition:transform .23s,box-shadow .23s}
html[data-ww-route="search"] .ww4-search-page :is(.ww4-result,.ww4-topic):hover,html[data-ww-route="archive"] .ww5-archive .ww5-article-card:hover{transform:translateY(-4px);box-shadow:var(--wwf-shadow)!important}
html[data-ww-route="archive"] .ww5-archive .ww5-filters{border-radius:20px;overflow:hidden}
html[data-ww-route="archive"] .ww5-archive .ww5-filter-form{accent-color:var(--wwf-accent)}
/* Tool directory; keep working calculators full width and untouched. */
html[data-ww-route="calculators"] .wwcp-public{background:transparent;color:var(--wwf-text)}
html[data-ww-route="calculators"] .wwcp-public-shell{max-width:1500px}
html[data-ww-route="calculators"] .wwcp-public-hero{position:relative;isolation:isolate;overflow:hidden;border:1px solid var(--wwf-line)!important;border-radius:30px!important;background:radial-gradient(circle at 85% 20%,var(--wwf-tint),transparent 52%),var(--wwf-card)!important;color:var(--wwf-text)!important;box-shadow:var(--wwf-shadow);padding:clamp(24px,4vw,52px)!important}
html[data-ww-route="calculators"] .wwcp-public-hero :is(h1,p,strong){color:var(--wwf-text)}
html[data-ww-route="calculators"] .wwcp-public-filter{border:1px solid var(--wwf-line);border-radius:18px;background:var(--wwf-card);padding:clamp(13px,2vw,21px);box-shadow:0 8px 26px rgba(24,34,70,.04)}
html[data-ww-route="calculators"] .wwcp-public-card{position:relative;overflow:hidden;background:var(--wwf-card)!important;border:1px solid var(--wwf-line)!important;border-radius:var(--wwf-radius)!important;box-shadow:0 10px 25px rgba(22,35,75,.045);transition:transform .23s,box-shadow .23s}
html[data-ww-route="calculators"] .wwcp-public-card:before{content:"";position:absolute;inset:0 0 auto;height:3px;background:linear-gradient(90deg,var(--wwf-accent),transparent)}
html[data-ww-route="calculators"] .wwcp-public-card:hover{transform:translateY(-4px);box-shadow:var(--wwf-shadow)}
html[data-ww-route="calculators"] .wwcp-public-card :is(h2,p){color:var(--wwf-text)}
html[data-ww-route="calculators"] .wwcp-public-card p{color:var(--wwf-sub)}
html[data-ww-route="calculators"] .wwcp-public-open{border-radius:11px}
/* Calculator view — controls stay usable, no extra sidebars, no forced height. */
html[data-ww-route="view-page"] .wwp-tool-page{width:min(100%,1800px);max-width:none;margin-inline:auto;padding-inline:clamp(12px,2.4vw,36px)}
html[data-ww-route="view-page"] .wwp-tool-heading{background:var(--wwf-card);border:1px solid var(--wwf-line);border-radius:20px;padding:clamp(14px,2vw,25px);margin-block:16px}
html[data-ww-route="view-page"] .wwp-tool-shell{min-width:0;width:100%;border:1px solid var(--wwf-line);border-radius:18px;overflow:hidden;background:var(--wwf-card);box-shadow:var(--wwf-shadow)}
html[data-ww-route="view-page"] .wwp-tool-frame{width:100%;max-width:100%;display:block}
/* Editorial article reading, protect text measure and media */
html[data-ww-route="view-page"] .ww9-article-page :is(.ww9-reading-panel,.ww9-aside-card,.ww9-masthead),html[data-ww-route="view-page"] .wwp-static-page{border-radius:var(--wwf-radius);border-color:var(--wwf-line);box-shadow:0 12px 38px rgba(25,35,70,.05)}
html[data-ww-route="view-page"] .ww9-article-page :is(.ww9-reading-panel,.ww9-article-content,.ww9-content-body) :is(p,li){line-height:1.8}
html[data-ww-route="view-page"] .ww9-article-page :is(.ww9-article-content,.ww9-content-body) :is(img,video,iframe){max-width:100%;height:auto;border-radius:12px}
html[data-ww-route="view-page"] .ww9-article-page :is(table){max-width:100%;display:block;overflow-x:auto}
/* Product directory, reviews, specifications and comparisons */
html[data-ww-route="products"] .wwps-directory,html[data-ww-route="compare-products"] .wwps-directory,html[data-ww-route="view-page"] .wwps-page{--wwps-signature-accent:var(--wwf-accent);max-width:1520px;margin-inline:auto}
html[data-ww-route="products"] .wwps-dir-head,html[data-ww-route="compare-products"] .wwps-dir-head,html[data-ww-route="view-page"] .wwps-hero{position:relative;overflow:hidden;border:1px solid var(--wwf-line)!important;background:radial-gradient(circle at 88% 12%,var(--wwf-tint),transparent 49%),var(--wwf-card)!important;border-radius:30px!important;box-shadow:var(--wwf-shadow);padding:clamp(23px,3.4vw,45px)!important}
html[data-ww-route="products"] .wwps-dir-card,html[data-ww-route="view-page"] .wwps-product-card,html[data-ww-route="compare-products"] .wwps-product-card{background:var(--wwf-card)!important;border:1px solid var(--wwf-line)!important;border-radius:var(--wwf-radius)!important;box-shadow:0 10px 28px rgba(28,36,76,.05)!important;transition:transform .2s,box-shadow .2s}
html[data-ww-route="products"] .wwps-dir-card:hover{transform:translateY(-4px);box-shadow:var(--wwf-shadow)!important}
html[data-ww-route] .wwps-directory .wwps-compare-form{background:var(--wwf-card);padding:clamp(13px,2.1vw,25px);border-radius:18px;border:1px solid var(--wwf-line)}
html[data-ww-route] .wwps-table-scroll{max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
html[data-ww-route] .wwps-table{min-width:540px;border-collapse:separate;border-spacing:0}
html[data-ww-route] .wwps-table thead th{position:sticky;top:0;z-index:1}
/* Static/general pages and collections */
html[data-ww-route="view-page"] .wwp-page-wrap{max-width:1250px;margin-inline:auto;padding-inline:clamp(14px,3vw,32px)}
html[data-ww-route="view-page"] .wwp-static-page{background:var(--wwf-card);border:1px solid var(--wwf-line)}
html[data-ww-route="view-custom-page"] .ww5-custom .card,html[data-ww-route="view-collection-group"] .card,html[data-ww-route="author"] .author-profile-header{border:1px solid var(--wwf-line)!important;border-radius:var(--wwf-radius)!important;box-shadow:var(--wwf-shadow);background:var(--wwf-card)}
html[data-ww-route="view-collection-group"] main>header{background:radial-gradient(circle at 93% 0%,var(--wwf-tint),transparent 45%),var(--wwf-card);border:1px solid var(--wwf-line);border-radius:24px;padding:clamp(20px,3vw,42px);box-shadow:var(--wwf-shadow)}
html[data-ww-route="view-collection-group"] main>section{margin-block:30px!important}
html[data-ww-route="view-collection-group"] main>section h2{margin-bottom:15px}
html[data-ww-route="author"] .author-profile-header{padding:clamp(20px,3vw,38px)}
/* Responsive layouts and touch targets */
@media(max-width:900px){
 html[data-ww-route] :is(.wwps-dir-head,.ww5-hero,.ww4-search-hero,.wwp-hero){border-radius:21px!important}
 html[data-ww-route="view-page"] .wwp-tool-page{padding-inline:10px}
 html[data-ww-route="view-page"] .wwp-tool-heading{border-radius:15px}
 html[data-ww-route="products"] .wwps-dir-head{padding:23px!important}
}
@media(max-width:600px){
 html[data-ww-route="categories"] .wwp-hero,html[data-ww-route="calculators"] .wwcp-public-hero{padding:22px!important;border-radius:19px!important}
 html[data-ww-route="calculators"] .wwcp-public-filter{display:grid;grid-template-columns:1fr;gap:11px}
 html[data-ww-route="calculators"] .wwcp-public-filter :is(label,input,select,button){width:100%;min-width:0}
 html[data-ww-route="products"] .wwps-dir-head,html[data-ww-route="compare-products"] .wwps-dir-head{padding:20px!important;border-radius:19px!important}
 html[data-ww-route] main :is(button,[type=submit]){min-height:42px}
 html[data-ww-route="view-collection-group"] main>header{padding:22px}
}
/* Eight theme personalities; differences extend beyond accent hues. */
html[data-ww-theme="liquid-glass"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card,.ww5-article-card,.ww4-result){backdrop-filter:blur(var(--ww-user-blur,12px));-webkit-backdrop-filter:blur(var(--ww-user-blur,12px));background:color-mix(in srgb,var(--wwf-card) 80%,transparent)!important;box-shadow:0 16px 44px rgba(52,81,139,.12)!important}
html[data-ww-theme="aurora-glass"] :is(.wwp-hero,.wwcp-public-hero,.wwps-dir-head,.ww5-hero){background:linear-gradient(135deg,var(--wwf-card),var(--wwf-tint) 58%,var(--wwf-card))!important}
html[data-ww-theme="aurora-glass"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card):hover{box-shadow:0 14px 42px color-mix(in srgb,var(--wwf-accent) 18%,transparent)!important}
html[data-ww-theme="editorial-luxury"] main :is(h1,h2,h3){font-family:Georgia,'Times New Roman',serif;letter-spacing:-.035em}
html[data-ww-theme="editorial-luxury"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card,.ww5-article-card){border-radius:8px!important;box-shadow:0 8px 25px rgba(68,51,35,.06)!important}
html[data-ww-theme="bento-studio"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card){border-radius:27px!important}
html[data-ww-theme="bento-studio"] :is(.wwp-category:nth-child(4n+2),.wwcp-public-card:nth-child(4n+2),.wwps-dir-card:nth-child(4n+2)){background:color-mix(in srgb,var(--wwf-tint) 42%,var(--wwf-card))!important}
html[data-ww-theme="soft-neumorphic"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card,.ww5-article-card){border-color:transparent!important;box-shadow:9px 9px 24px #879ab738,-9px -9px 24px #ffffffa8!important}
html[data-ww-theme="swiss-minimal"] :is(.wwp-hero,.wwcp-public-hero,.wwps-dir-head,.wwp-category,.wwcp-public-card,.wwps-dir-card,.ww4-result,.ww5-article-card){border-radius:2px!important;box-shadow:none!important}
html[data-ww-theme="swiss-minimal"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card):hover{transform:none;border-color:var(--wwf-text)!important}
html[data-ww-theme="pearl-classic"] :is(.wwp-hero,.wwcp-public-hero,.wwps-dir-head){background:linear-gradient(120deg,#fffefa,var(--wwf-tint))!important}
html[data-ww-theme="pearl-classic"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card){box-shadow:0 11px 30px rgba(99,78,136,.08)!important}
html[data-ww-theme="midnight-glass"]:not([data-ww-mode="light"]):not([data-ww-system-dark="0"][data-ww-mode="auto"]) :is(.wwp-category,.wwcp-public-card,.wwps-dir-card,.ww5-article-card,.ww4-result){box-shadow:0 17px 39px rgba(0,0,0,.3)!important}
html[data-ww-mode="dark"] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card){background:var(--wwf-card)!important}
@media(prefers-reduced-motion:reduce){html[data-ww-route] :is(.wwp-category,.wwcp-public-card,.wwps-dir-card,.ww5-article-card,.ww4-result,.post-card,.page-card){transition:none!important;transform:none!important}}
/* Additional explicit route surfaces discovered in the consolidated templates. */
html[data-ww-route="view-page"] .ww9-journal :is(.ww9-reading-panel,.ww9-aside-card,.ww9-masthead){border-radius:var(--wwf-radius)!important;border-color:var(--wwf-line)!important;box-shadow:0 12px 38px rgba(25,35,70,.07)}
html[data-ww-route="view-page"] .ww9-journal .ww9-reading-panel :is(p,li){line-height:1.82}
html[data-ww-route="view-page"] .ww9-journal .ww9-reading-panel :is(img,video,iframe){max-width:100%;height:auto;border-radius:12px}
html[data-ww-route="view-page"] .ww9-journal .ww9-reading-panel table{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
html[data-ww-route="view-page"] .ww9-journal .ww9-masthead h1{letter-spacing:-.045em;text-wrap:balance}
html[data-ww-route="author"] .author-profile-header{border-radius:0!important;background:linear-gradient(112deg,var(--wwf-card),var(--wwf-tint))!important;border-inline:0!important}
html[data-ww-route="author"] :is(.author-stats-card,.recent-post-item,.sidebar-section){border-radius:var(--wwf-radius);border-color:var(--wwf-line);box-shadow:0 8px 25px rgba(25,34,76,.045)}
html[data-ww-route="view-custom-page"] .ww5-custom{max-width:1510px;margin-inline:auto}
html[data-ww-route="view-custom-page"] .ww5-custom-hero{padding:clamp(22px,3vw,43px);background:radial-gradient(circle at 90% 0%,var(--wwf-tint),transparent 50%),var(--wwf-card);border:1px solid var(--wwf-line);border-radius:var(--wwf-radius);box-shadow:var(--wwf-shadow)}
html[data-ww-route="view-custom-page"] .ww5-custom .card{transition:transform .22s,box-shadow .22s}
html[data-ww-route="view-custom-page"] .ww5-custom .card:hover{transform:translateY(-4px);box-shadow:var(--wwf-shadow)}
html[data-ww-route="view-page"] .wwp-static-page .wwp-page-body{font-size:clamp(15px,1.1vw,17px);line-height:1.78}
html[data-ww-route="view-page"] .wwp-static-page .wwp-page-body table{display:block;max-width:100%;overflow-x:auto}
html[data-ww-route="view-page"] .wwp-static-page .wwp-page-body :is(img,video,iframe){max-width:100%;height:auto}
@media(max-width:767px){html[data-ww-route="view-page"] .ww9-journal .ww9-reading-panel{border-radius:14px!important}html[data-ww-route="author"] .author-profile-header{padding:18px 0}}
html[data-ww-route="view-collection-group"] .wwf-collection-page{max-width:1370px;margin:clamp(20px,3vw,38px) auto;min-height:55vh;padding:0 clamp(14px,2.3vw,28px)}
html[data-ww-route="view-collection-group"] .wwf-collection-hero{margin-bottom:26px}
html[data-ww-route="view-collection-group"] .wwf-collection-section{margin:30px 0}
html[data-ww-route="view-collection-group"] .wwf-collection-section>.row{row-gap:18px}
html[data-ww-route="view-collection-group"] .wwf-collection-section .card{min-height:145px;padding:clamp(17px,2vw,25px)!important;transition:transform .22s,box-shadow .22s}
html[data-ww-route="view-collection-group"] .wwf-collection-section .card:hover{transform:translateY(-4px);box-shadow:var(--wwf-shadow)!important}
html[data-ww-route="view-collection-group"] .wwf-collection-card-title{font-size:1.14rem;line-height:1.35;margin-bottom:10px}
