/* LATVSI motion system, shared by the public website and the case management system.
   Everything here is decoration: with reduced motion switched on, or without JavaScript,
   every element is simply shown in its final state. */

:root {
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- Page to page: cross-document view transitions (Chrome, Edge, Safari 18.2+) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  html:not(.vt-local)::view-transition-old(root) { animation: vt-out .2s var(--ease-in) both; }
  html:not(.vt-local)::view-transition-new(root) { animation: vt-in .42s var(--ease-out) both; }
  .site-head { view-transition-name: site-head; }
  html.vt-local .site-head, html.vt-local .side, html.vt-local .top { view-transition-name: none; }
  .side { view-transition-name: side; }
  .top { view-transition-name: topbar; }
  ::view-transition-group(site-head), ::view-transition-group(side), ::view-transition-group(topbar) { animation-duration: .25s; }
  ::view-transition-group(*) { animation-timing-function: var(--ease-out); }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Logo ---------- */
.mark__star { transform-box: view-box; transform-origin: 24px 23.4px; }
.mark__glint { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .mark--live .mark__ring { stroke-dasharray: 100; animation: mark-draw 1.25s var(--ease-out) .1s backwards; }
  .mark--live .mark__star { animation: mark-star .9s var(--ease-spring) .55s backwards; }
  .mark--live .mark__disc { animation: mark-disc .6s var(--ease-out) backwards; transform-box: view-box; transform-origin: 24px 24px; }
  .mark--live .mark__glint { stroke-dasharray: 9 91; animation: mark-glint 7s linear 2.4s infinite; }
  .mark-seen .mark--live .mark__ring, .mark-seen .mark--live .mark__star, .mark-seen .mark--live .mark__disc { animation: none; }
  .mark-seen .mark--live .mark__glint { animation-delay: 1s; }
  a:hover > .mark--live .mark__star, a:focus-visible > .mark--live .mark__star { transform: rotate(72deg); transition: transform .7s var(--ease-spring); }
  .mark--live .mark__star { transition: transform .5s var(--ease-out); }
}
@keyframes mark-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes mark-star { from { opacity: 0; transform: scale(.2) rotate(-144deg); } to { opacity: 1; transform: none; } }
@keyframes mark-disc { from { transform: scale(.7); opacity: 0; } }
@keyframes mark-glint {
  0% { stroke-dashoffset: 100; opacity: 0; }
  4% { opacity: .95; }
  22% { stroke-dashoffset: 0; opacity: .95; }
  26%, 100% { stroke-dashoffset: -9; opacity: 0; }
}

/* Uploaded logo image */
img.mark { height: 40px; width: auto; max-width: 180px; object-fit: contain; flex: none; display: block; }
.side__brand img.mark { height: 36px; max-width: 150px; }
.ph-mark img.mark { height: 56px; opacity: .6; }
@media (prefers-reduced-motion: no-preference) {
  img.mark--live { animation: mark-img-in .9s var(--ease-spring) .1s backwards; transition: transform .5s var(--ease-spring), filter .4s; }
  .mark-seen img.mark--live { animation: none; }
  a:hover > img.mark--live, a:focus-visible > img.mark--live { transform: scale(1.06) rotate(-3deg); filter: drop-shadow(0 4px 10px rgba(232,169,58,.45)); }
}
@keyframes mark-img-in { from { opacity: 0; transform: scale(.6) rotate(-20deg); } }

/* ---------- Reveal on scroll (classes added by motion.js) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .rv { opacity: 0; translate: 0 22px; transition: opacity .75s var(--ease-out), translate .75s var(--ease-out), scale .75s var(--ease-out); transition-delay: calc(var(--rv, 0) * 65ms); }
  .js .rv--zoom { translate: none; scale: .96; }
  .js .rv--fade { translate: none; }
  .js .rv.is-in { opacity: 1; translate: none; scale: none; }
}
@media print { .rv { opacity: 1 !important; translate: none !important; scale: none !important; } }

/* ---------- Admin watermark ---------- */
.wm { position: fixed; right: max(-140px, -8vw); bottom: max(-160px, -12vh); width: min(62vw, 760px); aspect-ratio: 1; pointer-events: none; z-index: 0; color: var(--navy, #0B2A4A); opacity: .055; }
.wm svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wm__orbit, .wm__ring, .wm__star, .wm__dots { transform-box: view-box; transform-origin: 50% 50%; }
@media (prefers-reduced-motion: no-preference) {
  .wm__ring { animation: wm-spin 80s linear infinite; }
  .wm__dots { animation: wm-spin 140s linear infinite reverse; }
  .wm__orbit { animation: wm-breathe 9s ease-in-out infinite; }
  .wm__star { animation: wm-star 12s var(--ease-out) infinite; }
  .wm { animation: wm-in 1.6s var(--ease-out) both; }
}
@keyframes wm-spin { to { transform: rotate(360deg); } }
@keyframes wm-breathe { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.035); opacity: .55; } }
@keyframes wm-star { 0%, 70%, 100% { transform: none; } 80% { transform: rotate(72deg) scale(1.04); } 90% { transform: rotate(72deg); } }
@keyframes wm-in { from { opacity: 0; transform: scale(.9) rotate(-12deg); } }
@media print { .wm { display: none; } }

/* ---------- Count-up numbers keep their width while they tick ---------- */
[data-countup] { font-variant-numeric: tabular-nums; }

/* Scroll-linked progress line (browsers with scroll-driven animations only) */
.scroll-line { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--gold, #E8A93A), #FFD58A); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; display: none; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .scroll-line { display: block; animation: scroll-line linear both; animation-timeline: scroll(root block); }
  }
}
@keyframes scroll-line { to { transform: scaleX(1); } }

/* ---------- Fit every screen: notches, rounded corners, home indicators ---------- */
html { -webkit-tap-highlight-color: rgba(232,169,58,.18); text-size-adjust: 100%; }
body { overflow-x: hidden; overflow-x: clip; }
img, video, iframe, svg { max-width: 100%; }
.wrap { padding-left: max(var(--gutter, 16px), env(safe-area-inset-left)); padding-right: max(var(--gutter, 16px), env(safe-area-inset-right)); }
.site-head { padding-top: env(safe-area-inset-top); }
.site-foot { padding-bottom: env(safe-area-inset-bottom); }
.top { padding-top: max(12px, env(safe-area-inset-top)); }
.side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); }
.content { padding-bottom: max(48px, calc(env(safe-area-inset-bottom) + 24px)); }
.form-actions { padding-bottom: max(4px, env(safe-area-inset-bottom)); }
.lb__bar { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.lb__close { top: max(16px, env(safe-area-inset-top)); }
button, a, input, select, textarea, label { touch-action: manipulation; }
/* iPhone zooms into any field under 16px; keep fields at 16px on touch screens */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }
}

/* Installed app: feels native, no browser chrome to scroll under */
html.is-app, html.is-app body { overscroll-behavior-y: none; }
@media (display-mode: standalone) {
  html { overscroll-behavior-y: none; }
  .install-link, .foot-install, .side__install, .login__install { display: none !important; }
}

/* ---------- Install buttons ---------- */
[data-install] svg { width: 16px; height: 16px; flex: none; }
.install-link { width: auto; text-align: left; }
@media (min-width: 961px) { .install-link { display: none !important; } }
.install-link svg { margin-right: 2px; }
.foot-install { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #fff; font: 600 14px var(--body, system-ui); cursor: pointer; transition: background .2s, border-color .2s; }
.foot-install:hover { background: rgba(255,255,255,.12); border-color: var(--gold, #E8A93A); }
.side__install { display: flex; align-items: center; gap: 10px; margin: 0 10px 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed rgba(232,169,58,.55); background: rgba(232,169,58,.08); color: #fff; text-align: left; font: 600 13.5px var(--body, system-ui); cursor: pointer; transition: background .2s; }
.side__install:hover { background: rgba(232,169,58,.16); }
.side__install small { display: block; color: #9FB3C9; font-weight: 500; font-size: 11.5px; }
.side__install svg { width: 20px; height: 20px; color: var(--gold, #E8A93A); }
.login__install { margin-top: 14px; width: 100%; }

/* ---------- Install sheet ---------- */
.install-sheet { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.install-sheet__scrim { position: absolute; inset: 0; background: rgba(4,12,24,.55); opacity: 0; transition: opacity .3s; }
.install-sheet__card { position: relative; width: min(100%, 460px); margin: 0 auto; background: #fff; color: #0E1B2E; border-radius: 22px 22px 0 0; padding: 22px 22px max(22px, calc(env(safe-area-inset-bottom) + 14px)); box-shadow: 0 -20px 60px -20px rgba(0,0,0,.45); transform: translateY(105%); transition: transform .42s cubic-bezier(.2,.8,.2,1); font: 15.5px/1.5 var(--body, system-ui); }
.install-sheet.is-open .install-sheet__scrim { opacity: 1; }
.install-sheet.is-open .install-sheet__card { transform: none; }
@media (min-width: 640px) { .install-sheet { align-items: center; } .install-sheet__card { border-radius: 20px; transform: translateY(24px) scale(.96); opacity: 0; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .25s; } .install-sheet.is-open .install-sheet__card { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .install-sheet__card, .install-sheet__scrim { transition: none; } }
.install-sheet__card::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: #D5DDE7; margin: -10px auto 14px; }
@media (min-width: 640px) { .install-sheet__card::before { display: none; } }
.install-sheet__x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #EEF2F6; color: #3B4A5E; font-size: 22px; line-height: 1; cursor: pointer; }
.install-sheet__head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; padding-right: 36px; }
.install-sheet__head img { border-radius: 14px; box-shadow: 0 6px 16px -6px rgba(11,42,74,.5); }
.install-sheet__head b { display: block; font: 800 1.15rem/1.2 var(--display, system-ui); }
.install-sheet__head span { color: #64748B; font-size: 13.5px; }
.install-sheet p { margin: 0 0 14px; color: #3B4A5E; }
.install-sheet ol { margin: 4px 0 16px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.install-sheet li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; color: #3B4A5E; }
.install-sheet li::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #0B2A4A; color: #fff; font: 700 13px var(--body, system-ui); }
.install-sheet li svg { width: 20px; height: 20px; vertical-align: -4px; color: #1F5690; }
.install-sheet__actions { display: flex; gap: 10px; }
.install-sheet__actions button { flex: 1; padding: 14px; border-radius: 12px; font: 700 16px var(--body, system-ui); cursor: pointer; border: 0; }
.install-sheet__go { background: #0B2A4A; color: #fff; }
.install-sheet__later { background: #EEF2F6; color: #0E1B2E; }

.app-toast { position: fixed; left: 50%; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); translate: -50% 16px; opacity: 0; z-index: 210; margin: 0; max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 999px; background: #0E1B2E; color: #fff; font: 600 14px var(--body, system-ui); box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); transition: opacity .25s, translate .35s cubic-bezier(.34,1.56,.64,1); pointer-events: none; text-align: center; }
.app-toast.is-in { opacity: 1; translate: -50% 0; }
.install-sheet .install-sheet__os { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #F1F5FA; color: #0B2A4A; font-size: 14.5px; }
.install-sheet__os svg { width: 26px; height: 26px; flex: none; color: #B57A12; }
@media (prefers-reduced-motion: no-preference) { .install-sheet.is-open .install-sheet__os svg { animation: os-pop .6s cubic-bezier(.34,1.56,.64,1) .25s backwards; } }
@keyframes os-pop { from { transform: scale(.4) rotate(-15deg); opacity: 0; } }
