Surfaces, shadow, and the stack. The z-axis treated as a statement of state: what is above what, what can be touched right now, and what will go away. Five levels and the rules for who gets which.
A shadow is a claim that one surface is in front of another. Depth is a primitive because that claim tells the user what is temporary, what is on top, and where their attention belongs, and a shadow that makes the claim falsely is a bug, not a style.
Start with the failure, because it is the common one. Here is a sample-tracking screen from an invented water-quality lab: a top bar, a batch header with three actions, a grid of sample cards, an inspector panel, an open overflow menu on the first card, and a toast confirming the last sample logged. Every shadow on it was added by someone with a reason: the bar "needed to feel sticky," the buttons "looked flat," the cards "needed to pop," the inspector "needed separation." Look at it before turning the inventory on.
Three things are wrong, and none of them is the amount of shadow. The shadows say nothing true. The cards and the open menu wear the same shadow (S3), so the menu, which really is floating above the grid, makes the same claim as the cards, which are not. There is no scale. Six shadows on one screen, each a different offset, blur, and alpha, written by hand in six components. And the order is broken. The menu is clipped by the card next to it, because the card's hover animation created a stacking context the menu can't escape (section VII). Section XI audits this screen and fixes it with two shadows.
The reason depth deserves a chapter is that the eye reads it before anything else. A shadow under a surface is the visual system's oldest cue for "this is in front," and in an interface "in front" means three things at once: it covers something (so the thing under it is temporarily unavailable), it is temporary (it arrived and will leave), and it has attention (it is what the user is dealing with now). A menu, a dialog, and a toast are all true on those three counts. A card in a grid is false on all three, which is why a shadowed card grid reads as noise: twelve surfaces each claiming to be the thing on top.
The industry has swung across this twice. Skeuomorphic interfaces put depth on everything. Flat design removed it from everything, including the places it was doing work, and produced menus that couldn't be told apart from the page beneath them. The convergence since, visible in Material 3, Atlassian, and Fluent 2, is the position this chapter takes: a few named levels, shadow reserved for surfaces that are actually above the page, and everything that is part of the page drawn flat. The button chapter reached the same place for buttons in Button Taxonomy §II: depth deployed sparingly and on purpose, not as decoration.
The menu and the cards make the same claim. Nothing is above anything, so nothing is.
The flat overcorrection. The open menu reads as a third card that landed on the other two.
Cards are bordered and flat; the menu, the only temporary surface, is the only shadow.
The boundary with neighbouring chapters, stated once. Spacing & Density decides how far apart surfaces are and Grid & Layout decides where they sit; this chapter decides which of them is in front. Border & Radius (a planned Foundations chapter) owns border weight and corner radius; this chapter owns which separation method means "above." Overlays: Modal & Drawer and Overlays: Popover & Tooltip own focus trapping, dismissal, positioning, and sizing; this chapter owns the level each one sits at. Color owns the gray ramps; this chapter takes two of them, one per mode, and assigns them to levels.
Separate surfaces that share a plane with a hairline or a tonal step, and reserve shadow for the one thing neither of those can say: this surface is above the others. There are only three ways to tell the eye that two surfaces are different, and they form a ladder of how much they claim.
A hairline says "these are two regions of the same surface." It is the cheapest claim and the right one for the frame's regions (sidebar against main, an inspector against the content beside it), for table rows, and for cards in a grid. A tonal step says "this region has a different role." A sidebar a shade darker than the main canvas, a toolbar band, a code block, an input well: all on the same plane, but not the same kind of surface. Dark mode does most of its work this way (section VI). A shadow says "this is not part of the page." It is the only one of the three that implies a z-position, and with it, coverage, impermanence, and attention.
That gives the rule for choosing. Ask whether the surface would move if the page scrolled under it, or leave if the user pressed Escape. If neither, it is on the page, and it gets a hairline or a tone. If either, it is above the page, and it gets a shadow. The sidebar in the bottom-left frame fails that test, and the shadow makes a false promise: users read it as something that will slide shut. It is the most common misuse of shadow in application frames, and it usually comes from wanting more separation than a hairline gives; the fix for that is a tonal step, not a z-position.
| Method | Claims | Use for | Not for |
|---|---|---|---|
| Hairline | Two regions, one plane | Frame regions, table rows, cards in a grid, list dividers, the sticky header at rest. | Anything floating; a hairline alone on a menu makes it a third card. |
| Tonal step | Same plane, different role | Sidebar or rail backgrounds, toolbars, wells and code blocks (stepped down), every level in dark mode (stepped up). | Signalling interactivity; a tinted card is not a button. |
| Shadow | Above the plane | Menus, popovers, listboxes, drawers, dialogs, toasts, drag ghosts. The sticky header only while content scrolls under it. | Cards, panels, sidebars, inspectors, table rows, anything that is part of the page. |
Combining them is allowed in one direction only. A raised surface may carry a hairline as well as its shadow: on a white menu over a white card, the shadow gives height but the edge is soft, and a 1px border at low alpha (--el-edge in this chapter) draws it crisply. That border is the menu's edge, the shadow is its height, and each does one job. What fails is the bottom-right card: a flat surface wearing a border, a tint, and a shadow at once, each added because the others "weren't enough." When a surface needs three cues to stand apart, the problem is usually that everything around it is wearing two.
A believable shadow is two shadows: a tight one that draws the edge and a wide, faint one that says how high, both in a tinted dark of the surface underneath rather than black. Every box-shadow layer has the same four parameters, and the figure labels them on a single layer before the variants show why one layer is never enough.
Offset says where the light is. A y-offset with no x-offset puts the light overhead and slightly in front of the user, which is the convention every major system uses and the one to keep: a shadow pushed sideways reads as a decision about the room's lighting that the rest of the interface doesn't share. The size of the offset is the strongest single cue to height. Blur says how far the surface is from what it's casting onto: a surface touching the page casts a hard shadow, one hovering above it casts a soft one. Blur and offset should grow together. Spread grows or shrinks the copy before it's blurred. A negative spread tucks a wide shadow under the box, so it falls below the surface rather than haloing out on every side, and it is the parameter most hand-written shadows forget. Color and alpha say how much light the surface blocks. Real shadows are darker versions of the surface they land on, so on warm paper the shadow is a warm dark; pure black at the same alpha reads as gray dirt rather than shade.
A real object under a real light casts two shadows at once: a sharp, dark one right at the contact edge, where almost no light reaches, and a wide, faint one from the general light in the room. Material calls these the key and ambient shadows, and Fluent 2 builds every elevation from exactly that pair. In CSS it is two comma-separated layers. The key layer is tight: offset 1 to 3px, blur 2 to 8px, alpha around .10. It draws the edge, so the surface looks like it has a bottom. The ambient layer is wide: offset and blur that grow with the level, a negative spread, alpha .15 to .30. It says how high. A single layer can only do one of the two jobs, which is why single-layer shadows fail in one of two recognisable ways.
The proportion in the last row is the one to keep: for the ambient layer, blur is two to three times the offset, and the spread is about minus a quarter of the blur. Less blur than that and the shadow is too sharp for the distance the offset claims, so the surface looks like it's sitting on a hard, dark slab. More and it turns into a smudge with no discernible source. The playground below draws the ambient layer with the sliders, adds the key layer under it, and writes the CSS.
box-shadow: 0 2px 6px rgb(46 40 30 / .10), 0 18px 44px -8px rgb(46 40 30 / .24);
Use five levels, numbered 0 to 4 and named for what they mean: flat, raised, floating, overlay, top. Each level binds one shadow pair, one surface color per mode, and one band of the z-index scale, so that choosing a level for a component is the only depth decision anyone makes.
0 · Flat: the canvas, cards, panels, the sidebar, tables. 1 · Raised: the sticky header while content scrolls under it, a slider's thumb, a switch's knob, the selected segment. 2 · Floating: menus, popovers, listboxes, date pickers, tooltips. 3 · Overlay: drawers, dialogs, bottom sheets, with a scrim when modal. 4 · Top: toasts and the drag ghost. Section V gives the full roster, at rest and while active.
| Level | Means | Shadow · key, ambient | z-layer | Surface · light / dark |
|---|---|---|---|---|
| 0 · flat | Part of the page | none | base 0 | #fff on #f6f5f2 / #1a1a1a on #121212 |
| 1 · raised | On the page, in front of it for now | 0 1px 2px .12 0 1px 4px .06 | sticky 100 | #fff / #212121 |
| 2 · floating | Anchored to the page, temporary | 0 1px 3px .10 0 8px 20px −4px .16 | popover 1000 tooltip 1400 | #fff / #282828 |
| 3 · overlay | Covers the page, takes focus | 0 2px 6px .10 0 18px 44px −8px .24 | drawer 1100 modal 1200 | #fff / #2f2f2f |
| 4 · top | Unanchored, survives overlays | 0 3px 8px .12 0 28px 64px −12px .30 | toast 1300 | #fff / #363636 |
The shadows climb on every parameter at once: the key layer's offset goes 1, 1, 2, 3 and the ambient layer's offset 1, 8, 18, 28, with blur at roughly two and a half times the offset and a spread that tucks it further under each step. The alphas climb too, gently, because a higher surface blocks more of the room's light. In light mode every level's surface is the same white: height is the shadow's job, and only the shadow's. In dark mode the surface does the work instead (section VI).
Five is the number of distinct things depth has to say in an application, and each level answers a different question: is it part of the page; is it part of the page but in front for now; is it attached to something on the page; does it cover the page; must it survive things that cover the page. A sixth level would have to answer a sixth question, and in practice it gets used for "this one should look a bit more important," which is the decorative use the scale exists to stop. Fewer than five and two of those questions share an answer: most often popovers and dialogs share a shadow, and a menu opened inside a dialog can no longer be seen to sit above it.
Real systems land in the same range. Material 3 collapsed Material 2's two dozen dp values into six levels (0 to 5) and uses the top two mostly for hover and drag states of the levels below. Atlassian names four surfaces, sunken, default, raised, and overlay, which is this scale with a well added below and the top two merged. Carbon separates nested surfaces almost entirely with alternating layer tones and keeps shadow for floating things, which is the hairline-and-tone rung of section II made into policy. shadcn/ui pairs a 1px border with a medium shadow on its popovers and menus and a larger one on its dialog, the edge-plus-height combination this chapter recommends. None of these systems uses more than six, and every one of them reserves the largest shadows for surfaces that cover the page.
The shadow says how high a surface looks; the z-index makes it true. They are two scales because order needs more distinctions than appearance does: a drawer and a dialog look the same height, but if both are open the dialog must win. So the z-index scale has eight named layers (section VII) and the shadow scale has five levels, and every layer maps to exactly one level. The one deliberate exception is the tooltip: it is small and anchored, so it takes level 2's shadow, but it must never be covered, so it takes the highest layer. Everywhere else, a component that looks higher is higher.
A card in a grid is part of the page, so it rests flat or bordered at level 0 and never wears a shadow. Elevation at rest belongs only to surfaces that are not part of the page: menus, popovers, dialogs, drawers, toasts, and the thing being dragged. Everything else earns elevation only while something is happening to it, and gives it back when that stops.
| Component | At rest | While something happens |
|---|---|---|
| Card in a grid | 0 · hairline | 1 on hover only if the whole card is one link |
| Panel, sidebar, inspector | 0 · hairline or tone | Stays 0. A sidebar that slides over content on a narrow screen is a drawer (3). |
| Table row | 0 · divider | Stays 0; hover is a tint, selection a tint plus a mark |
| Sticky header | 0 · hairline | 1 while content scrolls under it |
| Slider thumb, switch knob, selected segment | 1 | 1. The moving part of a control is the one place level 1 lives at rest. |
| Menu, popover, listbox, tooltip | 2 while open | Does not exist when closed |
| Drawer, dialog, bottom sheet | 3 while open, with scrim | Does not exist when closed |
| Toast | 4 while visible | Leaves on its own |
| Dragged item | Its own resting level | 4 while dragged, leaving a slot behind |
The test from section II applies without exception. A card in a grid doesn't move when the page scrolls and doesn't leave on Escape, so it is part of the page, and a shadow on it is a false claim of the kind section I's screen made twelve times over. The usual argument for shadowed cards is that they need separation from the canvas. They do, and that is the hairline's job or the tone's (a white card on a canvas one step darker). The usual argument for shadowed panels is that the screen "looks flat." It is supposed to: a flat page is what makes the one raised thing on it legible.
Buttons are a component decision rather than a surface decision, and Button Taxonomy §II made it: flat by default, a slight lift as a deliberate stylistic choice. If a system gives its buttons a lift, it is level 1 and no more, the same as a slider thumb: a control's moving part, never a surface.
Lifting on hover is honest when the lift predicts what a click will do: the whole card is one target, or the thing can be picked up. It is noise everywhere else. A card that is one big link lifts from 0 to 1 on hover, because the lift says "this entire surface is the button," which is true. In a list of such cards the lift is withdrawn all the same: a grid of surfaces that each rise under the pointer flickers as the pointer crosses it, so Cards I §V marks liveness there with a stroke or a tint, and the lift stays for a card that stands alone. A card that contains a checkbox, a menu button, and a link should not lift, because the lift promises one target and the card has three. A table row should never lift: rows are slices of one surface, and a lifted row breaks the table into pieces. Rows take a tint.
Keep the lift small and fast. Level 0 to level 1 plus a 1px rise is enough; jumping a hovered card to level 3 makes it look like it is about to become a dialog. The duration and easing belong to Motion & Easing, but the rule is that the lift arrives quickly and leaves at the same speed, so it tracks the pointer rather than performing for it. And because hover doesn't exist on touch, nothing may depend on it: the card must already look like a link at rest, through its chevron and its title, before the lift confirms it.
The dragged item is the clearest case of honest elevation, and it goes to the top: level 4, with the slot it came from left visible. The item is above everything for as long as the pointer holds it, it will be put down somewhere, and nothing else should be competing for attention. The slot matters as much as the ghost: it shows where the item will return if the drag is cancelled, and it keeps the list from closing up and jumping under the pointer.
Light mode says "higher" with a shadow; dark mode says it with a lighter surface and a faint top edge, and keeps the shadow only to darken the gap beneath. The reason is physical: a shadow is a region darker than its surroundings, and on a surface that is already nearly black there is almost no darker left. The same five levels, rendered with shadows alone on a dark canvas, collapse into one.
The dark ramp steps the surface up about 3% in lightness per level, from #1a1a1a at level 0 to #363636 at level 4, on a canvas of #121212. It is the scheme Material's dark theme made famous with white overlays at rising opacity, and the one Apple's HIG encodes as separate base and elevated background colors, so that a sheet presented over a dark screen is visibly lighter than the screen. The two cues that make it work are the ones a light-mode shadow gets for free. The tonal step gives each level a distinct surface. The edge, a hairline of white at 6 to 10% with the top side a little brighter, draws the boundary that a light-mode key shadow would have drawn, as if the surface caught light from above. The shadow stays, in black at higher alpha, and it does a smaller job: it darkens the canvas just outside the surface so the lighter surface reads lighter still.
The light-mode recipe, ported. The menu is the same gray as the card under it, and its shadow is lost in the dark.
Two steps lighter than the card, a brighter top edge, and the shadow underneath. The menu reads as above at a glance.
| Level | Light · surface, shadow | Dark · surface | Dark · edge (sides / top) | Dark · shadow |
|---|---|---|---|---|
| canvas | #f6f5f2 | #121212 | — | — |
| 0 · flat | #fff · hairline #e2e0da | #1a1a1a | 6% / 6% | none |
| 1 · raised | #fff · elevation-1 | #212121 | 7% / 10% | key only, black .5 |
| 2 · floating | #fff · elevation-2 | #282828 | 8% / 12% | pair, black .5 / .6 |
| 3 · overlay | #fff · elevation-3 | #2f2f2f | 9% / 14% | pair, black .5 / .7 |
| 4 · top | #fff · elevation-4 | #363636 | 10% / 16% | pair, black .5 / .75 |
Three consequences follow. The surface tokens are per mode, and components never pick colors. A menu asks for --surface-2 and --elevation-2; the mode decides whether that means white with a shadow or #282828 with an edge. This is the same parallel-palette argument Button Taxonomy III §G1 made for button colors: dark mode is a second ramp, not an inversion of the first. Never glow. A white or light shadow on a dark surface looks like a neon outline, not height; the edge hairline is the dark-mode replacement for the key shadow, and it is one pixel. Tonal lift is not hierarchy. A lighter surface in dark mode means "higher," so a dark-mode card that is lighter than its neighbours to look "important" is making the same false claim as a shadowed card in light mode.
z-index is a token scale of eight named layers, set once for the product; a raw number in a component is a bug waiting for the next overlay. The shadow scale makes a surface look higher. The z-index scale is what makes it actually paint on top, and unlike the shadow, it fails silently: the menu renders, it just renders underneath something.
The order is the order of what must win. The page is at the bottom. Sticky headers sit above it, and rails above them, so a rail that expands on hover covers the header too. Menus and popovers come next, above everything that is part of the page. Drawers sit above popovers, so a drawer opening closes over any menu that was open, and dialogs above drawers, so a confirmation raised from a drawer appears on top of it, with the scrim just under the dialog. Toasts sit above dialogs because a toast confirming the dialog's action must be visible while the dialog closes. Tooltips are last, because a tooltip on a button inside any of the above must never be covered by the thing it describes.
The gaps are deliberate. The jump from 200 to 1000 separates things that are part of the page from things that are above it, so a page component that needs a local order (a badge over an avatar, a sticky table header inside a scrolling panel) can use 1 to 99 inside its own container without ever approaching an overlay. The steps of 100 leave room to insert a layer later without renumbering. Bootstrap has shipped a named scale of this shape for years, dropdowns at 1000 and tooltips near the top; the specific numbers matter much less than having names and forbidding everything else.
The most common z-index bug has nothing to do with the numbers. A z-index only competes within its stacking context, and many properties quietly create one: transform, opacity below 1, filter, backdrop-filter, will-change, isolation: isolate, contain: paint, and any positioned element with a z-index of its own. A menu with z-index: 9999 inside a card that has a hover transform is 9999 inside that card and nothing outside it; the next card, painted later, covers it. This is what happened to the menu in section I.
The transform was added for a hover animation. It made each card a stacking context, so the menu can't rise above its card's sibling.
The menu is rendered outside the card (a portal, or the top layer) and takes its layer from the scale, so no card's styling can trap it.
The durable fix is structural: anything at level 2 or above is rendered outside the component that opened it, at the root of the document, so that no ancestor's transform, opacity, or overflow can trap or clip it. Every mature component library does this with a portal. The platform now does it natively: an element opened with <dialog>.showModal() or the popover attribute goes into the browser's top layer, above every z-index on the page, stacked in the order things were opened. Where the top layer is available, use it for levels 2 to 4 and keep the z-index scale for the layers that are part of the page (sticky, rail) and as the fallback. Where it isn't, portal to the root and use the tokens. Either way, the rule for code review is the same: a z-index in a component that isn't a token is a defect, and a z-index larger than the scale's top is two defects.
A scrim is required exactly when the page underneath stops responding: a modal dialog always gets one, a drawer gets one when it is modal, and a menu, popover, or tooltip never does. The scrim is not decoration and not a dimmer for drama. It is the visible half of a state change whose invisible half is that clicks on the page no longer reach it, and showing one without the other is a lie in either direction.
A modal without a scrim looks like a popover, so the user clicks the page behind it, and nothing happens. A menu with a scrim looks like a dialog, so a lightweight choice suddenly feels like a decision, and a click outside it, which should simply close it, feels like it might cancel something. The pairing is fixed: levels 2 and 4 never have a scrim; level 3 has one whenever it is modal. A non-modal drawer, such as an inspector that slides in while the page stays usable, has no scrim, and it should then not cover the content the user is working with.
A scrim should dim the page enough that it unmistakably can't be used, and not so much that the user loses track of what they were doing. In light mode that is about 40% of the shadow tint, the same warm dark the shadows use, so the page looks shaded rather than grayed. In dark mode it is about 60% black, since the page is already dark and needs more to recede. Lighter and the page looks live; darker and the dialog floats in a void with no context, which matters most when the dialog is asking about something on the page.
Blur is a scrim with a texture, and behind a dialog it is the wrong texture. It costs a full-screen filter on every frame the dialog animates, and it removes the one thing a scrim is careful to keep: a legible page, so the user can see which sample they are archiving. Blur has no better home elsewhere: a translucent bar with content scrolling under it pays the same filter on every frame to show a smear of what the user is about to scroll to anyway, and Part II measures what it costs the bar's own text. Behind overlays, a flat scrim at the right alpha does the job better.
Overlays open from inside overlays all the time: a select inside a dialog, a date picker inside a drawer, a confirmation raised by a dialog's action. The scale resolves every one of them with one rule: a child overlay keeps its own level's shadow and stacks directly above its parent, in the order opened. The listbox inside a dialog is still a level-2 surface with a level-2 shadow, because it is still anchored and temporary; it paints above the dialog because it was opened from it. The top layer does this by itself. With z-index tokens, it means the child renders at the root and takes its parent's layer plus one step, never its own level's layer, which would put it under the dialog.
Dialogs over dialogs are allowed exactly once, for a confirmation: closing a dialog with unsaved edits, or confirming an irreversible action that the dialog led to. The scrim moves up rather than doubling: the first dialog's scrim clears and the confirmation's scrim dims the first dialog and the page together, so the first visibly recedes and the page is never dimmed twice (Overlays: Modal & Drawer §XI measures why). The confirmation is always smaller than its parent. A second full dialog over a first is a sign the flow should have been a page or a stepped dialog. Positioning and collision handling for the listbox are covered in Select §VIII.
The boundary, stated once: the Overlays chapters (Modal & Drawer, Popover & Tooltip) own how overlays behave: focus trapping and return, dismissal on Escape and outside click, sizing in large viewports, positioning and collision. This chapter owns where they sit: the level, the layer, the scrim, and the order when one opens from another.
The highest surface that takes input is the one that has focus, and when two surfaces are raised at once, the screen is asking two questions of a user who can answer only one. Depth is how the screen shows where attention belongs. The keyboard focus, the visual height, and the scrim all have to agree on a single surface.
Opening an overlay closes everything floating on the page. Menus, popovers, coach marks, and hover cards belong to the page, and when the page goes under a scrim, they go with it. Most of these close on an outside click anyway; the ones that don't (coach marks, persistent popovers, a "what's new" callout pinned to a button) are the ones that end up floating above a dialog, and they are almost always the product of someone giving a component a "very high" z-index so that it would "never be hidden." Section VII's scale makes that impossible: a coach mark is anchored and temporary, so it is level 2 on the popover layer, below every dialog.
The page under a modal is inert, not just dim. The scrim is what the user sees; the inert state is what the keyboard and assistive technology get, so that Tab can't wander onto a button under the scrim and a screen reader doesn't read the page behind the dialog. showModal() does both. A hand-built modal has to set inert on everything outside it, and a modal that dims the page without making it inert has a focus order that walks out of the dialog into a page the user can't see properly.
The only thing above the focused surface is a toast, and a toast never asks. Level 4 sits above dialogs so that a confirmation of what the dialog just did can be seen while it closes. That works only because a toast takes no focus and demands nothing: it reports, offers at most an Undo, and leaves on its own. A toast that needs a decision is a dialog in disguise, and it should be a dialog, because it is now a second raised thing asking a second question.
Disabled is not receded. Unavailability is a state of the control, shown by the control (Button Taxonomy covers disabled styling); a change of level claims the surface moved, which it didn't. The one surface-wide recession the system has is the scrim, and it means the whole page is unavailable, for exactly as long as the overlay is open.
Inset is honest in two places only: a control that holds a value or a moving part (an input well, a switch or slider track, a segmented control's tray), and a surface that sits below the page (a code block, a sunken tray). Everywhere else it's skeuomorphic noise. Going below the plane is the mirror image of going above it, and it claims the opposite thing: this is a container to put something into, rather than this is on top.
The input well is the most common inset in the scale and the most useful: a 1 or 2px inset shadow at low alpha inside the border tells the eye that this box receives text rather than displays it. It belongs to the input chapter's border strategies (Text Inputs §IV) as an option, and it is the one inset most systems keep. Tracks follow the same logic: the switch's track and the slider's rail sink a little, and the knob and thumb rise to level 1, so the control reads as a channel with something to move along it. A segmented control is the clearest case: a sunken tray holding a raised selected pill, two levels apart, and the selection is unmistakable without any color.
A sunken surface without a control in it, such as a code block, a well holding an attachment list, or the tray of a kanban column, is better drawn by a tone than by an inset shadow: one step darker than the page in light mode, one step darker than level 0 in dark, on the --surface-sunken token. It is Atlassian's "sunken" surface, and it's the only level below 0 a system needs. Inset shadows on large surfaces look embossed; a tone just looks lower.
The failures are the same failure. Neumorphism extrudes and insets every surface with paired light and dark shadows, so nothing is above or below anything; it is the shadow-on-everything screen from section I, rendered in clay. The pressed-in tab uses inset to mean "selected," but inset means "a place to put something" or, briefly, "being pressed." A pressed state is an inset for the duration of the press, :active only, and gone the moment the pointer lifts; a selected state is a mark, an underline or a fill, and stays.
Count the distinct shadows on a screen: the count should equal the number of levels in use, and on most screens at rest that number is zero or one. Here is section I's screen after one pass of the audit: same components, same content, two shadows.
| Check | Found in §I | Fix |
|---|---|---|
| Distinct shadows | Six, all hand-written, pure black | Two, both from the scale: level 2 on the menu, level 4 on the toast. |
| Raised at rest | Top bar, buttons, cards, inspector | All flat. Bar and inspector take a hairline; cards a hairline on a canvas one step darker (§II, §V). |
| Same claim, different truth | Menu wore the cards' shadow | Menu is the only floating surface, so its level 2 shadow is now legible (§IV). |
| Stacking | Menu trapped by the cards' hover transform | Transform removed from the cards; menu on --z-popover, rendered outside the card in production (§VII). |
| Hover | Cards lift to a fourth shadow | No lift: the cards hold a menu button, so they aren't one target (§V). |
| Toast | Black shadow at .45 to be seen over the noise | Level 4 at its normal alpha; with a flat page, it doesn't need to shout. |
Count the shadows. Every distinct computed box-shadow on the screen should be one of the scale's levels, and the number of distinct values should be the number of levels in use. A browser console makes the count exact rather than a matter of squinting:
Find everything raised at rest. With no menu open, no dialog, no toast, and nothing being dragged, the count should be zero, or one if a header is scrolled or a control has a thumb. Anything else that wears a shadow is a page surface making a false claim: give it a hairline or a tone.
Find the raw z-indexes. Search the codebase for z-index followed by a digit. Every hit outside the token file is a defect; anything above the scale's top is a stacking-context workaround someone couldn't explain, and the explanation is usually a transform or an opacity on an ancestor (§VII).
Open every overlay from every overlay. A select in each dialog, a date picker in each drawer, a menu on a page while a toast is showing. Check that the child is above its parent, unclipped, and carries its own level's shadow, and that nothing from the page floats above a scrim.
Switch to dark mode and repeat. Every level should still be distinct. If a menu disappears into the card under it, the surface tokens are being shared between modes or a component picked its own color (§VI).
Mobile is a reducing layer here as everywhere else, and it reduces the scale to three levels in practice. Hover lift disappears, since there is no hover. Popovers and menus that would float at level 2 on desktop usually become bottom sheets, which are drawers from the bottom edge, at level 3 with a scrim, because a small anchored surface is hard to hit and easy to cover with a thumb. What survives is the flat page, the sticky header's level 1 while scrolled, the overlay at level 3, and the toast at 4. The z-index scale doesn't change at all, which is the point of having one.
Decide depth for the system once, in this order, and components inherit it; decided per component, it drifts into section I's screen within a release. Each step depends on the ones before it.
Steps one through seven are tokens and component contracts; they change rarely. Step eight is the habit that keeps them true, and it is short: one console snippet, one search, one theme switch.
Shadowed card grids. Twelve surfaces each claiming to be on top, so the one surface that is (the open menu) has nothing left to say. Cards rest flat with a hairline.
Shadow strings in components. A box-shadow with literal values anywhere but the token file. Each one is a level nobody named, and six of them are section I's screen.
z-index: 9999. The number is a confession that someone fought a stacking context and didn't find it. Name the layer and render the overlay at the root.
Light-mode shadows ported to dark mode. The scale survives, but every level renders the same. Dark mode needs its own surface ramp and edge.
Two raised things at once. A coach mark over a dialog, a popover left open under a drawer, a toast that asks a question. One surface listens at a time.
Neumorphic and embossed surfaces. Inset and outset on everything, so nothing is above or below anything. Inset is for wells and tracks.
This part has been about the static z-axis: which surface sits at which level, and in what order. Part II takes up materials and movement: the two materials a surface can be made of and why translucency is not a third, how a surface travels between levels as it opens and closes, and where elevation hands off to Motion & Easing.
Part I of Elevation & Depth.
A flat page is not the absence of depth. It is what lets the one raised thing be seen.