/* Oil on water and frosted glass, shared by the app, the sign-in page and Advanced admin.
   The oil itself is drawn by templates/includes/oil.html. Rules: .claude/skills/tortuga-ui. */

:root {
  --oil-strength: 0.55;
  --oil-signin: 0.5;
  --oil-blend: multiply;
  /* Frosted glass: one sheet over the oil that the sidebar and work area share. */
  --frost: rgb(240 240 240 / 0.62);
  --frost-side: rgb(250 250 250 / 0.74);
  --frost-blur: 26px;
  /* The tray: a clearer, brighter pane of glass with rounded corners that holds every
     panel on the page, so the pieces read as one connected surface. */
  --tray: rgb(255 255 255 / 0.4);
  --tray-edge: rgb(255 255 255 / 0.9);
  --tray-line: rgb(0 0 0 / 0.06);
  --tray-shadow: 0 18px 50px rgb(20 24 32 / 0.08);
  --tray-blur: 44px;
  --tray-radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --oil-strength: 0.6;
    --oil-signin: 0.32;
    --oil-blend: screen;
    --frost: rgb(20 21 24 / 0.62);
    --frost-side: rgb(23 24 27 / 0.74);
    --tray: rgb(44 47 54 / 0.34);
    --tray-edge: rgb(255 255 255 / 0.09);
    --tray-line: rgb(0 0 0 / 0.35);
    --tray-shadow: 0 18px 50px rgb(0 0 0 / 0.35);
  }
}
:root[data-theme="dark"] {
  --oil-strength: 0.6;
  --oil-signin: 0.32;
  --oil-blend: screen;
  --frost: rgb(20 21 24 / 0.62);
  --frost-side: rgb(23 24 27 / 0.74);
  --tray: rgb(44 47 54 / 0.34);
  --tray-edge: rgb(255 255 255 / 0.09);
  --tray-line: rgb(0 0 0 / 0.35);
  --tray-shadow: 0 18px 50px rgb(0 0 0 / 0.35);
}

/* A fixed layer behind everything. The sidebar and work area are frosted glass over it;
   panels, tables, forms and documents stay solid above that. */
.oil-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.oil-layer .oil {
  width: 100%; height: 100%; opacity: var(--oil-strength); mix-blend-mode: var(--oil-blend);
  transform-origin: 50% 50%;
  /* Really subtle: a 1-2% drift over two minutes, and the sheen's colours shifting slowly,
     so the oil catches the light differently over time. Never noticeable as motion. */
  animation: oil-drift-slow 127s ease-in-out infinite alternate, oil-sheen 53s ease-in-out infinite alternate;
  will-change: transform, filter;
}
@keyframes oil-drift-slow {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to { transform: translate3d(-1.2%, 0.8%, 0) scale(1.06) rotate(0.6deg); }
}
@keyframes oil-sheen {
  0% { filter: hue-rotate(0deg) brightness(1); }
  50% { filter: hue-rotate(14deg) brightness(1.04); }
  100% { filter: hue-rotate(-10deg) brightness(0.98); }
}
@keyframes oil-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-4%, 3%, 0) scale(1.08) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) { .oil, .oil-layer .oil, .auth-art .oil { animation: none; } }

/* Glass rims (see --tray): every panel sits in its own rim of brighter frosted glass that
   follows the panel's outline with rounded corners. Panels are 16px apart and each rim is
   8px wide, so neighbouring rims meet and the glass flows around the whole layout, in
   front of the frosted oil and behind the solid panels. Drawn as a spread shadow so
   panels that scroll or clip their contents (tables, the document viewer) keep their rim. */
:root { --rim: 8px; }
.card, .work-panel, .settings-list, .filters {
  box-shadow: 0 0 0 var(--rim) var(--tray), 0 0 0 calc(var(--rim) + 1px) var(--tray-line), var(--tray-shadow);
}
/* Panels nested inside another panel, and dialogs, don't get a second rim. */
.card .card, .card .filters, .dialog .card { box-shadow: none; }
@media (max-width: 760px) { :root { --rim: 6px; } }

/* One connected sheet of glass (static/js/site.js draws it): the script traces a single
   outline around every panel (12px out from each), bridges small gaps, and rounds every
   corner at 20px, inside corners included. It has a 1px edge line and a two-layer shadow
   (a tight contact shadow plus a soft lift) so it reads as a solid pane over the oil.
   Drawn as one layer, so there are no seams or doubled-up overlaps. When the script runs
   it replaces the per-panel rims above. */
.content { position: relative; }
.content > :not(.glass-layer) { position: relative; z-index: 1; }
.glass-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.glass-shape { position: absolute; inset: 0; filter: drop-shadow(0 1px 2px var(--glass-contact)) drop-shadow(0 12px 28px var(--glass-shadow)); }
.glass-shape svg { display: block; overflow: visible; }
.glass-shape path { fill: var(--glass-fill); stroke: var(--glass-edge); stroke-width: 1; }
.has-glass .card, .has-glass .work-panel, .has-glass .settings-list, .has-glass .filters { box-shadow: none; }
:root {
  --glass-fill: rgb(255 255 255 / 0.66); --glass-edge: rgb(20 24 32 / 0.16);
  --glass-contact: rgb(20 24 32 / 0.08); --glass-shadow: rgb(20 24 32 / 0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass-fill: rgb(58 62 70 / 0.5); --glass-edge: rgb(255 255 255 / 0.14);
    --glass-contact: rgb(0 0 0 / 0.45); --glass-shadow: rgb(0 0 0 / 0.5);
  }
}
:root[data-theme="dark"] {
  --glass-fill: rgb(58 62 70 / 0.5); --glass-edge: rgb(255 255 255 / 0.14);
  --glass-contact: rgb(0 0 0 / 0.45); --glass-shadow: rgb(0 0 0 / 0.5);
}
/* The page head holds the Admin menu, which must open over the panels below it. */
.content > .page-head { z-index: 3; }
/* The search box's suggestion list opens over the content below it. */
.content > .filters { z-index: 2; }
