/* ══════════════════════════════════════════════════════════════
   Write Worth — shared skeleton kit + top progress bar
   Shapes:  .wwk (base) + --line --title --avatar --circle --pill --btn --img --block
   Presets are built by wwketon.js (card, post, row, list, tile, chart, table, text).
   ══════════════════════════════════════════════════════════════ */
:root {
    /* same tones as the feed / stories / marketplace skeletons */
    --wwk-a: #f3f4f6;
    --wwk-b: #e5e7eb;
    --wwk-card: #ffffff;
    --wwk-border: #e5e7eb;
    --wwk-radius: 16px;
    --wwk-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 20px rgba(0,0,0,.05);
}
html[data-theme="dark"] {
    --wwk-a: rgba(255,255,255,.05);
    --wwk-b: rgba(255,255,255,.11);
    --wwk-card: #161b22;
    --wwk-border: rgba(255,255,255,.08);
    --wwk-shadow: 0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
}
@keyframes wwkShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.wwk {
    display: block; border-radius: 8px;
    background: linear-gradient(90deg, var(--wwk-a) 25%, var(--wwk-b) 50%, var(--wwk-a) 75%);
    background-size: 200% 100%; animation: wwkShimmer 1.2s infinite linear;
}
.wwk--line   { height: 11px; width: 100%; margin-bottom: 8px; }
.wwk--title  { height: 15px; width: 60%; margin-bottom: 10px; }
.wwk--avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.wwk--circle { border-radius: 50%; }
.wwk--pill   { height: 20px; width: 64px; border-radius: 999px; }
.wwk--btn    { height: 34px; width: 88px; border-radius: 10px; }
.wwk--img    { width: 100%; height: 170px; border-radius: 12px; }
.wwk--block  { width: 100%; height: 100%; border-radius: 0; }

/* preset containers */
.wwk-card { background: var(--wwk-card); border-radius: var(--wwk-radius); box-shadow: var(--wwk-shadow); overflow: hidden; height: 100%; }
.wwk-card__body { padding: 16px 18px 18px; }
.wwk-flex { display: flex; align-items: center; gap: 10px; }
.wwk-flex > .wwk-grow { flex: 1; min-width: 0; }
.wwk-row { display: flex; align-items: center; gap: 11px; padding: 10px 8px; }

.wwk-gap { display: flex; gap: 6px; margin: 10px 0 14px; }
.wwk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--wwk-border); }
.wwk-tile { background: var(--wwk-card); border-radius: 12px; box-shadow: var(--wwk-shadow); padding: 14px 16px; }
.wwk-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.wwk-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.wwk-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 10px 4px 0; }
.wwk-chart > .wwk { flex: 1; border-radius: 6px 6px 0 0; }
.wwk-table { width: 100%; }
.wwk-table .wwk-tr { display: grid; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--wwk-border); }
.wwk-post { background: var(--wwk-card); border-radius: var(--wwk-radius); box-shadow: var(--wwk-shadow); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.wwk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* images: shimmer until loaded, calm if they fail */
img.ww-shimmer:not(.is-loaded) {
    background: linear-gradient(90deg, var(--wwk-a) 25%, var(--wwk-b) 50%, var(--wwk-a) 75%);
    background-size: 200% 100%; animation: wwkShimmer 1.2s infinite linear; color: transparent;
}
img.ww-shimmer.is-failed { animation: none; background: var(--wwk-a); }

/* ── top progress bar (page-to-page navigation) ── */
#ww-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 2147483000; pointer-events: none;
    background: linear-gradient(90deg, #16a34a, #3ecf8e 60%, #a7f3d0);
    box-shadow: 0 0 10px rgba(62,207,142,.6), 0 0 4px rgba(62,207,142,.5);
    opacity: 0; transition: width .25s ease, opacity .3s ease;
    margin-top: env(safe-area-inset-top, 0px);
}
#ww-progress.is-on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .wwk, img.ww-shimmer:not(.is-loaded) { animation: none; }
    #ww-progress { transition: opacity .2s ease; }
}

/* ══════════════════════════════════════════════════════════════
   Live lists — skeletons drawn into a list while it reloads in place
   (same look as the My Projects skeleton)
   ══════════════════════════════════════════════════════════════ */
.wwk-trow td { padding: 4px 12px !important; border: 0 !important; background: transparent !important; }
.wwk-tline { display: flex; align-items: center; gap: 18px; padding: 10px 6px; }
.wwk-tline .wwk { flex: none; height: 13px; border-radius: 7px; }
.wwk-tline .wwk:first-child { height: 16px; }
.wwk-mcard { background: var(--wwk-card); border-radius: 14px; box-shadow: var(--wwk-shadow); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.wwk-mcard .wwk { height: 13px; border-radius: 7px; }
.wwk-mmeta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wwk-mmeta .wwk { height: 42px; border-radius: 10px; }
.wwk-block { padding: 6px 0; }
.wwk-block .wwk { height: 14px; border-radius: 7px; margin: 10px 0; }
[data-ww-live] { scroll-margin-top: 90px; }
[data-ww-live][aria-busy="true"] .pagination,
[data-ww-live][aria-busy="true"] [data-ww-live-hide] { visibility: hidden; }


/* ══ the native Write Worth dropdown (replaces select2 on simple lists) ══ */
select.ww-native-select {
    -webkit-appearance: none !important; appearance: none !important; cursor: pointer;
    padding-right: 40px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233ecf8e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important; background-position: right 14px center !important; background-size: 12px !important;
    text-overflow: ellipsis;
}
select.ww-native-select:focus { outline: none; border-color: rgba(62,207,142,.6) !important; box-shadow: 0 0 0 3px rgba(62,207,142,.14) !important; }
select.ww-native-select:focus-visible { outline: 2px solid #3ecf8e; outline-offset: 1px; }
select.ww-native-select option { color: #0f172a; background: #ffffff; }
html[data-theme="dark"] select.ww-native-select { color-scheme: dark; }
html[data-theme="dark"] select.ww-native-select option { color: #f1f5f9; background: #12171e; }

/* grid skeleton — placeholder cards in the page's own grid */
.wwk-gcard { background: var(--wwk-card); border-radius: 16px; box-shadow: var(--wwk-shadow); overflow: hidden; height: 100%; min-height: 250px; display: flex; flex-direction: column; }
.wwk-gcard .wwk-gimg { display: block; height: 150px; border-radius: 0; }
.wwk-gbody { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 9px; }
.wwk-gbody .wwk { height: 11px; border-radius: 7px; }
