/*
 * Cronum Work's one-document shell: Work's rail beside the windows (the windows themselves, their
 * heads, bars and a phone's tabs are suite-core windows.css). On a phone the rail is a thin bar
 * at the top with the brand, the live dot and Settings: the modules are the windows'
 * tabs at the bottom, and nothing is wider than the screen from 320 px on.
 */
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--kit-bg); color: var(--kit-text); }

/* Print or save as PDF: Notes hangs the note on the page's body, and its own sheet, scoped to its
   windows here, can't hide the rest of the page or let the note run past the first sheet. */
@media print {
  body:has(> .print-note) > :not(.print-note) { display: none !important; }
  html:has(> body > .print-note), body:has(> .print-note) { height: auto; overflow: visible; }
}

/* The whole screen, fixed to it (100dvh fell short in Work installed on an iPhone). Beside a
   notch (an iPhone on its side, viewport-fit=cover) the rail's ground goes under it and its buttons
   don't, and the windows keep clear of the other side (audit of 6/11, work-web-14). */
.cw-shell {
  position: fixed; inset: 0; display: grid; min-width: 0;
  grid-template-columns: calc(64px + env(safe-area-inset-left)) minmax(0, 1fr);
}
/* With a phone's keyboard up (suite-core keyboard.js fitToKeyboard), the part of the screen it
   leaves, as a module's own page has it: the keyboard covered the foot of the windows, the sheets'
   buttons and the notices (audit of 6/11, sc-shell-4). */
:root[data-kit-keyboard] .cw-shell { top: var(--kit-view-top); bottom: auto; height: var(--kit-view-h); }
.cw-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding-inline-end: env(safe-area-inset-right); }
.cw-banners:empty { display: none; }
.cw-desk { flex: 1; min-width: 0; min-height: 0; }

/* Signing in: the kit's screen over the shell, which is fixed and would take its clicks, and
   scrolling when it is taller than the screen. */
body > .kit-signin { position: relative; z-index: 1; }
body:has(> .kit-signin) { overflow-y: auto; }

/* ---------------------------------- the rail --------------------------------- */

.cw-rail {
  display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 0;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)) env(safe-area-inset-left); overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--kit-border); background: var(--kit-bg);
}
.cw-rail__top { display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* The module's drawer: a phone's, beside the brand (below). */
.cw-rail__button.cw-rail__menu { display: none; }
.cw-rail__brand { display: grid; place-items: center; width: 36px; height: 36px; }
.cw-rail__brand img { width: 30px; height: 30px; display: block; }
/* The beta's mark, under the brand (beside it on a phone): small, in Work's accent. */
.cw-rail__beta {
  padding: 2px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: .04em;
  text-transform: uppercase; color: var(--kit-accent); background: color-mix(in srgb, var(--kit-accent) 12%, transparent);
}
.cw-rail__beta[hidden] { display: none; }
.cw-feedback textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 120px; }
/* 16px or more on a touch screen: below it an iPhone zooms the page in on tapping it. */
@media (pointer: coarse) { .cw-feedback textarea { font-size: max(16px, var(--look-body)); } }
/* The screenshot: its button, then the picture small with its name and an ×, one or the other. */
.cw-feedback__files { display: flex; align-items: center; min-width: 0; }
.cw-feedback__pick { gap: 6px; }
.cw-feedback__shot { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cw-feedback__pick[hidden], .cw-feedback__shot[hidden] { display: none; }
.cw-feedback__shot img { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: var(--look-r-sm); border: 1px solid var(--kit-border); }
/* 13 px in Cronum, off the look's scale; the Clean look's subhead, at the base rule's weight. */
.cw-feedback__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--kit-muted); }
:where(:root[data-look="clean"]) .cw-feedback__name { font-size: var(--look-subhead); }
/* On a phone the field is a little shorter, so the sheet fits whole over an iPhone's keyboard and
   keeps its height going up and down with it. */
@media (max-width: 640px) { .cw-feedback textarea { height: 120px; } }
.cw-rail__modules, .cw-rail__layouts, .cw-rail__foot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cw-rail__layouts { padding-top: 10px; border-top: 1px solid var(--kit-border); }
.cw-rail__foot { margin-top: auto; }

.cw-rail__module, .cw-rail__button {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px; background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.cw-rail__module img { width: 26px; height: 26px; display: block; }
.cw-rail__name {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.cw-rail__button .kit-icon { width: 20px; height: 20px; }
.cw-rail__module:hover, .cw-rail__button:hover { background: var(--kit-hover, color-mix(in srgb, currentColor 8%, transparent)); }
.cw-rail__module:focus-visible, .cw-rail__button:focus-visible { outline: 2px solid var(--kit-accent); outline-offset: 1px; }
/* The modules in sight are marked; the one in use, in its colour. */
.cw-rail__module[data-shown]::before {
  content: ''; position: absolute; left: -10px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: color-mix(in srgb, var(--module, var(--kit-accent)) 45%, transparent);
}
.cw-rail__module[aria-current="true"]::before { top: 8px; bottom: 8px; background: var(--module, var(--kit-accent)); }
.cw-rail__module[aria-current="true"] { background: color-mix(in srgb, var(--module, var(--kit-accent)) 12%, transparent); }
.cw-rail__button[aria-pressed="true"], .cw-rail__calendar[aria-expanded="true"], .cw-rail__day[aria-expanded="true"],
.cw-rail__views[aria-expanded="true"] { background: color-mix(in srgb, var(--kit-accent) 12%, transparent); color: var(--kit-accent); }
/*
 * The views' panel (work.js pickView), beside the rail: a picture of each, in rows of one, two,
 * three and four windows. The one in sight in the accent; one that doesn't fit the desk, faint.
 */
.cw-views { display: grid; gap: 6px; padding: 2px 4px 4px; }
.cw-views__title { padding: 2px 4px 2px; font-size: var(--look-footnote); color: var(--kit-muted); }
.cw-views__row { display: flex; gap: 6px; }
.cw-views__pick {
  display: grid; place-items: center; width: 60px; height: 46px; padding: 0; border: 0; border-radius: var(--look-r-sm);
  background: none; color: var(--kit-muted); cursor: pointer;
}
.cw-views__pick:hover, .cw-views__pick:focus-visible { background: var(--kit-hover); color: var(--kit-text); outline: none; }
.cw-views__pick:focus-visible { box-shadow: inset 0 0 0 2px var(--kit-accent); }
.cw-views__pick[aria-current="true"] { background: color-mix(in srgb, var(--kit-accent) 12%, transparent); color: var(--kit-accent); }
.cw-views__pick[aria-disabled="true"] { opacity: .35; cursor: default; }
.cw-views__pick[aria-disabled="true"]:hover { background: none; color: var(--kit-muted); }
.cw-views__shape { width: 40px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.cw-views__pick[aria-current="true"] .cw-views__shape rect { fill: color-mix(in srgb, currentColor 14%, transparent); }
/*
 * Croc's keyhole (work.js `askKey`), shown while a key waits: a soft halo of Cronum's yolk behind it,
 * breathing gently. Under reduced motion the halo stays, still.
 */
.cw-rail__key { isolation: isolate; }
.cw-rail__key--lit::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; translate: -50% -50%;
  z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, #FFC21A 50%, transparent) 0%,
    color-mix(in srgb, #FFC21A 24%, transparent) 52%, transparent 74%);
}
@media (prefers-reduced-motion: no-preference) {
  .cw-rail__key--lit::before { animation: cw-key-pulse 2.8s ease-in-out infinite; }
}
@keyframes cw-key-pulse {
  0%, 100% { opacity: .55; scale: .88; }
  50% { opacity: 1; scale: 1.08; }
}

/* ------------------------ the host's pages in a window ------------------------ */

/*
 * Over the desk (work.js sets its top, under the banners): the calendar and the day's (/today/),
 * each grown out of its button on the rail.
 */
.cw-main { position: relative; }
.cw-page {
  position: absolute; z-index: 20; inset: calc(var(--cw-page-top, 0px) + 8px) calc(8px + env(safe-area-inset-right)) 8px 8px;
  box-shadow: var(--kit-shadow-high);
}
.cw-cal, .cw-day, .cw-croc { transform-origin: 0 0; }
/* a phone-shaped column in the middle of the desk: it is a game for one hand. On a tall screen it
   stops at a phone's height, in the middle, rather than a long strip from top to bottom. */
.cw-croc {
  left: max(8px, calc(50% - 215px)); right: auto; width: min(430px, calc(100% - 16px));
  top: calc(var(--cw-page-top, 0px) + max(8px, (100% - var(--cw-page-top, 0px) - 780px) / 2));
  bottom: auto; height: min(780px, calc(100% - var(--cw-page-top, 0px) - 16px));
}
/* While it is over the desk, the windows under it wait: a veil takes their clicks (Martin, 11/11).
   The rail and the banners stay at hand, and the keyhole, Esc or its × put it away. */
.cw-main:has(> .cw-croc:not([hidden])) > .cw-desk::after {
  content: ""; position: absolute; inset: 0; z-index: 19; background: var(--kit-scrim);
}
@media (prefers-reduced-motion: no-preference) {
  .cw-main:has(> .cw-croc:not([hidden])) > .cw-desk::after { animation: cw-veil-in .2s ease-out; }
}
@keyframes cw-veil-in { from { opacity: 0; } }
.cw-page .cw-win__head { cursor: default; }
.cw-page .cw-win__icon, .cw-win[data-page] .cw-win__icon { display: inline-grid; place-items: center; color: var(--kit-accent); }
.cw-page .cw-win__icon .kit-icon, .cw-win[data-page] .cw-win__icon .kit-icon { width: 15px; height: 15px; }
/* The day's sun, in Cronum's yolk: "now" in the suite. */
.cw-day .cw-win__icon, .cw-win[data-page="today"] .cw-win__icon { color: var(--kit-now-text); }
/*
 * Opened and closed (work.js `fadePage`), the calendar's and the day's alike: the button's box
 * grows into the window's, the button fading out and the window in, each at its own size from the
 * top corner, never stretched; back the other way. Nothing else on the page is named meanwhile.
 */
:root:is([data-cw-cal-fade], [data-cw-day-fade], [data-cw-croc-fade])::view-transition-old(root),
:root:is([data-cw-cal-fade], [data-cw-day-fade], [data-cw-croc-fade])::view-transition-new(root) { animation-duration: .28s; }
::view-transition-group(cw-cal), ::view-transition-group(cw-day), ::view-transition-group(cw-croc) {
  animation-duration: .28s; animation-timing-function: cubic-bezier(.32, .72, 0, 1);
  border-radius: 12px; background: var(--kit-bg); box-shadow: var(--kit-shadow-high), inset 0 0 0 1px var(--kit-border);
}
::view-transition-image-pair(cw-cal), ::view-transition-image-pair(cw-day), ::view-transition-image-pair(cw-croc) { clip-path: inset(0 round 12px); }
::view-transition-old(cw-cal), ::view-transition-new(cw-cal), ::view-transition-old(cw-day), ::view-transition-new(cw-day), ::view-transition-old(cw-croc), ::view-transition-new(cw-croc) {
  inline-size: auto; block-size: auto; object-fit: none; object-position: 0 0;
}
/* The new one comes in over the old, which stays as it is under it: no moment where both are faint. */
::view-transition-old(cw-cal), ::view-transition-old(cw-day), ::view-transition-old(cw-croc) { animation: none; mix-blend-mode: normal; }
::view-transition-new(cw-cal), ::view-transition-new(cw-day), ::view-transition-new(cw-croc) { animation: cw-cal-fade-in .2s ease-out .03s both; mix-blend-mode: normal; }
@keyframes cw-cal-fade-in { from { opacity: 0; } }

/* ----------------------------- inside the windows ---------------------------- */

.cw-win__icon { width: 16px; height: 16px; flex: none; }
.cw-win__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The arrow after a window's name: what this window shows (work.js pickFor). */
.cw-win__pick {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; margin-inline-start: -5px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--kit-muted); cursor: pointer;
}
.cw-win__pick[hidden] { display: none; }
.cw-win__pick:hover, .cw-win__pick[aria-expanded="true"] { background: var(--kit-hover); color: var(--kit-text); }
.cw-win__pick:focus-visible { outline: 2px solid var(--kit-accent); outline-offset: -2px; }
.cw-win__pick .kit-icon { width: 15px; height: 15px; transition: transform .15s ease; }
.cw-win__pick[aria-expanded="true"] .kit-icon { transform: rotate(180deg); }
.cw-pick__note { padding-inline-start: 16px; color: var(--kit-muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.kit-menu__item[data-option="calendar"] .kit-icon { color: var(--kit-accent); }
.kit-menu__item[data-option="today"] .kit-icon { color: var(--kit-now-text); }
/* The module's page, inside its window: what was the viewport is the window's body. */
.cw-win__body > .kit-app, .cw-win__body > .kit-frame, .cw-win__body > .kit-shell { height: 100% !important; min-height: 0 !important; }
.cw-win__frame { display: block; width: 100%; height: 100%; border: 0; }
.cw-win__failed { display: grid; place-content: center; justify-items: center; gap: 12px; height: 100%; padding: 24px; text-align: center; }
.cw-win__failed .kit-error { margin: 0; }
.cw-win__why { margin: -4px 0 4px; max-width: 32em; color: var(--kit-muted); font-size: 12px; overflow-wrap: anywhere; }
.cw-failed { padding: 24px; }

/* While a window is moved or resized, the frames don't take the pointer from the gesture. */
.cw-desk[data-resizing] iframe, .cw-desk[data-reordering] iframe { pointer-events: none; }
/* Nor does one under a row being carried: it goes on over a page on the desk. */
:root[data-kit-dragging] .cw-desk iframe { pointer-events: none; }

/* ------------------------- something carried between them -------------------- */

/* The other windows' rows it could be linked with, and their heads (create there, linked). */
body[data-carrying] .cw-win__body [data-ref] {
  outline: 1px dashed color-mix(in srgb, var(--cw-carry, var(--kit-accent)) 55%, transparent); outline-offset: -2px;
}
body[data-carrying] .cw-win__head { box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--cw-carry, var(--kit-accent)) 45%, transparent); }
body[data-carrying^="tasks:"] [data-module="tasks"] [data-ref],
body[data-carrying^="projects:"] [data-module="projects"] [data-ref],
body[data-carrying^="next:"] [data-module="next"] [data-ref],
body[data-carrying^="notes:"] [data-module="notes"] [data-ref] { outline: none; }
body[data-carrying^="tasks:"] [data-win="tasks"] .cw-win__head,
body[data-carrying^="projects:"] [data-win="projects"] .cw-win__head,
body[data-carrying^="next:"] [data-win="next"] .cw-win__head,
body[data-carrying^="notes:"] [data-win="notes"] .cw-win__head,
body[data-carrying] .cw-win[data-page] .cw-win__head { box-shadow: none; }

.cw-perf {
  position: fixed; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 1000; margin: 0;
  padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .78); color: #fff;
  font: 11px/1.4 ui-monospace, monospace; pointer-events: none;
}

/* ---------------------------------- a phone ---------------------------------- */

@media (max-width: 767.98px) {
  .cw-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .cw-main { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
  .cw-rail {
    flex-direction: row; gap: 8px; overflow: hidden;
    padding: calc(4px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 4px calc(12px + env(safe-area-inset-left));
    border-right: 0; border-bottom: 1px solid var(--kit-border);
  }
  .cw-rail__top { flex-direction: row; align-items: center; }
  /* ☰ opens the drawer of the module in sight; the module's own gives way to it. */
  .cw-rail__button.cw-rail__menu { display: grid; width: 40px; height: 40px; margin-inline-start: -8px; }
  .cw-win__body .kit-bar__menu { display: none !important; }
  /* Without its ☰, a list's large title (the Clean look's) stays on the row of its actions: on a
     row of its own under them, the row above held only "…". */
  :root[data-look="clean"] .cw-desk .kit-head[data-pane="list"] .kit-head__row { flex-wrap: nowrap; }
  :root[data-look="clean"] .cw-desk .kit-head[data-pane="list"] .kit-head__row::before { content: none; }
  :root[data-look="clean"] .cw-desk .kit-head[data-pane="list"] .kit-head__row > * { order: 0; }
  .cw-rail__brand { width: 32px; height: 32px; }
  .cw-rail__brand img { width: 26px; height: 26px; }
  /* The modules are windows.js's tabs, one window at a time: no layouts. */
  .cw-rail__modules, .cw-rail__layouts { display: none; }
  .cw-rail__foot { flex-direction: row; margin: 0 0 0 auto; }
  .cw-rail__button { width: 40px; height: 40px; }
  /* With the keyhole (and Feedback, and the beta's mark) the bar is fuller than a 320 px phone: the
     buttons at the foot give each other room, none under 32 px wide. */
  .cw-rail__foot { min-width: 0; }
  .cw-rail__foot .cw-rail__button { min-width: 32px; }
  /* A phone's: the whole screen under the bar, as its windows, and the home bar's room under it. */
  .cw-page {
    inset: var(--cw-page-top, 0px) env(safe-area-inset-right) 0 env(safe-area-inset-left); border: 0; border-radius: 0; box-shadow: none;
    padding-block-end: env(safe-area-inset-bottom);
  }
  .cw-croc { left: 0; right: 0; width: auto; height: auto; }
  .cw-page .cw-win__head { height: 40px; }
  .cw-page__close { width: 32px; height: 32px; }
  /* A page's window in sight (work.js `pagesChanged`): the whole screen, the bar above giving way.
     Its ☰ opened the drawer of the module under the page, out of sight: the window closes with its
     ×. The banners stay above it, and the status bar's room is kept as the bar kept it. */
  body[data-page-open] .cw-shell { grid-template-rows: minmax(0, 1fr); }
  body[data-page-open] .cw-rail { display: none; }
  body[data-page-open] .cw-main { padding-top: env(safe-area-inset-top); }
  ::view-transition-group(cw-cal), ::view-transition-group(cw-day), ::view-transition-group(cw-croc) { border-radius: 0; }
  ::view-transition-image-pair(cw-cal), ::view-transition-image-pair(cw-day), ::view-transition-image-pair(cw-croc) { clip-path: inset(0); }
}
/* The narrowest phones: with the calendar's button too, the beta's mark leaves the bar its room. */
@media (max-width: 359.98px) {
  .cw-rail__beta { display: none; }
}
