/* Docshar — home page (#homeView): hero, category panels, tool tiles, search, chips. */

/* ---------- Home: hero mesh, cards with gradient surfaces, glow, spotlight & animated border ---------- */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.hero-mesh { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.hero-mesh::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(99,102,241,.22) 1px, transparent 1.4px); background-size: 22px 22px; -webkit-mask-image: radial-gradient(70% 90% at 70% 10%, #000, transparent 75%); mask-image: radial-gradient(70% 90% at 70% 10%, #000, transparent 75%); }
.hero-blob { position: absolute; border-radius: 50%; will-change: transform; animation: blob-drift 18s ease-in-out infinite alternate; }
.hero-blob.b1 { width: 560px; height: 560px; left: -160px; top: -240px; background: radial-gradient(circle, rgba(129,140,248,.42), transparent 66%); }
.hero-blob.b2 { width: 500px; height: 500px; right: -120px; top: -170px; background: radial-gradient(circle, rgba(232,121,249,.28), transparent 66%); animation-duration: 23s; animation-delay: -7s; }
.hero-blob.b3 { width: 420px; height: 420px; left: 42%; top: 40px; background: radial-gradient(circle, rgba(56,189,248,.2), transparent 66%); animation-duration: 27s; animation-delay: -13s; }
@keyframes blob-drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(46px, 28px) scale(1.08); } 100% { transform: translate(-34px, 18px) scale(.94); } }
.hero-float { animation: hero-float 7s ease-in-out infinite; }
.hero-badge { animation: badge-float 5.5s ease-in-out infinite; }
@keyframes hero-float { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-9px) rotate(-1.2deg); } }
@keyframes badge-float { 0%, 100% { transform: translateY(0) rotate(6deg); } 50% { transform: translateY(-7px) rotate(10deg); } }

/* ---------- Home: category panels + square tool tiles ----------
   --T = tile size. On desktop it is sized so 9 tiles + 2 panels fill a row exactly
   (overhead: 7 tile gaps + 2 panels x (2 padding + 2 border) + 1 panel gap = 126px). */
#homeSections { container-type: inline-size; --g: 8px; --p: 13px; --G: 14px; --T: calc((100cqi - 126px) / 9 - .3px); }
@media (max-width: 999px) { #homeSections { --T: calc((100cqi - 68px) / 6 - .3px); } }
.cat-flow { display: flex; flex-wrap: wrap; gap: var(--G); align-items: stretch; }
.cat-panel {
  --n: 3; position: relative; min-width: 0; box-sizing: border-box;
  flex: var(--n) 1 calc(var(--n) * var(--T) + (var(--n) - 1) * var(--g) + 2 * var(--p) + 2px);
  padding: 11px var(--p) var(--p); border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--c) 24%, #e2e8f0);
  background: linear-gradient(180deg, color-mix(in srgb, var(--t) 80%, #fff) 0%, color-mix(in srgb, var(--t) 38%, #fff) 100%);
  box-shadow: inset 0 4px 0 var(--c), 0 1px 2px rgba(15,23,42,.04), 0 12px 28px -20px color-mix(in srgb, var(--c) 55%, transparent);
}
@media (min-width: 1000px) { .cat-flow > .cat-panel:last-child:not(:first-child) { flex-grow: 0; } }
.cat-panel.pop { flex-basis: 100%; border-color: #c7d2fe;
  background: linear-gradient(115deg, rgba(238,242,255,.98), rgba(255,255,255,.85) 45%, rgba(253,244,255,.98));
  box-shadow: inset 0 4px 0 #6366f1, 0 14px 34px -22px rgba(79,70,229,.45); }
.tile-grid { display: grid; gap: var(--g); grid-template-columns: repeat(auto-fill, var(--T)); }
.cat-panel.pop .tile-grid { justify-content: space-between; }
@media (max-width: 639px) {
  #homeSections { --p: 11px; --G: 12px; }
  .cat-panel { flex-basis: 100%; border-radius: 16px; }
  /* 3 equal squares per row; a partial last row is centred so no tile sits alone at the left edge */
  .tile-grid { display: flex; flex-wrap: wrap; justify-content: center; }
  .tile-grid > .tool-cell { flex: 0 0 calc((100% - 2 * var(--g)) / 3); }
  .cat-panel.pop .tile-grid { justify-content: center; }
}
/* panel header */
.sec-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 11px; min-width: 0; }
.sec-ico { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 62%, #fff), var(--c)); box-shadow: 0 5px 12px -4px color-mix(in srgb, var(--c) 70%, transparent); }
.sec-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; color: color-mix(in srgb, var(--c) 45%, #18181b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-sub { font-size: 12px; line-height: 1.3; color: #64748b; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-count { flex-shrink: 0; font-size: 11px; font-weight: 700; line-height: 1; padding: 5px 9px; border-radius: 999px; color: var(--c); background: #fff;
  border: 1px solid color-mix(in srgb, var(--c) 28%, #fff); white-space: nowrap; }

/* square tile */
.tool-cell {
  position: relative; aspect-ratio: 1; min-width: 0; border-radius: 16px; container: tile / inline-size;
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  animation: card-in .55s cubic-bezier(.2,.8,.2,1) backwards; animation-delay: calc(min(var(--i, 0), 30) * 22ms);
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.94); } }
/* animated conic gradient ring, revealed through the card's transparent border on hover */
.tool-cell::before {
  content: ""; position: absolute; inset: -1px; border-radius: 17px; opacity: 0; transition: opacity .3s;
  background: conic-gradient(from var(--ang), var(--c), #a78bfa, #f472b6, #fbbf24, var(--c));
}
.tool-cell:hover::before, .tool-cell:focus-within::before { opacity: 1; animation: ring-spin 2.8s linear infinite; }
@keyframes ring-spin { to { --ang: 360deg; } }
.tool-cell:hover { transform: translateY(-4px); }
.tool-card {
  position: relative; z-index: 1; isolation: isolate; overflow: hidden; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  justify-content: flex-start; gap: clamp(6px, 7cqi, 10px); padding: clamp(12px, 17cqi, 30px) 8px 8px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--c) 18%, #e2e8f0);
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--t) 85%, #fff) 0%, #fff 62%) padding-box;
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 14px -9px color-mix(in srgb, var(--c) 45%, transparent);
  transition: box-shadow .3s, border-color .3s;
}
.tool-cell:hover .tool-card, .tool-card:focus-visible { border-color: transparent; box-shadow: 0 2px 4px rgba(15,23,42,.05), 0 18px 30px -14px color-mix(in srgb, var(--c) 62%, transparent); }
.tool-card:focus-visible { outline: none; }
/* spotlight that follows the pointer (--mx/--my set from a delegated pointermove) */
.tool-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(130px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--c) 18%, transparent), transparent 70%);
}
.tool-cell:hover .tool-card::before { opacity: 1; }
/* shine sweep */
.tool-card::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 60%; pointer-events: none;
  background: linear-gradient(105deg, transparent 15%, rgba(255,255,255,.75) 50%, transparent 85%);
  transform: translateX(-140%) skewX(-14deg);
}
.tool-cell:hover .tool-card::after { transform: translateX(260%) skewX(-14deg); transition: transform .85s cubic-bezier(.3,.7,.3,1); }
/* base icon tile (also used on the tool page header) */
.tool-ico { width: 44px; height: 44px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; background: var(--t); color: var(--c); transition: transform .25s; }
.tool-card .tool-ico {
  width: clamp(36px, 37cqi, 54px); height: clamp(36px, 37cqi, 54px); border-radius: clamp(11px, 11cqi, 16px); flex-shrink: 0; color: #fff;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 62%, #fff), var(--c) 58%, color-mix(in srgb, var(--c) 82%, #000));
  box-shadow: 0 7px 14px -5px color-mix(in srgb, var(--c) 75%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.tool-card .tool-ico svg { width: 46%; height: 46%; }
.tool-cell:hover .tool-card .tool-ico { transform: translateY(-2px) rotate(-8deg) scale(1.1); animation: ico-wiggle .65s cubic-bezier(.34,1.56,.64,1); }
@keyframes ico-wiggle { 0% { transform: none; } 35% { transform: translateY(-6px) rotate(-14deg) scale(1.14); } 65% { transform: translateY(0) rotate(4deg) scale(1.06); } 100% { transform: translateY(-2px) rotate(-8deg) scale(1.1); } }
.tool-name {
  font-weight: 700; font-size: clamp(11.5px, 10.4cqi, 14px); line-height: 1.2; letter-spacing: -.01em; color: #18181b;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%;
}
.tool-desc { display: none; font-size: 11px; line-height: 1.3; color: #64748b; max-width: 100%; }
@container tile (min-width: 150px) { .tool-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } }
.tool-go {
  position: absolute; right: 7px; top: 7px; width: 22px; height: 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff);
  opacity: 0; transform: translate(-6px, 6px); transition: opacity .25s, transform .35s cubic-bezier(.34,1.56,.64,1);
}
.tool-cell:hover .tool-go, .tool-card:focus-visible .tool-go { opacity: 1; transform: none; }
/* featured tile (PDF Editor) */
.tool-card.featured {
  border-color: transparent; background: linear-gradient(115deg, #4f46e5, #7c3aed 35%, #c026d3 60%, #7c3aed 80%, #4f46e5) padding-box;
  background-size: 280% 100%; animation: feat-flow 9s ease-in-out infinite;
  box-shadow: 0 10px 24px -8px rgba(124,58,237,.6), inset 0 1px 0 rgba(255,255,255,.2);
}
.tool-card.featured .tool-name { color: #fff; }
.tool-card.featured .tool-desc { color: rgba(255,255,255,.8); }
.tool-card.featured .tool-go { color: #fff; background: rgba(255,255,255,.22); }
.tool-cell:hover .tool-card.featured { box-shadow: 0 16px 34px -10px rgba(147,51,234,.7), inset 0 1px 0 rgba(255,255,255,.2); }
@keyframes feat-flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.tool-card.featured .tool-ico { background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); color: #fff; }
.tool-card.featured::before { background: radial-gradient(130px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.28), transparent 70%); }
.tool-card.featured::after { animation: shine-auto 5s ease-in-out 1.4s infinite; }
@keyframes shine-auto { 0%, 62% { transform: translateX(-140%) skewX(-14deg); } 88%, 100% { transform: translateX(260%) skewX(-14deg); } }
/* search */
#toolSearch { border-color: #7c3aed; transition: box-shadow .3s, border-color .2s; }
#toolSearch:hover { box-shadow: 0 8px 22px -10px rgba(124,58,237,.45); }
#toolSearch:focus { outline: none; border-color: #6d28d9; animation: search-glow 2.6s ease-in-out infinite; box-shadow: 0 0 0 4px rgba(124,58,237,.2), 0 8px 24px -8px rgba(124,58,237,.35); }
@keyframes search-glow { 0%, 100% { box-shadow: 0 0 0 4px rgba(124,58,237,.18), 0 8px 24px -8px rgba(124,58,237,.3); } 50% { box-shadow: 0 0 0 6px rgba(139,92,246,.26), 0 10px 32px -6px rgba(168,85,247,.45); } }
/* chips */
.cat-chip { transition: transform .2s, box-shadow .2s, border-color .2s, background-color .2s; }
.cat-chip:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 40%, #fff); background-color: color-mix(in srgb, var(--t) 70%, #fff); box-shadow: 0 8px 16px -10px color-mix(in srgb, var(--c) 70%, transparent); }
.cat-chip .chip-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.cat-chip[data-on="true"] { background: #18181b; color: #fff; border-color: #18181b; }
.hero-sheet { position: absolute; width: 190px; height: 240px; background: #fff; border-radius: 14px; box-shadow: 0 20px 40px -12px rgba(15,23,42,.25); clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 34px, 100% 100%, 0 100%); padding: 22px 20px; }
.hero-line { height: 7px; border-radius: 4px; background: #e2e8f0; margin-bottom: 10px; }
@media (prefers-reduced-motion: reduce) {
  #homeView *, #homeView *::before, #homeView *::after { animation: none !important; transition-duration: .01ms !important; }
  #homeView .tool-cell:hover, #homeView .cat-chip:hover { transform: none; }
}

