/*
 * The site header, the app bar and the footer for the apps' static pages
 * (public/trawl and later ones). They copy the Next.js header and footer
 * (components/site/Header.tsx, Footer.tsx) value for value: same sizes,
 * spacing, colours and type. Change one, change the other.
 * Needs /brand/tokens.css first.
 */
:root {
  --cl-display: var(--font-bricolage), ui-sans-serif, system-ui, sans-serif;
  --cl-sans: var(--font-geist), ui-sans-serif, system-ui, sans-serif;
  --cl-mono: var(--font-geist-mono), ui-monospace, monospace;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.cl-header {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 70%, transparent);
  background: color-mix(in oklab, var(--background) 80%, transparent);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.cl-header__inner {
  max-width: 80rem; margin: 0 auto; height: 4rem; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.cl-logo {
  display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--foreground);
  font-family: var(--cl-display); font-size: 1.125rem; font-weight: 700; letter-spacing: -0.025em;
}
.cl-logo__tile {
  display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem;
  background: var(--foreground); color: var(--background); font-size: 0.875rem;
}
.cl-logo__labs { color: var(--muted-foreground); }

.cl-nav { display: none; align-items: center; gap: 0.25rem; }
.cl-nav a, .cl-menu__panel a {
  border-radius: 999px; padding: 0.5rem 1rem; font-size: 0.875rem; text-decoration: none;
  color: var(--muted-foreground); transition: background-color .15s, color .15s;
}
.cl-nav a:hover, .cl-menu__panel a:hover { background: var(--secondary); color: var(--foreground); }
.cl-nav a[aria-current="page"] { background: var(--secondary); color: var(--foreground); font-weight: 500; }

.cl-actions { display: flex; align-items: center; gap: 0.5rem; }
.cl-cta {
  display: none; border-radius: 999px; padding: 0.5rem 1.25rem; font-size: 0.875rem; font-weight: 500;
  background: var(--foreground); color: var(--background); text-decoration: none; transition: transform .15s;
}
.cl-cta:hover { transform: scale(1.03); }
.cl-icon-btn {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; min-height: 0;
  border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--foreground);
  cursor: pointer; transition: background-color .15s;
}
.cl-icon-btn:hover { background: var(--secondary); filter: none; transform: none; }
.cl-icon-btn svg { width: 1rem; height: 1rem; }
.cl-icon-btn .cl-sun { display: none; }
.dark .cl-icon-btn .cl-sun { display: block; }
.dark .cl-icon-btn .cl-moon { display: none; }

/* Products dropdown (a disclosure; /brand/theme.js closes it on Esc or a click outside). */
.cl-dd { position: relative; }
.cl-dd > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.25rem;
  border-radius: 999px; padding: 0.5rem 1rem; font-size: 0.875rem; color: var(--muted-foreground); transition: background-color .15s, color .15s;
}
.cl-dd > summary::-webkit-details-marker { display: none; }
.cl-dd > summary:hover, .cl-dd[open] > summary { background: var(--secondary); color: var(--foreground); }
.cl-dd > summary span { font-size: 0.75rem; transition: transform .15s; }
.cl-dd[open] > summary span { transform: rotate(180deg); }
.cl-dd__panel {
  position: absolute; left: 50%; top: calc(100% + 0.75rem); transform: translateX(-50%); width: 22rem;
  padding: 0.75rem; border: 1px solid var(--border); border-radius: 1.5rem; background: var(--card); box-shadow: var(--shadow-float);
}
.cl-nav .cl-dd__item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem; border-radius: 1rem; color: var(--foreground); }
.cl-dd__item img { width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; }
.cl-dd__item b { display: block; font-size: 0.875rem; font-weight: 600; }
.cl-dd__item span span { display: block; font-size: 0.75rem; color: var(--muted-foreground); }
.cl-nav .cl-dd__all { display: flex; justify-content: space-between; margin-top: 0.5rem; padding: 0.75rem 1rem; border-radius: 1rem; background: var(--secondary); color: var(--foreground); font-weight: 500; }

/* Phone menu: a disclosure, so it needs no script. */
.cl-menu { position: relative; }
.cl-menu > summary { list-style: none; }
.cl-menu > summary::-webkit-details-marker { display: none; }
.cl-menu__panel {
  position: absolute; right: 0; top: calc(100% + 0.75rem); width: min(18rem, calc(100vw - 3rem));
  display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem;
  border: 1px solid var(--border); border-radius: 1.5rem; background: var(--card);
  box-shadow: var(--shadow-float);
}
.cl-menu__panel .cl-menu__cta { margin-top: 0.5rem; background: var(--foreground); color: var(--background); text-align: center; font-weight: 500; }
.cl-menu__panel .cl-menu__cta:hover { background: var(--foreground); color: var(--background); }

@media (min-width: 640px) { .cl-cta { display: block; } }
@media (min-width: 768px) {
  .cl-nav { display: flex; }
  .cl-menu { display: none; }
}

/* ── App bar: an app's own pages, under the site header ─────────────── */
.app-bar { border-bottom: 1px solid var(--border); background: var(--card); }
.app-bar__inner {
  max-width: 80rem; margin: 0 auto; padding: 0 1.5rem; min-height: 3.25rem;
  display: flex; align-items: center; gap: 1.25rem; overflow-x: auto; scrollbar-width: none;
}
.app-bar__inner::-webkit-scrollbar { display: none; }
.app-bar__name {
  display: flex; align-items: center; gap: 0.6rem; flex: 0 0 auto; text-decoration: none; color: var(--foreground);
  font-family: var(--cl-display); font-weight: 700; font-size: 1rem;
}
.app-bar__name img { width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; }
.app-bar ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; flex: 0 0 auto; }
.app-bar li { margin: 0; }
.app-bar ul a {
  display: block; border-radius: 999px; padding: 0.4rem 0.85rem; font-size: 0.875rem; text-decoration: none;
  color: var(--muted-foreground); white-space: nowrap; transition: background-color .15s, color .15s;
}
.app-bar ul a:hover { background: var(--secondary); color: var(--foreground); }
.app-bar ul a[aria-current="page"] { background: var(--foreground); color: var(--background); }

/* ── Footer ─────────────────────────────────────────────────────────── */
.cl-footer { background: var(--ink); color: var(--ink-foreground); margin-top: 6rem; }
.cl-footer a { color: inherit; text-decoration: none; opacity: 0.6; }
.cl-footer a:hover { opacity: 1; }
.cl-footer__grid { max-width: 80rem; margin: 0 auto; padding: 3.5rem 1.5rem; display: grid; gap: 2.5rem; }
.cl-footer__brand p { margin: 0.75rem 0 0; max-width: 20rem; font-size: 0.875rem; opacity: 0.6; }
.cl-footer__logo { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-family: var(--cl-display); font-size: 1.125rem; font-weight: 700; }
.cl-footer__logo span { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; background: var(--ink-foreground); color: var(--ink); font-size: 0.875rem; }
.cl-footer__col { display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
.cl-footer__col h2 { margin: 0 0 0.25rem; font-family: var(--cl-mono); font-size: 0.75rem; font-weight: 400; letter-spacing: 0; text-transform: uppercase; opacity: 0.4; color: inherit; }
.cl-footer__base { max-width: 80rem; margin: 0 auto; padding: 1.5rem; border-top: 1px solid color-mix(in oklab, var(--ink-foreground) 10%, transparent); font-size: 0.75rem; opacity: 0.5; }
.cl-footer__base p { margin: 0 0 0.5rem; }
@media (min-width: 768px) { .cl-footer__grid { grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr; } }
