/* ==========================================================
   Karetok shared header. Used by index.html and get-started.html.
   Markup + behaviour: site-header.js. Tokens are copied from the
   landing page so the header looks identical on every page.
   ========================================================== */

.kt-header {
  --kt-blue: #007BFF;
  --kt-ink: #041931;
  --kt-text: rgba(4, 25, 49, 0.78);
  --kt-line: rgba(4, 25, 49, 0.08);
  --kt-blue-soft: rgba(0, 123, 255, 0.10);
  --kt-blue-border: rgba(0, 123, 255, 0.18);
  --kt-pastel: #E8F2FF;

  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(1180px, calc(100% - 32px));
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 12px 0 24px;
  border: 1px solid var(--kt-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 35px rgba(4, 25, 49, 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* :where() keeps these resets at zero specificity so the component classes below always win */
.kt-header :where(*, *::before, *::after) { box-sizing: border-box; }
.kt-header :where(a) { color: inherit; text-decoration: none; }
.kt-header :where(button) { font: inherit; color: inherit; cursor: pointer; }
.kt-header :where(ul) { list-style: none; margin: 0; padding: 0; }
.kt-header :focus-visible { outline: 3px solid var(--kt-blue); outline-offset: 2px; border-radius: 12px; }

/* Links that aren't live yet (no URL set in site-config.js) */
.is-pending { opacity: .45; pointer-events: none; cursor: not-allowed; }

/* ---------- Brand ---------- */
.kt-brand { display: inline-flex; align-items: center; flex: 0 0 auto; line-height: 0; }
.kt-brand img { height: 26px; width: auto; object-fit: contain; }

/* ---------- Centre links ---------- */
.kt-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.kt-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--kt-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: color .2s ease, background .2s ease;
}

.kt-link:hover,
.kt-dd.is-open > .kt-link { color: var(--kt-blue); background: var(--kt-blue-soft); }
.kt-link[aria-current="page"] { color: var(--kt-blue); background: var(--kt-blue-soft); }

.kt-chev { width: 14px; height: 14px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.kt-dd.is-open > button .kt-chev { transform: rotate(180deg); }

/* ---------- Right actions ---------- */
.kt-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.kt-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1.5px solid var(--kt-blue-border);
  border-radius: 999px;
  background: #fff;
  color: var(--kt-blue);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  transition: background .2s ease, transform .2s ease;
}
.kt-login:hover { background: var(--kt-blue-soft); transform: translateY(-1px); }

.kt-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--kt-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 10px 22px rgba(0, 123, 255, 0.28);
  transition: transform .25s ease, box-shadow .25s ease;
}
.kt-download:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0, 123, 255, 0.34); }

/* ---------- Dropdowns ---------- */
.kt-dd { position: relative; }

.kt-panel {
  position: absolute;
  top: calc(100% + 14px);
  min-width: 250px;
  padding: 8px;
  border: 1px solid var(--kt-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 40px rgba(4, 25, 49, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 5;
}
.kt-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; } /* hover bridge */
.kt-panel--left { left: 0; }
.kt-panel--right { right: 0; }

.kt-dd.is-open > .kt-panel { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) {
  .kt-dd--hover:hover > .kt-panel { opacity: 1; visibility: visible; transform: none; }
  .kt-dd--hover:hover > .kt-link { color: var(--kt-blue); background: var(--kt-blue-soft); }
  .kt-dd--hover:hover > button .kt-chev { transform: rotate(180deg); }
}

.kt-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 16px;
  color: var(--kt-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  transition: background .15s ease, color .15s ease;
}
.kt-item:hover { background: var(--kt-pastel); color: var(--kt-blue); }

.kt-store img { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; object-fit: contain; }
.kt-store span { flex: 1 1 auto; white-space: nowrap; }
.kt-store.is-pending { opacity: .6; }
.kt-store.is-pending span::after {
  content: "Coming soon";
  display: block;
  margin-top: 3px;
  color: var(--kt-blue);
  font-size: 12px;
  font-weight: 800;
}
.kt-panel--right { min-width: 280px; }

/* ---------- Mobile ---------- */
.kt-burger {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1.5px solid var(--kt-blue-border);
  border-radius: 50%;
  background: #fff;
  color: var(--kt-blue);
}
.kt-burger svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
.kt-burger .kt-x { display: none; }
.kt-header.menu-open .kt-burger .kt-bars { display: none; }
.kt-header.menu-open .kt-burger .kt-x { display: block; }

.kt-mobile {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  padding: 10px;
  border: 1px solid var(--kt-line);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 24px 40px rgba(4, 25, 49, 0.16);
}
.kt-header.menu-open .kt-mobile { display: block; }

.kt-mobile .kt-item,
.kt-mobile-toggle {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
}
.kt-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  font-weight: 700;
  color: var(--kt-ink);
}
.kt-mobile-toggle:hover, .kt-mobile-group.is-open > .kt-mobile-toggle { background: var(--kt-pastel); color: var(--kt-blue); }
.kt-mobile-group.is-open > .kt-mobile-toggle .kt-chev { transform: rotate(180deg); }
.kt-mobile-sub { display: none; padding: 2px 0 6px 12px; }
.kt-mobile-group.is-open > .kt-mobile-sub { display: block; }
.kt-mobile-sub .kt-item { min-height: 46px; font-size: 15px; color: var(--kt-text); }
.kt-mobile-login { display: none; }

@media (max-width: 860px) {
  .kt-header { height: 64px; padding: 0 10px 0 20px; gap: 10px; }
  .kt-brand img { height: 22px; }
  .kt-links { display: none; }
  .kt-burger { display: inline-flex; }
}

@media (max-width: 540px) {
  .kt-header { width: calc(100% - 24px); top: 12px; }
  .kt-actions { gap: 6px; }
  .kt-actions .kt-login { display: none; }
  .kt-mobile-login { display: flex; }
  /* On phones, anchor the Download panel to the header's edge so it can never run off-screen */
  .kt-actions .kt-dd { position: static; }
  .kt-panel--right { top: calc(100% + 10px); right: 0; min-width: min(290px, calc(100vw - 24px)); }
}

@media (max-width: 380px) {
  .kt-header { padding-left: 14px; gap: 6px; }
  .kt-brand img { height: 20px; }
  .kt-download { padding: 0 14px 0 16px; }
  .kt-actions { gap: 4px; }
}

@media (max-width: 380px) {
  .kt-panel--right { min-width: 0; width: calc(100vw - 24px); }
  .kt-store span { white-space: normal; }
  .kt-store { font-size: 14px; gap: 10px; }
}

@media (max-width: 340px) {
  .kt-header { padding: 0 8px 0 12px; }
  .kt-download { padding: 0 12px 0 14px; gap: 6px; }
  .kt-burger { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .kt-panel, .kt-chev, .kt-download, .kt-login { transition: none; }
}
