/* ReInk: from designer-preview/css/topbar.css @ 827d893 (oldDesigner-redesign). Everything below this line is that file,
   unchanged. When the prototype changes it, carry the change across: docs/syncing.md. */
/*
	designer-preview/css/topbar.css

	The top bar: a white band across the whole window with the Sterling logo and the
	product on the left and Add To Cart on the right. The side panel (Save, Undo, Redo, the tabs) and
	the design area start below it. The bar is <header id="smTopBar"> (Designer.cfm already has an empty
	<header>, hidden by site.app.css); js/topbar.js fills in the product's name.

	html.sm-bar-red gives the alternative, a solid Sterling red bar (flat, no gradient) with a white logo
	and a white Add To Cart; the Preview copy menu switches between the two, and .bar-red in the address forces
	red for one visit (js/topbar.js).

	Layout only in this file and css/workspace.css; css/premium.css stays paint only.
*/

:root { --sm-top-h: 56px; }
@media (max-height: 520px), (max-width: 700px) { :root { --sm-top-h: 48px; } }   /* short or narrow windows: the design keeps the room */
@media (max-height: 420px) { :root { --sm-top-h: 40px; } }   /* a phone held sideways */

/* ===== The bar ===== */
header#smTopBar {
  position: fixed; z-index: 101; top: 0; right: 0; left: 0; display: flex; align-items: center; gap: 16px;
  box-sizing: border-box; height: var(--sm-top-h); max-height: none; margin: 0; padding: 0 20px; overflow: visible;
  background-color: var(--sp-surface, var(--sm-surface, rgb(255 255 255)));
  border-bottom: 1px solid var(--sp-line, var(--sm-divider, rgb(218 220 224)));
  font: 14px/20px Arial, Helvetica, sans-serif; color: var(--sp-ink-2, var(--sm-ink-2, rgb(31 28 28))); }

/* the logo: the facelift placed it absolutely in the side panel's logo block; here it is in the bar's flow */
header#smTopBar a.sterlingLogo { flex: none; display: block; line-height: 0; pointer-events: auto; color: inherit; font-size: 0; }
header#smTopBar a.sterlingLogo > img { position: static; display: block; width: 113.33px; height: 34px; margin: 0; transition: none; }
header#smTopBar a.sterlingLogo:focus-visible { outline: none; }
header#smTopBar a.sterlingLogo:focus-visible > img { outline: 2px solid var(--sm-focus, rgb(4 0 0)); outline-offset: 4px; border-radius: 2px; }

/* the product: name, then code and size in a quieter line; a hairline divides it from the logo */
header#smTopBar .smTopProduct { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  padding-left: 16px; border-left: 1px solid var(--sp-line, var(--sm-divider, rgb(218 220 224))); }
header#smTopBar .smTopProduct:empty { display: none; }
header#smTopBar .smTopProductName { overflow: hidden; font-weight: 700; font-size: 15px; line-height: 20px; white-space: nowrap; text-overflow: ellipsis;
  color: var(--sp-ink, var(--sm-ink, rgb(4 0 0))); }
header#smTopBar .smTopProductMeta { overflow: hidden; font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis;
  color: var(--sp-ink-3, var(--sm-ink-3, rgb(84 87 92))); }

/* Add To Cart: the bar's right end (css/workspace.css draws the button) */
header#smTopBar #smTopActions { position: static; z-index: auto; flex: none; margin-left: auto; }
/* the 40px bar of a phone held sideways: a smaller logo and button */
@media (max-height: 420px) {
  header#smTopBar a.sterlingLogo > img { width: 86.67px; height: 26px; }
  html.sm-ws header#smTopBar #smAddToCart, html.sm-ws header#smTopBar #smAddToCart:is(:focus, :hover, :active) { height: 32px; padding: 0 14px 0 11px; line-height: 32px; font-size: 13px; }
  html.sm-ws header#smTopBar #smAddToCart .material-icons { width: 18px; height: 18px; margin-right: 6px; background-size: 18px 18px; }
}

/* ===== Everything else starts below the bar ===== */
aside { top: var(--sm-top-h); }
main { top: var(--sm-top-h); }
#panelCollapseHandle { top: calc(50% + var(--sm-top-h) / 2); }   /* centred on the panel, not the window */
@media (max-width: 700px) {
  /* site.app.css stacks the design (top 60%) over the panel (bottom 40%) with !important */
  main { top: var(--sm-top-h) !important; height: calc(60% - var(--sm-top-h)); }
  header#smTopBar { padding: 0 12px 0 14px; gap: 12px; }
}
@media (max-width: 560px) { header#smTopBar .smTopProduct { display: none; } }   /* the logo and Add To Cart need the width */

/* ===== Red bar (html.sm-bar-red) ===== */
html.sm-bar-red header#smTopBar { background-color: var(--sp-red, var(--sm-red, rgb(234 0 41))); border-bottom-color: transparent; color: rgb(255 255 255); }
html.sm-bar-red header#smTopBar a.sterlingLogo > img { filter: brightness(0) invert(1); }   /* the logo in white */
html.sm-bar-red header#smTopBar a.sterlingLogo:focus-visible > img,
html.sm-bar-red header#smTopBar #smAddToCart:focus-visible { outline-color: rgb(255 255 255); }
html.sm-bar-red header#smTopBar .smTopProduct { border-left-color: rgb(255 255 255 / 0.4); }
html.sm-bar-red header#smTopBar :is(.smTopProductName, .smTopProductMeta) { color: rgb(255 255 255); }
/* Add To Cart turns white with red ink, so it still stands out on the red */
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart,
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart:focus { background-color: rgb(255 255 255); color: var(--sm-red-text, rgb(207 0 36));
  box-shadow: 0 1px 2px rgb(84 0 15 / 0.3), 0 4px 12px -4px rgb(84 0 15 / 0.35); }
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart:hover { background-color: rgb(255 240 242); color: var(--sm-red-press, rgb(176 0 31)); }
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart:active { background-color: rgb(255 226 231); color: var(--sm-red-press, rgb(176 0 31)); }
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart .material-icons { background-image: url("../icons/cart-add-red.svg"); }
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart:focus-visible { box-shadow: 0 0 0 2px var(--sp-red, rgb(234 0 41)), 0 0 0 6px var(--sp-red, rgb(234 0 41)); }
html.sm-bar-red.sm-ws header#smTopBar #smAddToCart .mui-ripple { background-color: rgb(234 0 41 / 0.25); }

/* ===== Windows High Contrast ===== */
@media (forced-colors: active) {
  header#smTopBar, html.sm-bar-red header#smTopBar { border-bottom: 1px solid CanvasText; background-color: Canvas; color: CanvasText; }
  header#smTopBar a.sterlingLogo > img { forced-color-adjust: none; background-color: rgb(255 255 255); filter: none; }
  header#smTopBar .smTopProduct, html.sm-bar-red header#smTopBar .smTopProduct { border-left-color: CanvasText; }
  header#smTopBar :is(.smTopProductName, .smTopProductMeta) { color: CanvasText; }
}

