/* =============================================================
   THEME 4 - SHARED STRUCTURE  (html.esdm-theme-4)
   -------------------------------------------------------------
   The two-tone GEOMETRY for theme-4, independent of light/dark mode.
   index.html links this statically alongside BOTH mode sheets so the
   layout is identical whether the app is in light or dark - the
   mode files (light.css / dark.css) only re-skin the colours on
   top of this structure.

   Splitting structure from colour is what fixes the dark-mode
   regression where the tiles collapsed back to the base round
   white button: previously the square-tile / label-bar geometry
   lived ONLY in theme-4/light, so dark mode (which did not load
   light) got colours but no structure.
   ============================================================= */

/* ---- TILE: square face fills the tile frame ----
   Geometry shared by both modes. Colours (background / border /
   shadow / hover lift) are overridden by mode files. */
html.esdm-theme-4 .tenant-resources .tile-view .tenant-resources-btn{
    /* position:absolute inside .tenant-resources which has position:relative,
       so the button is positioned relative to the tile card. */
    position:absolute !important;
    left:50% !important;
    top:50% !important;
    transform:translate(-50%,-50%) !important;
    width:clamp(80px, calc(100px * var(--esdm-zoom,1)), 140px) !important;
    height:clamp(80px, calc(100px * var(--esdm-zoom,1)), 140px) !important;
    margin:0 auto !important;
    border-radius:8px !important;
    transition:border-color .15s ease,box-shadow .15s ease !important;
}
/* breathing room between tiles so they never touch at any zoom level.
   The tile needs explicit width AND height because the button inside is
   position:absolute (out of flow). clamp() keeps the tile frame within
   the same 80-140px bounds as the button. */
html.esdm-theme-4 .tenant-resources .tile-view{
    position:relative !important;
    width:clamp(80px, calc(100px * var(--esdm-zoom,1)), 140px) !important;
    height:clamp(80px, calc(100px * var(--esdm-zoom,1)), 140px) !important;
    margin:calc(8px * var(--esdm-zoom,1)) !important;
    overflow:visible !important;
}

/* ---- TILE LAYOUT: icon + flood bar, both anchored to the BUTTON ----
   The DOM nests the icon wrapper and the label bar inside the button's
   flex span, but a POSITIONED span becomes the containing block for its
   children, and every percentage then resolves against the span instead
   of the button. That is what broke the flood bar: with the span sized
   to the non-flooded band (65% of the button), the label's height:35%
   silently became 35% OF THE SPAN = 22.75% of the button, and bottom:0
   parked it at the span's bottom edge instead of the button's.

   So the span is deliberately left UNPOSITIONED (static). The label bar
   then resolves against the button - correct full width, correct 35%
   height, flush on the button's bottom edge. The icon is placed directly
   against the button too, with ONE calculation instead of nesting:
   its centre lands at 32.5% of the button height, which is exactly the
   middle of the non-flooded band (0%..65%), so it never touches the
   flood line and never sits on the tile's top edge - at any zoom. */
html.esdm-theme-4 .tenant-resources .tile-view .tenant-resources-btn-container{
    padding:0 !important;
    position:static !important;
    top:auto !important;
    left:auto !important;
    right:auto !important;
    bottom:auto !important;
    height:auto !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:center !important;
    justify-content:center !important;
    gap:0 !important;
}
/* Icon: centred left/right, and vertically centred in the band ABOVE the
   flood line (32.5% = the midpoint of 0..65%). The wrapper is sized to
   the SAME clamp as the <img> inside it - the app writes an inline
   width/height:32px, and a 32px box around a 50px icon makes the image
   overflow its own box's bottom-right corner, so the icon looks shifted
   down and right of true centre. */
html.esdm-theme-4 .tenant-resources .tile-view .tile-view-thumbnail{
    position:absolute !important;
    left:50% !important;
    top:32.5% !important;
    transform:translate(-50%,-50%) !important;
    margin:0 !important;
    order:0 !important;
    width:clamp(20px, calc(40px * var(--esdm-zoom,1)), 56px) !important;
    height:clamp(20px, calc(40px * var(--esdm-zoom,1)), 56px) !important;
}
/* icons keep their natural colours on the tile top (light: white top,
   dark: dark-grey top) - no grey wash in either mode. */
html.esdm-theme-4 .tenant-resources .tile-view .tile-view-thumbnail > img.ms-Image-image{
    /* clamp icon size so it never vanishes at small zoom or overflow at
       large zoom - scales with --esdm-zoom but stays within bounds. */
    width:clamp(20px, calc(40px * var(--esdm-zoom,1)), 56px) !important;
    height:clamp(20px, calc(40px * var(--esdm-zoom,1)), 56px) !important;
    /* kill the base.css grayscale(1) filter so icons keep their natural
       colours instead of turning grey in theme-4. base.css applies
       grayscale(1) to all non-stock themes; theme-4 overrides it here. */
    filter:none !important;
}

/* ---- TILE DIAGONAL RESIZE (--esdm-zoom) ----
   The +/- buttons nudge --esdm-zoom on <html>. base.css applies it as
   CSS zoom on .tenant-resources, which scales the entire tile frame
   AND its contents proportionally - gaps between tiles are preserved
   because they're part of the zoomed render. The tile button face
   scales explicitly with --esdm-zoom but stays smaller than the tile
   frame so gaps are preserved at every level.
   NOTE: the min/max constraints above are FIXED (60px-140px, not zoom-
   scaled) and are NOT re-set here - doing so would override them and let
   the button collapse to a pea at small zoom or overflow the tile frame
   at large zoom. The first block already has the full width/height/min/max
   set correctly. */
/* ---- TILE FOOTER BAR ----
   Taken OUT of the button's flex column and pinned to the bottom of the
   button instead. As a flex item it could only ever be a rectangle in the
   flow - its width was whatever the flex column left over, so it never
   reached the tile edges and never looked like it was pooling. As an
   absolutely-positioned child of the (position:absolute) button it spans
   the FULL tile width and sits flush on the bottom edge every time, at
   every zoom level - the surface colour is applied by the mode files. */
html.esdm-theme-4 .tenant-resources .tile-view .tile-view-label-container{
    position:absolute !important;
    left:0 !important;
    right:0 !important;
    bottom:0 !important;
    top:auto !important;
    height:35% !important;
    min-height:0 !important;
    margin:0 !important;
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    z-index:2 !important;
    border-radius:0 0 7px 7px !important;
    padding:clamp(3px, calc(7px * var(--esdm-zoom,1)), 7px) clamp(4px, calc(8px * var(--esdm-zoom,1)), 8px) !important;
    text-align:center !important;
    box-sizing:border-box !important;
}

/* ---- TILE LABEL ----
   Typography is shared (keeps the footer bar's geometry as designed);
   the text colour / aurora is applied by the mode files. */
html.esdm-theme-4 .tenant-resources .tile-view .tile-view-label{
    background-image:none !important;
    background-color:transparent !important;
    border:none !important;
    box-shadow:none !important;
    padding:0 !important;
    animation:none !important;
    text-shadow:none !important;
    font-family:"Segoe UI",Tahoma,Geneva,Verdana,sans-serif !important;
    font-weight:600 !important;
    font-size:13px !important;
    letter-spacing:0 !important;
    line-height:1 !important;
    display:inline-block !important;
    position:relative !important;
    height:auto !important;
}

/* ---- PANEL ----
   Structural: the glass blur is dropped in BOTH modes so the flat cards
   sit on a clean surface (the base layer adds the blur/scrim). The
   surface colour and edge are supplied by the mode files. */
html.esdm-theme-4 .tenants-container{
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
}

/* ---- HEADER BAR ----
   Structural: radius + no blur in both modes. The solid brand-blue
   (light) vs flat-black (dark) surface is applied by the mode files. */
html.esdm-theme-4 .tenant-header,
html.esdm-theme-4 .tenant-header:hover,
html.esdm-theme-4 .tenant-header:focus,
html.esdm-theme-4 .tenant-header:focus-within,
html.esdm-theme-4 .tenant-header:focus-visible,
html.esdm-theme-4 .tenant-header:active,
html.esdm-theme-4 .tenant-header-container .tenant-header{
    border-radius:10px !important;
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
}

/* ---- HEADER TITLE ----
   Strip any box/background so the glyph sits directly on the header
   surface (the base layer could paint it separately). */
html.esdm-theme-4 .tenant-header .tenant-display-name,
html.esdm-theme-4 .tenant-header .title-container .tenant-display-name{
    background-image:none !important;
    background-color:transparent !important;
    border:none !important;
    box-shadow:none !important;
    animation:none !important;
    padding:0 !important;
}

/* ---- LIST VIEW: two-tone split ----
   Fixed-width (44px) white/icon cradle + blue remainder. The split is
   pinned to the icon so it lands in the same place at every column
   count. Position/min-height/padding repeat chunk's row values so the
   absolute children below always resolve against the row itself.
   The surface gradient follows the mode (light: white|blue, dark: flat
   grey). */
html.esdm-theme-4 .tenant-resources .list-view{
    position:relative !important;
    min-height:calc(45px * var(--esdm-zoom,1)) !important;
    padding:calc(10px * var(--esdm-zoom,1)) !important;
    border-radius:8px !important;
    transition:background .15s ease,border-color .15s ease,box-shadow .15s ease !important;
}
/* skip the base-layer burn bands (the ::before band on the row border
   and the ::after ring outside it) - they belong to the holographic
   hover system, not the two-tone card */
html.esdm-theme-4 .tenant-resources .list-view::before,
html.esdm-theme-4 .tenant-resources .list-view::after{
    content:none !important;
    display:none !important;
}
/* icon centred inside the white cradle (28px = middle of the 56px
   cradle, matching the gradient split in light/dark/theme.css).
   EVERY pixel here scales with --esdm-zoom so the icon, cradle and label
   gap all grow/shrink together - a fixed 22px/56px left the icon pinned
   in place while the row stretched, which overlapped the label when zoomed
   up and shrank the icon to nothing when zoomed down. */
html.esdm-theme-4 .tenant-resources .list-view .list-view-thumbnail{
    position:absolute !important;
    left:calc(28px * var(--esdm-zoom,1)) !important;
    top:50% !important;
    transform:translate(-50%,-50%) !important;
}
/* label starts after the cradle and is centred vertically; min-width:0
   keeps the ellipsis working */
html.esdm-theme-4 .tenant-resources .list-view .list-view-label-container{
    position:absolute !important;
    left:calc(56px * var(--esdm-zoom,1)) !important;
    right:calc(10px * var(--esdm-zoom,1)) !important;
    top:0 !important;
    bottom:0 !important;
    display:flex !important;
    align-items:center !important;
}
html.esdm-theme-4 .tenant-resources .list-view .list-view-label{
    min-width:0 !important;
    text-shadow:none !important;
}
/* the base layer gives the row's button a translucent white glass face;
   it would wash over the split. Harmless when the app renders no button. */
html.esdm-theme-4 .tenant-resources .list-view .tenant-resources-btn{
    background:transparent !important;
    border:none !important;
    box-shadow:none !important;
}