/* Troy: the site's small navigation. Loaded by the landing page (a slim header over the painting and a row of
   links in the footer) and by the dashboard, the panel and the privacy page (a plain header on paper).
   Colors and fonts come from tokens.css. The only motion here is the handoff between pages, at the bottom. */

/* ---------- Landing: the header over the day painting ---------- */

.site-nav {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(12px, 2.4vw, 32px);
  color: var(--ink);
  font-family: var(--font-body);
}
/* The same treatment the hero headline uses on the morning sky: ink text on a soft paper haze with no edge. */
.site-nav-brand,
.site-nav-links {
  position: relative;
  isolation: isolate;
}
.site-nav-brand::before,
.site-nav-links::before {
  content: "";
  position: absolute;
  inset: -6px -14px;
  z-index: -1;
  background: rgba(var(--paper-rgb), 0.42);
  border-radius: 40px;
  filter: blur(14px);
  pointer-events: none;
}
.site-nav-brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1;
  color: inherit;
  text-decoration: none;
}
.site-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--r-pill);
}
.site-nav-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
.site-nav :focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Below 1200px the links come close to the centered headline, so the hero starts a little lower (16 to 24px).
   From 1200px up the headline is clear of both ends and nothing moves. */
@media (max-width: 1199px) {
  #hero { padding-top: clamp(56px, 5vh + 16px, 76px); }
}
/* Phones: only the links, in one row. The type and the gaps scale with the screen so every link fits from 320px up. */
@media (max-width: 599px) {
  .site-nav { justify-content: center; padding: 0 8px; }
  .site-nav-brand { display: none; }
  .site-nav-links { gap: 0; }
  .site-nav-links a { padding: 0 clamp(3px, 1vw, 11px); font-size: clamp(10.5px, 3.3vw, 14px); }
  /* With five links the row spans the screen, so the pill behind it hugs the row instead of reaching past the edges. */
  .site-nav-links::before { inset: -6px -6px; }
}

/* ---------- Landing: the links at the bottom of the night footer ---------- */

.footer-links {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 4px;
  color: var(--white);
  font-family: var(--font-body);
}
.footer-links::before {
  content: "";
  position: absolute;
  inset: -10px -28px;
  z-index: -1;
  background: rgba(var(--ink-rgb), 0.5);
  border-radius: 48px;
  filter: blur(18px);
  pointer-events: none;
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.footer-links a:hover { text-decoration: underline; text-underline-offset: 4px; }
/* Phones: every link on one row. */
@media (max-width: 599px) {
  .footer-links { flex-wrap: nowrap; gap: 0; }
  .footer-links a { padding: 0 clamp(4px, 1.4vw, 8px); font-size: clamp(10.5px, 3.3vw, 13px); }
}

/* ---------- Dashboard, panel, privacy: the header on paper ---------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding: 10px 0 0;
}
.site-head .site-nav-brand { padding-left: 0; color: var(--ink); }
.site-head .site-nav-brand::before,
.site-head .site-nav-links::before { content: none; }
.site-head .site-nav-links { color: var(--stone); margin-right: -12px; }
.site-head .site-nav-links a:hover { color: var(--ink); }
.site-head .site-nav-links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.site-head :focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (max-width: 599px) {
  .site-head { justify-content: center; padding-top: 4px; }
  .site-head .site-nav-brand { display: none; }
  .site-head .site-nav-links { margin: 0; gap: 0; }
  .site-head .site-nav-links a { padding: 0 clamp(4px, 1.4vw, 9px); font-size: clamp(10.5px, 3.3vw, 14px); }
}

/* ---------- Moving between pages ---------- */

/* Every page loads this file, so a click on a nav link is one continuous move, not a hard cut: the old page fades
   back, the new one fades up a few pixels behind it, and the brand and the links slide to their new places in the
   header and stay sharp the whole way. Browsers without cross-page view transitions just load the page as before. */
@view-transition { navigation: auto; }

.site-nav-brand { view-transition-name: site-brand; }
.site-nav-links { view-transition-name: site-links; }

@keyframes page-leave {
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes page-arrive {
  from { opacity: 0; transform: translateY(12px); }
}
::view-transition-old(root) { animation: page-leave 240ms cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: page-arrive 520ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both; }
::view-transition-group(site-brand),
::view-transition-group(site-links) { animation-duration: 520ms; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
/* Arriving home is different: the painting fills the screen, so a fade through empty space reads as a flash and a
   slide fights the hero's own motion. The page you left stays put underneath and home fades in over it, with no
   movement. Home's header has three links to the others' four, so it is not slid between them either. */
@keyframes page-fade {
  from { opacity: 0; }
}
:root:has(#hero) .site-nav-brand,
:root:has(#hero) .site-nav-links { view-transition-name: none; }
:root:has(#hero)::view-transition-old(root) { animation: none; }
:root:has(#hero)::view-transition-new(root) { animation: page-fade 520ms cubic-bezier(0.33, 0, 0.2, 1) both; mix-blend-mode: normal; }
:root:has(#hero)::view-transition-old(site-brand),
:root:has(#hero)::view-transition-old(site-links) { animation-duration: 180ms; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
