/* ==========================================================================
   Header — clock, tabs, theme toggle
   ========================================================================== */

.header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: var(--header-h);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* ---------- Clock ---------- */
.clock {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
  color: var(--muted);
  font-size: 16px;
  line-height: 21px;
  letter-spacing: -0.16px;
  white-space: nowrap;
}
.clock .num { font-variant-numeric: tabular-nums; }

/* ---------- Tabs ---------- */
.nav {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: flex;
  gap: 4px;
  height: 18px;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 4px;
  background: var(--tab);
  color: var(--tab-text);
  font-weight: 500;
  font-size: 14px;
  line-height: 10px;
  letter-spacing: -0.14px;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  -webkit-user-drag: none; /* tabs can't be dragged like a link (see also draggable="false") */
  transition: background-color 0.2s, color 0.25s;
}
/* ~44px tall hit area, same visual */
.tab::after { content: ""; position: absolute; inset: -13px -2px; }
.tab span {
  position: relative;
  z-index: 1;
  display: block;
  line-height: 1;
  text-box: trim-both cap alphabetic;
}
.tab:hover { background: var(--tab-hover); color: var(--tab-hover-text); }
.tab:active span { transform: translateY(1px); }
.tab[aria-current="page"] { color: var(--tab-active-text); }

/* Black block sliding behind the active tab */
.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 18px;
  background: var(--black);
  transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out), opacity 0.2s;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative;
  width: 16px;
  height: 16px;
  transition: scale 0.2s var(--spring);
}
.theme-toggle::after { content: ""; position: absolute; inset: -12px; }
.theme-toggle:active { scale: 0.88; }

.theme-toggle .icon {
  position: absolute;
  inset: 0;
  transition: opacity 0.3s, rotate 0.5s var(--spring), scale 0.5s var(--spring);
}
.theme-toggle:hover .icon { rotate: 20deg; }

/* light → moon visible, dark → sun visible */
.theme-toggle .sun { opacity: 0; rotate: -90deg; scale: 0.5; }
:root[data-theme="dark"] .theme-toggle .moon { opacity: 0; rotate: 90deg; scale: 0.5; }
:root[data-theme="dark"] .theme-toggle .sun  { opacity: 1; rotate: 0deg; scale: 1; }

/* ---------- Mobile: clock moves to the very bottom of the page ---------- */
@media (max-width: 720px) {
  .header { padding: 20px 16px; }
  .clock {
    top: auto;
    bottom: 20px;
    left: 50%;
    translate: -50% 0;
    font-size: 14px;
    line-height: 18px;
    letter-spacing: -0.14px;
  }
}
