/* Tailend site header: one header for the homepage, blog and use-case pages.
   Markup source: blog-src/header.html (the blog and use-case builders read it;
   the homepage carries the same block between HEADER markers). Behaviour:
   /header.js. Uses each page's Dusk tokens. */
.site-head {
  --sh-h: 64px;
  --g-sh-rowhomes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.6 20.6 V8.4 H9.2 V20.6 M9.2 20.6 V6.2 H16.4 V20.6 M16.4 20.6 V9.2 H23.4 V20.6 M2 8.4 h7.8 M8.6 6.2 h8.4 M15.8 9.2 h8.2 M4.8 11.6 h2.2 M11.8 9.6 h2.2 M18.8 12.4 h2.2 M11.6 20.6 v-4.6 h2.6 v4.6 M1.6 20.8 Q12.6 20.4 24.4 20.8'/%3E%3C/svg%3E");
  --g-sh-tree: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.6 21 Q12.4 16.6 12.6 13 M12.6 15.6 Q10.8 14.4 9.6 13.2 M6.4 11.4 Q4.6 6.6 9.2 5.4 Q10.6 2.4 14.2 3.2 Q18.6 3.4 19 7.6 Q21.4 11.6 17 13 Q12.8 14.6 9.2 13.4 Q6.8 13 6.4 11.4z M9 21.2 Q12.6 20.8 16.2 21.2'/%3E%3C/svg%3E");
  --g-sh-door: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 20.6 V8.6 Q7.2 3.2 12.6 3.2 Q18 3.4 18.1 8.6 V20.6 M12.6 20.6 Q12.5 14 12.6 9.2 Q15 8.4 16.9 7.8 M14.6 14.2 h.2 M4.8 20.8 Q12.6 20.3 20.4 20.8'/%3E%3C/svg%3E");
  --g-sh-awning: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.2 9.4 L6.2 4.2 H19.6 L21.8 9.4 Q19.6 11.6 17.6 9.4 Q15.4 11.6 13.2 9.4 Q11 11.6 8.8 9.4 Q6.4 11.6 4.2 9.4z M5.4 10.6 V20.4 H20.6 V10.6 M11.2 20.4 V14.6 H14.8 V20.4 M16.6 13.4 h2.2 v2.4 h-2.2z'/%3E%3C/svg%3E");
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg, #fffefc) 94%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease;
  font-family: var(--text, "Instrument Sans", system-ui, sans-serif);
}
.site-head.is-scrolled { border-bottom-color: var(--line, #ebe7e0); box-shadow: 0 6px 18px -16px rgba(var(--shadow-rgb, 52, 40, 30), .5); }
.site-head .sh-inner { max-width: var(--wrap, 1320px); height: var(--sh-h); margin: 0 auto; padding: 0 var(--gutter, 16px); display: flex; align-items: center; gap: 24px; }
.site-head .sh-logo { display: inline-flex; align-items: center; gap: 9px; flex: none; text-decoration: none; color: var(--ink); }
.site-head .logo-mark { display: block; width: 28px; height: 28px; flex: none; position: relative; }
.site-head .logo-mark svg { display: block; width: 100%; height: 100%; }
/* Animated mark (header.js): a Rive canvas sits exactly over the static SVG.
   The SVG stays as the fallback; it hides only once the canvas has drawn. */
.site-head .logo-mark canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.site-head .logo-mark.is-live svg { visibility: hidden; }
/* First visit: the ring and dot wait for the intro. If the script never runs,
   they appear (without animating) after 2.5s. */
.logo-intro .site-head .logo-mark .lm-draw { opacity: 0; animation: te-logo-reveal 0s 2.5s forwards; }
@keyframes te-logo-reveal { to { opacity: 1; } }
.site-head .sh-word { font: 800 21px/1 "Bricolage Grotesque", var(--display); letter-spacing: -0.02em; }
.site-head .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; }

.site-head .sh-nav { flex: 1 1 auto; min-width: 0; }
.site-head .sh-links { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; }
.site-head .sh-links > li > a, .site-head .menu-btn {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; padding: 8px 12px; border-radius: 8px;
  font: 500 15px/1.2 var(--text); color: var(--ink-2); text-decoration: none; background: none; border: 0; cursor: pointer;
  transition: background-color .15s ease, color .15s ease; }
.site-head .sh-links > li > a:hover, .site-head .menu-btn:hover, .site-head .menu-btn[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
.site-head .sh-links > li > a[aria-current] { color: var(--ink); }
.site-head .sh-links > li { position: relative; }
.site-head .sh-links > li > a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent); border-radius: 8px 8px 2px 2px; }
.site-head a:focus-visible, .site-head button:focus-visible { outline: 2px solid var(--lead); outline-offset: 2px; }

.site-head .sh-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.site-head .sh-docs { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 10px; font: 600 15px/1.2 var(--text);
  background: var(--ink); color: var(--surface); text-decoration: none; transition: background-color .15s ease, transform .15s ease; }
.site-head .sh-docs:hover { background: var(--lead-hover); color: var(--on-lead); }
.site-head .sh-docs:active { transform: translateY(1px); }

/* Product menu */
.site-head .menu { position: relative; }
.site-head .menu-btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.site-head .menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.site-head .menu-pop { position: absolute; top: calc(100% + 12px); left: -8px; width: 300px; background: var(--surface); border-radius: 16px; padding: 8px;
  box-shadow: 0 0 0 1px var(--line), 0 18px 40px -18px rgba(var(--shadow-rgb), .35); display: grid; gap: 2px; z-index: 60; transform-origin: 20% 0; animation: sh-pop .16s ease-out; }
.site-head .menu-pop[hidden] { display: none; }
@keyframes sh-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.site-head .menu-pop a { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; padding: 10px; border-radius: 12px; text-decoration: none; color: var(--ink-2); }
.site-head .menu-pop a:hover, .site-head .menu-pop a:focus-visible { background: var(--soft); }
.site-head .menu-pop a.mp-sub { padding: 6px 10px; }
.site-head .menu-pop b { display: block; color: var(--ink); font-weight: 600; font-size: 15px; line-height: 1.3; }
.site-head .menu-pop small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; font-weight: 400; }
.site-head .menu-pop a.mp-sub small { margin: 0; color: var(--ink-2); font-size: 14px; }
.site-head .menu-pop a[aria-current] small, .site-head .menu-pop a[aria-current] b { color: var(--ink); font-weight: 600; }
.site-head .mi { width: 30px; height: 30px; border-radius: 9px; background: var(--lead-soft); position: relative; }
.site-head .mi::after { content: ""; position: absolute; inset: 6px; background: var(--lead-ink); -webkit-mask: var(--g) center / contain no-repeat; mask: var(--g) center / contain no-repeat; }
.site-head .mi-api { --g: var(--g-sh-rowhomes); } .site-head .mi-uc { --g: var(--g-sh-tree); } .site-head .mi-play { --g: var(--g-sh-door); }
.site-head .mi-spaces { --g: var(--g-sh-awning); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.site-head .mi-spaces::after { background: var(--accent-ink); }

/* Mobile: links fold into a sheet behind the menu button */
.site-head .sh-toggle { display: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--ink); cursor: pointer; align-items: center; justify-content: center; }
.site-head .sh-toggle:hover { background: var(--soft); }
.site-head .sh-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.site-head .sh-toggle path { transform-origin: 10px 10px; transition: transform .2s ease; }
.site-head .sh-toggle[aria-expanded="true"] .l1 { transform: translateY(3.5px) rotate(45deg); }
.site-head .sh-toggle[aria-expanded="true"] .l2 { transform: translateY(-3.5px) rotate(-45deg); }
.site-head .sh-sheet { border-top: 1px solid var(--line); background: var(--bg); max-height: calc(100vh - var(--sh-h)); overflow-y: auto; animation: sh-pop .16s ease-out; }
.site-head .sh-sheet[hidden] { display: none; }
.site-head .sh-sheet ul { list-style: none; margin: 0; padding: 0; }
.site-head .sh-sheet > ul { padding: 8px 16px 18px; }
.site-head .sh-sheet a { display: block; padding: 12px 4px; font: 500 17px/1.3 var(--text); color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.site-head .sh-sheet a[aria-current] { color: var(--lead-ink); }
.site-head .sh-subs a { padding: 9px 4px 9px 18px; font-size: 15.5px; color: var(--ink-2); }
@media (max-width: 860px) {
  .site-head .sh-nav { display: none; }
  .site-head .sh-toggle { display: inline-flex; }
}
@media (min-width: 861px) { .site-head .sh-sheet { display: none !important; } }
@media (max-width: 380px) { .site-head .sh-word { font-size: 19px; } .site-head .sh-inner { gap: 12px; } }
@media (prefers-reduced-motion: reduce) {
  .site-head, .site-head *, .site-head .menu-pop, .site-head .sh-sheet { transition: none !important; animation: none !important; }
}

/* Desktop: true centre for the nav (logo left, links centred, actions right) */
@media (min-width: 861px) {
  .site-head .sh-inner { display: grid; grid-template-columns: 1fr auto 1fr; }
  .site-head .sh-nav { flex: none; justify-self: center; }
  .site-head .sh-actions { justify-self: end; }
}
