/* Grafters minimal CSS — most styling now comes from MudBlazor's theme
   system (configured in App.razor). What stays here:
   - HTML/body baseline so the page is dark BEFORE Blazor mounts.
   - Centered branded splash while WASM downloads + initialises.
   - Blazor runtime error banner styling.
   - Brand mark pulse animation (signature motion on page load).
   - <pre> styling for free-text Notes / Descriptions on detail pages. */

/* ---------------------------------------------------------------- */
/* Baseline reset only. Do NOT hardcode a background/colour here — that
   bleeds through behind MudBlazor content in light mode (the page went
   black). MudThemeProvider owns the themed background; the FOUC script in
   index.html paints documentElement for the brief pre-mount window. */
html, body {
    margin: 0;
    padding: 0;
    /* Theme-aware so the whole viewport (including any area MudBlazor's layout
       doesn't paint) follows the active palette. var() is undefined pre-mount,
       so the index.html FOUC script's inline colour covers the load window. */
    background-color: var(--mud-palette-background);
}

/* ---------------------------------------------------------------- */
/* Splash — shown while WASM downloads. The default Blazor template puts
   an SVG with two circles + a sibling div with the loading percentage
   inside #app. After Blazor mounts it replaces #app entirely, so these
   selectors only fire pre-mount. */

.loading-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 96px;
    height: 96px;
    transform: translate(-50%, -50%);
}

.loading-progress circle {
    fill: none;
    stroke: #2c2f35;
    stroke-width: 6;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #bba96c;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 25%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
    animation: grafters-spin 1.4s linear infinite;
}

@keyframes grafters-spin {
    from { transform: rotate(-90deg); }
    to   { transform: rotate(270deg); }
}

.loading-progress-text {
    position: fixed;
    top: calc(50% + 64px);
    left: 50%;
    transform: translateX(-50%);
    color: #bba96c;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-size: 1.1rem;
}

.loading-progress-text:after {
    content: 'Grafters';
}

/* ---------------------------------------------------------------- */
/* Runtime error banner (only visible if Blazor throws on the WASM side). */
#blazor-error-ui {
    background: #DF6F42;
    color: #ffffff;
    padding: 0.7rem 1.2rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    display: none;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.4);
}
#blazor-error-ui .reload {
    color: #ffffff;
    margin-left: 0.6rem;
    text-decoration: underline;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.7rem;
    font-size: 1.2rem;
}

/* ---------------------------------------------------------------- */
/* Brand mark pulse animation. Triggered on each page navigation by the
   .grafters-icon class on a <MudIcon>. */
@keyframes grafters-blink {
    0%, 100% { transform: rotate(0deg); }
    20%      { transform: rotate(-8deg); }
    40%      { transform: rotate(0deg); }
}

.grafters-icon {
    animation: grafters-blink 2.6s ease-in-out;
}

/* ---------------------------------------------------------------- */
/* Shared <pre> formatting for free-text Notes / Descriptions. */
.grafters-notes {
    background: var(--mud-palette-background-gray);
    color: var(--mud-palette-text-primary);
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 0.92rem;
    margin: 0;
}

/* ---------------------------------------------------------------- */
/* Job photo gallery + signature pad (Van / field). */
.grafters-photo-tile {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-gray);
}

.grafters-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grafters-photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.45), transparent);
}

.grafters-sig-canvas {
    width: 100%;
    max-width: 600px;
    height: 220px;
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: 6px;
    background: #ffffff;
    touch-action: none;       /* let the pad capture touch strokes */
    cursor: crosshair;
}
