.site-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding-top: 0.75rem;
}

.site-nav__top {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 var(--spacing-page-x);
}

.site-nav__brand,
.site-nav__brand:hover {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.site-nav img { height: 50px; }
.logo-dark  { display: none; }

[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark  { display: block; }

.site-nav__name {
  font-family: 'Oleo Script', cursive;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--color-primary);
}

.nav-subtree .fi {
  margin-left: 0.35rem;
  border: 1px solid #eee;
  vertical-align: middle;
}

.nav-tree,
.nav-subtree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-tree {
  display: flex;
  gap: 0;
  font-size: 0.925rem;
  background: var(--color-surface);
  width: 100%;
}


.nav-branch {
  position: relative;
}

.nav-branch > a {
  display: block;
  font-weight: 400;
  padding: 0.5rem var(--spacing-page-x);
  color: var(--color-primary);
  border-radius: 4px;
  position: relative;
}

.nav-tree > .nav-branch > a {
  font-size: 0.875rem;
}

.nav-tree > .nav-branch > a:hover {
  text-decoration: none;
}

.nav-tree > .nav-branch > a:not(.nav--active):hover::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--spacing-page-x);
  right: var(--spacing-page-x);
  height: 2px;
  background: var(--color-border);
}

.nav-branch > a.nav--active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--spacing-page-x);
  right: var(--spacing-page-x);
  height: 2px;
  background: var(--color-nav-active, var(--color-text)); /* override --color-nav-active per app; defaults to text color */
}

/* only the first level floats over the page */
.nav-tree > .nav-branch > .nav-subtree {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-bg);
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  padding: 0.5rem 0.75rem 0.75rem;
}

/* nested subtrees flow in-document inside the floating container */
.nav-subtree .nav-subtree {
  display: none;
  position: static;
}

/* tree lines — technique from jsfiddle.net/davidThomas/Ljnhc/1/
   li border-left = vertical trunk
   a::before     = L-shaped connector (bottom + left borders)
   last-child    = trunk goes transparent so it stops at the last item */
.nav-subtree li {
  border-left: 1px solid var(--color-border);
  margin-left: 1em;
}

.nav-tree > .nav-branch > .nav-subtree > li {
  margin-left: 0.4em;
}

.nav-subtree li:last-child {
  border-left: 1px solid transparent;
}

.nav-subtree a {
  display: block;
  padding: 0.8rem 0.5rem 0 0.75em;
  position: relative;
  color: var(--color-primary);
}

.nav-subtree a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -1px;
  bottom: 0.6em;
  width: 0.6em;
  border: 1px solid var(--color-border);
  border-top: 0 none transparent;
  border-right: 0 none transparent;
  border-bottom-left-radius: 0.15em;
}

/* show entire subtree on hover of the top-level branch */
.nav-tree > .nav-branch:hover .nav-subtree {
  display: block;
}


/* -------------------------------------------------------------------------
   Kebab menu
   ------------------------------------------------------------------------- */

.site-nav__search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 3rem;
  margin-right: 0.75rem;
}

.search-sport {
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%231a1a1a'/%3E%3C/svg%3E") no-repeat right 2px center;
  border: none;
  outline: none;
  padding: 0 14px 0 4px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--color-text);
  cursor: pointer;
}

[data-theme="dark"] .search-sport {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23e5e7eb'/%3E%3C/svg%3E");
}

.search-form {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-form:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 20%, transparent);
}

.search-form__icon {
  width: 15px;
  height: 15px;
  color: #9ca3af;
  flex-shrink: 0;
  margin-right: 0.4rem;
}

.search-form__input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--color-text);
  width: 240px;
  padding: 0;
}

.search-form__input::placeholder {
  color: #9ca3af;
}

.search-form__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.site-nav__kebab {
  margin-left: auto;
  position: relative;
}

.kebab-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  color: var(--color-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.kebab-btn:hover {
  background: var(--color-surface);
}

.kebab-btn__dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.kebab-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  min-width: 180px;
  padding: 0.5rem 0;
  z-index: 100;
}

.kebab-dropdown--open {
  display: block;
}

.kebab-dropdown__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text);
  gap: 1rem;
}

/* -------------------------------------------------------------------------
   Toggle switch
   ------------------------------------------------------------------------- */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-switch input:checked + .toggle-switch__track {
  background: var(--color-surface);
}

.toggle-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-switch__track::after {
  transform: translateX(16px);
}
