/* ============================================================
   APP.CSS -- Core public styles
   Extracted from shop.css (Polymer pattern), adapted for core
   Only: header, drawer, forms, buttons, toast, spinner, responsive
   ============================================================ */

/* -- Variables ------------------------------------------------ */

:root {
    --app-primary: #202020;
    --app-secondary: #595959;
    --app-accent: #172C50;
    --app-bg: #fff;
    --app-bg-alt: #f5f5f5;
    --app-border: #e0e0e0;
    --app-radius: 0;
    --app-max-width: 1200px;
    --app-header-height: 64px;
    --app-font: system-ui, -apple-system, 'Segoe UI', sans-serif;
    --app-success: #16a34a;
    --app-error: #dc2626;
    --app-warning: #d97706;
    --z-header: 100;
    --z-drawer-overlay: 200;
    --z-drawer: 201;
    --z-toast: 500;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* -- Language panel ------------------------------------------- */

.app-lang-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.3);
    z-index: 400; opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
}
.app-lang-overlay.is-open { opacity: 1; pointer-events: auto; }

.app-lang-panel {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-radius: 0;
    padding: 20px 24px 32px; z-index: 401;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    border-top: 1px solid var(--app-border);
    pointer-events: none; visibility: hidden;
}
.app-lang-panel.is-open {
    transform: translateY(0); pointer-events: auto; visibility: visible;
}

.app-lang-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--app-border);
    font-size: 15px; color: var(--app-primary); text-decoration: none;
}
.app-lang-item:last-child { border-bottom: none; }
.app-lang-item:hover { color: var(--app-accent); }
.app-lang-item.is-active { font-weight: 600; }

@media (min-width: 769px) {
    .app-lang-panel {
        position: fixed; bottom: auto; top: 56px; right: 16px;
        left: auto; width: 200px; border-radius: 0;
        padding: 16px 20px 20px;
        transform: translateY(-10px); opacity: 0;
        transition: transform 0.2s ease, opacity 0.2s ease;
        pointer-events: none; visibility: hidden;
        border: 1px solid var(--app-border);
    }
    .app-lang-panel.is-open {
        transform: translateY(0); opacity: 1;
        pointer-events: auto; visibility: visible;
    }
}

/* -- Mobile drawer -------------------------------------------- */

.app-drawer-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: var(--z-drawer-overlay);
}
.app-drawer-overlay.is-open { display: block; }

.app-drawer {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; background: var(--app-bg);
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding: 24px 20px;
    overflow-y: auto;
}
.app-drawer.is-open { transform: translateX(0); }

.app-drawer a {
    display: block; padding: 0 16px; line-height: 44px;
    color: var(--app-primary); text-decoration: none;
    font-size: 14px; font-weight: 500;
}
.app-drawer a:hover,
.app-drawer a.is-active {
    color: var(--app-accent); font-weight: 600;
}

.app-drawer__langs {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--app-border);
    margin-top: 12px;
    padding-top: 16px;
}

.app-drawer__lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 6px 12px;
    border: 1px solid var(--app-border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: var(--app-secondary);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.app-drawer__lang-pill:hover {
    color: var(--app-accent);
    border-color: var(--app-accent);
}

.app-drawer__lang-pill.is-active {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
    font-weight: 600;
}

/* -- Field (floating label) ----------------------------------- */

.app-field {
    position: relative;
    padding-top: 20px;
    margin-bottom: 12px;
}

.app-input {
    width: 100%;
    font-size: 1em;
    font-weight: 300;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid #ccc;
    background-color: transparent;
    color: var(--app-primary);
    outline: none;
    background-image: linear-gradient(var(--app-accent), var(--app-accent));
    background-size: 0% 2px;
    background-position: center bottom;
    background-repeat: no-repeat;
    transition: background-size 0.2s ease-in;
}

.app-input::placeholder { color: transparent; }

/* Reset Firefox default invalid style */
.app-input:invalid { box-shadow: none; }

.app-input:focus {
    border-bottom-color: transparent;
    background-size: 100% 2px;
}

.app-field > label {
    position: absolute; left: 0; top: 28px;
    font-size: 1em; font-weight: 300;
    color: var(--app-secondary); opacity: 0.5;
    pointer-events: none; transform-origin: 0 0;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out, color 0.15s ease-out;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

.app-field > .app-input:focus ~ label {
    opacity: 1; transform: translate3d(0, -1.9em, 0) scale(0.8);
    color: var(--app-accent);
}

.app-field > .app-input:not(:placeholder-shown) ~ label {
    opacity: 1; transform: translate3d(0, -1.9em, 0) scale(0.8);
}

/* Validation -- via aria-invalid attribute (set by JS on submit attempt) */
.app-field > .app-input[aria-invalid='true']:not(:valid) {
    border-bottom-color: transparent;
    background-image: linear-gradient(#dd2c00, #dd2c00);
    background-size: 100% 2px;
}

.app-field > .app-input[aria-invalid='true']:not(:valid) ~ label {
    color: #dd2c00;
}

.app-field > .app-input[aria-invalid='true']:not(:valid) ~ .app-field-error {
    display: block;
}

.app-field-error {
    display: none; font-size: 0.65em; color: #dd2c00; margin-top: 2px;
}

/* Select styling */
.app-field > select.app-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image:
        linear-gradient(var(--app-accent), var(--app-accent)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23595959' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-size: 0% 2px, 12px;
    background-position: center bottom, right 0 center;
    background-repeat: no-repeat;
    padding-right: 20px;
    cursor: pointer;
}

.app-field > select.app-input:focus {
    background-size: 100% 2px, 12px;
}

/* Textarea */
.app-field > textarea.app-input {
    min-height: 80px;
    resize: vertical;
}

/* Input rows (side by side) */
.app-input-row {
    display: flex; align-items: flex-end; gap: 8px;
}
.app-input-row > * { flex: 1; }

/* -- Button (Polymer style) ----------------------------------- */

.app-button {
    display: inline-block;
}

.app-button > a,
.app-button > button {
    display: inline-block; box-sizing: border-box;
    border: 2px solid #000; background: #fff;
    font-size: 14px; font-weight: 500;
    color: var(--app-primary);
    margin: 0; padding: 8px 44px;
    text-align: center; text-decoration: none;
    text-transform: uppercase; border-radius: 0;
    outline: none; cursor: pointer;
    -webkit-appearance: none;
    transition: background-color 0.15s, color 0.15s;
}

.app-button > a:focus,
.app-button > button:focus { background: #c5cad3; }

.app-button > a:active,
.app-button > button:active { background: #000; color: #fff; }

.app-button > button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Primary (filled) */
.app-button--primary > a,
.app-button--primary > button {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

.app-button--primary > a:active,
.app-button--primary > button:active { background: #0e1b33; }

/* -- Button states (spinner -> check/x -> idle) --------------- */

.app-btn-spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: appSpin 0.6s linear infinite;
    vertical-align: middle;
}

.app-button:not(.app-button--primary) button .app-btn-spinner {
    border-color: rgba(0,0,0,0.15);
    border-top-color: #000;
}

/* -- Spinner -------------------------------------------------- */

.app-spinner {
    position: fixed;
    top: calc(50% - 20px); left: calc(50% - 20px);
    width: 40px; height: 40px;
    border: 3px solid var(--app-border);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: appSpin 0.8s linear infinite;
    z-index: 300;
}

@keyframes appSpin { to { transform: rotate(360deg); } }

/* -- Toast ---------------------------------------------------- */

.app-toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--app-primary); color: #fff;
    padding: 12px 24px; border-radius: 0;
    font-size: 14px; font-weight: 500;
    z-index: var(--z-toast); opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.1);
}

.app-toast.is-visible {
    opacity: 1; transform: translateX(-50%) translateY(0);
}

/* -- Image lazy load + shimmer -------------------------------- */

.app-image {
    position: relative;
    overflow: hidden;
    background-color: var(--app-bg-alt);
}

.app-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: appShimmer 1.2s ease-in-out infinite;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.app-image.is-loaded::before {
    opacity: 0;
    pointer-events: none;
}

.app-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.app-image.is-loaded img {
    opacity: 1;
}

@keyframes appShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -- Gallery grid images --------------------------------------- */

.gallery-grid__img {
    display: block;
    aspect-ratio: 4/3;
}

.gallery-grid__img img {
    transition: opacity 0.5s ease, transform 0.3s ease;
}

a.gallery-grid__img:hover img {
    transform: scale(1.04);
}

/* -- Hero image section ---------------------------------------- */

.hero-image {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    width: 100%;
    background: #0f172a;
    overflow: hidden;
}

.hero-image__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hero-image__bg.is-loaded {
    opacity: 1;
}

.hero-image__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    pointer-events: none;
    z-index: 1;
}

.hero-image__content {
    position: relative;
    z-index: 2;
    padding: calc(var(--app-header-height) + 3rem) 2rem 4rem;
    width: 100%;
}

.hero-image__title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-image__subtitle {
    font-size: 1.125rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 2rem;
    max-width: 540px;
}

.hero-image--center { text-align: center; }
.hero-image--center .hero-image__subtitle {
    margin-left: auto;
    margin-right: auto;
}

.hero-image__cta {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    background: #fff;
    color: #0f172a;
    font-weight: 700;
    border-radius: 0;
    text-decoration: none;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: background-color 0.15s, transform 0.15s;
}

.hero-image__cta:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

/* -- Site header (intelligent: transparent over hero, solid otherwise) */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    background: transparent;
    color: #f8fafc;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.3s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.site-header.is-solid {
    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

/* Offset main content below fixed header (pages without hero) */
#main-content {
    margin-top: var(--app-header-height);
}

/* Full-bleed pages: hero slides under the header */
#main-content.full-bleed {
    margin-top: 0;
}

.site-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .05em;
}

.site-header h1 a {
    color: inherit;
    text-decoration: none;
}

.site-header nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: .85rem;
    margin-left: .75rem;
}

.site-header nav a:hover,
.site-header nav a.active {
    color: #fff;
}

.site-header nav form {
    display: inline;
    margin-left: .75rem;
}

.site-header nav button {
    background: none;
    border: none;
    color: #cbd5e1;
    font-size: .85rem;
    cursor: pointer;
    padding: 0;
}

.site-header nav button:hover {
    color: #f8fafc;
}

.site-header .badge {
    font-size: .7rem;
    background: #334155;
    color: #94a3b8;
    padding: .15rem .4rem;
    border-radius: .25rem;
    margin-left: .35rem;
}

.site-header #menuToggle {
    display: none;
    background: none;
    border: none;
    color: #f8fafc;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 767px) {
    .site-header #menuToggle { display: block; }
    .site-header nav { display: none; }
}

/* -- View Transitions API ------------------------------------- */

::view-transition-old(root) {
    animation: vtFadeOut 0.15s ease-out both;
}
::view-transition-new(root) {
    animation: vtFadeIn 0.2s ease-in both;
}
@keyframes vtFadeOut { to { opacity: 0; } }
@keyframes vtFadeIn  { from { opacity: 0; } }

/* Header persists across navigations — no flash */
.site-header { view-transition-name: header; }
::view-transition-group(header) { animation: none; }

/* -- Transitions ---------------------------------------------- */

.app-fade-in { animation: appFadeIn 0.25s ease; }
@keyframes appFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* -- Responsive ----------------------------------------------- */

@media (max-width: 767px) {
    .app-input-row {
        flex-direction: column; align-items: stretch; gap: 0;
    }

    /* Responsive button: full-width fixed bottom */
    .app-button--responsive {
        position: fixed; bottom: 0; left: 0; right: 0;
        height: 64px; z-index: 50;
    }
    .app-button--responsive > a,
    .app-button--responsive > button {
        background: var(--app-accent); border: none; color: #fff;
        width: 100%; height: 100%; padding: 20px; font-size: 15px;
    }
}

/* -- Accessibility -------------------------------------------- */

.app-sr-only {
    position: fixed; height: 0; overflow: hidden;
}

/* -- Pricing grid --------------------------------------------- */

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pricing-card {
    border: 1px solid #e2e8f0;
    padding: 2rem 1.5rem;
    position: relative;
}

.pricing-card--featured {
    border: 2px solid var(--app-accent);
}

.pricing-badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--app-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
}

.pricing-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #0f172a;
}

.pricing-price {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1.25rem;
    line-height: 1;
}

.pricing-price span {
    font-size: 0.875rem;
    font-weight: 400;
    color: #64748b;
}

.pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.pricing-card li {
    padding: 0.4rem 0;
    font-size: 0.875rem;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.pricing-card li:last-child {
    border-bottom: none;
}

.pricing-cta {
    display: block;
    text-align: center;
    padding: 0.75rem;
    border: 2px solid var(--app-accent);
    color: var(--app-accent);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: background-color 0.15s, color 0.15s;
}

.pricing-cta:hover {
    background: var(--app-accent);
    color: #fff;
}

.pricing-card--featured .pricing-cta {
    background: var(--app-accent);
    color: #fff;
}

.pricing-card--featured .pricing-cta:hover {
    background: #0e1b33;
}

/* -- Feature alternating (zig-zag service sections) ----------- */

.feature-alt {
    padding: 5rem 1.5rem;
}

.feature-alt__inner {
    display: flex;
    align-items: center;
    gap: 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

.feature-alt__text {
    flex: 1;
    min-width: 0;
}

.feature-alt__title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.feature-alt__body {
    font-size: 1rem;
    color: #475569;
    line-height: 1.7;
    margin-bottom: 1.25rem;
}

.feature-alt__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-alt__tags li {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0f172a;
    padding: 0.35rem 0.75rem;
    border: 1px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.feature-alt__icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.feature-alt__icon svg {
    max-width: 100%;
    height: auto;
}

/* SVG illustration layer stacking (multi-layer icons) */
.service-icon__layers {
    display: inline-block;
    position: relative;
    width: 100%;
    max-width: 15rem;
    height: auto;
}

.service-icon__layers svg {
    width: 100%;
    height: auto;
}

/* Layer stacking: first SVG is static, subsequent are absolute */
.service-icon__layers svg:not(:first-child) {
    position: absolute;
    inset: 0;
}

/* Initial hidden state — layers stagger in on reveal */
.service-icon__layers svg {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Stagger delay per layer */
.service-icon__layers svg:nth-child(1) { transition-delay: 0s; }
.service-icon__layers svg:nth-child(2) { transition-delay: 0.12s; }
.service-icon__layers svg:nth-child(3) { transition-delay: 0.24s; }
.service-icon__layers svg:nth-child(4) { transition-delay: 0.36s; }
.service-icon__layers svg:nth-child(5) { transition-delay: 0.48s; }
.service-icon__layers svg:nth-child(6) { transition-delay: 0.6s; }
.service-icon__layers svg:nth-child(7) { transition-delay: 0.72s; }

/* Active state — triggered by IntersectionObserver adding .is-visible */
.service-icon.is-visible .service-icon__layers svg {
    opacity: 1;
    transform: none;
}

@media (max-width: 767px) {
    .feature-alt__inner {
        flex-direction: column;
        gap: 2rem;
    }

    .feature-alt__text,
    .feature-alt__icon {
        order: unset !important;
    }

    .feature-alt__icon {
        max-width: 280px;
        margin: 0 auto;
    }

    .feature-alt {
        padding: 3rem 1.5rem;
    }
}
