/* ══════════════════════════════════════════════════════════════════
   service.css — "Service" surface: calm, spacious, Apple-style pages
   for end users and no-auth flows (one-shot links, e-sign, intake,
   status pages). Less portal, more concierge.

   OPT-IN: nothing here applies unless a page is wrapped in .svc
       <div class="svc">
           <main class="svc-stage">
               <section class="svc-card svc-reveal">…</section>
           </main>
       </div>

   Principles: one clear task per screen · big quiet type · generous
   space · frosted materials with soft layered shadow · critically-damped
   motion that never blocks the user · cross-fade (not slide) under
   reduced-motion · dark theme. Rules follow emilkowalski/skills apple-design.

   Reuses the motion language from Signup/Join (same easing curve),
   but keyframes are namespaced svc-* so they never collide with
   scoped .razor.css animations.
   ══════════════════════════════════════════════════════════════════ */

/* ── Tokens (scoped to .svc so they never leak into the portal) ── */
.svc {
    --svc-accent: var(--tone-primary, #00c8ca);
    --svc-accent-strong: var(--tone-primary-strong, #00c4d9);
    --svc-accent-ink: #006e70;               /* accessible accent text on light */
    --svc-bg: #f5f5f7;                       /* Apple system grouped bg */
    --svc-bg-glow-a: rgba(0, 200, 202, .16);
    --svc-bg-glow-b: rgba(0, 102, 153, .10);
    --svc-surface: rgba(255, 255, 255, .78);
    --svc-surface-solid: #fff;
    --svc-border: rgba(0, 0, 0, .06);
    --svc-text: #1d1d1f;
    --svc-text-2: #6e6e73;
    --svc-text-3: #98989d;
    --svc-field: rgba(120, 120, 128, .09);
    --svc-field-focus: #fff;
    --svc-danger: #d70015;
    --svc-success: #1a8f45;

    --svc-radius-s: 12px;
    --svc-radius-m: 18px;
    --svc-radius-l: 28px;

    --svc-shadow-1: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
    --svc-shadow-2: 0 2px 4px rgba(0,0,0,.03), 0 12px 32px rgba(0,0,0,.08), 0 32px 64px rgba(0,0,0,.06);

    --svc-ease: cubic-bezier(.22, 1, .36, 1);          /* matches Signup/Join */
    /* Default UI spring is critically damped (damping 1.0): settles, never overshoots. */
    --svc-press: 100ms ease-out;                       /* respond on pointer-down */

    --svc-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                Poppins, "Segoe UI", system-ui, sans-serif;

    position: relative;
    min-height: 100vh;
    background: var(--svc-bg);
    color: var(--svc-text);
    font-family: var(--svc-font);
    font-size: 1.0625rem;                     /* 17px — Apple body size */
    line-height: 1.47;
    letter-spacing: 0;                        /* body ≈ 0; tracking is size-specific */
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    color-scheme: light;
    isolation: isolate;
}

/* Dark: follows the app's theme switch (html[data-theme]). */
html[data-theme="dark"] .svc {
    color-scheme: dark;
    --svc-bg: #000;
    --svc-bg-glow-a: rgba(0, 200, 202, .20);
    --svc-bg-glow-b: rgba(10, 132, 255, .14);
    --svc-surface: rgba(28, 28, 30, .72);
    --svc-surface-solid: #1c1c1e;
    --svc-border: rgba(255, 255, 255, .09);
    --svc-text: #f5f5f7;
    --svc-text-2: #a1a1a6;
    --svc-text-3: #6e6e73;
    --svc-field: rgba(235, 235, 245, .10);
    --svc-field-focus: #2c2c2e;
    --svc-accent-ink: #5eeed0;
    --svc-danger: #ff453a;
    --svc-success: #32d74b;
    --svc-shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --svc-shadow-2: 0 2px 4px rgba(0,0,0,.3), 0 16px 40px rgba(0,0,0,.5);
}

.svc *, .svc *::before, .svc *::after { box-sizing: border-box; }

/* ── Ambient backdrop: slow-drifting aurora behind everything ── */
.svc::before,
.svc::after {
    content: "";
    position: fixed;
    z-index: -1;
    width: 60vmax; height: 60vmax;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    will-change: transform;
}
.svc::before {
    top: -25vmax; left: -15vmax;
    background: radial-gradient(circle, var(--svc-bg-glow-a), transparent 65%);
    animation: svc-drift-a 28s ease-in-out infinite alternate;
}
.svc::after {
    bottom: -30vmax; right: -20vmax;
    background: radial-gradient(circle, var(--svc-bg-glow-b), transparent 65%);
    animation: svc-drift-b 34s ease-in-out infinite alternate;
}

/* ── Layout ── */
.svc-stage {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(1.25rem, 5vw, 4rem) 1.25rem;
}

.svc-stack {                                /* vertical rhythm helper */
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.svc-stack--lg { gap: 2rem; }

.svc-center { text-align: center; align-items: center; }

/* ── Brand mark (top of page, quiet) ── */
.svc-brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: -0.01em;
    color: var(--svc-text-2);
    text-decoration: none;
    margin-bottom: 1.5rem;
}
.svc-brand img { height: 1.75rem; width: auto; }

/* ── Card: frosted material ── */
.svc-card {
    width: 100%;
    max-width: 30rem;
    padding: clamp(1.75rem, 5vw, 2.75rem);
    background: var(--svc-surface);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
            backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--svc-border);
    border-top-color: rgba(255, 255, 255, .6);   /* light edge on the material */
    border-radius: var(--svc-radius-l);
    box-shadow: var(--svc-shadow-2);
}
.svc-card--wide  { max-width: 44rem; }
.svc-card--flush { padding: 0; overflow: hidden; }

/* Fallback when backdrop-filter is unsupported */
@media (prefers-reduced-transparency: reduce) {
    .svc-card { background: var(--svc-surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .svc-card { background: var(--svc-surface-solid); }
}

/* ── Type ── */
.svc-eyebrow {
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .06em;                    /* small text: positive tracking */
    text-transform: uppercase;
    color: var(--svc-accent-ink);
}

.svc-title {
    margin: 0;
    font-size: clamp(1.75rem, 4.5vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--svc-text);
}
.svc-title--hero {
    font-size: clamp(2.25rem, 7vw, 3.5rem);
    letter-spacing: -0.025em;
    line-height: 1.05;                        /* tight leading on display */
}

.svc-lead {
    margin: 0;
    font-size: 1.1875rem;
    line-height: 1.42;
    color: var(--svc-text-2);
    letter-spacing: -0.005em;
}

.svc-caption {
    margin: 0;
    font-size: .8125rem;
    line-height: 1.45;
    color: var(--svc-text-3);
    letter-spacing: .01em;                    /* small text: slightly positive */
}

.svc a:not(.svc-btn) {
    color: var(--svc-accent-ink);
    text-decoration: none;
    font-weight: 500;
}
.svc a:not(.svc-btn):hover { text-decoration: underline; text-underline-offset: 3px; }

/* ── Fields: filled, borderless, Apple-style ── */
.svc-field { display: flex; flex-direction: column; gap: .4rem; }

.svc-label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--svc-text-2);
    padding-inline: .25rem;
}

.svc-input,
.svc-select,
.svc-textarea {
    width: 100%;
    min-height: 3.1rem;
    padding: .8rem 1rem;
    font: inherit;
    font-size: 1.0625rem;
    color: var(--svc-text);
    background: var(--svc-field);
    border: 1.5px solid transparent;
    border-radius: var(--svc-radius-s);
    outline: none;
    transition: background-color .2s var(--svc-ease),
                border-color .2s var(--svc-ease),
                box-shadow .25s var(--svc-ease);
}
.svc-textarea { min-height: 7rem; resize: vertical; }
.svc-input::placeholder, .svc-textarea::placeholder { color: var(--svc-text-3); }

.svc-input:hover, .svc-select:hover, .svc-textarea:hover { background: color-mix(in srgb, var(--svc-field) 140%, transparent); }

.svc-input:focus, .svc-select:focus, .svc-textarea:focus {
    background: var(--svc-field-focus);
    border-color: var(--svc-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--svc-accent) 22%, transparent);
}

.svc-field--error .svc-input,
.svc-field--error .svc-select,
.svc-field--error .svc-textarea { border-color: var(--svc-danger); }

.svc-error {
    font-size: .8125rem;
    color: var(--svc-danger);
    padding-inline: .25rem;
    animation: svc-fade-up .25s var(--svc-ease) both;
}

/* ── Buttons: pill, soft glow, springy press ── */
.svc-btn {
    --_bg: var(--svc-accent);
    --_fg: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: 3.1rem;
    padding: .8rem 1.75rem;
    font: inherit;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--_fg);
    background: var(--_bg);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0,0,0,.1),
                0 8px 20px color-mix(in srgb, var(--_bg) 38%, transparent);
    transition: transform .4s var(--svc-ease),
                box-shadow .3s var(--svc-ease),
                filter .2s var(--svc-ease),
                background-color .2s var(--svc-ease);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.svc-btn:hover  { filter: brightness(1.05); transform: translateY(-1px); }
.svc-btn:active { transform: scale(.97); filter: brightness(.96); transition: transform var(--svc-press), filter var(--svc-press); }
.svc-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--_bg) 35%, transparent);
}
.svc-btn[disabled], .svc-btn[aria-disabled="true"] {
    opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; filter: none;
}

.svc-btn--block { display: flex; width: 100%; }
.svc-btn--lg    { min-height: 3.5rem; padding-inline: 2.25rem; font-size: 1.1875rem; }

.svc-btn--secondary {
    --_bg: var(--svc-field);
    --_fg: var(--svc-text);
    box-shadow: none;
}
.svc-btn--secondary:focus-visible { box-shadow: 0 0 0 4px color-mix(in srgb, var(--svc-accent) 35%, transparent); }

.svc-btn--quiet {
    --_bg: transparent;
    --_fg: var(--svc-accent-ink);
    box-shadow: none;
    padding-inline: 1rem;
}
.svc-btn--quiet:hover { background: color-mix(in srgb, var(--svc-accent) 10%, transparent); filter: none; }

.svc-btn--danger { --_bg: var(--svc-danger); }

/* Busy state — add .is-busy while awaiting the server */
.svc-btn.is-busy { pointer-events: none; color: transparent; position: relative; }
.svc-btn.is-busy::after {
    content: "";
    position: absolute;
    width: 1.2rem; height: 1.2rem;
    border: 2.5px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: svc-spin .7s linear infinite;
}

/* ── Alerts (also restyles Bootstrap .alert from shared components like StatusMessage) ── */
.svc-alert, .svc .alert {
    margin: 0;
    padding: .9rem 1.1rem;
    border: 0;
    border-radius: var(--svc-radius-s);
    font-size: .9375rem;
    line-height: 1.4;
    color: var(--svc-text);
    background: var(--svc-field);
    animation: svc-fade-up .35s var(--svc-ease) both;
}
.svc-alert--danger,  .svc .alert-danger  { color: var(--svc-danger);  background: color-mix(in srgb, var(--svc-danger) 10%, transparent); }
.svc-alert--success, .svc .alert-success { color: var(--svc-success); background: color-mix(in srgb, var(--svc-success) 12%, transparent); }
.svc .validation-message { font-size: .8125rem; color: var(--svc-danger); padding-inline: .25rem; }
.svc .validation-errors  { margin: 0; padding-inline-start: 1.1rem; font-size: .8125rem; color: var(--svc-danger); }

/* ── Checkbox row ── */
.svc-check-row { display: flex; gap: .65rem; align-items: flex-start; font-size: .9375rem; color: var(--svc-text-2); }
.svc-check-row input { width: 1.15rem; height: 1.15rem; margin-top: .15rem; accent-color: var(--svc-accent); flex-shrink: 0; }

/* ── Pills / status chips ── */
.svc-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .75rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--svc-text-2);
    background: var(--svc-field);
    border-radius: 999px;
}
.svc-pill--success { color: var(--svc-success); background: color-mix(in srgb, var(--svc-success) 12%, transparent); }
.svc-pill--accent  { color: var(--svc-accent-ink); background: color-mix(in srgb, var(--svc-accent) 14%, transparent); }

/* ── Grouped list (Settings-style rows) ── */
.svc-list {
    margin: 0; padding: 0; list-style: none;
    background: var(--svc-surface-solid);
    border: 1px solid var(--svc-border);
    border-radius: var(--svc-radius-m);
    overflow: hidden;
    box-shadow: var(--svc-shadow-1);
}
.svc-list > * {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .95rem 1.1rem;
    min-height: 3.25rem;
}
.svc-list > * + * { border-top: 1px solid var(--svc-border); }
.svc-list__value { margin-inline-start: auto; color: var(--svc-text-2); text-align: end; }

/* ── Step dots (quiet progress) ── */
.svc-dots { display: flex; gap: .45rem; justify-content: center; }
.svc-dots > span {
    width: .45rem; height: .45rem; border-radius: 999px;
    background: var(--svc-text-3); opacity: .35;
    transition: width .4s var(--svc-ease), opacity .3s var(--svc-ease), background-color .3s;
}
.svc-dots > .is-active { width: 1.4rem; background: var(--svc-accent); opacity: 1; }
.svc-dots > .is-done   { background: var(--svc-accent); opacity: .7; }

/* ── Success checkmark (draws itself) ──
   <svg class="svc-check" viewBox="0 0 52 52"><circle cx="26" cy="26" r="24"/><path d="M15 27l8 8 14-16"/></svg> */
.svc-check { width: 4.5rem; height: 4.5rem; fill: none; stroke: var(--svc-success); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.svc-check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: svc-draw .7s var(--svc-ease) .1s forwards; opacity: .35; }
.svc-check path   { stroke-dasharray: 40;  stroke-dashoffset: 40;  animation: svc-draw .45s var(--svc-ease) .55s forwards; }

/* ── Syncfusion bridge: cards and buttons inside .svc pick up the same look ──
   Inputs/dropdowns are left to the active Syncfusion theme (light/dark). */
.svc .e-card {
    background: var(--svc-surface-solid);
    border: 1px solid var(--svc-border);
    border-radius: var(--svc-radius-m);
    box-shadow: var(--svc-shadow-1);
    overflow: hidden;
}
.svc .e-card .e-card-header { padding: 1.1rem 1.25rem .25rem; }
.svc .e-card .e-card-header-title,
.svc .e-card .e-card-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: 0; color: var(--svc-text); }
.svc .e-card .e-card-content { padding: .75rem 1.25rem 1.25rem; color: var(--svc-text); }

.svc .e-btn.e-primary,
.svc .e-btn.e-primary:not(:disabled) {
    min-height: 3.1rem;
    font: inherit; font-size: 1.0625rem; font-weight: 600;
    color: #fff;
    background: var(--svc-accent);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 8px 20px color-mix(in srgb, var(--svc-accent) 38%, transparent);
    transition: transform .4s var(--svc-ease), filter .2s var(--svc-ease), box-shadow .3s var(--svc-ease);
}
.svc .e-btn.e-primary:hover:not(:disabled)  { background: var(--svc-accent); filter: brightness(1.05); transform: translateY(-1px); }
.svc .e-btn.e-primary:active:not(:disabled) { background: var(--svc-accent); transform: scale(.97); transition: transform var(--svc-press); }
.svc .e-btn.e-primary:disabled { opacity: .45; }
.svc .e-btn.e-flat { border-radius: 999px; font-weight: 600; }

/* ── Item card (a task inside a card: upload row, checklist item) ── */
.svc-item {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1.1rem 1.25rem;
    background: var(--svc-surface-solid);
    border: 1px solid var(--svc-border);
    border-radius: var(--svc-radius-m);
    box-shadow: var(--svc-shadow-1);
}
.svc-item__title { margin: 0; font-size: 1.0625rem; font-weight: 600; letter-spacing: 0; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.svc-file { font: inherit; font-size: .9375rem; color: var(--svc-text-2); max-width: 100%; }
.svc-file::file-selector-button {
    margin-inline-end: .85rem;
    padding: .5rem 1.1rem;
    font: inherit; font-weight: 600; color: var(--svc-text);
    background: var(--svc-field);
    border: 0; border-radius: 999px; cursor: pointer;
    transition: background-color .2s var(--svc-ease), transform var(--svc-press);
}
.svc-file::file-selector-button:hover  { background: color-mix(in srgb, var(--svc-accent) 14%, transparent); }
.svc-file::file-selector-button:active { transform: scale(.97); }

/* ── Logo + inline row ── */
.svc-logo { height: 2.25rem; width: auto; max-width: 70%; object-fit: contain; }
.svc-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .9375rem; }
.svc-card form { margin: 0; }

/* ── Spinner (standalone loading indicator) ── */
.svc-spinner {
    width: 2.25rem; height: 2.25rem;
    border: 3px solid color-mix(in srgb, var(--svc-accent) 25%, transparent);
    border-top-color: var(--svc-accent);
    border-radius: 50%;
    animation: svc-spin .8s linear infinite;
}

/* ── Top-aligned stage + embedded frame (signing sessions, long content) ── */
.svc-stage--top { place-items: start center; }
.svc-sign { width: 100%; max-width: 64rem; }
.svc-frame {
    width: 100%;
    min-height: 78vh;
    border: 1px solid var(--svc-border);
    border-radius: var(--svc-radius-l);
    background: #fff;
    box-shadow: var(--svc-shadow-2);
}

/* ── Divider ── */
.svc-divider { height: 1px; border: 0; background: var(--svc-border); margin: .5rem 0; }

/* ── Hero section (marketing-ish landing for no-auth pages) ── */
.svc-hero {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 1.25rem; max-width: 46rem; margin-inline: auto;
    padding-block: clamp(2rem, 8vh, 6rem);
}
.svc-gradient-text {
    background: linear-gradient(120deg, var(--svc-accent) 0%, #0a84ff 60%, #bf5af2 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}

/* ══════════════════════════════════════════════════════════════════
   MOTION
   Entrance: add .svc-reveal to any element; stagger children with
   .svc-stagger on the parent (up to 8 children, 70ms apart).
   Scroll reveal: .svc-reveal--scroll (CSS scroll-timeline; no JS).
   ══════════════════════════════════════════════════════════════════ */
@keyframes svc-fade-up {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes svc-scale-in {
    from { opacity: 0; transform: scale(.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}
@keyframes svc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes svc-spin { to { transform: rotate(360deg); } }
@keyframes svc-draw { to { stroke-dashoffset: 0; } }
@keyframes svc-drift-a { to { transform: translate3d(12vmax, 8vmax, 0) scale(1.15); } }
@keyframes svc-drift-b { to { transform: translate3d(-10vmax, -6vmax, 0) scale(1.1); } }

.svc-reveal       { animation: svc-fade-up .7s var(--svc-ease) both; }
.svc-reveal--pop  { animation: svc-scale-in .75s var(--svc-ease) both; }
.svc-reveal--fade { animation: svc-fade .6s ease both; }

.svc-stagger > * { animation: svc-fade-up .65s var(--svc-ease) both; }
.svc-stagger > :nth-child(1) { animation-delay: .05s; }
.svc-stagger > :nth-child(2) { animation-delay: .12s; }
.svc-stagger > :nth-child(3) { animation-delay: .19s; }
.svc-stagger > :nth-child(4) { animation-delay: .26s; }
.svc-stagger > :nth-child(5) { animation-delay: .33s; }
.svc-stagger > :nth-child(6) { animation-delay: .40s; }
.svc-stagger > :nth-child(7) { animation-delay: .47s; }
.svc-stagger > :nth-child(8) { animation-delay: .54s; }

/* Scroll-driven reveal — pure CSS where supported, otherwise visible. */
@supports (animation-timeline: view()) {
    .svc-reveal--scroll {
        animation: svc-fade-up linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 55%;
    }
}

/* Page-to-page crossfade for MPA-style navigations (progressive). */
@view-transition { navigation: auto; }

/* ── Responsive ── */
@media (max-width: 520px) {
    .svc-card { border-radius: var(--svc-radius-m); box-shadow: var(--svc-shadow-1); }
    .svc-btn  { width: 100%; }
    .svc-btn--quiet { width: auto; }
}

/* ── RTL ── (logical properties used throughout; only the list value flips) */
[dir="rtl"] .svc-list__value { text-align: start; }

/* ── Reduced motion: no slides/springs, but keep gentle opacity cross-fades ── */
@keyframes svc-fade-only { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .svc::before, .svc::after { animation: none; }
    .svc-reveal, .svc-reveal--pop, .svc-reveal--fade, .svc-reveal--scroll,
    .svc-stagger > *, .svc-error, .svc-alert, .svc .alert {
        animation: svc-fade-only .2s ease both !important;
        animation-timeline: auto !important;
        animation-range: normal !important;
        animation-delay: 0s !important;
        transform: none !important;
    }
    .svc-check circle, .svc-check path { animation: none; stroke-dashoffset: 0; }
    .svc-btn, .svc-input, .svc-dots > span { transition: background-color .2s ease, opacity .2s ease; }
    .svc-btn:hover, .svc-btn:active { transform: none; }
    .svc-btn.is-busy::after { animation-duration: 1.6s; }
}
