
/* =========================
   Design system (calm palette)
   ========================= */
:root{
    /* Graphite + Growth (professional, warm) */
    --bg: #E9EFE9;          /* no “white page” feel */
    --surface: #F6F8F6;     /* soft card surface (not pure white) */

    --text: #2C2F2E;        /* graphite */
    --muted: #5F6B63;
    --border: #DDE3DD;

    --brand: #5C7A60;       /* growth green */
    --brand-2: #4A654F;     /* hover/deeper */
    --focus: #5C7A60;

    /* Service palette (distinct, muted, same temperature) */
    --sage: #5B7F6A;        /* muted green */
    --muted-blue: #9A6F75;  /* repurposed to dusty rose */
    --sand: #8A8073;        /* warm greige */
    --lavender: #7C748F;    /* muted plum */
    --terracotta: #4F7A73;  /* muted teal */
    --slate: #2F3E34;       /* deep graphite-green */
}
::selection{ background: rgba(92,122,96,0.25); }

/* Global responsive safety */
*{ box-sizing: border-box; }
html, body{ max-width: 100%; overflow-x: hidden; }
img, svg, video{ max-width: 100%; height: auto; }


body{
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    margin: 0; /* prevent default margins causing tiny overflows/scrollbars */
}

html, body{
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale; height: 100%; }

/* Links (content) */
a{
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
a:hover{ color: var(--brand-2); text-decoration: none; opacity: 0.92; }
a:focus-visible{
    outline: 3px solid rgba(92,122,96,0.25);
    outline-offset: 2px;
    border-radius: 8px;
}

/* Layout: keep footer at the bottom without increasing page height */
body{
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale; display: flex; flex-direction: column; min-height: 100vh; }
.main-content{ flex: 1; }

/* Accessibility focus */
:focus-visible{
    outline: 3px solid rgba(92,122,96,0.35);
    outline-offset: 3px;
}

/* Header */
.header{
    background: var(--brand);
    color: white;
    padding: 0.9rem 0;
}

.header-inner{
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-title{
    font-weight: 700;
    letter-spacing: 0.2px;
    font-size: 1.05rem;
}

.brand-subtitle{
    font-size: 0.9rem;
    opacity: 0.9;
}

.nav{
    display: flex;
    gap: 0.9rem;
    align-items: center;
    flex-wrap: wrap;
}
.nav a{
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    transition: background 0.2s ease, opacity 0.2s ease;
}
.nav a:hover{
    background: rgba(255,255,255,0.12);
}
.nav .nav-cta{
    background: rgba(255,255,255,0.18);
}
.nav .nav-cta:hover{
    background: rgba(255,255,255,0.26);
}

/* Hero */
.hero{
    background:
        radial-gradient(circle at 20% 30%, rgba(92,122,96,0.10), transparent 52%),
        linear-gradient(135deg, var(--surface) 0%, #E5ECE6 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3.5rem 3rem;
    margin-top: 1.5rem;
    box-shadow: 0 25px 60px rgba(44,47,46,0.08);
}
.hero h1{
    text-align: left;
    margin-bottom: 0.75rem;
    font-size: 2.4rem;
    max-width: 720px;
    line-height: 1.25;
    color: var(--text);
}
.hero-lead{
    font-size: 1.12rem;
    color: var(--muted);
    max-width: 70ch;
}
.hero-cta{
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.hero-badges{
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.badge{
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(92,122,96,0.10);
    color: var(--brand);
    border: 1px solid rgba(92,122,96,0.14);
    font-weight: 700;
    font-size: 0.9rem;
}


/* Spacing rhythm (more “air”, premium feel) */
.story, .services, .cta, .contact-section{
    margin-top: 4rem;
}

/* Section helpers */
.section-lead{
    color: var(--muted);
    max-width: 85ch;
    margin: 0.35rem 0 1.25rem 0;
    font-size: 1.05rem;
}
.story{
    margin-top: 2.5rem;
}

/* Subtle section accent (keeps professional + adds character) */
.story h2::after, .services h2::after, .cta h2::after{
    content: "";
    display: block;
    width: 48px;
    height: 3px;
    background: var(--brand);
    margin-top: 0.6rem;
    border-radius: 2px;
    opacity: 0.7;
}

.story h2, .services h2, .cta h2{
    text-align: left;
    color: var(--text);
    margin-bottom: 0.35rem;
    font-size: 1.75rem;
}
.story-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.story-card{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.story-card h3{
    margin-bottom: 0.35rem;
    color: var(--text);
    font-size: 1.08rem;
}
.story-card p{
    color: var(--muted);
}

/* CTA */
.cta{
    margin-top: 3rem;
}
.cta-inner{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.cta-inner p{
    color: var(--muted);
    margin: 0.5rem 0 1.25rem 0;
    max-width: 85ch;
}

/* Buttons */
.btn-primary{
    background: #2C2F2E;
    color: #ffffff;
    border: none;
    border-bottom: 3px solid var(--brand);
    padding: 0.9rem 1.25rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 800;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;

}
.btn-primary:hover{
    background: #1F2221;
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.12);
}
.btn-secondary{
    background: rgba(92,122,96,0.10);
    color: var(--brand);
    border: 1px solid rgba(92,122,96,0.22);
    padding: 0.9rem 1.25rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 800;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.btn-secondary:hover{
    background: rgba(92,122,96,0.16);
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.08);
}
.btn-secondary:hover{
    background: rgba(92,122,96,0.16);
    transform: translateY(-1px);
}
.btn-link{
    background: none;
    border: none;
    color: var(--brand);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    font-weight: 750;
    font-size: 1.05rem;
    font-family: inherit;
    padding: 0.4rem 0.2rem;
}
.btn-link:hover{ color: var(--brand-2); }
.btn-link:focus-visible{
    outline: 3px solid rgba(92,122,96,0.25);
    outline-offset: 3px;
    border-radius: 10px;
}

/* Pills */
.pill{
    display: inline-flex;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.22);
    font-size: 0.9rem;
    font-weight: 800;
    color: white;
}

/* Service color classes */
/* Each service gets its own muted palette (same warmth/temperature)
   and can be reused in the detail view via CSS variables. */
.service-sage{
    --svc-a: #5B7F6A;
    --svc-b: #3F5E4D;
    --svc-tint: rgba(91,127,106,0.12);
    --svc-shadow: rgba(63,94,77,0.18);
    background: linear-gradient(135deg, var(--svc-a), var(--svc-b));
}
.service-muted-blue{
    --svc-a: #9A6F75;       /* dusty rose */
    --svc-b: #7B575D;
    --svc-tint: rgba(154,111,117,0.12);
    --svc-shadow: rgba(123,87,93,0.18);
    background: linear-gradient(135deg, var(--svc-a), var(--svc-b));
}
.service-sand{
    --svc-a: #8A8073;       /* warm greige */
    --svc-b: #6C6359;
    --svc-tint: rgba(138,128,115,0.12);
    --svc-shadow: rgba(108,99,89,0.18);
    background: linear-gradient(135deg, var(--svc-a), var(--svc-b));
}
.service-lavender{
    --svc-a: #7C748F;       /* muted plum */
    --svc-b: #5F586F;
    --svc-tint: rgba(124,116,143,0.12);
    --svc-shadow: rgba(95,88,111,0.18);
    background: linear-gradient(135deg, var(--svc-a), var(--svc-b));
}
.service-terracotta{
    --svc-a: #4F7A73;       /* muted teal */
    --svc-b: #3B5F59;
    --svc-tint: rgba(79,122,115,0.12);
    --svc-shadow: rgba(59,95,89,0.18);
    background: linear-gradient(135deg, var(--svc-a), var(--svc-b));
}
.service-slate{
    --svc-a: #2F3E34;       /* deep graphite-green */
    --svc-b: #4C5F52;
    --svc-tint: rgba(47,62,52,0.10);
    --svc-shadow: rgba(47,62,52,0.22);
    background: linear-gradient(135deg, var(--svc-a), var(--svc-b));
}

/* Detail view gets the service "atmosphere" (tint + depth) */
.detail-view.service-sage,
.detail-view.service-muted-blue,
.detail-view.service-sand,
.detail-view.service-lavender,
.detail-view.service-terracotta,
.detail-view.service-slate{
    background:
        radial-gradient(circle at 18% 10%, rgba(255,255,255,0.55), transparent 52%),
        linear-gradient(135deg, var(--svc-tint), rgba(255,255,255,0.12));
    border: 1px solid rgba(44,47,46,0.10);
    box-shadow: 0 24px 60px rgba(44,47,46,0.10);
}


/* Privalomų laukų stiliai */
.form-group label[for]:after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

.form-group label[for="phone"]:after {
    content: ""; /* Telefono laukas nėra privalomas */
}

/* Paaiškinimas apie privalomus laukus */
.form-required-note {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
    text-align: center;
    font-style: italic;
}

/* Žinučių stiliai */
.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    max-width: 400px;
}

.message {
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
    position: relative;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.message-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 1rem;
    color: inherit;
    opacity: 0.7;
}

.message-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive žinutės */
@media (max-width: 768px) {
    .message-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .message {
        padding: 0.8rem 1rem;
    }
}

/* =========================
   Responsive layout fixes
   =========================
   Main issue: container padding + grid min width caused overflow on phones.
   These rules keep the same design but adapt spacing and type.
*/

@media (max-width: 980px){
    .hero{ padding: 2.5rem 2rem; }
    .hero h1{ font-size: 2.05rem; }
}

@media (max-width: 720px){
    .header-inner{
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .nav{ gap: 0.5rem; }

    .container{
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
}

    .hero{
        padding: 1.75rem 1.25rem;
        border-radius: 18px;
    }
    .hero h1{ font-size: 1.75rem; line-height: 1.2; }
    .hero-lead{ font-size: 1.0rem; }

    .story, .services, .cta, .contact-section{ margin-top: 3rem; }
}

@media (max-width: 560px){
    /* allow 1-column or 2-column depending on space without forcing overflow */
    .grid{
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 420px){
    .container{ padding: 1rem; }

    /* Prevent phone overflow: smaller min card width + smaller gaps */
    .grid{
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .square{ min-height: 200px; padding: 1.5rem; }
    .square h3{ font-size: 1.35rem; }

    .btn-primary,
    .btn-secondary{
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}


@media (max-width: 720px){
    .page-title{ font-size: 1.85rem; margin-top: 1.5rem; }
    .page-subtitle{ font-size: 1.15rem; }
    .detail-view{
        max-height: none;
        overflow: visible;
        border-radius: 16px;
    }
}
@media (max-width: 420px){
    .page-title{ font-size: 1.6rem; }
}

/* Dialogo stiliai */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative; /* Reikalinga uždarimo mygtukui */
}

/* Uždarimo mygtukas */
.dialog-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.dialog-close:hover {
    background: #f8f9fa;
    color: #e74c3c;
}

.dialog-content h2 {
    color: var(--text);
    margin-bottom: 1.5rem;
    text-align: center;
    padding-right: 2rem; /* Vieta uždarimo mygtukui */
}

/* Baziniai stiliai */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

h1{
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    font-size: 2.4rem;
}

/* Grid sistema kvadratams */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.2rem;
    margin-top: 2rem;
}

/* Kvadratų stiliai - SKIRTINGOS SPALVOS */
.square {
    padding: 2rem;
    border-radius: 14px;
    color: white;
    text-align: center;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 10px 25px rgba(0,0,0,0.10);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.square::before{
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(900px 300px at 20% 0%, rgba(255,255,255,0.18), rgba(255,255,255,0) 55%),
        linear-gradient(180deg, rgba(0,0,0,0.16), rgba(0,0,0,0.10));
    pointer-events: none;
}
.square > *{
    position: relative;
    z-index: 1;
}
.square h3,
.square p,
.square .square-action{
    text-shadow: 0 1px 2px rgba(0,0,0,0.28);
}


.square:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 35px rgba(0,0,0,0.16);
}

.square h3 {
    margin-bottom: 0.6rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.square p {
    margin-bottom: 1rem;
    opacity: 0.95;
    line-height: 1.5;
}

/* Susisiekti mygtukas */
.contact-section {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.btn-contact{ all: unset; }
.btn-contact{ display:inline-block; }
.btn-contact{ }

.btn-contact:hover {
    background: var(--brand-2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Dialogo stiliai */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-content h2 {
    color: var(--text);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Formos stiliai */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 700;
}

.form-group input,
.form-group textarea {
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus{
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(92,122,96,0.18);
    background: #fff;
}
.form-group input:focus-visible,
.form-group textarea:focus-visible{
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(92,122,96,0.24);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.btn-cancel{
    background: rgba(92,122,96,0.10);
    color: var(--brand);
    border: 1px solid rgba(92,122,96,0.20);
    padding: 0.85rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.btn-cancel:hover{
    background: rgba(92,122,96,0.16);
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.08);
}

.btn-cancel:hover{ background: rgba(92,122,96,0.14); transform: translateY(-1px); }

.btn-submit{ background: var(--brand); color: white; border: none; padding: 0.85rem 1.2rem; border-radius: 10px; cursor: pointer; font-weight: 800; transition: background 0.2s ease, transform 0.15s ease; }

.btn-submit:hover{ background: var(--brand-2); transform: translateY(-1px); }

/* Detalaus vaizdo stiliai (individuali paslaugos spalva per foną + akcentus)
   Nekeičiam turinio/struktūros – tik vizualus „hero“ blokas ir atmosfera. */
.detail-view {
    max-width: 760px;
    margin: 0 auto;
    border-radius: 18px;
    border: 1px solid rgba(44,47,46,0.10);
    box-shadow: 0 24px 60px rgba(44,47,46,0.10);
    overflow: auto;
    max-height: calc(100vh - 220px);
    /* service-aware atmosphere */
    background:
        radial-gradient(circle at 18% 8%, rgba(255,255,255,0.55), transparent 52%),
        linear-gradient(180deg, var(--svc-tint, rgba(92,122,96,0.12)) 0%, rgba(255,255,255,0.00) 42%),
        var(--surface);
    padding: 0; /* vidinius paddingus valdo header/body blokai */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.detail-view::-webkit-scrollbar{ width: 0; height: 0; }

/* HERO (viršus) – tos paslaugos spalva */
.detail-header{
    position: relative;
    padding: clamp(1.4rem, 2.4vw, 2.2rem);
    background: linear-gradient(135deg, var(--svc-a, #5C7A60), var(--svc-b, #3F5E4D));
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.16);
    overflow: hidden;
}
.detail-header::before{
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 22% 18%, rgba(255,255,255,0.18), transparent 56%);
    pointer-events: none;
}
.detail-title{ position: relative; }
.detail-view h2 {
    color: #fff;
    margin: 0;
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    line-height: 1.2;
    text-align: left;
    text-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.full-text {
    padding: clamp(1.25rem, 2.2vw, 2rem);
    line-height: 1.85;
    color: rgba(44,47,46,0.92);
    margin: 0;
    font-size: 1.1rem;
}


/* Reading comfort rhythm */
.full-text p{
    margin-bottom: 1.2rem;
    text-indent: 1.25rem;
}
.full-text ul{
    padding-left: 1.2rem;
    margin-bottom: 1.2rem;
}
.full-text li{
    margin-bottom: 0.6rem;
}
.btn-back {
    background: var(--brand);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 800;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: block;
    margin: 0 auto;
}

/* Detail footer/bottom spacing + service accents */
.detail-footer{
    padding: 0  clamp(1.25rem, 2.2vw, 2rem)  0;
}
.detail-bottom{
    padding: 0 clamp(1.25rem, 2.2vw, 2rem) clamp(1.25rem, 2.2vw, 2rem);
}
.detail-line{
    color: var(--text);
    font-weight: 800;
    opacity: 0.95;
}
.detail-view .btn-link{
    color: var(--svc-a, var(--brand));
    font-weight: 800;
    text-underline-offset: 4px;
}
.detail-view .btn-link:hover{
    color: var(--svc-b, var(--brand-2));
    opacity: 0.95;
}

.btn-back:hover {
    background: var(--brand-2);
    color: white;
}

/* Header ir Footer */
.header {
    background: var(--brand);
    color: white;
    padding: 1rem 0;
    text-align: center;
}

.footer {
    background: var(--brand);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .square {
        min-height: 150px;
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .detail-view {
        padding: 0;
        max-height: none;
        overflow: visible;
    }
    
    .dialog-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

/* Legacy button compatibility */
.btn-contact{ }

/* Service cards improvements */
.square{
    border-radius: 18px;
    min-height: 220px;
    align-items: flex-start;
    text-align: left;
    padding: 1.6rem;
}
.square:hover{
    filter: none;
    transform: translateY(-4px);
}
.square .square-top{
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.square .square-meta{
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.square .square-action{
    margin-top: auto;
    font-weight: 800;
    opacity: 0.95;
    text-decoration: underline;
}
.square p{
    opacity: 0.95;
}
.services{
    margin-top: 2.75rem;
}

/* Detail view */
.detail-view{
    border-radius: 18px;
}
.detail-header{
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.detail-actions{
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.detail-meta{
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.45rem;
}
.detail-meta .pill{
    background: rgba(92,122,96,0.10);
    color: var(--brand);
    border: 1px solid rgba(92,122,96,0.18);
}
.full-text h3{
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.full-text ul{
    margin: 0.75rem 0 0.75rem 1.2rem;
}
.detail-bottom{
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}

/* Form select styling */
select{
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
}
.form-intro{
    text-align: center;
    color: var(--muted);
    margin: -0.5rem 0 1rem 0;
}
.form-hint{
    margin-top: 0.4rem;
    font-size: 0.95rem;
    color: var(--muted);
}

/* Footer */
.footer{
    background: var(--brand);
}
.footer-inner{
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer a{
    color: rgba(255,255,255,0.92);
}

.footer-links{
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.social-link{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    transition: transform 0.15s ease, background 0.2s ease;
}

.social-link:hover{
    background: rgba(255,255,255,0.14);
    transform: translateY(-1px);
}

.social-link svg{
    width: 18px;
    height: 18px;
    fill: rgba(255,255,255,0.95);
}


/* Links that look like buttons */
a.btn-primary, a.btn-secondary{
    display: inline-block;
    text-decoration: none;
}


/* Home page headings */
.page-title{
    text-align: center;
    margin: 2rem 0 0.75rem 0;
    font-size: 2.35rem;
    color: var(--text);
}
.page-subtitle{
    text-align: center;
    margin: 0 0 2rem 0;
    font-size: 1.6rem;
    color: var(--text);
}
.contact-section{
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Services content rendered on page */
.services-content{
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.service-section{
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.6rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.service-section h3{
    margin-bottom: 0.6rem;
    color: var(--text);
    font-size: 1.25rem;
}
.service-section .service-body{
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--muted);
    line-height: 1.8;
    font-size: 1.05rem;
}
.service-section .service-body ul{
    margin: 0.75rem 0 0.75rem 1.2rem;
}
.service-section .service-actions{
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Detail footer line */
.detail-footer{
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}
.detail-line{
    color: var(--text);
    font-weight: 700;
    opacity: 0.95;
}



/* =========================
   Home: no page scroll (fits viewport)
   Detail: internal scroll cue
   ========================= */
html, body { overflow-x: hidden; }

body.page-home {
    height: 100dvh;
    overflow: hidden; /* no page scrollbars */
}

body.page-home .container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Home layout: keep everything inside the viewport */
body.page-home .page-title { margin-top: 0.6rem; }
body.page-home .page-subtitle { margin-top: 0.4rem; margin-bottom: 1rem; }

body.page-home .grid {
    flex: 1;
    min-height: 0;
    align-content: start;
}

/* Services grid: 3 cols desktop, 2 cols tablet, 2 cols small phones to avoid scroll */
@media (max-width: 980px) {
    body.page-home .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    body.page-home .container { padding: 1rem; }
    body.page-home .page-title { font-size: 1.5rem; line-height: 1.25; }
    body.page-home .page-subtitle { font-size: 1.05rem; margin-bottom: 0.8rem; }
    body.page-home .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
    body.page-home .square { min-height: 118px; padding: 0.9rem; border-radius: 16px; }
    body.page-home .square h3 { font-size: 1rem; margin-bottom: 0.35rem; }
    body.page-home .square p { font-size: 0.92rem; line-height: 1.35; }
    body.page-home .contact-section { padding: 0.8rem 0 0.4rem; }
    body.page-home .btn-primary { width: 100%; }
}

/* If the user opens a service detail, keep the page locked but allow the text area to scroll */
body.page-home.is-detail-open .detail-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.page-home.is-detail-open .detail-header,
body.page-home.is-detail-open .detail-footer,
body.page-home.is-detail-open .detail-bottom {
    flex: 0 0 auto;
}

body.page-home.is-detail-open .full-text {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 0.6rem; /* space for scrollbar */
    scroll-behavior: smooth;
}

/* Subtle “scroll down” cue */
body.page-home.is-detail-open .full-text::after {
    content: "";
    position: sticky;
    display: block;
    bottom: 0;
    height: 36px;
    margin-top: -36px;
    background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.06));
    pointer-events: none;
}



/* =========================
   FINAL: layout rules agreed in chat
   - Home: no scroll, full squares visible, footer visible
   - Detail: natural page scroll (A), no inner scroll box
   - No horizontal scroll anywhere
   ========================= */
html, body { overflow-x: hidden; }

/* Footer baseline (ensure spacing everywhere) */
.footer{
  color: #fff;
  padding: 1.1rem 0;
  width: 100%;
  margin-top: auto;
}

/* HOME: lock the page to the viewport ONLY when not in detail view */
body.page-home:not(.is-detail-open){
  height: 100dvh;
  overflow: hidden;
}
body.page-home:not(.is-detail-open) .main-content{
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.page-home:not(.is-detail-open) .container{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(0.9rem, 2vw, 2rem);
}
body.page-home:not(.is-detail-open) .page-title{
  margin: 0.35rem 0 0.25rem 0;
  font-size: clamp(1.35rem, 2.6vw, 2.4rem);
  line-height: 1.2;
}
body.page-home:not(.is-detail-open) .page-subtitle{
  margin: 0.15rem 0 0.6rem 0;
  font-size: clamp(1.0rem, 1.6vw, 1.35rem);
}

/* Grid must fit into remaining space */
body.page-home:not(.is-detail-open) .grid{
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(0.7rem, 1.2vw, 2.0rem);
  align-content: stretch;
}

/* Squares must always be fully visible (no cropping) */
body.page-home:not(.is-detail-open) .square{
  min-height: 0;
  height: auto;
  padding: clamp(0.8rem, 1.5vw, 2rem);
  border-radius: 16px;
}
body.page-home:not(.is-detail-open) .square h3{
  font-size: clamp(0.95rem, 1.4vw, 1.45rem);
  margin-bottom: 0.35rem;
}
body.page-home:not(.is-detail-open) .square p{
  font-size: clamp(0.82rem, 1.05vw, 1.0rem);
  line-height: 1.35;
  margin: 0.35rem 0 0.65rem 0;
}
body.page-home:not(.is-detail-open) .square-action{
  font-size: 0.92rem;
  opacity: 0.9;
}

/* Keep the CTA button compact so everything fits */
body.page-home:not(.is-detail-open) .contact-section{
  margin-top: 0;
  padding: 0.35rem 0 0.1rem;
}
body.page-home:not(.is-detail-open) .btn-primary{
  padding: 0.85rem 1.2rem;
}

/* Tablet / phone: 2 columns x 3 rows */
@media (max-width: 980px){
  body.page-home:not(.is-detail-open) .grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }
}

/* Very small phones / short screens: reduce gaps a bit more */
@media (max-width: 520px){
  body.page-home:not(.is-detail-open) .grid{
    gap: 0.65rem;
    margin-top: 0.6rem;
    margin-bottom: 0.6rem;
  }
  body.page-home:not(.is-detail-open) .square{
    padding: 0.75rem;
  }
  body.page-home:not(.is-detail-open) .btn-primary{
    width: 100%;
  }
}
@media (max-height: 720px){
  body.page-home:not(.is-detail-open) .grid{
    gap: 0.6rem;
  }
  body.page-home:not(.is-detail-open) .square p{
    margin: 0.25rem 0 0.5rem 0;
  }
}

/* DETAIL (service opened): natural page scroll (A) */
body.page-home.is-detail-open{
  height: auto;
  min-height: 100dvh;
  overflow-y: auto;
}
body.page-home.is-detail-open .main-content{
  overflow: visible;
}
body.page-home.is-detail-open .container{
  height: auto;
  display: block;
}
body.page-home.is-detail-open .grid{
  display: block;
}

/* Disable inner-scroll box behavior from earlier experiments */
body.page-home.is-detail-open .detail-view{
  height: auto;
  min-height: 0;
  display: block;
}
body.page-home.is-detail-open .full-text{
  overflow: visible;
  padding-right: 0;
}
body.page-home.is-detail-open .full-text::after{
  content: none;
}

/* Detail ending: calm line + simple return link (no “block” feeling) */
.detail-footer{
  margin-top: 1.0rem;
  padding-top: 0;
  border-top: none;
  text-align: left;
}
.detail-line{
  font-weight: 600;
  opacity: 0.82;
  font-size: 0.98rem;
}
.detail-bottom{
  margin-top: 0.35rem;
  padding-top: 0;
  text-align: left;
}
.btn-link{
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
  cursor: pointer;
  font-size: 0.98rem;
}
.btn-link:hover{ opacity: 1; }

/* Safety: prevent any accidental horizontal scroll */
.container, .grid, .detail-view { max-width: 100%; }

/* === FINAL POLISH === */

/* 1. Prevent double scroll: allow only page scroll */
html, body {
  overflow-x: hidden;
}

/* Remove inner scroll containers */
.detail-view, .detail-content, .detail-inner {
  overflow: visible !important;
  max-height: none !important;
}

/* 2. Reading width for inner pages */
.detail-view .content,
.detail-view .text,
.detail-view article {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* 3. Calm ending line */
.detail-meta {
  margin-top: 2.5rem;
  font-size: 0.95rem;
  opacity: 0.85;
}

/* Back link harmony */
.detail-back {
  display: inline-block;
  margin-top: 1rem;
  text-decoration: none;
}

/* 4. Home cards more square */
.service-grid {
  align-items: stretch;
}
.service-card {
  aspect-ratio: 1 / 1;
}

/* 5. Footer calmer */
footer {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}
footer .social-icons svg {
  width: 18px;
  height: 18px;
}

/* === FINAL FIX: center duration line & tighten spacing === */
.detail-line {
  text-align: center !important;
  white-space: nowrap;
  margin-top: 0.5rem !important;
}

.detail-content p:last-of-type {
  margin-bottom: 0.5rem !important;
}

/* === FINAL TEXT POLISH: no paragraph indent, tighter spacing === */
.detail-content p,
.detail-content p:first-of-type {
  text-indent: 0 !important;
}

.detail-content p {
  margin-bottom: 0.8rem;
}

/* === ABSOLUTE FINAL TEXT NORMALIZATION === */
/* remove any paragraph indent everywhere */
p {
  text-indent: 0 !important;
}

/* normalize paragraph spacing */
p {
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.hp-wrap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
