/* ==========================================================
   ws-services.css
   What I do rail and dialogs. Home and tool pages. Owns wssvc.
   Markup: ws_services_rail(), inc/services.php. Script: ws-services.js.
   Rail spans container. Caller makes container full width.
   ========================================================== */

.wssvc {
    /* Edges match header, footer */
    --wssvc-gutter: 24px;
    --wssvc-max: 1140px;
    /* Diagonal corners. Logged 3px exception */
    --wssvc-curve: 40px;
    --wssvc-corners: var(--ws-radius) var(--wssvc-curve);
    /* First card line up with content edge */
    --wssvc-edge: max(var(--wssvc-gutter), calc((100% - var(--wssvc-max)) / 2 + var(--wssvc-gutter)));
    --wssvc-card: 348px;
    --wssvc-btn: #ECEDE9;
    /* Tint. Lift on hover */
    --wssvc-tint: rgba(18, 18, 20, 0.42);
    --wssvc-tint-lift: rgba(18, 18, 20, 0.12);
}
[data-theme="dark"] .wssvc { --wssvc-btn: #2C2C31; }

/* Room so focus ring not clipped */
.wssvc__rail {
    position: relative;
    display: flex;
    gap: 24px;
    margin: 0;
    padding: 10px var(--wssvc-edge) 14px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--wssvc-edge);
    scrollbar-width: none;
}
.wssvc__rail::-webkit-scrollbar { display: none; }
.wssvc__item { flex: 0 0 var(--wssvc-card); margin: 0; scroll-snap-align: start; }

/* Isolation keep zoom inside corners on Safari */
.wssvc__card {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 6 / 7;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    isolation: isolate;
    font: inherit;
    text-align: left;
    color: var(--ws-white);
    background: var(--ws-charcoal);
    border-radius: var(--wssvc-corners);
    cursor: pointer;
}
.wssvc__card:focus-visible { outline: 3px solid var(--ws-heading); outline-offset: 4px; }

.wssvc__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ws-ease);
}
/* Extra dark top behind words */
.wssvc__shade {
    position: absolute;
    inset: 0;
    background-color: var(--wssvc-tint);
    transition: background-color 0.3s ease;
}
.wssvc__shade::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 10, 12, 0.55) 0%, rgba(10, 10, 12, 0) 58%);
}

/* Button center content. Pin top */
.wssvc__text { position: absolute; top: 0; left: 0; right: 0; display: block; padding: 28px 28px 0; }
.wssvc__name { display: block; font-size: 0.95rem; font-weight: 700; }
.wssvc__line {
    display: block;
    margin-top: 8px;
    font-size: clamp(1.4rem, 1vw + 1rem, 1.75rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-wrap: balance;
}
/* Lime circle, charcoal plus */
.wssvc__plus {
    position: absolute;
    right: 22px;
    bottom: 22px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ws-accent);
    color: var(--ws-charcoal);
    transition: transform 0.2s var(--ws-ease);
}
.wssvc__plus svg,
.wssvc__arrow svg,
.wssvc-dlg__close svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.wssvc__plus svg { width: 18px; height: 18px; stroke-width: 2.6; }

/* Hover: tint lift, photo creep, plus turn */
@media (hover: hover) {
    .wssvc__card:hover .wssvc__shade { background-color: var(--wssvc-tint-lift); }
    .wssvc__card:hover .wssvc__photo { transform: scale(1.04); }
    .wssvc__card:hover .wssvc__plus { transform: rotate(90deg); }
}
.wssvc__card:focus-visible .wssvc__shade { background-color: var(--wssvc-tint-lift); }

/* Arrows, dots need JS */
.wssvc__nav { display: none; align-items: center; justify-content: flex-end; margin-top: 12px; padding: 0 var(--wssvc-edge); }
.js .wssvc__nav { display: flex; }
.wssvc__arrows { display: flex; gap: 12px; }
.wssvc__dots { display: none; }

.wssvc__arrow {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--wssvc-btn);
    color: var(--ws-heading);
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.wssvc__arrow svg { width: 20px; height: 20px; stroke-width: 2.4; }
.wssvc__arrow:disabled { opacity: 0.35; cursor: default; }

/* 44px target, 8px dot */
.wssvc__dot {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.wssvc__dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: var(--ws-grey);
    transition: width 0.2s ease, background-color 0.2s ease;
}
.wssvc__dot[aria-current="true"]::before { width: 24px; background: var(--ws-heading); }
.wssvc__arrow:focus-visible,
.wssvc__dot:focus-visible { outline: 3px solid var(--ws-heading); outline-offset: 2px; }

/* Narrow: one centered, neighbors faded. No JS: all full */
@media (max-width: 1023px) {
    .wssvc { --wssvc-card: min(300px, 78vw); }
    .wssvc__rail {
        gap: 14px;
        padding-left: calc((100% - var(--wssvc-card)) / 2);
        padding-right: calc((100% - var(--wssvc-card)) / 2);
        scroll-padding-inline: 0;
    }
    .wssvc__item { scroll-snap-align: center; }
    .js .wssvc__item { opacity: 0.45; scale: 0.92; transition: opacity 0.25s ease, scale 0.25s ease; }
    .js .wssvc__item.is-on { opacity: 1; scale: 1; }
    .wssvc__item.is-on .wssvc__shade { background-color: rgba(18, 18, 20, 0.22); }
    .wssvc__nav { justify-content: center; margin-top: 0; }
    .wssvc__arrows { display: none; }
    .wssvc__dots { display: flex; }
    .wssvc__text { padding: 24px 24px 0; }
    .wssvc__plus { right: 18px; bottom: 18px; }
}

/* === Service dialogs === */
/* Top layer. Tokens still inherit */
.wssvc-dlg {
    width: min(900px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 0;
    border: 0;
    overflow: auto;
    overscroll-behavior: contain;
    color: var(--ws-text);
    background: var(--ws-surface);
    border-radius: var(--wssvc-corners);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}
.wssvc-dlg::backdrop { background: rgba(14, 14, 15, 0.62); }
.wssvc-dlg[open] { animation: wssvc-dlg-in 0.28s var(--ws-ease); }
.wssvc-dlg[open]::backdrop { animation: wssvc-fade 0.2s ease; }
@keyframes wssvc-dlg-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes wssvc-fade { from { opacity: 0; } to { opacity: 1; } }

/* Page no scroll. JS pad scrollbar. Gutter left blank strip on Windows */
html.wssvc-lock { overflow: hidden; }

.wssvc-dlg__inner { display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.wssvc-dlg__photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.wssvc-dlg__body { position: relative; padding: 44px 48px 40px; }

.wssvc-dlg__close {
    position: absolute;
    top: 20px;
    right: 20px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--ws-border);
    border-radius: 50%;
    background: transparent;
    color: var(--ws-heading);
    cursor: pointer;
    transition: border-color 0.2s ease;
}
.wssvc-dlg__close:hover { border-color: var(--ws-accent); }
.wssvc-dlg__close:focus-visible { outline: 3px solid var(--ws-heading); outline-offset: 2px; }
.wssvc-dlg__close svg { width: 18px; height: 18px; stroke-width: 2.4; }

/* Name = h3, eyebrow look. Tagline big */
.wssvc-dlg__name {
    margin: 0;
    padding-right: 56px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ws-muted);
}
.wssvc-dlg__line {
    margin: 10px 0 16px;
    padding-right: 40px;
    font-size: clamp(1.6rem, 1.4vw + 1rem, 2rem);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: -0.01em;
    color: var(--ws-heading);
    text-wrap: balance;
}
.wssvc-dlg__text { margin: 0; line-height: 1.6; color: var(--ws-muted); text-wrap: pretty; }

/* Lime square bullets */
.wssvc-dlg__list {
    display: grid;
    gap: 10px;
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
}
.wssvc-dlg__list li {
    position: relative;
    padding-left: 18px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--ws-text);
}
.wssvc-dlg__list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 8px;
    height: 8px;
    background: var(--ws-accent);
    border-radius: var(--ws-radius-sm);
}
.wssvc-dlg__cta { margin-top: 28px; }

/* Phone: bottom sheet, photo top */
@media (max-width: 719px) {
    .wssvc-dlg {
        width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        margin: auto 0 0;
        border-radius: var(--ws-radius) var(--wssvc-curve) 0 0;
    }
    .wssvc-dlg[open] { animation-name: wssvc-sheet-in; }
    .wssvc-dlg__inner { grid-template-columns: 1fr; }
    .wssvc-dlg__photo { height: 170px; }
    .wssvc-dlg__body { padding: 24px 22px 28px; }
    .wssvc-dlg__close { top: 14px; right: 14px; }
    .wssvc-dlg__cta { display: block; }
}
@keyframes wssvc-sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .wssvc__photo,
    .wssvc__shade,
    .wssvc__plus,
    .wssvc__dot::before,
    .js .wssvc__item { transition: none; }
    .wssvc__card:hover .wssvc__photo { transform: none; }
    .wssvc-dlg[open],
    .wssvc-dlg[open]::backdrop { animation: none; }
}
