/* THE CHROME. One masthead, one navigation, one tucked-away panel, shared by
   the gallery and the admin.
 *
 * Why it is here and not in either surface's stylesheet: Nicholas, 2026-11-21 --
 * "its like the two sides are two completely different apps". They were. The
 * gallery had a centred, lightly tracked masthead with a bottom tab bar on a
 * phone; the admin had a bold left wordmark and ten links in one flex row that
 * scrolled sideways. Two implementations of one idea drift, and these two had.
 *
 * Every rule below was MOVED out of internal/web/static/site.css verbatim, not
 * rewritten, so the gallery is byte-identical to what Nicholas approved and the
 * admin simply joins it. The only additions are marked ADMIN and are density,
 * never colour or voice.
 *
 * Loaded by both base templates between tokens.css and the surface's own
 * stylesheet. Palette and type still come from tokens.css; nothing here
 * declares a colour. */

/* ---- the masthead ----
   Centred, light and widely tracked, with the navigation on a second line
   under a hairline. The earlier header put a bold wordmark hard against the
   left edge with the nav against the right, which is the shape of an
   application toolbar; a photographer's site puts the name in the middle of
   a lot of nothing and gets out of the way. */
.site { max-width: var(--page-max); margin: 0 auto;
        padding: var(--space-8) var(--page-pad) var(--space-5); text-align: center }
.site-name { margin: 0; font: var(--text-h3); font-weight: var(--weight-light);
             letter-spacing: var(--track-wide); text-transform: uppercase }
.site-name a { text-decoration: none }
.site nav { display: flex; align-items: center; justify-content: center; gap: var(--space-5);
            margin-top: var(--space-5) }
.site nav a, .site nav button {
  display: inline-flex; align-items: center; min-height: var(--target); padding: 0;
  color: var(--text-muted); font: var(--text-caption);
  letter-spacing: var(--track-caption); text-transform: uppercase; text-decoration: none }
.site nav a:hover, .site nav button:hover { color: var(--text) }
.site nav a[aria-current] { color: var(--text); font-weight: var(--weight-medium) }
.site nav a[aria-current]::after {
  content: ""; position: absolute; margin-top: 1.6em; width: 1.2em; height: 1px; background: currentColor }
.site nav a[aria-current] { position: relative }

/* ADMIN: the working surface says so, quietly, beside the name. It is the one
   place the accent appears in the chrome, and it is how you know at a glance
   which of the two sites you are looking at on a phone. */
.site-tag { display: inline-block; margin-left: var(--space-2);
            padding: 0 var(--space-2); border-radius: var(--radius-sm);
            background: var(--accent-fill); color: var(--on-accent);
            font: var(--text-caption); letter-spacing: var(--track-caption);
            text-transform: uppercase; vertical-align: middle }

/* ADMIN: the archive is a working surface and wants its vertical space back,
   so the masthead is shallower there than on the gallery. The voice --
   centred, light, tracked -- is unchanged; only the padding is. */
.site.working { padding: var(--space-5) var(--page-pad) var(--space-4) }
.site.working nav { margin-top: var(--space-4); gap: var(--space-5) }

/* ---- the tucked-away panel in the masthead ----
   A <details> whose summary is a single ellipsis, holding the theme switch and
   the way into the admin. It opens with JavaScript off, which is the reason it
   is a <details> rather than a popover with a script behind it.

   The marker is removed and the summary styled like the nav links beside it,
   so it reads as one more quiet item in the row rather than as a control. */
.tuck { position: relative; display: inline-flex }
.tuck > summary {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--target); min-width: var(--target);
  color: var(--text-muted); font: var(--text-caption);
  letter-spacing: var(--track-caption); cursor: pointer; list-style: none;
}
.tuck > summary::-webkit-details-marker { display: none }
.tuck > summary::marker { content: "" }
.tuck > summary:hover, .tuck[open] > summary { color: var(--text) }
.tuck-body {
  position: absolute; top: 100%; right: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: stretch;
  min-width: 140px; margin-top: var(--space-2); padding: var(--space-2);
  background: var(--raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-2); text-align: left;
}
/* The panel's own items are left-aligned normal-case text: the masthead's
   tracked uppercase is for navigation, and these two are settings.

   The selector is `.site nav .tuck-item` and not `.tuck-item`, which is what
   it was at first and which did nothing. `.site nav a` and `.site nav button`
   already match these elements and set uppercase with wide tracking, and they
   are more specific than a single class — so the panel rendered "DARK" and
   "ADMIN ↗" in masthead voice. Seen in the browser, not deduced. */
.site nav .tuck-item {
  display: flex; align-items: center; min-height: var(--target);
  padding: 0 var(--space-3); border-radius: var(--radius-sm);
  color: var(--text); font: var(--text-small);
  letter-spacing: normal; text-transform: none; text-decoration: none;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.site nav .tuck-item:hover { background: var(--surface); color: var(--text) }
/* ADMIN: the sign-out form inside the panel must not re-introduce a row. */
.site nav .tuck-body form { display: contents }
/* The summary keeps the masthead voice; only the items inside differ. */
.site nav .tuck > summary { text-transform: none; letter-spacing: normal; font-size: 1.1rem }

/* ---- the phone ---- */
@media (max-width: 760px) {
  .site { padding: var(--space-6) var(--page-pad) var(--space-4) }
  .site.working { padding: var(--space-4) var(--page-pad) var(--space-3) }
  /* The nav becomes a bottom tab bar on a phone. It is the SAME <nav>
     element and the same links, moved -- not a second copy, so there is
     one landmark and the two cannot drift apart.

     The rule that used to live here, `.site nav a.opt { display: none }`,
     deleted the Albums link below 760px with no replacement anywhere: the
     filter tray holds only filters. A link hidden by CSS is still in the tab
     order, so a keyboard or screen-reader user could reach a destination a
     sighted user could not see. Every destination, always. */
  .site nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 20;
    gap: 0; margin: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .site nav a {
    flex: 1;
    justify-content: center;
    min-height: var(--target);   /* 44px, the floor -- 24 is the failure line */
  }
  .site nav a[aria-current]::after { display: none }
  .site nav a[aria-current] { box-shadow: inset 0 2px 0 var(--accent-fill) }
  /* The tuck panel does not belong in the tab bar. */
  .site nav .tuck { position: fixed; top: var(--space-4); right: var(--page-pad); bottom: auto }
  /* ADMIN: its panel holds six items, so it opens UPWARDS from a summary that
     sits in the tab bar's row rather than over the content. */
  .site nav .tuck-body { right: 0; left: auto }
  /* Reserve the bar's height so it never covers the last photograph. */
  body { padding-bottom: calc(var(--target) + env(safe-area-inset-bottom) + var(--space-4)) }
}
