/* The shells' structure (the builder's: written with theme/layout.html, never edited).
   Where things sit, and how the frame folds at a phone's width; nothing about how they
   look, which is app.css's (colours, type, borders, the signature). */
/* neutral defaults, at no specificity (:where), for app.css to override: so a frame
   the app's stylesheet doesn't style yet (a new shell) still reads as one */
:where(.dd-frame-header, .dd-frame-strip) { background: var(--surface, var(--bg)); border-bottom: 1px solid var(--line); }
:where(.dd-frame-side) { background: var(--surface, var(--bg)); }
:where(.dd-shell-sidebar .dd-frame-side) { border-right: 1px solid var(--line); }
:where(.dd-shell-top_bar_sidebar .dd-frame-side) { border-right: 1px solid var(--line); }
:where(.dd-frame-nav a, .dd-frame-tabs a) { color: var(--ink); text-decoration: none; }
:where(.dd-frame-nav a.active, .dd-frame-tabs a.active) { color: var(--accent); }

.dd-skip { position: absolute; left: -9999px; top: 0; }
.dd-skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--bg); color: var(--ink); padding: .5rem 1rem; }
.dd-frame-brand { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; text-decoration: none; }
.dd-frame-brand img { height: 2.25rem; width: auto; }
.dd-frame-nav { display: flex; gap: var(--sp, 1rem); }
.dd-frame-account { display: flex; align-items: center; gap: calc(var(--sp, 1rem) / 2); }
.dd-frame-note:empty { display: none; }
.dd-frame-adminnav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding-inline: clamp(16px, 4vw, 32px); }
.dd-frame-main { display: block; min-width: 0; }

/* top bar (and the top bar of top_bar_sidebar, bottom_tabs) */
.dd-frame-bar { display: flex; align-items: center; gap: var(--sp, 1rem); min-height: 4rem; flex-wrap: wrap; }
.dd-frame-bar .dd-frame-nav { flex: 1; align-items: center; flex-wrap: wrap; }
.dd-shell-bottom_tabs .dd-frame-bar .dd-frame-note { flex: 1; }

/* sidebar */
.dd-shell-sidebar .dd-frame { display: grid; grid-template-columns: var(--dd-side-w, 15rem) minmax(0, 1fr); min-height: 100vh; }
.dd-shell-sidebar .dd-frame-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 1.25rem; padding: 1rem; }
.dd-shell-sidebar .dd-frame-side-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.dd-shell-sidebar .dd-frame-side .dd-frame-nav { flex-direction: column; gap: .15rem; }
.dd-shell-sidebar .dd-frame-side .dd-frame-nav a { display: block; padding: .5rem .75rem; }
.dd-shell-sidebar .dd-frame-side .dd-frame-note { margin-top: auto; max-width: 100%; }
.dd-shell-sidebar .dd-frame-side .dd-frame-note * { max-width: 100%; white-space: normal; }
.dd-shell-sidebar .dd-frame-col { display: flex; flex-direction: column; min-width: 0; }
.dd-shell-sidebar .dd-frame-strip { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; min-height: 3.25rem; padding-inline: clamp(16px, 4vw, 32px); }
.dd-shell-sidebar .dd-frame-main { flex: 1; width: 100%; }

/* top bar and sidebar */
.dd-shell-top_bar_sidebar .dd-frame { display: grid; grid-template-columns: var(--dd-side-w, 14rem) minmax(0, 1fr); }
.dd-shell-top_bar_sidebar .dd-frame-side { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.dd-shell-top_bar_sidebar .dd-frame-side:not(:has(*)) { display: none; }
.dd-shell-top_bar_sidebar .dd-frame:has(.dd-frame-side:not(:has(*))) { grid-template-columns: minmax(0, 1fr); }
.dd-shell-top_bar_sidebar .dd-frame-side .dd-frame-adminnav { flex-direction: column; padding: 0; }
.dd-shell-top_bar_sidebar .dd-frame-main { padding-inline: clamp(16px, 4vw, 32px); }

/* bottom tabs */
body.dd-shell-bottom_tabs { padding-bottom: 4.5rem; }
.dd-frame-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; background: var(--surface, var(--bg)); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.dd-frame-tabs a { flex: 1; max-width: 9rem; display: flex; align-items: center; justify-content: center; min-height: 3.5rem; padding: .25rem; text-align: center; text-decoration: none; }

/* the phone's frame (mobile/layout.html): a compact header, the main links as tabs at
   the foot of the screen */
body.dd-shell-mobile { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
.dd-shell-mobile .dd-frame-bar { min-height: 3.25rem; flex-wrap: nowrap; justify-content: space-between; }
.dd-shell-mobile .dd-frame-brand img { height: 2rem; }
.dd-shell-mobile .dd-frame-account { flex-shrink: 0; }
.dd-shell-mobile .dd-frame-tabs .kit-menu { flex: 1; max-width: 9rem; display: flex; }
.dd-shell-mobile .dd-frame-tabs .kit-menu > summary { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 3.5rem; cursor: pointer; list-style: none; }
.dd-shell-mobile .dd-frame-tabs .kit-menu-list { top: auto; bottom: 100%; }
.dd-frame-switch { display: inline-block; margin-top: .75rem; font-size: .85em; }

/* a phone's width: the sidebars fold into a top bar with the menu button */
@media (max-width: 760px) {
  .dd-shell-sidebar .dd-frame, .dd-shell-top_bar_sidebar .dd-frame { display: block; }
  .dd-shell-sidebar .dd-frame-side { position: static; height: auto; overflow: visible; padding: .5rem clamp(16px, 4vw, 32px); gap: 0; }
  .dd-shell-sidebar .dd-frame-side .dd-frame-note { display: none; }
  .dd-shell-sidebar .dd-frame-strip { min-height: 2.75rem; }
  .dd-shell-top_bar_sidebar .dd-frame-side { padding-inline: clamp(16px, 4vw, 32px); }
  .dd-frame-bar .dd-frame-note { display: none; }
}

/* the arrangements (a layout of kind arrangement): how a main page's content sits inside
   the frame, used by the page templates (dd-arrange-*); the look is app.css's */
.dd-arrange { display: grid; gap: calc(var(--sp, 1rem) * 1.5); align-items: start; min-width: 0; }
.dd-arrange > * { min-width: 0; }
.dd-arrange-side_panel { grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem); }
.dd-arrange-side_panel > .dd-arrange-panel { position: sticky; top: 1rem; }
.dd-arrange-list_and_detail { grid-template-columns: minmax(16rem, 24rem) minmax(0, 1fr); }
.dd-arrange-dashboard_grid { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.dd-arrange-dashboard_grid > .dd-arrange-wide { grid-column: span 2; }
.dd-arrange-single_column { max-width: 42rem; margin-inline: auto; }
@media (max-width: 760px) {
  .dd-arrange-side_panel, .dd-arrange-list_and_detail { grid-template-columns: minmax(0, 1fr); }
  .dd-arrange-side_panel > .dd-arrange-panel { position: static; }
  .dd-arrange-dashboard_grid > .dd-arrange-wide { grid-column: auto; }
}
