/* usefulweb.site premium apps: landing pages, tutorials, /apps overview, main-page showcase and the workspace top bar.
   Per-app colours come from /static/apps/themes.css ([data-app="<id>"] sets --app-accent, --app-accent-2, --app-gradient).
   No inline styles anywhere (CSP style-src 'self'). */
:root { --app-accent: #0b5cad; --app-accent-2: #5b21b6; --app-gradient: linear-gradient(135deg, #0b5cad 0%, #5b21b6 100%); --app-radius: 18px; --app-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 12px 32px rgba(15, 23, 42, .10); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- buttons ---------- */
.app-launch { display: inline-flex; align-items: center; gap: .4em; padding: .7em 1.25em; border-radius: 999px; background: var(--app-gradient); color: #fff !important; font-weight: 700; text-decoration: none; box-shadow: 0 6px 18px color-mix(in srgb, var(--app-accent) 35%, transparent); transition: transform .12s ease, box-shadow .12s ease; }
.app-launch:hover, .app-launch:focus-visible { transform: translateY(-1px); box-shadow: 0 10px 26px color-mix(in srgb, var(--app-accent) 45%, transparent); }
.app-launch:focus-visible, .app-more:focus-visible, .app-thumb:focus-visible { outline: 3px solid color-mix(in srgb, var(--app-accent) 60%, #fff); outline-offset: 3px; }
.app-launch-xl { font-size: 1.15rem; padding: .85em 1.6em; }
.app-more { display: inline-flex; align-items: center; padding: .65em 1.1em; border-radius: 999px; border: 1.5px solid color-mix(in srgb, var(--app-accent) 45%, #d1d5db); color: color-mix(in srgb, var(--app-accent) 85%, #000); font-weight: 600; text-decoration: none; background: #fff; }
.app-more:hover { border-color: var(--app-accent); }

/* ---------- landing hero ---------- */
.app-hero { position: relative; overflow: hidden; color: #fff; background: var(--app-gradient); padding: clamp(2rem, 6vw, 4.5rem) 0; }
.app-hero::after { content: ""; position: absolute; inset: auto -10% -60% 40%; height: 120%; background: radial-gradient(closest-side, rgba(255, 255, 255, .22), transparent); pointer-events: none; }
.app-hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.app-hero a { color: #fff; }
.app-kicker { display: flex; align-items: center; gap: .75rem; margin: 0 0 .75rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; font-size: .85rem; opacity: .95; }
.app-kicker .app-logo { border-radius: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); background: #fff; }
.app-title { margin: 0; font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -.02em; color: #fff; }
.app-wordmark { display: block; max-width: min(420px, 100%); height: auto; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .2)); }
.app-tagline { font-size: clamp(1.15rem, 2.2vw, 1.45rem); font-weight: 600; margin: .9rem 0 .5rem; }
.app-lede { opacity: .92; max-width: 38em; }
.app-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 .75rem; }
.app-hero .app-launch { background: #fff; color: color-mix(in srgb, var(--app-accent) 90%, #000) !important; }
.app-hero .app-more { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .6); }
.app-meta { opacity: .85; }
.app-hero-shot { margin: 0; }
.app-hero-shot img { display: block; width: 100%; height: auto; border-radius: var(--app-radius); box-shadow: 0 24px 60px rgba(2, 6, 23, .45); border: 1px solid rgba(255, 255, 255, .25); background: #fff; transform: perspective(1400px) rotateY(-4deg); transition: transform .3s ease; }
.app-hero-shot a:hover img { transform: none; }
[dir=rtl] .app-hero-shot img { transform: perspective(1400px) rotateY(4deg); }

/* ---------- sections ---------- */
.app-page { --accent: var(--app-accent); }
.app-section { padding: clamp(1.75rem, 4vw, 3rem) 0 0; }
.app-section > h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-bottom: .4rem; }
.app-section > h2::after { content: ""; display: block; width: 56px; height: 4px; margin-top: .45rem; border-radius: 4px; background: var(--app-gradient); }
.app-final { text-align: center; }
.app-final > h2::after { margin-inline: auto; }

/* gallery + no-JS lightbox (:target) */
.app-gallery { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.app-thumb { display: block; border-radius: 14px; overflow: hidden; border: 1px solid #e5e7eb; background: #fff; box-shadow: var(--app-shadow); text-decoration: none; color: inherit; transition: transform .12s ease; }
.app-thumb:hover { transform: translateY(-2px); }
.app-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: #f1f5f9; }
.app-thumb-caption { display: block; padding: .55rem .8rem; font-size: .9rem; color: #475569; }
.app-lightbox { display: none; }
.app-lightbox:target { display: grid; position: fixed; inset: 0; z-index: 50; place-items: center; padding: 3vh 3vw; background: rgba(2, 6, 23, .86); }
.lb-backdrop { position: absolute; inset: 0; }
.app-lightbox figure { position: relative; margin: 0; max-width: min(1400px, 94vw); }
.app-lightbox img { display: block; max-width: 100%; max-height: 80vh; width: auto; height: auto; border-radius: 12px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.app-lightbox figcaption { color: #e2e8f0; text-align: center; margin-top: .6rem; }
.lb-nav { position: relative; display: flex; gap: 1rem; justify-content: center; margin: .8rem 0 0; }
.lb-nav a { color: #fff; background: rgba(255, 255, 255, .14); padding: .45em .9em; border-radius: 999px; text-decoration: none; font-weight: 600; }
.lb-nav a:hover, .lb-nav a:focus-visible { background: rgba(255, 255, 255, .28); }

/* features */
.app-features { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 1rem; }
.app-features li { padding: 1.1rem 1.1rem 1rem; border-radius: 16px; background: #fff; border: 1px solid color-mix(in srgb, var(--app-accent) 16%, #e5e7eb); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.app-features h3 { margin: .6rem 0 .25rem; font-size: 1.05rem; }
.app-features p { margin: 0; color: #475569; font-size: .95rem; }
.app-feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; background: var(--app-gradient); }
.app-feature-icon img { width: 26px; height: 26px; filter: brightness(0) invert(1); }

/* templates */
.app-templates { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 1rem; }
.app-templates li { padding: 1rem 1.1rem; border-radius: 16px; border: 1px dashed color-mix(in srgb, var(--app-accent) 40%, #cbd5e1); background: color-mix(in srgb, var(--app-accent) 4%, #fff); }
.app-templates h3 { margin: 0 0 .3rem; font-size: 1.05rem; }

/* for AI agents */
.app-agents { --code-bg: #0f172a; }
.app-tool-list { padding-left: 1.1rem; }
.app-tool-list li { margin: .5rem 0; }
.app-tool-list code, .app-agent-links code, .app-agent-links a, .app-agents code { overflow-wrap: anywhere; word-break: break-word; }
.app-formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 1rem; }
.app-formats h3 { margin-bottom: .2rem; }
.app-shortcuts kbd { display: inline-block; min-width: 1.6em; padding: .1em .45em; border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 6px; background: #f8fafc; font: 600 .85em ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.app-faq { border: 1px solid #e5e7eb; border-radius: 12px; padding: .7rem 1rem; margin: .5rem 0; background: #fff; }
.app-faq summary { cursor: pointer; font-weight: 600; }
.app-faq p { margin: .5rem 0 0; }

/* tutorials */
.app-tutorials { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; counter-reset: tut; }
.app-tutorials a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .9rem; padding: .9rem 1rem; border-radius: 14px; border: 1px solid #e5e7eb; background: #fff; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); counter-increment: tut; }
.app-tutorials a::before { content: counter(tut); grid-row: 1 / span 3; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--app-gradient); color: #fff; font-weight: 700; }
.app-tutorials a:hover { border-color: var(--app-accent); }
.tut-title { font-weight: 700; color: color-mix(in srgb, var(--app-accent) 85%, #000); }
.tut-desc { color: #475569; font-size: .95rem; }
.tut-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .35rem; }
.tut-badge { display: inline-block; padding: .1em .6em; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.tut-level[data-level="beginner"] { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.tut-level[data-level="intermediate"] { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.tut-level[data-level="advanced"] { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }
.app-tutorial .blog-content img { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid #e5e7eb; margin: 1rem 0; }
.tut-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2rem 0 1rem; }
.tut-pager a { display: grid; gap: .2rem; padding: .8rem 1rem; border: 1px solid #e5e7eb; border-radius: 12px; text-decoration: none; }
.tut-next { text-align: end; }

/* ---------- cards (main-page showcase, /apps, related apps) ---------- */
.app-showcase { padding: clamp(1.5rem, 4vw, 2.5rem) 0 .5rem; }
.app-showcase-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0; }
.app-showcase-head .lede { margin-top: .3rem; color: #475569; }
.app-cards { list-style: none; padding: 0; margin: 1.1rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 1.25rem; }
.app-cards-small { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
.app-card { display: flex; flex-direction: column; border-radius: var(--app-radius); overflow: hidden; background: #fff; border: 1px solid color-mix(in srgb, var(--app-accent) 22%, #e5e7eb); box-shadow: var(--app-shadow); transition: transform .14s ease, box-shadow .14s ease; }
.app-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(15, 23, 42, .06), 0 20px 44px rgba(15, 23, 42, .14); }
.app-card-shot { display: block; position: relative; background: var(--app-gradient); padding: 14px 14px 0; }
.app-card-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: top left; border-radius: 10px 10px 0 0; box-shadow: 0 -2px 18px rgba(2, 6, 23, .25); background: #fff; }
.app-card-body { display: flex; flex-direction: column; flex: 1; padding: 1rem 1.15rem 1.15rem; }
.app-card-head { display: flex; align-items: center; gap: .75rem; }
.app-card-head h2, .app-card-head h3 { margin: 0; font-size: 1.3rem; }
.app-card-head h2 a, .app-card-head h3 a { color: var(--ink-strong, #0f172a); text-decoration: none; }
.app-card-head .app-logo { border-radius: 12px; flex: none; }
.app-card-kind { margin: 0; font-size: .85rem; font-weight: 600; color: color-mix(in srgb, var(--app-accent) 85%, #000); }
.app-card-tagline { margin: .7rem 0 .4rem; }
.app-highlights { margin: .2rem 0 .8rem; padding: 0; list-style: none; display: grid; gap: .3rem; }
.app-highlights li { position: relative; padding-inline-start: 1.5rem; font-size: .95rem; color: #334155; }
.app-highlights li::before { content: "✓"; position: absolute; inset-inline-start: 0; font-weight: 800; color: var(--app-accent); }
.app-card-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: auto 0 0; padding-top: .4rem; }
.app-showcase-more { margin: 1rem 0 0; font-weight: 600; }
.app-logo-fallback { display: inline-flex; }

/* ---------- workspace (/app) ---------- */
.uwapp-html, .uwapp-body { height: 100%; }
.uwapp-body { margin: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: #f8fafc; color: var(--ink-strong, #0f172a); }
.uwapp-bar { display: flex; align-items: center; gap: .9rem; height: 48px; padding: 0 .9rem; background: #fff; border-bottom: 1px solid color-mix(in srgb, var(--app-accent) 25%, #e5e7eb); box-shadow: 0 1px 0 rgba(15, 23, 42, .03); flex: none; }
.uwapp-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.05rem; color: var(--ink-strong, #0f172a); text-decoration: none; }
.uwapp-brand .app-logo { border-radius: 8px; }
.uwapp-platform { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: #64748b; text-decoration: none; padding-inline-start: .9rem; border-inline-start: 1px solid #e5e7eb; }
.uwapp-platform svg { border-radius: 5px; }
.uwapp-spacer { flex: 1; }
.uwapp-help { font-weight: 600; text-decoration: none; color: color-mix(in srgb, var(--app-accent) 85%, #000); }
.uwapp-bar .lang-switch { margin: 0; }
.uwapp-root { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; outline: none; }
.uwapp-loading { margin: auto; color: #64748b; }
.uwapp-noscript { max-width: 40rem; margin: 2rem auto; padding: 1.25rem 1.5rem; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; }
@media (max-width: 640px) {
  .uwapp-platform span, .uwapp-name { display: none; }
  .app-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .app-hero-shot img { transform: none; }
  .tut-pager { grid-template-columns: 1fr; }
}
@media (max-width: 900px) { .app-hero-grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .app-launch, .app-thumb, .app-card, .app-hero-shot img { transition: none; transform: none !important; } }
