/* ==========================================================================
   LANE 1 POLISH (Ram, 22 Nov 2026; run_20261122T161741Z_d2188d19): how every signed-in and signed-out page FEELS.
   Ram, Papa and the office use these pages all day: on the office computer (1280 to 1920 wide) and on their phones
   between pickups. A tap must be answered at once, a page must give way to the next smoothly, and the frame must look
   like SLP Express (royal purple and gold, the website's own colours), not like a plain admin tool.

   Loaded after nav1.css (layout.eta), so it has the last word on the frame's look; it changes no page's layout, no
   field's size and no route. Everything here is additive:
     a  tokens: royal purple, gold, surfaces, elevation, the focus ring, easing
     b  one page gives way to the next (the browser's own view transition) and the page's parts rise in once
     c  the frame: the top bar frosted once the page scrolls, the velvet menu bar, the menu's folds, the phone's drawer
        and bottom tabs, the narrow bar's width
     d  cards, buttons, chips, fields, tables, the person's menu
     e  the fixed line over the page (the toast) stays centred
     f  a part that refreshes in place on a tap (htmx): busy, then settles in
     g  a person who asked for less motion gets none
   No inline styles or scripts anywhere (the Content-Security-Policy); no font sizes or field heights here (16 px fields
   keep phones from zooming, 44 px keep a thumb's target). The classes the script sets: app-feel.js sections 8 to 10.
   ========================================================================== */

/* ---- a. tokens ------------------------------------------------------------------------------------------------- */
:root {
  --slp-royal: #4a0072;
  --slp-royal-deep: #2a0040;
  --slp-royal-bright: #6a0099;
  --slp-gold: #d4af37;
  --slp-gold-soft: #ffd54f;
  --slp-surface: #ffffff;
  --slp-surface-tint: #faf6fd;
  --slp-surface-frost: rgba(255, 255, 255, 0.84);
  --slp-line: rgba(74, 0, 114, 0.12);
  --slp-line-strong: rgba(74, 0, 114, 0.22);
  --slp-elev-1: 0 1px 2px rgba(42, 0, 64, 0.06), 0 2px 8px rgba(42, 0, 64, 0.05);
  --slp-elev-2: 0 2px 4px rgba(42, 0, 64, 0.07), 0 10px 24px rgba(42, 0, 64, 0.1);
  --slp-elev-3: 0 4px 10px rgba(42, 0, 64, 0.1), 0 18px 44px rgba(42, 0, 64, 0.18);
  --slp-elev-toast: 0 6px 14px rgba(42, 0, 64, 0.16), 0 18px 40px rgba(42, 0, 64, 0.26);
  --slp-focus-ring: 0 0 0 3px rgba(106, 0, 153, 0.22);
  --slp-focus-color: #6a0099;
  --slp-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --slp-ease-in: cubic-bezier(0.4, 0, 1, 1);
  --slp-ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --slp-dur-fast: 130ms;
  --slp-dur: 200ms;
  --slp-dur-slow: 260ms;
  --slp-rail-velvet:
    radial-gradient(120% 55% at 0% 0%, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0) 60%),
    linear-gradient(180deg, #3d0060 0%, #33004f 42%, #2a0040 100%);
}

/* ---- b. one page gives way to the next ------------------------------------------------------------------------ */
/* desk.css section 12 already turns the browser's page change on and keeps the top bar, the menu bar and the tabs
   still. Here: the gold bar stands still too, the old page leaves in 130 ms and the new one is there in 200 ms. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  #page-progress {
    view-transition-name: slp-progress;
  }

  ::view-transition-group(slp-progress) {
    animation: none;
  }

  ::view-transition-old(root) {
    animation: slp-vt-out var(--slp-dur-fast) var(--slp-ease-in) both;
  }

  ::view-transition-new(root) {
    animation: slp-vt-in var(--slp-dur) var(--slp-ease-out) both;
  }

  /* The page's parts rise in once, shorter than before (260 ms), and keep nothing when they are done ("backwards",
     not "both"): a part that has risen carries no transform, so a card fixed over the page inside it (a sheet, the
     toast) is placed against the screen again, not against the part. */
  body.app .page > :not(.notice--toast) {
    animation: slp-rise var(--slp-dur-slow) var(--slp-ease-out) backwards;
  }

  body.app .page > :not(.notice--toast):nth-child(2) {
    animation-delay: 40ms;
  }

  body.app .page > :not(.notice--toast):nth-child(3) {
    animation-delay: 80ms;
  }
}

@keyframes slp-vt-out {
  to {
    opacity: 0;
  }
}

@keyframes slp-vt-in {
  from {
    opacity: 0;
  }
}

@keyframes slp-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---- c. the frame ---------------------------------------------------------------------------------------------- */
/* The top bar, once the page has scrolled (`is-scrolled` on <html>, app-feel.js section 8): frosted glass with a soft
   shadow, so it reads as standing over the page. The frost is on a layer under the bar's own content (::before): a
   blur on the bar itself would become the box of the fixed parts inside it. */
body.app .appbar {
  transition:
    background-color var(--slp-dur) var(--slp-ease-out),
    box-shadow var(--slp-dur) var(--slp-ease-out),
    border-color var(--slp-dur) var(--slp-ease-out);
}

html.is-scrolled body.app .appbar {
  background-color: var(--slp-surface-frost);
  border-bottom-color: var(--slp-line);
  box-shadow: 0 1px 0 rgba(212, 175, 55, 0.18), 0 8px 24px rgba(42, 0, 64, 0.08);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.is-scrolled body.app .appbar::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    backdrop-filter: saturate(160%) blur(12px);
  }
}

/* The menu bar: royal velvet, a breath of gold at its top corner, a thin gold edge on a computer. */
body.app .rail {
  background: var(--slp-rail-velvet);
  background-color: var(--slp-royal-deep);
}

@media (min-width: 1024px) {
  body.app .rail {
    box-shadow: inset -1px 0 0 rgba(255, 213, 79, 0.1);
  }
}

/* The controls of the frame answer smoothly (colour and shadow only: nothing moves). */
body.app .rail__link,
body.app .rail__top,
body.app .rail__folder-top,
body.app .rail__burger,
body.app .rail__close,
body.app .rail__signout-button,
body.app .appbar__menu,
body.app .appbar__quick-link,
body.app .appbar__crumb-part,
body.app .appbar__me-button,
body.app .appbar__me-link,
body.app .appbar__bell a,
body.app .appbar__search input,
body.app .lang-switch__button,
body.app .alert-quiet__chip,
body.app .topbar-alerts {
  transition:
    background-color var(--slp-dur-fast) var(--slp-ease-out),
    color var(--slp-dur-fast) var(--slp-ease-out),
    border-color var(--slp-dur-fast) var(--slp-ease-out),
    box-shadow var(--slp-dur) var(--slp-ease-out);
}

/* A module of the menu opens and closes smoothly where the browser can size to its content (desk.css section 12 does
   the same for the page's own folds; its rule for them, `overflow-y: visible` once open, is left as it is). */
@supports (interpolate-size: allow-keywords) {
  @media (prefers-reduced-motion: no-preference) {
    body.app .rail {
      interpolate-size: allow-keywords;
    }

    body.app .rail__module::details-content,
    body.app .rail__folder::details-content {
      block-size: 0;
      overflow-y: clip;
      transition:
        block-size var(--slp-dur-slow) var(--slp-ease-out),
        content-visibility var(--slp-dur-slow) allow-discrete;
    }

    body.app .rail__module[open]::details-content,
    body.app .rail__folder[open]::details-content {
      block-size: auto;
      overflow-y: visible;
      transition:
        block-size var(--slp-dur-slow) var(--slp-ease-out),
        content-visibility var(--slp-dur-slow) allow-discrete,
        overflow-y 0s var(--slp-dur-slow) allow-discrete;
    }
  }
}

@media (prefers-reduced-motion: no-preference) {
  body.app .rail__chev {
    transition: transform var(--slp-dur) var(--slp-ease-spring);
  }

  /* The narrow bar (a person's own choice, the button at the top of the menu bar) changes width smoothly, only while
     it is being switched (`is-nav-switching`, app-feel.js section 10): a page that opens narrow does not slide. */
  @media (min-width: 1024px) {
    html.is-nav-switching body.app {
      transition: grid-template-columns var(--slp-dur) var(--slp-ease-out);
    }
  }
}

/* A phone: the drawer stands over the page with a deep shadow; the page behind it is dimmed and softly blurred. The
   sheet's own backdrop the same. The sheet's panel keeps its animations as they are (the 0.35 s `sheet-arm` that stops a
   ghost tap on the panel's first button). */
@media (max-width: 1023.98px) {
  body.app .nav-toggle:checked ~ .rail {
    box-shadow: 24px 0 48px rgba(26, 0, 51, 0.38), 1px 0 0 rgba(255, 213, 79, 0.12);
  }
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.app .scrim,
  .sheet[open] > summary::before {
    -webkit-backdrop-filter: blur(3px) saturate(115%);
    backdrop-filter: blur(3px) saturate(115%);
  }
}

/* The phone's bottom tabs: the gold mark of the current tab grows in, the current icon stands a little higher, and a
   press is felt. */
@media (max-width: 1023.98px) and (prefers-reduced-motion: no-preference) {
  body.app .tabbar__item {
    transition:
      color var(--slp-dur-fast) var(--slp-ease-out),
      background-color var(--slp-dur-fast) var(--slp-ease-out);
  }

  body.app .tabbar__icon-wrap {
    transition: transform var(--slp-dur) var(--slp-ease-spring);
  }

  body.app .tabbar__item[aria-current='page'] .tabbar__icon-wrap,
  body.app .tabbar__more.is-current .tabbar__icon-wrap {
    transform: translateY(-1px);
  }

  body.app .tabbar__item:active .tabbar__icon-wrap {
    transform: scale(0.92);
  }

  body.app .tabbar__item[aria-current='page']::before,
  body.app .tabbar__more.is-current::before {
    animation: slp-tab-mark var(--slp-dur-slow) var(--slp-ease-spring) backwards;
    transform-origin: 50% 0;
  }
}

@keyframes slp-tab-mark {
  from {
    opacity: 0;
    transform: scaleX(0.3);
  }
}

/* ---- d. cards, buttons, chips, fields, tables ------------------------------------------------------------------ */
/* A soft layered shadow on the cards that have none of their own (zero weight: any card a page or desk.css already
   shaped keeps its own look, its gold ring or its flat edge). */
:where(body.app) :where(.card, .panel-card, .desk-card, .kpi, .tile) {
  box-shadow: var(--slp-elev-1);
}

body.app .card,
body.app .panel-card,
body.app .desk-card,
body.app .kpi,
body.app .tile {
  transition:
    box-shadow var(--slp-dur) var(--slp-ease-out),
    border-color var(--slp-dur) var(--slp-ease-out),
    transform var(--slp-dur) var(--slp-ease-out);
}

/* With a mouse: a card a person points at stands up a little. Only the cards that ARE a link move; the rest deepen
   their shadow (a card holding an open fold or a sheet never moves: it would carry the sheet with it). */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body.app :is(.card, .panel-card, .desk-card, .kpi, .tile):hover {
    box-shadow: var(--slp-elev-2);
  }

  body.app :is(a.card, a.tile, a.kpi, .panel-card.is-link):not(:has(details[open], .sheet)):hover {
    transform: translateY(-2px);
  }
}

/* Buttons answer a press at once. */
@media (prefers-reduced-motion: no-preference) {
  body.app .button,
  body.app button:not(.link) {
    transition:
      background-color var(--slp-dur-fast) var(--slp-ease-out),
      color var(--slp-dur-fast) var(--slp-ease-out),
      border-color var(--slp-dur-fast) var(--slp-ease-out),
      box-shadow var(--slp-dur) var(--slp-ease-out),
      transform var(--slp-dur-fast) var(--slp-ease-out);
  }
}

/* The flat buttons of the frame, the menus and the chips are not "big" buttons: app.css's gold glow under a button
   (::after) and its 2 px jump on a mouse made them flicker in the bar and the lists. They stay put and keep only their
   own colour change. A pressed one that is sending keeps its turning ring (`is-busy`, desk.css). */
:root body :is(
  .rail__burger,
  .appbar__me-link,
  .lang-switch__button,
  .notice__undo-button,
  .chat-head__number--tap,
  .chip-button,
  .alert-quiet__chip,
  .parcel-chip
):not(.is-busy)::after {
  content: none;
  box-shadow: none;
  opacity: 0;
}

:root body :is(
  .rail__burger,
  .appbar__me-link,
  .lang-switch__button,
  .notice__undo-button,
  .chat-head__number--tap,
  .chip-button,
  .alert-quiet__chip,
  .parcel-chip
):is(:hover, :active) {
  transform: none;
}

/* Fields: a clear royal-purple ring where the typing goes (colour and ring only: the size stays). */
body :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea) {
  transition:
    border-color var(--slp-dur-fast) var(--slp-ease-out),
    box-shadow var(--slp-dur-fast) var(--slp-ease-out);
}

body :is(input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='range']), select, textarea):not([aria-invalid='true']):focus-visible {
  border-color: var(--slp-focus-color);
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--slp-focus-ring);
}

/* Tables: the row under the mouse is tinted; the table's box has a soft edge. */
body.app .table tbody tr {
  transition: background-color var(--slp-dur-fast) var(--slp-ease-out);
}

@media (hover: hover) {
  body.app .table tbody tr:hover {
    background-color: var(--slp-surface-tint);
  }
}

:where(body.app) :where(.table-wrap) {
  box-shadow: var(--slp-elev-1);
}

/* The person's menu (the round mark at the top right) drops in with a little spring, and keeps nothing after it. */
@media (prefers-reduced-motion: no-preference) {
  body.app .appbar__me[open] .appbar__me-menu {
    transform-origin: 100% 0;
    animation: slp-drop-in var(--slp-dur) var(--slp-ease-spring) backwards;
  }
}

@keyframes slp-drop-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
}

/* ---- e. the line over the page stays centred ------------------------------------------------------------------- */
/* The toast (nav1.css, EZ9 section 3) is centred by `left: 50%` and `translateX(-50%)`. desk.css's entrance for the
   page's parts ended on `transform: none` and kept it ("both"), which won over the centring: the card stood half its
   width to the right. Its own entrance keeps the centring at every step and keeps nothing after it. */
@media (prefers-reduced-motion: no-preference) {
  body.app .page > .notice.notice--toast {
    animation: slp-toast-in var(--slp-dur-slow) var(--slp-ease-spring) backwards;
  }
}

body.app .page > .notice.notice--toast {
  animation-fill-mode: backwards;
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.45), var(--slp-elev-toast);
}

@keyframes slp-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(-50%);
  }
}

body.app .notice.notice--toast.is-leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition:
    opacity 0.18s var(--slp-ease-in),
    transform 0.2s var(--slp-ease-in);
}

/* ---- f. a part that refreshes in place on a tap ---------------------------------------------------------------- */
/* While the request is on its way (`slp-htmx-busy`, app-feel.js section 9): the part that was tapped dims and breathes,
   so the tap is seen. When the new part is in (`slp-htmx-in`, 260 ms): it fades and rises in. The lists' own 10-second
   refreshes get neither (they would flicker every 10 seconds). Opacity and a small rise only: no filter, no position. */
body .slp-htmx-busy {
  cursor: progress;
  opacity: 0.72;
  transition: opacity var(--slp-dur) var(--slp-ease-out);
}

@media (prefers-reduced-motion: no-preference) {
  body .slp-htmx-busy {
    animation: slp-busy 1.1s ease-in-out infinite;
  }

  /* As weighty as desk.css's "no entrance once the page refreshes itself" (html.is-live …, up to 0,4,1), so a tap's own
     new part still settles in. */
  html body .slp-htmx-in.slp-htmx-in.slp-htmx-in.slp-htmx-in:not(:has(details[open])) {
    animation: slp-settle-in var(--slp-dur) var(--slp-ease-out) backwards;
  }
}

@keyframes slp-busy {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes slp-settle-in {
  from {
    opacity: 0.35;
    transform: translateY(4px);
  }
}

/* ---- g. less motion ---------------------------------------------------------------------------------------------- */
/* A person whose phone or computer asks for less motion: no page change animation, no entrance, no transition, nothing
   that breathes. The one animation kept is the sheet's guard (`sheet-arm`, app.css): it moves nothing, it only stops a
   ghost tap on the panel for 0.35 s. */
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  details.sheet[open] > .sheet__panel {
    animation: sheet-arm 0.35s step-end both !important;
  }

  body .slp-htmx-busy,
  html body .slp-htmx-in {
    animation: none !important;
  }
}
