/*
 * The header across the top of every page: the marketing site links it as a
 * stylesheet, the app inlines it (src/web/site-header.ts), and both draw the
 * same markup (site/partials/header.html). One file, so the two can't drift.
 *
 * Every rule sits under .site-header and sets everything it relies on: the
 * app has its own .wrap, .brand, .btn and .signin, and none of them may reach
 * in here. What only the marketing site does (sticking, the tint on scroll,
 * the button stepping aside) stays in site/assets/site.css.
 */

.site-header { display: block; padding: 0; font: 17px/1.55 var(--font-text); color: var(--ink); -webkit-font-smoothing: antialiased; }
.site-header .nav { background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 68px; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); position: relative; }

.site-header .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; font-family: inherit; font-weight: 600; font-size: 21px; letter-spacing: -0.01em; }
.site-header .brand .wm { display: block; height: 26px; width: auto; flex: none; }

/* The home page's sections, for a wide screen; below 960px the page is one
   thumb-scroll anyway. */
.site-header .sections { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; font-size: 15px; font-weight: 500; }
.site-header .sections a { color: var(--body); text-decoration: none; }
.site-header .sections a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 960px) { .site-header .sections { display: none; } }

.site-header .right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 15px; }

/* The copy button. Both labels sit in the same grid cell, so the button never
   changes width as they cross-fade. */
.site-header .btn {
  display: inline-grid; align-items: center; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  font: 600 15px/1 var(--font-text); text-decoration: none; border: 0; cursor: pointer;
  white-space: nowrap; transition: background var(--motion-base) var(--motion-ease), transform var(--motion-base) var(--motion-ease);
  background: var(--accent); color: var(--on-accent);
}
.site-header .btn:hover { background: var(--accent-hover); color: var(--on-accent); transform: translateY(-1px); }
.site-header .btn > span { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); transition: opacity var(--motion-slow) var(--motion-ease), transform var(--motion-slow) var(--motion-ease); }
.site-header .btn .state-done { opacity: 0; transform: translateY(5px); }
.site-header .btn.done .state-idle { opacity: 0; transform: translateY(-5px); }
.site-header .btn.done .state-done { opacity: 1; transform: none; }
.site-header .btn .short { display: none; }
@media (prefers-reduced-motion: reduce) { .site-header .btn, .site-header .btn > span { transition: none; } }

/* For someone coming back to their properties: /my shows the list, or asks
   them to sign in first. Quieter than the button beside it, and last in the
   row: the button keeps its space while it steps aside, so anything after it
   would float mid-header with a hole at the edge. */
.site-header .signin { order: 1; margin: 0; max-width: none; color: var(--ink); font-weight: 500; text-decoration: none; white-space: nowrap; }
.site-header .signin:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }

/* Signed in, the same place holds "Your properties" and a menu with Account
   and Sign out. The marketing site learns it from the cookie (the line of
   script in the partial puts .signed-in on <html>); the app knows, and puts
   it on the header itself. */
html.signed-in .site-header .signed-out, .site-header.signed-in .signed-out,
html:not(.signed-in) .site-header:not(.signed-in) .account { display: none; }
.site-header .account { order: 1; display: flex; align-items: center; gap: 14px; }
.site-header .account > .signin { order: 0; }
.site-header .me { position: relative; }
.site-header .me summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.site-header .me summary::-webkit-details-marker { display: none; }
.site-header .me summary:hover, .site-header .me[open] summary { border-color: var(--accent); color: var(--accent-text); }
.site-header .me summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-header .me-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 170px; padding: 6px; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 12px 32px -16px rgba(20, 16, 60, .35); }
.site-header .me-menu form { margin: 0; }
.site-header .me-menu a, .site-header .me-menu button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap; }
.site-header .me-menu a:hover, .site-header .me-menu button:hover, .site-header .me-menu a:focus-visible, .site-header .me-menu button:focus-visible { background: var(--accent-tint); color: var(--accent-text); outline: none; }
/* A phone has no room for "Your properties" beside the menu, so it moves into it. */
.site-header .me-menu .narrow { display: none; }
@media (max-width: 560px) { .site-header .account > .signin { display: none; } .site-header .me-menu .narrow { display: block; } }

/* On a phone the wordmark, Sign in and the button share 343px: all three
   step down a little rather than the button running off the edge. */
@media (max-width: 480px) {
  .site-header .wrap { gap: 12px; }
  .site-header .right { gap: 14px; }
  .site-header .brand { gap: 7px; }
  .site-header .brand .wm { height: 22px; }
  .site-header .btn { padding: 0 14px; }
  .site-header .btn .long { display: none; }
  .site-header .btn .short { display: inline; }
}
