/* usefulweb 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).
   Site tokens (styles.css) give light and dark themes; the workspace keeps each app's own theme and only the platform
   top bar (.uwapp-bar) follows the site theme. 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; }
.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; min-height: 44px; padding: .7em 1.3em; border-radius: var(--r-pill, 999px); background: var(--app-gradient); color: #fff !important; font-weight: 700; text-decoration: none; border: 0; box-shadow: 0 6px 18px color-mix(in srgb, var(--app-accent) 30%, 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) 40%, transparent); }
.app-launch:focus-visible, .app-more:focus-visible, .app-thumb:focus-visible { outline: 3px solid var(--focus-color, #b45309); outline-offset: 3px; }
.app-launch-xl { font-size: 1.15rem; padding: .85em 1.6em; }
.app-more { display: inline-flex; align-items: center; min-height: 44px; padding: .65em 1.1em; border-radius: var(--r-pill, 999px); border: 1.5px solid var(--accent-line); color: var(--accent-text); font-weight: 600; text-decoration: none; background: var(--surface); }
.app-more:hover { border-color: var(--accent-text); color: var(--accent-text); background: var(--accent-tint); }

/* ---------- 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, rgb(255 255 255 / .2), transparent); pointer-events: none; }
:root[data-theme="dark"] .app-hero::before { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / .28); pointer-events: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .app-hero::before { content: ""; position: absolute; inset: 0; background: rgb(0 0 0 / .28); 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-hero :focus-visible { outline-color: #fff; }
.app-kicker { display: flex; align-items: center; gap: .75rem; margin: 0 0 .75rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; font-size: .85rem; }
.app-kicker .app-logo { border-radius: 14px; box-shadow: 0 6px 18px rgb(0 0 0 / .25); background: #fff; }
.app-title { margin: 0; font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -.025em; color: #fff; }
.app-wordmark { display: block; max-width: min(420px, 100%); height: auto; filter: drop-shadow(0 4px 14px rgb(0 0 0 / .2)); }
.app-tagline { font-size: clamp(1.15rem, 2.2vw, 1.45rem); font-weight: 600; margin: .9rem 0 .5rem; }
.app-lede { max-width: 38em; }
.app-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0 1.25rem; } /* right under the tagline: the primary action is above the fold on phones (docs/PERFORMANCE.md) */
.app-hero .app-launch { background: #fff; color: #111827 !important; }
.app-hero .app-more { background: transparent; color: #fff; border-color: rgb(255 255 255 / .7); }
.app-hero .app-more:hover { background: rgb(255 255 255 / .12); color: #fff; }
.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 rgb(2 6 23 / .45); border: 1px solid rgb(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-top: clamp(1.75rem, 4vw, 3rem); }
.app-section > h2 { font-size: var(--fs-2xl, 1.7rem); margin-bottom: .5rem; }
.app-section > h2::after { content: ""; display: block; width: 48px; height: 4px; margin-top: .5rem; 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-gallery li { margin: 0; }
.app-thumb { display: block; border-radius: var(--r-lg, 14px); overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.app-thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.app-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--surface-2); }
.app-thumb-caption { display: block; padding: .6rem .85rem; font-size: .9rem; color: var(--ink-2); }
.app-lightbox { display: none; }
.app-lightbox:target { display: grid; position: fixed; inset: 0; z-index: 50; place-items: center; padding: 3vh 3vw; background: rgb(2 6 23 / .88); }
.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 rgb(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: rgb(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: rgb(255 255 255 / .28); color: #fff; }
.lb-nav a:focus-visible { outline-color: #fff; }

/* 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 { margin: 0; padding: 1.15rem 1.15rem 1.05rem; border-radius: var(--r-lg, 14px); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.app-features h3 { margin: .65rem 0 .3rem; font-size: 1.05rem; }
.app-features p { margin: 0; color: var(--ink-2); 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 { margin: 0; padding: 1rem 1.1rem; border-radius: var(--r-lg, 14px); border: 1px dashed var(--accent-line); background: var(--accent-tint); }
.app-templates h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.app-templates p { color: var(--ink-2); }

/* for AI agents */
.app-tool-list { padding-inline-start: 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-faq { border: 1px solid var(--line); border-radius: var(--r-md, 10px); padding: .75rem 1rem; margin: .5rem 0; background: var(--surface); }
.app-faq summary { font-weight: 600; }
.app-faq p { margin: .5rem 0 0; color: var(--ink-2); }

/* tutorials */
.app-tutorials { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; counter-reset: tut; }
.app-tutorials li { margin: 0; }
.app-tutorials a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: .9rem; padding: .95rem 1.05rem; border-radius: var(--r-lg, 14px); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: inherit; box-shadow: var(--shadow-1); 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(--accent-line); box-shadow: var(--shadow-2); }
.tut-title { font-weight: 700; color: var(--accent-text); }
.tut-desc { color: var(--ink-2); 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: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tut-level[data-level="beginner"] { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.tut-level[data-level="intermediate"] { background: var(--info-bg); color: var(--primary-text); border-color: var(--info-line); }
.tut-level[data-level="advanced"] { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.app-tutorial .blog-content img { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); 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: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md, 12px); text-decoration: none; background: var(--surface); }
.tut-pager a:hover { border-color: var(--accent-line); }
.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: var(--fs-2xl, 2rem); margin: 0; }
.app-showcase-head .lede { margin-top: .4rem; color: var(--ink-2); }
.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 > li { margin: 0; }
.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: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--accent-line); }
.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 rgb(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); text-decoration: none; }
.app-card-head h2 a:hover, .app-card-head h3 a:hover { color: var(--accent-text); text-decoration: underline; }
.app-card-head .app-logo { border-radius: 12px; flex: none; }
.app-card-kind { margin: 0; font-size: .85rem; font-weight: 600; color: var(--accent-text); }
.app-card-tagline { margin: .7rem 0 .4rem; color: var(--ink-2); }
.app-highlights { margin: .2rem 0 .8rem; padding: 0; list-style: none; display: grid; gap: .3rem; }
.app-highlights li { position: relative; margin: 0; padding-inline-start: 1.5rem; font-size: .95rem; color: var(--ink-2); }
.app-highlights li::before { content: "✓"; position: absolute; inset-inline-start: 0; font-weight: 800; color: var(--accent-text); }
.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): keeps the app's own theme; the platform bar follows the site theme ---------- */
:root.uwapp-html { color-scheme: light; }
.uwapp-html, .uwapp-body { height: 100%; }
.uwapp-body { margin: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: #f8fafc; color: #0f172a; }
.uwapp-bar { display: flex; align-items: center; gap: .9rem; height: 48px; padding: 0 .9rem; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); flex: none; }
.uwapp-brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.uwapp-brand .app-logo { border-radius: 8px; }
.uwapp-platform { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); text-decoration: none; padding-inline-start: .9rem; border-inline-start: 1px solid var(--line); }
.uwapp-platform svg { border-radius: 5px; }
.uwapp-bar a:hover { color: var(--accent-text); }
.uwapp-spacer { flex: 1; }
.uwapp-help { font-weight: 600; text-decoration: none; color: var(--accent-text); }
.uwapp-bar .lang-switch { margin: 0; }
.uwapp-bar .lang-switch select { min-height: 32px; padding-block: 3px; }
.uwapp-bar .lang-switch .lang-apply { min-height: 32px; padding-block: 3px; }
.uwapp-bar button { min-height: 32px; }
.uwapp-root { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; outline: none; }
.uwapp-loading { margin: auto; color: #4b5563; }
.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 { display: none; }
  /* Narrow phones (320–390 px): the language select ("Automatic (English)") pushed the bar past the viewport. */
  .uwapp-bar { gap: .5rem; padding: 0 .6rem; }
  .uwapp-platform { padding-inline-start: .5rem; }
  .uwapp-bar .lang-switch { min-width: 0; flex: 0 1 auto; }
  .uwapp-bar .lang-switch select { min-width: 0; max-width: 8.5rem; text-overflow: ellipsis; }
  /* Visually hidden but still the link's accessible name (axe link-name). */
  .uwapp-name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .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; } }
@media print { .app-launch, .app-more, .app-lightbox { display: none !important; } .app-hero { background: none; color: #000; } .app-hero a, .app-title { color: #000; } }

/* "Built-in tools" on the app landing page (app-pages.ts): the app's toolIds with their pages. */
.app-builtin-tools { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.app-builtin-tools > li { padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md, 10px); background: var(--surface); }
.app-builtin-tools > li > a { font-weight: 700; }
.app-builtin-tagline { display: block; margin-top: .25rem; color: var(--ink-2); font-size: .95rem; }
.app-tool-badge { display: inline-block; margin-inline-start: .35rem; padding: 0 .45rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); font-size: .78rem; line-height: 1.6; vertical-align: middle; }
