/* The signed-in shell (sidebar, page head, phone tabbar and the New
   delivery button), sign-in, and the deliveries list. Loaded by
   index.html after app.css and components.css. Tokens, buttons, labels
   and lists are in app.css; panels, sheets and cards in components.css.
   The markup is in js/shell.js (shell, Account sheet), js/signin.js and
   js/deliveries.js.

   The desktop shell, 1360 wide:

     +-- 248 --------+-- main, up to 1180 + padding ---------------------+
     | [mark] Theirway                                                   |
     | [+ New delivery]   Deliveries                    [+ New delivery] |
     | > Deliveries       12 deliveries, 3.4 TB                          |
     |   Access tokens    +--------------------------------------------+ |
     |   Admin            | [cover] Wedding, 12 September  ...  Opened | |
     |                    +--------------------------------------------+ |
     | (A) anna@...                                                      |
     |     Sign out                                                      |
     +---------------+---------------------------------------------------+

   Below 820px the sidebar is hidden: the .tabbar takes over, and the
   .fab is the phone's New delivery button. */

/* --- the desktop shell ------------------------------------------------ */

.shell{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh}
.side{position:sticky;top:0;height:100vh;width:248px;padding:var(--space-5) var(--space-4);border-right:1px solid var(--line);background:var(--bg);display:flex;flex-direction:column;gap:var(--space-1);--edge:12px}
.side .brand{padding:0 var(--edge) var(--space-5)}
.side > .btn{justify-content:flex-start;padding-inline:calc(var(--edge) - 1px);margin-bottom:var(--space-4)}

/* Where you are: the row is lifted onto the surface and its icon turns
   accent. Hover is a paper tint, so the two never look alike. */
.nav{display:flex;flex-direction:column;gap:2px}
.nav a{display:flex;align-items:center;gap:var(--space-3);height:var(--control);padding:0 var(--edge);border-radius:var(--radius-control);color:var(--ink2);text-decoration:none;font:500 var(--text-ui)/20px var(--font-sans);transition:background-color var(--dur-fast),color var(--dur-fast)}
.nav a svg{color:var(--mute);transition:color var(--dur-fast)}
.nav a:hover{background:var(--hover);color:var(--ink)}
.nav a[aria-current]{background:var(--surface);color:var(--ink);box-shadow:0 0 0 1px var(--line)}
.nav a[aria-current] svg{color:var(--accent)}
.nav .cnt{margin-left:auto;background:var(--warning-bg);color:var(--warning-fg);font-size:var(--text-xs);line-height:18px;font-weight:500;border-radius:var(--radius-s);padding:0 6px}

.me{margin-top:auto;padding:var(--space-4) var(--edge) 0;border-top:1px solid var(--line);display:grid;grid-template-columns:28px minmax(0,1fr);column-gap:var(--space-2h);row-gap:var(--space-1);align-items:center;font-size:var(--text-m)}
.me .avatar{width:28px;height:28px}
.me-email{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink2);line-height:18px}
.me .tag{grid-column:2;justify-self:start;margin-top:var(--space-1)}
.me-foot{grid-column:1 / -1;display:flex;flex-direction:column;align-items:flex-start;min-width:0;margin-top:var(--space-2)}
.me-foot .btn.link{color:var(--ink2)}
.build{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);line-height:16px;color:var(--mute)}

/* --- the page --------------------------------------------------------- */

main{padding:var(--space-7) var(--gutter) var(--space-8);max-width:calc(var(--page-max) + 2 * var(--gutter));width:100%}
/* A sheet whose opener is gone gives focus to the page (shell.js
   showSheet). It is somewhere to start from, not a control: no ring around
   the whole page. */
main:focus{outline:none}
.head{display:flex;align-items:flex-end;gap:var(--space-4);margin-bottom:var(--space-6);flex-wrap:wrap}
.head .grow{flex:1;min-width:0}
.backlink{display:inline-flex;align-items:center;gap:var(--space-1);color:var(--mute);text-decoration:none;font:500 var(--text-m)/18px var(--font-sans);padding:4px 6px;margin:0 0 var(--space-3) -6px;transition:color var(--dur-fast),background-color var(--dur-fast)}
.backlink:hover{color:var(--ink);background:var(--hover)}

/* --- what shows at which width ---------------------------------------- */

.d-hide,.m-only{display:none}
.tabbar,.fab{display:none}
@media (max-width:820px){
 .shell{display:block}
 .side{display:none}
 main{padding:var(--space-5) var(--space-4) calc(56px + 88px + env(safe-area-inset-bottom,0px))}
 .d-hide{display:inline-flex}
 .m-only{display:inline}
 .head{margin-bottom:var(--space-5);gap:var(--space-3)}
 .hide-m{display:none!important}

 .tabbar{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;position:fixed;left:0;right:0;bottom:0;z-index:30;background:var(--surface);border-top:1px solid var(--line);padding:0 var(--space-1) env(safe-area-inset-bottom,0px)}
 .tabbar a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:56px;font:500 var(--text-xs)/16px var(--font-sans);color:var(--mute);text-decoration:none;position:relative}
 .tabbar a svg{width:var(--icon-l);height:var(--icon-l)}
 /* The current tab: accent words and a short bar along the top edge. */
 .tabbar a[aria-current]{color:var(--accent-ink)}
 .tabbar a[aria-current]::before{content:"";position:absolute;top:0;left:calc(50% - 14px);width:28px;height:2px;border-radius:0 0 2px 2px;background:var(--accent)}
 .tabbar .avatar{width:var(--icon-l);height:var(--icon-l);font-size:10px;border-radius:5px}
 .tabbar .cnt{position:absolute;top:var(--space-1);left:calc(50% + 6px);background:var(--warning-bg);color:var(--warning-fg);font-size:var(--text-xs);border-radius:var(--radius-s);padding:0 5px;line-height:16px}
 .fab{display:flex;position:fixed;right:var(--space-4);bottom:calc(56px + var(--space-4) + env(safe-area-inset-bottom,0px));z-index:31;--btn-h:48px;padding-left:var(--space-4);box-shadow:var(--shadow-overlay)}
}

/* The phone's Account sheet (shell.js). */
.account-who{display:grid;grid-template-columns:var(--control-l) minmax(0,1fr);gap:var(--space-3);align-items:center}
.account-who .avatar{width:var(--control-l);height:var(--control-l);font-size:var(--text-l);border-radius:var(--radius-control)}
.account-who .who-email{overflow-wrap:anywhere;color:var(--ink)}
.account-who .tag{margin-top:var(--space-1)}
.account-body .btn.block{margin-top:var(--space-5)}
.account-body .build{margin-top:var(--space-4);white-space:normal}

/* --- sign-in: a statement on the left, the form on the right ------------ */

/*   +-- sunken, 46% ------------+-- paper -------------------+
     | [mark] Theirway           |                            |
     |                           |   Sign in                  |
     | Deliver the whole shoot.  |   Send and track ...       |
     | Let them choose.          |   [ email              ]   |
     |                           |   [ Email me a link    ]   |
     | 1 Upload a folder once    |                            |
     | 2 Send one link           |                            |
     | 3 They take what they ... |                            |
     +---------------------------+----------------------------+
   On a phone the statement shrinks to its first line above the form. */
.signin{display:grid;grid-template-columns:minmax(0,46%) minmax(0,1fr);min-height:100dvh}
.signin-side{display:flex;flex-direction:column;gap:var(--space-6);padding:var(--space-6) var(--space-7);background:var(--sunken);border-right:1px solid var(--line)}
.signin-statement{margin:auto 0 0;font:400 56px/1.04 var(--font-display);letter-spacing:-.024em;color:var(--ink);max-width:14ch}
.signin-steps{display:grid;gap:var(--space-3);margin:0 0 var(--space-4);padding:0;list-style:none;counter-reset:step;max-width:36ch}
.signin-steps li{display:grid;grid-template-columns:28px minmax(0,1fr);gap:var(--space-2);color:var(--ink2);font-size:var(--text-l);line-height:24px;counter-increment:step}
.signin-steps li::before{content:counter(step);font:500 var(--text-l)/24px var(--font-display);color:var(--accent-ink)}
.signin .rv.auth{min-height:0}
.signin .rcard .brand{display:none}
.signin-form{display:grid;gap:var(--space-4);margin-top:var(--space-6)}
.signin-form + .hint{margin-top:var(--space-3)}
.signin-notice{margin-top:var(--space-4)}
.rcard .signin-text{margin:var(--space-3) 0 0;font-size:var(--text-l);line-height:24px;color:var(--ink2)}
.rcard .signin-text b{color:var(--ink);font-weight:500}
.rcard .signin-text + .btn{margin-top:var(--space-5)}
@media (max-width:820px){
 .signin{grid-template-columns:minmax(0,1fr);grid-template-rows:auto 1fr;min-height:100dvh}
 .signin-side{gap:var(--space-5);padding:var(--space-5) var(--space-4) var(--space-5);border-right:0;border-bottom:1px solid var(--line)}
 .signin-statement{margin:0;font-size:34px}
 .signin-steps{display:none}
 .signin .rv.auth{padding-top:var(--space-6)}   /* still top-aligned, so the card does not move between its faces */
}

/* --- the deliveries list ------------------------------------------------ */

/* The list is one panel. A row leads with its cover so you find a shoot by
   its pictures, then reads title and client, the counts, and when. Months
   divide it, newest first. */
.list.deliveries-table{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-l)}
.list.deliveries-table .list-head,.list.deliveries-table .list-row{--cols:minmax(0,1fr) 72px 80px 120px;--row-x:var(--space-4)}
.deliveries-table .list-head > :first-child{padding-left:calc(var(--cover-w) + var(--space-4))}
.deliveries-table .list-row{padding-block:var(--space-3)}
.deliveries-table .cell-num time{display:inline}
.deliveries-toolbar .search{margin-left:0;max-width:340px}
.deliveries-toolbar .search input::-webkit-search-cancel-button{-webkit-appearance:none}

.delivery-main{display:flex;align-items:center;gap:var(--space-4);min-width:0}
/* The cover: up to three of the delivery's pictures, one large and two
   small stacked, so you find a shoot by what it looks like. Fewer pictures
   fill the same frame. None at all (a delivery with no thumbnails yet, or a
   list that does not send cover_urls) is the first letter of its title
   in the display face, on a paper tile. The sunken ground shows while a
   picture loads, and the picture fades in over it (the fade keyframes,
   220ms). */
.cover{position:relative;flex:none;width:var(--cover-w);height:var(--cover-h);border-radius:var(--radius-control);overflow:hidden;background:var(--sunken);display:grid;place-items:center;font:400 28px/1 var(--font-display);color:var(--mute);box-shadow:inset 0 0 0 1px var(--line)}
.cover img{width:100%;height:100%;min-height:0;object-fit:cover;display:block;animation:fade var(--dur-slow) var(--ease-out);transition:transform var(--dur-slow) var(--ease-out)}
.cover-2,.cover-3{grid-template-columns:2fr 1fr;gap:2px;place-items:stretch}
.cover-2 img:first-child,.cover-3 img:first-child{grid-row:1 / span 2}
.cover-2 img:nth-child(2){grid-row:1 / span 2}
a.list-row:hover .cover img{transform:scale(1.04)}
.deliveries-table .who .t{font:400 var(--text-xl)/24px var(--font-display);letter-spacing:-.005em}
.deliveries-table .who .s{display:flex}
.deliveries-table .who .client{min-width:0;overflow:hidden;text-overflow:ellipsis}
.deliveries-table .who .size{flex:none;margin-right:var(--space-1)}

/* A month: a quiet band across the list. */
.list-group{padding:6px var(--space-4);background:var(--bg);border-top:1px solid var(--line2);border-bottom:1px solid var(--line2);font:500 var(--text-label)/16px var(--font-sans);letter-spacing:.04em;text-transform:uppercase;color:var(--mute)}
.list-head + .list-group{border-top:0}
.deliveries-table .list-row{border-top:0}
.deliveries-table .list-row:not(.is-first){border-top:1px solid var(--line2)}
.deliveries-table .no-match{padding:var(--row-y) var(--space-4);margin:0;border-top:1px solid var(--line2)}

/* Two lines once the columns leave the title no room (1024px): the cover
   and its words on the left, when on the right. */
@media (max-width:1024px){
 .deliveries-table .list-head{display:none}
 .deliveries-toolbar .search{max-width:none}
 .deliveries-table .hide-m{display:none!important}
 .deliveries-table .m-only{display:inline}
 .list.deliveries-table .list-row{--cols:minmax(0,1fr) auto;row-gap:var(--space-1)}
 .deliveries-table .delivery-main{grid-column:1;grid-row:1 / span 2}
 .deliveries-table .list-row > .cell-num:last-child{grid-row:1;grid-column:2;align-self:end}
}
@media (max-width:520px){
 :root{--cover-w:56px;--cover-h:56px}
 .cover{font-size:22px}
 .cover-2,.cover-3{grid-template-columns:1fr}
 .cover-2 img:first-child,.cover-3 img:first-child{grid-row:auto}
 .cover-2 img:nth-child(n+2),.cover-3 img:nth-child(n+2){display:none}
 .delivery-main{gap:var(--space-3)}
 .deliveries-table .who .t{font-size:var(--text-l);line-height:22px;white-space:normal;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
 .list.deliveries-table .list-row{--row-x:var(--space-3)}
}

/* The first delivery: an invitation on the paper beside how it works. */
.deliveries-empty{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,380px);gap:var(--space-7);align-items:start;max-width:none}
.deliveries-empty .empty{padding-top:var(--space-3)}
.how{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-l);padding:var(--space-5)}
.how h2{font-size:var(--text-l);line-height:22px;font-family:var(--font-sans);font-weight:500;margin-bottom:var(--space-4)}
.how ol{margin:0;padding:0;list-style:none;counter-reset:step;display:grid;gap:var(--space-4)}
.how li{display:grid;grid-template-columns:32px minmax(0,1fr);gap:var(--space-2);counter-increment:step;color:var(--ink2)}
.how li::before{content:counter(step);font:400 var(--text-2xl)/24px var(--font-display);color:var(--accent-ink)}
.how li b{display:block;color:var(--ink)}
@media (max-width:820px){.deliveries-empty{grid-template-columns:minmax(0,1fr);gap:var(--space-6)}}

.deliveries-loading{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-l)}
.deliveries-loading .skeleton-row{--cols:88px minmax(0,1fr);--row-x:var(--space-4)}
.deliveries-loading .skeleton-row i:first-child{width:88px;height:62px;border-radius:var(--radius-control)}
.deliveries-loading .skeleton-row i:last-child{width:40%}

/* The New delivery sheet's title and its one-line promise, stacked. */
#new-delivery-form header{align-items:flex-start}
