/* brand.css — branding: the header logo slot (brand.js) and the Branding tab (brand-editor.js).
   styles.css already carries Ephemeris's .bc-logo / .bc-divider and the editor's logo preview and
   swatches; only what Tessera needs on top is here. */

/* the header logo: styles.css sets display:block, which would beat the hidden attribute */
header.bc-head .bc-logo{max-width:220px;object-fit:contain;flex:0 0 auto}
header.bc-head .bc-logo[hidden],header.bc-head .bc-divider[hidden]{display:none}
header.bc-head .bc-divider{flex:0 0 auto}
@media (max-width:640px){
  header.bc-head .bc-logo{height:30px;max-width:120px}
  header.bc-head .bc-divider{height:26px}
}

/* ---- the logo's CORNER and SIZE: classes brand.js puts on <html> only while a logo is shown and its
   corner or size is not the default (top left, medium: the rules above), so a page without them
   matches none of these rules. ---- */
/* size: medium is 40px tall (30px on a phone); small and large scale it, width cap included */
html.bc-logo-sm .bc-logo{height:28px;max-width:154px}
html.bc-logo-lg .bc-logo{height:56px;max-width:308px}
/* top right: on the titles' line, pushed to its right end (just before the search and the controls when
   they share that line). It takes the place the logo had before the titles, so it never needs a line
   of its own: a header is never taller for it. The free space goes before the logo instead of before
   the search or the controls (their auto margin is dropped; the doubled class outranks search.css), and
   a line the controls wrap onto is packed right. The negative margins keep its line no taller than the
   controls should it ever share theirs. */
html.bc-logo-tr header.bc-head{justify-content:flex-end}
html.bc-logo-tr header.bc-head > .bc-logo{order:2;margin-left:auto;margin-top:-6px;margin-bottom:-6px}
html.bc-logo-tr.bc-logo-tr header.bc-head > :is(.bc-mz-search,.bc-head-right){margin-left:0}
/* bottom left / right: div.bc-logo-band, pinned to the bottom edge across the page and painted like
   the page, holds the logo in its corner. Its height is kept free under the page (a transparent bottom
   border on #app), so the end of the page always scrolls clear of it, and keyboard focus scrolls clear
   of it too. Under every drawer, dialog, card and menu (all 60 and up), over the page's own content. */
html.bc-logo-bl,html.bc-logo-br{--bc-logo-band:60px;scroll-padding-bottom:var(--bc-logo-band)}
html.bc-logo-bl.bc-logo-sm,html.bc-logo-br.bc-logo-sm{--bc-logo-band:48px}
html.bc-logo-bl.bc-logo-lg,html.bc-logo-br.bc-logo-lg{--bc-logo-band:76px}
html.bc-logo-bl #app,html.bc-logo-br #app{border-bottom:var(--bc-logo-band) solid transparent}
.bc-logo-band{position:fixed;left:0;right:0;bottom:0;z-index:40;box-sizing:border-box;height:var(--bc-logo-band,60px);
  display:flex;align-items:center;padding:0 22px;background:var(--paper,#FAF8F4)}
html.bc-logo-br .bc-logo-band{justify-content:flex-end}
.bc-logo-band .bc-logo{display:block;width:auto;height:40px;max-width:220px;object-fit:contain;flex:0 0 auto}
.bc-logo-band .bc-logo[hidden]{display:none}
@media (max-width:640px){
  html.bc-logo-sm .bc-logo{height:22px;max-width:84px}
  html.bc-logo-lg .bc-logo{height:40px;max-width:168px}
  html.bc-logo-bl,html.bc-logo-br{--bc-logo-band:46px}
  html.bc-logo-bl.bc-logo-sm,html.bc-logo-br.bc-logo-sm{--bc-logo-band:38px}
  html.bc-logo-bl.bc-logo-lg,html.bc-logo-br.bc-logo-lg{--bc-logo-band:56px}
  .bc-logo-band{padding:0 14px}
  .bc-logo-band .bc-logo{height:30px;max-width:120px}
}
/* on paper the band is not pinned: it prints once, after the page */
@media print{
  html.bc-logo-bl #app,html.bc-logo-br #app{border-bottom:0}
  .bc-logo-band{position:static;height:auto;padding:12px 0 0;background:none}
}

/* ---- the LOOK: classes brand.js puts on <html> only when a branding sets them, so a page with no
   look matches none of these rules. The accent is the three gold variables (the default gold when no
   accent is set); --bc-look-on is white or ink, whichever reads better on it. An item with a color
   of its own reads it from a --bc-c-* variable brand.js writes only then; unset, every var() below
   falls back to exactly the value it had before item colors existed. ---- */
/* accent frame: a band around the page (fixed, so it never moves the layout), and around each tile */
html.bc-look-frame body::after{content:"";position:fixed;inset:0;border:5px solid var(--bc-c-frame,var(--wuwm-gold));pointer-events:none;z-index:50}
html.bc-look-frame .bc-tile{border-color:var(--bc-c-frame,var(--wuwm-gold));box-shadow:0 0 0 2px var(--bc-c-frame,var(--wuwm-gold)),var(--shadow,none)}
/* accent header row: the accent's soft tint, under labels a shade deeper than the plain header's: they
   read at 5.0:1 or better on the soft tint of any accent (4.6:1 under a read-only column's tint). A
   header row color of its own is a solid bar whose text (--bc-c-header-on) is white or ink, whichever
   reads better on it, or black where neither reaches 4.5:1. Screen only: print drops the fill. */
html.bc-look-header .bc-grid thead th{background:var(--wuwm-gold-soft);color:#554E47;border-bottom:2px solid var(--wuwm-gold)}
@media screen{html.bc-look-header.bc-look-c-header .bc-grid thead th{background:var(--bc-c-header);color:var(--bc-c-header-on);
  border-bottom-color:var(--bc-c-header)}}
/* accent title bar */
html.bc-look-titlebar header.bc-head{background:var(--bc-c-titlebar,var(--wuwm-gold));color:var(--bc-look-on,#231F20);border-bottom-color:transparent;
  border-radius:12px;padding:12px 18px}
html.bc-look-titlebar header.bc-head .bc-titles h1{color:inherit}
/* the subtitle at full strength: dimmed, it falls below 4.5:1 on a mid-tone title bar */
html.bc-look-titlebar header.bc-head .bc-titles .bc-sub{color:inherit}
html.bc-look-titlebar header.bc-head .bc-divider{background:currentColor;opacity:.4}
html.bc-look-titlebar header.bc-head .bc-signout,html.bc-look-titlebar header.bc-head .bc-gear{color:inherit;
  border-color:rgba(var(--bc-look-on-rgb,35,31,32),.38)}
html.bc-look-titlebar header.bc-head .bc-signout:hover,html.bc-look-titlebar header.bc-head .bc-gear:hover{color:inherit;
  background:rgba(var(--bc-look-on-rgb,35,31,32),.14)}
/* row spacing and stripes. :where() keeps these at the grid's own specificity, so a person's own
   "Compact" (gridtools.css), hover, the selected row and unsaved edits all still win. */
:where(html.bc-look-compact) .bc-grid tbody td{padding:4px 10px}
:where(html.bc-look-compact) .bc-grid thead th{padding:6px 10px}
:where(html.bc-look-roomy) .bc-grid tbody td{padding:13px 14px}
:where(html.bc-look-roomy) .bc-grid thead th{padding:13px 14px}
:where(html.bc-look-stripes .bc-grid tbody tr.bc-even) > td{background:var(--bc-c-stripe,rgba(128,128,128,.045))}
@media print{html.bc-look-frame body::after{display:none}}

/* ---- the page BACKGROUND: brand.js sets bc-look-c-bg, --bc-page-bg and --bc-page-ink (white, ink
   or black: at least 4.5:1 on the background) only when a branding has one. Text that sits right on
   it takes that ink at full strength; cards and grid surfaces keep their own surface color (the view
   page's toolbar, grid and footer become one card), and a banner's tint is laid over the surface.
   Screen only: print keeps the paper and the ink. ---- */
@media screen{
  html.bc-look-c-bg body{background:var(--bc-page-bg)}
  /* the header, unless the title bar look gives it a fill of its own */
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head{color:var(--bc-page-ink)}
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-titles h1,
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-titles .bc-sub{color:inherit}
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-divider{background:currentColor;opacity:.4}
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-signout,
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-gear{color:inherit;border-color:rgba(var(--bc-page-ink-rgb),.38)}
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-signout:hover,
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-gear:hover{color:inherit;background:rgba(var(--bc-page-ink-rgb),.14)}
  html.bc-look-c-bg:not(.bc-look-titlebar) header.bc-head .bc-dirtycount{background-color:var(--surface);
    background-image:linear-gradient(rgba(216,187,106,.22),rgba(216,187,106,.22))}
  html.bc-look-c-bg #app > .bc-banner{background-color:var(--surface);background-image:linear-gradient(rgba(156,74,47,.12),rgba(156,74,47,.12))}
  html.bc-look-c-bg #app > .bc-banner.ok{background-image:linear-gradient(rgba(30,122,76,.12),rgba(30,122,76,.12))}
  html.bc-look-c-bg #app > .bc-banner.info{background-image:linear-gradient(rgba(128,128,128,.14),rgba(128,128,128,.14))}
  /* the view page: toolbar, grid and footer on one surface card (the footer's own dimming moves to
     its contents, so the card under it stays solid) */
  html.bc-look-c-bg #app[data-bc-page="view"] > .bc-gt-bar{background:var(--surface);padding:12px 14px 10px;border-radius:12px 12px 0 0}
  html.bc-look-c-bg #app[data-bc-page="view"] > .bc-gridwrap{background:var(--surface)}
  html.bc-look-c-bg #app[data-bc-page="view"] > .bc-gridfoot{background:var(--surface);opacity:1;border-radius:0 0 12px 12px}
  html.bc-look-c-bg #app[data-bc-page="view"] > .bc-gridfoot > *{opacity:.7}
  /* an empty mosaic: its card stays solid (faded whole, a dark page would show through it), its
     text dimmed by color instead; the "+ Add view" card in Edit layout is drawn right on the page */
  html.bc-look-c-bg .bc-mz-empty{opacity:1;color:var(--ink-2)}
  html.bc-look-c-bg .bc-mz-addcard{color:var(--bc-page-ink);border-color:rgba(var(--bc-page-ink-rgb),.5);opacity:1}
  /* a logo pinned to a bottom corner: its band is the page */
  html.bc-look-c-bg .bc-logo-band{background:var(--bc-page-bg)}
}

/* the Branding tab */
.bc-brand-ed .bc-text{width:auto}
.bc-brand-ed .bc-logo-preview[hidden]{display:none}
.bc-brand-ed .bc-logo-preview{max-width:240px}
.bc-brand-ed .bc-brand-file{max-width:100%;font-family:var(--ui);font-size:.92rem}
.bc-brand-ed .bc-accent-swatch{flex:0 0 auto}
.bc-brand-ed .bc-accent-swatch:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(var(--wuwm-gold-rgb),.45)}
.bc-brand-ed .bc-brand-custom{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.bc-brand-ed .bc-brand-hex{width:9.5em;font-family:ui-monospace,Menlo,Consolas,monospace}
.bc-brand-ed .bc-brand-reset{margin-top:18px}
/* a look item's color, under its switch (highlights: a row of its own): compact swatches, picker
   and hex. The control takes the rest of the row and wraps inside itself when the drawer is narrow. */
.bc-brand-ed .bc-item-row{flex-wrap:wrap;padding-top:0;padding-left:22px}
.bc-brand-ed .bc-item-row.bc-item-solo{padding-top:12px;padding-left:0}
.bc-brand-ed .bc-item-row[hidden]{display:none}
.bc-brand-ed .bc-item-row:not(.bc-item-solo) .bc-row-label{font-size:1.05rem;color:var(--ink-2)}
.bc-brand-ed .bc-item-color{display:flex;align-items:center;justify-content:flex-end;gap:5px;flex-wrap:wrap;flex:1 1 260px;min-width:0}
.bc-brand-ed .bc-item-color .bc-item-default{font-size:.92rem;padding:4px 9px;margin-right:3px}
.bc-brand-ed .bc-item-color .bc-item-default.active{border-color:var(--ink);color:var(--ink)}
.bc-brand-ed .bc-item-color .bc-item-swatch{width:22px;height:22px;border-radius:6px}
.bc-brand-ed .bc-item-color .bc-color{width:36px;height:26px;margin-left:3px}
.bc-brand-ed .bc-item-color .bc-brand-hex{width:6.4em;font-size:.95rem;padding:4px 7px}
.bc-brand-ed .bc-item-color .bc-sp-err{flex-basis:100%;text-align:right;margin:0}
@media (max-width:640px){.bc-brand-ed .bc-item-color{justify-content:flex-start}.bc-brand-ed .bc-item-color .bc-sp-err{text-align:left}}
/* the logo's corner: four buttons in a square, each marked in the corner it stands for. Drawn in the
   drawer's own text color (currentColor), so it reads in either theme; the chosen one has the heavier
   edge and a filled mark. */
.bc-brand-ed .bc-logo-place[hidden]{display:none}
.bc-brand-ed .bc-logo-corners{display:grid;grid-template-columns:repeat(2,34px);grid-auto-rows:26px;gap:4px}
.bc-brand-ed .bc-logo-corner{position:relative;box-sizing:border-box;width:34px;height:26px;margin:0;padding:0;cursor:pointer;
  color:inherit;background:transparent;border:1px solid color-mix(in srgb,currentColor 55%,transparent);border-radius:5px}
.bc-brand-ed .bc-logo-corner-dot{position:absolute;width:11px;height:7px;border-radius:2px;
  border:1.5px solid currentColor;box-sizing:border-box;opacity:.75}
.bc-brand-ed .bc-logo-corner-top-left .bc-logo-corner-dot{left:3px;top:3px}
.bc-brand-ed .bc-logo-corner-top-right .bc-logo-corner-dot{right:3px;top:3px}
.bc-brand-ed .bc-logo-corner-bottom-left .bc-logo-corner-dot{left:3px;bottom:3px}
.bc-brand-ed .bc-logo-corner-bottom-right .bc-logo-corner-dot{right:3px;bottom:3px}
.bc-brand-ed .bc-logo-corner.active{border:2px solid currentColor}
.bc-brand-ed .bc-logo-corner.active .bc-logo-corner-dot{background:currentColor;opacity:1}
.bc-brand-ed .bc-logo-corner:focus-visible{outline:2px solid currentColor;outline-offset:2px}
