/* Page layout and the demo's own composition, adapted from the defuss-vectorsearch site. Colours, radii and shadows come
   from defuss-shadcn tokens, except the sticky-note paper, which has no token. */
@layer components {
  /* the base reset the defuss-shadcn docs site applies (docs-theme.css), which its Landing Page template assumes */
  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; line-height: 1.6; background: var(--background); color: var(--foreground); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
  /* component rules set display, which would otherwise beat the hidden attribute */
  [hidden] { display: none !important; }
  /* the header is a direct child of the page, so it stays sticky over every section, not only the hero */
  .ls-page { overflow-x: clip; }
  .ls-main { display: flex; flex-direction: column; gap: clamp(5rem, 11vw, 9rem); padding-block-end: clamp(5rem, 11vw, 9rem); }
  .ls-section { width: 100%; max-width: 76rem; padding-inline: 1rem; scroll-margin-top: 5rem; }
  .ls-icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .ls-icon-fill { fill: currentColor; stroke: none; }
  .mk-hero-note a, .mk-footer-copy a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
  /* the hero's long intro: three columns of muted prose under the CTA, so the buttons stay above the fold */
  .ls-intro { display: grid; gap: 2rem 2.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    width: 100%; max-width: 64rem; margin: clamp(5.5rem, 13vw, 10rem) auto 0; padding-inline: 1.25rem; text-align: start; }
  .ls-intro-item { display: flex; flex-direction: column; gap: .5rem; }
  .ls-intro-icon { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: var(--radius-xl); font-size: 2.25rem;
    color: var(--foreground); background: color-mix(in oklch, var(--chart-2) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--chart-2) 35%, transparent); }
  .ls-intro h3 { margin: .25rem 0 0; font-size: .9375rem; font-weight: 600; }
  .ls-intro p { margin: 0; font-size: .8125rem; line-height: 1.6; color: var(--muted-foreground); text-wrap: pretty; }
  .ls-intro code { font-family: var(--font-mono); font-size: .9em; }
  .ls-intro a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
  .ls-ext { width: .75em; height: .75em; margin-inline-start: .15em; vertical-align: -.05em; opacity: .75; }
  .ls-flip { margin: 0; font-size: clamp(1.5rem, 4.5vw, 2.5rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
  .ls-accent { background: linear-gradient(90deg, var(--chart-1), var(--chart-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }

  /* the demo window */
  .ls-window {
    display: flex; flex-direction: column; gap: 1.25rem; margin-block-start: 2.5rem; padding: clamp(.75rem, 2.5vw, 1.5rem);
    background-color: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow-2xl),
      0 30px 80px -30px color-mix(in oklch, var(--chart-2) 45%, transparent);
  }
  .ls-boot-body { display: grid; gap: 1.25rem 1.75rem; grid-template-columns: auto 1fr; align-items: center; }
  .ls-ring { --size: 7.5rem; }
  .ls-phases { display: flex; flex-direction: column; gap: .875rem; min-width: 0; }
  .ls-phases .progress-label { display: inline-flex; align-items: center; gap: .4rem; }
  .ls-stats { grid-column: 1 / -1; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
  .ls-stats .statistic { padding: .75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: color-mix(in oklch, var(--muted) 45%, transparent); }
  .ls-stats .statistic-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  /* a figure the worker has not reported yet */
  :is(.statistic-value, .mk-stat-value):empty::before { content: "\2013"; color: var(--muted-foreground); }
  .ls-boot-foot { flex-direction: column; align-items: stretch; gap: .75rem; }
  .ls-log { max-height: 13rem; overflow-y: auto; overscroll-behavior: contain; }
  @container (max-width: 34rem) { .ls-boot-body { grid-template-columns: 1fr; justify-items: center; } .ls-phases, .ls-stats { justify-self: stretch; } }
  .ls-boot { container-type: inline-size; }

  /* query row */
  .ls-query { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; scroll-margin-top: 6rem; }
  .ls-search { flex: 1 1 26rem; min-width: 0; }
  .ls-query .mk-search-box { max-width: none; } /* the block caps the large bar at 44rem; the demo row is wider */
  .ls-search form { width: 100%; }
  .ls-search .search-box { flex: 1; min-width: 0; }
  .ls-cta { padding-block: clamp(2rem, 6vw, 4rem); min-width: 0; }
  /* a long example (a path) wraps instead of widening the CTA past a phone screen */
  .ls-cta .mk-empty-state-actions { max-width: 100%; }
  .ls-cta #examples .btn { white-space: normal; height: auto; min-height: 2rem; padding-block: .375rem; text-align: start; max-width: 100%; }

  /* results: an ordered grid; each card keeps its passage id as a view-transition name, so re-ranks glide */
  .ls-results { list-style: none; margin: 0; padding: 0; --layout-min: 17rem; position: relative; }
  .ls-hit { view-transition-class: ls-hit; min-width: 0; }
  .ls-hit .card { height: 100%; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, opacity .25s ease; }
  .ls-hit .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .ls-hit > .aura { height: 100%; }
  .ls-hit .card-header .ls-gold { margin-inline-start: auto; }
  .ls-gold.aura { display: inline-grid; }
  .ls-hit .card-header { flex-direction: row; align-items: center; gap: .625rem; flex-wrap: wrap; }
  .ls-rank { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
  .ls-hit .card-title { font-size: .9375rem; }
  .ls-hit .card-description { font-family: var(--font-mono); font-size: .75rem; }
  .ls-hit .card-footer { gap: .75rem; }
  .ls-score { font-family: var(--font-mono); font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
  .ls-hit[data-gold] .card { border-color: color-mix(in oklch, var(--chart-2) 70%, var(--border)); box-shadow: 0 0 0 1px color-mix(in oklch, var(--chart-2) 45%, transparent), 0 12px 32px -16px color-mix(in oklch, var(--chart-2) 70%, transparent); }
  .ls-skeleton { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem; min-height: 10rem; }

  /* searching: cards dim and a light beam sweeps the grid */
  .ls-results[aria-busy="true"] .ls-hit .card { opacity: .55; }
  .ls-results::after {
    content: ""; position: absolute; inset: -.5rem; pointer-events: none; opacity: 0; border-radius: var(--radius-xl);
    background: linear-gradient(105deg, transparent 35%, color-mix(in oklch, var(--chart-1) 28%, transparent) 50%, transparent 65%);
    background-size: 250% 100%; transition: opacity .2s ease;
  }
  .ls-results[aria-busy="true"]::after { opacity: 1; animation: ls-scan .9s linear infinite; }
  @keyframes ls-scan { from { background-position: 120% 0; } to { background-position: -20% 0; } }

  ::view-transition-group(*.ls-hit) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }

  /* between the intro and the demo: the viewport-high stage shows only its middle band, so pull its empty
     top and bottom into the neighbouring gaps */
  .ls-flythrough { padding-inline: 1rem; margin-block: calc(-1 * clamp(4rem, 12vh, 9rem)); }
  .ls-flythrough .parallax-stage { clip-path: inset(max(0px, calc((100dvh - 28rem) / 2)) 0 round var(--radius-xl)); }
  .ls-fly-word { margin: 0; font-size: clamp(3rem, 10vw, 6rem); font-weight: 800; letter-spacing: -.04em; background: linear-gradient(90deg, #9db2ff, #e3a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }

  /* two ways in: side by side with a vertical separator, stacked with a horizontal one */
  .ls-ways { display: flex; gap: 2.5rem; margin-block-start: 2.5rem; }
  .ls-way { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1.5rem; }
  .ls-way-title { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.25rem; font-weight: 600; }
  .ls-way-desc { margin: 0; color: var(--muted-foreground); }
  .ls-way .mk-code-block { margin: 0; }
  /* a half-width column: wrap instead of cutting, with continuation lines hanging past the 2rem + 1rem number column */
  .ls-way .mk-code-block code > span { white-space: pre-wrap; overflow-wrap: anywhere; padding-inline-start: 3rem; text-indent: -3rem; }
  .ls-sep-horizontal { display: none; }
  @media (max-width: 56rem) {
    .ls-ways { flex-direction: column; }
    .ls-sep-vertical { display: none; }
    .ls-sep-horizontal { display: block; width: 100%; margin: 0; }
  }
  .ls-prompt { position: relative; }
  .ls-prompt .mockup-code { margin: 0; }
  .ls-prompt-copy { position: absolute; inset-block-start: .3rem; inset-inline-end: .5rem; }
  /* tab 2: notes board beside the notes search on wide screens, stacked on narrow ones */
  .ls-tabs .tab-list { margin-block-end: 1.25rem; }
  .ls-notes-layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); height: clamp(38rem, 75vh, 48rem); }
  .ls-board { position: relative; display: flex; flex-direction: column; gap: .75rem; height: 100%; min-width: 0; overflow: hidden; }
  .ls-board-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
  .ls-board-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
  .ls-notes-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .5rem .25rem 1rem; }
  .ls-notes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr)); }
  .ls-notes-search { display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; min-width: 0; }
  @media (max-width: 56rem) { .ls-notes-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 30rem auto; height: auto; } }

  /* a yellow sticky note: paper colours have no token, so they are literals here (the tokens stay for the UI) */
  .ls-note {
    --ls-note-paper: oklch(0.95 0.12 100); --ls-note-ink: oklch(0.28 0.04 85); --ls-note-pulse: oklch(0.78 0.17 85 / .85);
    position: relative; display: flex; flex-direction: column; gap: .375rem; padding: .75rem .875rem .625rem;
    background: var(--ls-note-paper); color: var(--ls-note-ink); border-radius: 2px 2px 1.25rem 2px;
    box-shadow: var(--shadow-md); rotate: -.6deg; overflow: hidden;
  }
  .ls-note:nth-child(even) { rotate: .5deg; }
  .ls-note:focus-within { outline: 2px solid oklch(0.62 0.15 80); outline-offset: 2px; }
  .ls-note-label { font-size: .75rem; font-weight: 600; letter-spacing: .02em; opacity: .7; }
  .ls-note .textarea { min-height: 6.5rem; padding: 0; border: 0; background: transparent; color: inherit; box-shadow: none; resize: vertical; font-size: .9375rem; line-height: 1.5; }
  .ls-note .textarea:focus-visible { outline: none; box-shadow: none; }
  .ls-note .textarea::placeholder { color: color-mix(in oklch, var(--ls-note-ink) 50%, transparent); }
  .ls-note-status { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; min-height: 1.5rem; margin: 0; font-size: .75rem; }
  .ls-note-status .spinner { width: 1rem; height: 1rem; }
  .ls-note-time { font-family: var(--font-mono); opacity: .8; white-space: nowrap; }
  .ls-note::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s ease;
    background: linear-gradient(105deg, transparent 35%, oklch(1 0 0 / .65) 50%, transparent 65%); background-size: 250% 100%;
  }
  .ls-note[aria-busy="true"]::after { opacity: 1; animation: ls-scan .9s linear infinite; }

  /* footer ad: a leaf-cornered panel with a squircle portrait in a gold halo */
  .ls-ad {
    --shape-round: 2rem; display: flex; flex-direction: column; gap: .875rem; padding: 1.25rem;
    border: 1px solid var(--border); box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, color-mix(in oklch, var(--chart-1) 16%, var(--card)), var(--card) 65%);
  }
  .ls-ad-head { display: flex; align-items: center; gap: .875rem; }
  .ls-ad-portrait { width: 5.5rem; flex: none; }
  /* the ad is the footer's widest column on large screens */
  @media (min-width: 64rem) { .ls-footer-nav.mk-footer-nav { grid-template-columns: 1fr 1fr 1fr 1.8fr; } }
  .ls-ad-portrait img { display: block; width: 100%; height: auto; }
  .ls-ad-name { margin: 0; font-size: 1.25rem; font-weight: 600; color: var(--foreground); }
  .ls-ad-role { margin: 0; font-size: .8125rem; line-height: 1.5; color: var(--muted-foreground); }
  .ls-ad .btn { align-self: flex-start; }
  .ls-cta-portrait { width: 4rem; flex: none; }
  .ls-cta-portrait img { display: block; width: 100%; height: auto; }

  .ls-inline-link { height: auto; padding: 0; font-size: inherit; vertical-align: baseline; }

  /* demo tabs: bigger, centred, an icon and a two-line label (title + what it holds) */
  .ls-tabs .tab-list { width: fit-content; max-width: 100%; margin-inline: auto; scroll-margin-top: 6rem; }
  .ls-tab { display: flex; align-items: center; gap: .75rem; height: auto; padding-block: .625rem; text-align: start; white-space: normal; overflow: visible; }
  .ls-tab-icon { width: 1.75rem; height: 1.75rem; flex: none; }
  .ls-tab-title { display: block; font-weight: 600; line-height: 1.25; }
  .ls-tab-desc { display: block; font-size: .75rem; font-weight: 400; line-height: 1.3; color: var(--muted-foreground); }

  /* consulting CTA: a leaf-cornered mesh panel; portrait + heading, then the wider text column, then the action */
  .ls-consult { --shape-round: 3rem; overflow: hidden; border: 1px solid var(--border); background-color: var(--card); }
  .ls-consult .mk-cta, .ls-consult .mk-cta[data-variant] { background: transparent; }
  .ls-consult .mk-cta[data-variant] .mk-cta-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: center; gap: 1.25rem 2rem; text-align: start;
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1.5rem, 3vw, 2.5rem); background: transparent; border-radius: 0; }
  .ls-consult .mk-cta[data-variant] .mk-cta-copy { display: contents; }
  .ls-consult .ls-cta-head { grid-column: 1; display: flex; align-items: center; gap: 1.25rem; }
  .ls-consult .mk-cta[data-variant] .mk-cta-title { margin: 0; font-size: clamp(1.25rem, 2.2vw, 1.625rem); }
  .ls-consult .mk-cta[data-variant] .mk-cta-desc { grid-column: 2; margin: 0; font-size: .875rem; }
  .ls-consult .mk-cta[data-variant] .mk-cta-actions { grid-column: 3; justify-content: flex-end; }
  @media (max-width: 56rem) {
    .ls-consult .mk-cta[data-variant] .mk-cta-inner { grid-template-columns: minmax(0, 1fr); }
    .ls-consult .ls-cta-head, .ls-consult .mk-cta[data-variant] .mk-cta-desc, .ls-consult .mk-cta[data-variant] .mk-cta-actions { grid-column: auto; justify-content: flex-start; }
  }

  /* "Use it": one leaf-cornered panel on a faint dot pattern */
  .ls-use {
    --shape-round: 3rem; --shape-ink: color-mix(in oklch, var(--foreground) 9%, transparent); --shape-pattern: 18px;
    padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--border);
    background-color: color-mix(in oklch, var(--card) 75%, transparent);
    box-shadow: var(--shadow-xl), 0 30px 80px -40px color-mix(in oklch, var(--chart-2) 45%, transparent);
  }
  .mk-stats-desc a { color: var(--foreground); text-decoration: underline; text-underline-offset: 2px; }
  .mk-stats-desc code { font-family: var(--font-mono); font-size: .875em; }

  /* search controls: match mode, switches and filters wrap as one row under the query */
  .ls-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; margin-block: 1rem 1.25rem; }
  .ls-control { display: flex; align-items: center; gap: .625rem; flex-wrap: wrap; }
  .ls-control-label { font-size: .8125rem; font-weight: 600; color: var(--muted-foreground); }
  .ls-control .toggle-group { flex-wrap: wrap; max-width: 100%; }
  .ls-switches { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
  .ls-switches .switch-item { display: inline-flex; align-items: center; gap: .4rem; font-size: .8125rem; }
  .ls-switches .switch:disabled + label { opacity: .5; }
  .ls-selects { display: flex; gap: .5rem; flex-wrap: wrap; }
  .ls-selects .select, .ls-board-actions .select { width: auto; }

  /* result cards: a highlighted excerpt, the matched terms and the exact-first tier */
  .ls-hit-head { display: flex; flex-direction: column; gap: .125rem; min-width: 0; flex: 1; }
  .ls-hit .card-description { overflow-wrap: anywhere; }
  .ls-path-hit { color: var(--chart-2); font-weight: 600; }
  .ls-excerpt { margin: 0; font-size: .875rem; line-height: 1.55; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden; }
  .ls-excerpt mark { padding: 0 .1em; border-radius: .2em; color: inherit; background: color-mix(in oklch, var(--chart-4) 38%, transparent); }
  .ls-field { margin-inline-end: .25rem; font-family: var(--font-mono); font-size: .6875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
  .ls-terms { display: flex; flex-wrap: wrap; gap: .375rem; margin: .75rem 0 0; padding: 0; list-style: none; }
  .ls-terms .badge { gap: .3em; font-family: var(--font-mono); font-weight: 500; }
  .ls-kind { font-family: var(--font-sans); color: var(--muted-foreground); }
  .ls-hit .card-footer { flex-wrap: wrap; }
  .ls-source { margin-inline-start: auto; height: auto; padding: 0; }
  .ls-cmd-path { margin-inline-start: auto; padding-inline-start: 1rem; font-family: var(--font-mono); font-size: .6875rem; color: var(--muted-foreground); }

  /* how it works: the tier ladder under the diagram */
  .ls-tiers { display: flex; flex-direction: column; gap: .75rem; margin-block-start: 2.5rem; }
  .ls-tier-list { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; counter-reset: tier; }
  .ls-tier-list li { display: flex; align-items: baseline; gap: .75rem; font-size: .875rem; color: var(--muted-foreground); counter-increment: tier; }
  .ls-tier-list li::before { content: counter(tier); width: 1.25rem; flex: none; font-family: var(--font-mono); font-size: .75rem; text-align: end; }
  .ls-tier-list .badge { flex: none; min-width: 8.5rem; justify-content: center; }

  /* measured: the benchmark table */
  .ls-bench { margin: 0; align-self: start; aspect-ratio: auto; overflow: visible; background: var(--card); }
  .ls-bench .card-content { overflow-x: auto; }
  .ls-bench-table code { font-family: var(--font-mono); font-size: .8125rem; }
  .ls-bench-table .badge { margin-inline-start: .25rem; }
  .ls-bench-table th { text-align: start; vertical-align: top; white-space: nowrap; }
  .ls-bench-table td { vertical-align: top; }
  .ls-bench-table :is(th, td) { padding-inline: .5rem; }
  .ls-bench-table .ls-num { text-align: end; }
  .ls-num { text-align: end; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .ls-bench-wait { color: var(--muted-foreground); }
  @media (max-width: 40rem) { .ls-tier-list .badge { min-width: 7rem; } }

  @media (prefers-reduced-motion: reduce) {
    .ls-results[aria-busy="true"]::after, .ls-note[aria-busy="true"]::after { animation: none; }
    .ls-hit .card { transition: none; }
    ::view-transition-group(*.ls-hit) { animation: none; }
  }
  @media (prefers-contrast: more) {
    .ls-results[aria-busy="true"] .ls-hit .card { opacity: 1; }
    .ls-results::after { display: none; }
  }
  @media (forced-colors: active) {
    .ls-accent, .ls-fly-word { color: CanvasText; background: none; }
    .ls-hit[data-gold] .card { border: 2px solid Highlight; }
    .ls-results::after { display: none; }
  }
}
