@layer components {
  /* ------------------------------------------
     SITE HEADER (Warm minimal)
     ------------------------------------------ */
  .site-header {
    background: linear-gradient(
        to bottom,
        var(--color-highlight-30) 0%,
        rgba(255, 255, 255, 0) 50%
      ),
      var(--color-bg-primary);
    box-shadow:
      0 1px 3px var(--color-ink-a05),
      inset 0 -1px 0 var(--color-ink-a05);
    position: relative;
    z-index: var(--z-sticky);
    transition: border-radius var(--duration-normal) var(--ease-out-expo);
  }

  .site-header:has(.header-mobile-panel[data-open="true"]) {
    border-radius: 0 0 16px 16px;
    box-shadow:
      0 4px 16px var(--color-ink-a08),
      0 1px 4px var(--color-ink-a05);
    overflow: hidden;
  }

  /* Fallback for browsers without :has() (Firefox < 121):
     Apply open-panel styling via a data attribute on the header itself.
     The component sets data-mobile-open when the panel is expanded. */
  @supports not selector(:has(*)) {
    .site-header[data-mobile-open] {
      border-radius: 0 0 16px 16px;
      box-shadow:
        0 4px 16px var(--color-ink-a08),
        0 1px 4px var(--color-ink-a05);
      overflow: hidden;
    }
  }

  .header-inner {
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4rem;
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
  }

  @media (min-width: 768px) {
    .header-inner {
      padding-left: 3rem;
      padding-right: 3rem;
    }
  }

  .header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
  }

  .header-logo {
    display: inline-flex;
    align-items: center;
    position: relative;
    line-height: 0;
    text-decoration: none;
  }

  .header-logo:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
  }

  .header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
  }

  .header-publish-btn {
    
    font-size: 0.6875rem;
    letter-spacing: var(--tracking-wider-05);
    padding: 0 1.25rem;
    height: 2.25rem;
    border: none;
    border-radius: var(--radius-full);
    background: var(--gradient-action-primary-rest);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: var(--btn-shadow-rest);
    transition:
      transform var(--transition-bounce),
      box-shadow var(--transition-fast),
      background var(--transition-fast);
    cursor: pointer;
  }

  .header-publish-btn:hover {
    transform: translateY(-1px);
    background: var(--gradient-action-primary-hover);
    box-shadow: var(--btn-shadow-hover);
  }

  .header-publish-btn:active {
    transform: translateY(1px);
    box-shadow: var(--btn-shadow-active);
  }

  .header-publish-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
  }

  /* Strong CTA styling when there are drafts ready for review */
  .header-publish-btn--review {
    background: var(--color-accent-green);
    animation: pulse-subtle 2s ease-in-out infinite;
  }

  .header-publish-btn--review:hover {
    background: var(--color-accent-green-hover);
  }

  /* Processing state with shimmer animation */
  .header-publish-btn--processing {
    background: linear-gradient(
      to bottom,
      hsl(25, 85%, 55%) 0%,
      hsl(25, 85%, 47%) 50%,
      hsl(25, 85%, 40%) 100%
    );
    cursor: wait;
    position: relative;
    overflow: hidden;
  }

  .header-publish-btn--processing:hover {
    background: linear-gradient(
      to bottom,
      hsl(25, 85%, 58%) 0%,
      hsl(25, 85%, 50%) 50%,
      hsl(25, 85%, 43%) 100%
    );
  }

  /* Shimmer animation overlay — keyframes live in tokens/motion.css */
  .header-publish-btn--processing::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-shimmer-light);
    animation: shimmer 1.5s ease-in-out infinite;
  }

  /* Processing text styling */
  .header-publish-processing-text {
    display: inline-flex;
    align-items: center;
    position: relative;
    z-index: 1;
  }

  /* Inline spinner — uses conic-gradient + mask instead of border to
     avoid the unlayered Tailwind preflight reset (border: 0px solid). */
  .header-publish-spinner {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-left: 0.5rem;
    border-radius: var(--radius-circle);
    background: conic-gradient(
      white 0deg 90deg,
      var(--color-highlight-30) 90deg 360deg
    );
    /* lint-tokens-ignore: mask opacity source, #000 is placeholder for "fully opaque" not a brand color */
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    /* lint-tokens-ignore: see above */
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    animation: spin 0.8s linear infinite;
    position: relative;
    z-index: 1;
  }

  /* `spin` and `pulse-subtle` keyframes live in tokens/motion.css */

  .header-city-btn {
    display: flex;
    align-items: center;
    height: 36px;
    border-radius: var(--radius-full);
    padding: 8px 16px;
    gap: 6px;
    background: var(--color-highlight-50);
    border: none;
    box-shadow:
      var(--ring-inset-subtle),
      inset 0 1px 0 var(--color-highlight-60),
      inset 0 -1px 0 var(--color-ink-a05),
      0 1px 2px var(--color-ink-a05);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider-05);
    color: var(--color-fg-primary);
    transition:
      background var(--transition-fast),
      box-shadow var(--transition-fast),
      transform var(--duration-instant) ease;
    flex-shrink: 0;
  }

  .header-city-btn:hover {
    background: var(--color-highlight-70);
    box-shadow:
      var(--ring-inset-standard),
      inset 0 1px 0 var(--color-highlight-70),
      inset 0 -1px 0 var(--color-ink-a05),
      0 1px 3px var(--color-ink-a05);
  }

  .header-city-btn:active {
    transform: scale(0.98);
    box-shadow:
      var(--ring-inset-standard),
      inset 0 2px 3px var(--color-ink-a08),
      inset 0 -1px 0 var(--color-highlight-30);
  }

  .header-city-btn:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
  }

  .header-city-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  .header-city-btn--muted {
    color: var(--color-fg-tertiary);
  }

  .header-cta {
    
    font-size: 0.6875rem;
    letter-spacing: var(--tracking-wider-05);
    padding: 0 1rem;
    height: 2.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-fg-secondary);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition:
      background var(--transition-normal),
      border-color var(--transition-normal);
  }

  .header-cta:hover {
    background: var(--color-bg-secondary);
    border-color: var(--color-border-hover);
  }

  .header-cta:focus-visible {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
  }

  .header-cta:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  /* Hamburger button - mobile only, hidden on desktop */
  .header-burger {
    display: none;
  }

  @media (max-width: 640px) {
    .header-publish-btn {
      display: none;
    }

    .header-cta {
      display: none;
    }

    .profile-trigger {
      display: none;
    }

    .header-city-btn {
      height: 32px;
      padding: 6px 12px;
      font-size: 10px;
      gap: 4px;
    }

    .header-city-icon {
      width: 12px;
      height: 12px;
    }

    .header-actions {
      gap: 0.5rem;
    }

    .header-burger {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 44px;
      height: 44px;
      border: none;
      border-radius: var(--radius-default);
      background: transparent;
      color: var(--color-fg-secondary);
      cursor: pointer;
      padding: 0;
      flex-shrink: 0;
      transition: color var(--transition-fast);
    }

    .header-burger:hover {
      color: var(--color-fg-primary);
    }

    .header-burger:active {
      color: var(--color-fg-primary);
    }

    .header-burger-icon {
      width: 20px;
      height: 20px;
      position: relative;
    }

    /* Icon morph: crossfade + rotate */
    .header-burger-icon-hamburger,
    .header-burger-icon-close {
      position: absolute;
      inset: 0;
      width: 20px;
      height: 20px;
      transition:
        opacity var(--duration-normal) var(--ease-out-expo),
        transform var(--duration-normal) var(--ease-out-expo);
    }

    .header-burger-icon-hamburger {
      opacity: 1;
      transform: rotate(0deg);
    }

    .header-burger-icon-close {
      opacity: 0;
      transform: rotate(-90deg);
    }

    .header-burger[aria-expanded="true"] .header-burger-icon-hamburger {
      opacity: 0;
      transform: rotate(90deg);
    }

    .header-burger[aria-expanded="true"] .header-burger-icon-close {
      opacity: 1;
      transform: rotate(0deg);
    }
  }

  /* ── Mobile dropdown menu (animated panel) ── */
  .header-mobile-panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
      grid-template-rows var(--duration-normal) var(--ease-out-expo),
      opacity var(--duration-normal) var(--ease-out-expo);
  }

  .header-mobile-panel[data-open="true"] {
    grid-template-rows: 1fr;
    opacity: 1;
  }

  .header-mobile-panel-inner {
    overflow: hidden;
  }

  .header-mobile-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 16px 24px;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    max-height: calc(100dvh - var(--layout-header-height));
    overflow-y: auto;
  }

  /* ── Mobile profile section (clickable) ── */
  .header-mobile-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin: 0 -12px 4px;
    width: calc(100% + 24px);
    border: none;
    border-radius: var(--radius-default);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    text-align: left;
  }

  .header-mobile-profile:hover {
    background: var(--color-ink-a05);
  }

  .header-mobile-profile:active {
    background: var(--color-ink-a08);
  }

  .header-mobile-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-action-primary);
    color: #f7f2ed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: var(--font-weight-bold);
    flex-shrink: 0;
    overflow: hidden;
  }

  .header-mobile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .header-mobile-profile-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }

  .header-mobile-profile-name {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: var(--font-weight-bold);
    color: var(--color-fg-primary);
  }

  .header-mobile-profile-email {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-fg-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* ── Mobile dividers ── */
  .header-mobile-divider {
    height: 1px;
    background: var(--color-ink-a08);
    margin: 4px 0;
  }

  /* ── Mobile inline city list ── */
  .header-mobile-menu .city-list--inline {
    padding: 4px 0;
  }

  .header-mobile-menu .city-list--inline .city-list-label {
    padding: 8px 0 6px;
  }

  .header-mobile-menu .city-list--inline .city-list-search {
    padding: 0 0 6px;
  }

  .header-mobile-menu .city-list--inline .city-list-option {
    padding: 8px 0;
  }

  /* ── Mobile action buttons (side by side) ── */
  .header-mobile-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 4px;
  }

  /* Publish CTA – extends shared .skeuo-btn-primary */
  .header-mobile-publish {
    
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 36px;
    border-radius: var(--radius-full);
    font-size: 10px;
    letter-spacing: var(--tracking-wider-05);
    cursor: pointer;
    transition:
      background var(--transition-fast),
      box-shadow var(--transition-fast),
      transform var(--duration-instant) ease;
  }

  .header-mobile-publish:active {
    transform: scale(0.98);
  }

  /* Sign in / Sign out – ghost outline pill */
  .header-mobile-ghost {
    
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 36px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    box-shadow:
      var(--ring-inset-medium),
      inset 0 1px 0 var(--color-highlight-40);
    color: var(--color-fg-body);
    font-size: 10px;
    letter-spacing: var(--tracking-wider-05);
    cursor: pointer;
    transition:
      background var(--transition-fast),
      box-shadow var(--transition-fast),
      transform var(--duration-instant) ease;
  }

  .header-mobile-ghost:hover {
    background: var(--color-ink-a03);
    box-shadow:
      var(--ring-inset-strong),
      inset 0 1px 0 var(--color-highlight-50);
  }

  .header-mobile-ghost:active {
    transform: scale(0.98);
    box-shadow:
      var(--ring-inset-strong),
      inset 0 2px 4px var(--color-ink-a12);
  }

  .header-mobile-ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  @media (prefers-reduced-motion: reduce) {
    .header-mobile-panel {
      transition: none;
    }

    .header-burger-icon-hamburger,
    .header-burger-icon-close {
      transition: none;
    }
  }
}
