/* ============================================================
   Isoler.ch — Stylesheet
   ============================================================ */

:root {
    --blue: #1e3a5f;
    --blue-light: #2a4f82;
    --blue-pale: #eef4fb;
    --orange: #f97316;
    --orange-light: #fff7ed;
    --gray-50: #f8fafc;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --white: #ffffff;
    --radius: 12px;
    --shadow: 0 4px 16px rgba(30,58,95,.1);
    --shadow-lg: 0 8px 32px rgba(30,58,95,.15);
    font-size: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
}

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

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--orange); }

/* ── Header ── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--blue);
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: .875rem;
    padding-bottom: .875rem;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--white);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
}
.logo:hover { color: var(--white); opacity: .9; }
.logo-icon { font-size: 1.5rem; }
.logo-dot { color: var(--orange); }

.main-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    flex-wrap: wrap;
}

.main-nav a {
    color: rgba(255,255,255,.85);
    padding: .375rem .75rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.main-nav a:hover { background: rgba(255,255,255,.12); color: var(--white); }
.main-nav .nav-cta {
    background: var(--orange);
    color: var(--white);
    padding: .375rem 1rem;
}
.main-nav .nav-cta:hover { background: #ea6b0a; color: var(--white); }
.main-nav .nav-cta-outline {
    border: 1.5px solid rgba(255,255,255,.5);
    color: rgba(255,255,255,.9);
    padding: .375rem 1rem;
}
.main-nav .nav-cta-outline:hover { background: rgba(255,255,255,.12); border-color: var(--white); color: var(--white); }

/* ── Nav dropdown ── */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,.85);
    padding: .375rem .75rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.nav-dropdown-btn:hover { background: rgba(255,255,255,.12); color: var(--white); }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    padding-top: .35rem;
    z-index: 200;
}
.nav-dropdown-menu-inner {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: .5rem 0;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: .55rem 1rem;
    color: var(--gray-800);
    font-size: .9rem;
    font-weight: 500;
    transition: background .1s;
}
.nav-dropdown-menu a:hover { background: var(--blue-pale); color: var(--blue); }

/* ── Mobile nav toggle ── */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: .25rem;
}

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 60%, #1a5276 100%);
    color: var(--white);
    padding: 4rem 0 3.5rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: .75rem;
}
.hero p {
    font-size: 1.1rem;
    opacity: .88;
    max-width: 620px;
    margin: 0 auto 2rem;
}

.search-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}
.search-bar {
    display: flex;
    background: var(--white);
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
}
.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    padding: .875rem 1.25rem;
    font-size: 1rem;
    color: var(--gray-800);
    min-width: 0;
}
.search-bar button {
    background: var(--orange);
    color: var(--white);
    border: none;
    padding: .875rem 1.5rem;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.search-bar button:hover { background: #ea6b0a; }

.ac-results {
    position: absolute;
    top: calc(100% + .5rem);
    left: .5rem;
    right: .5rem;
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.12);
    list-style: none;
    padding: .375rem;
    margin: 0;
    z-index: 50;
    max-height: 360px;
    overflow-y: auto;
    text-align: left;
}
.ac-results li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    padding: .625rem .875rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gray-800);
    font-size: .95rem;
    line-height: 1.3;
}
.ac-results li.active,
.ac-results li:hover { background: #f1f5f9; }
.ac-results li .ac-name {
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ac-results li .ac-name mark {
    background: #fde68a;
    color: inherit;
    padding: 0;
    font-weight: 700;
}
.ac-results li .ac-meta {
    font-size: .8rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.ac-results .ac-empty {
    padding: .75rem .875rem;
    color: #94a3b8;
    font-size: .9rem;
    text-align: center;
    cursor: default;
}

/* ── Section ── */
.section { padding: 3rem 0; }
.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--blue);
    margin-bottom: .5rem;
}
.section-subtitle {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* ── Cards ── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--orange);
    transition: transform .2s, box-shadow .2s;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card-icon { font-size: 2rem; margin-bottom: .75rem; }
.card h3 { font-size: 1.1rem; color: var(--blue); margin-bottom: .5rem; }
.card p  { font-size: .9rem; color: var(--gray-600); margin-bottom: 1rem; }

.card-meta {
    display: flex;
    gap: .75rem;
    font-size: .8rem;
    flex-wrap: wrap;
}
.badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-blue   { background: var(--blue-pale); color: var(--blue); }
.badge-green  { background: #f0fdf4; color: #16a34a; }
.badge-gray   { background: var(--gray-200); color: var(--gray-600); }

.btn {
    display: inline-block;
    padding: .65rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: #ea6b0a; color: var(--white); }
.btn-outline { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
.btn-outline:hover { background: var(--blue); color: var(--white); }

/* ── Subvention encart ── */
.subvention-box {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 2px solid var(--orange);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin: 2rem 0;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}
.subvention-box .sub-icon { font-size: 2.5rem; flex-shrink: 0; }
.subvention-box h3 { color: var(--orange); font-size: 1.1rem; margin-bottom: .4rem; }
.subvention-box .sub-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue);
    line-height: 1;
    margin-bottom: .4rem;
}
.subvention-box p { color: var(--gray-600); font-size: .9rem; }
.subvention-box a { color: var(--orange); font-weight: 600; }

/* ── HDD Badge ── */
.hdd-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: .9rem;
    color: white;
    margin-bottom: 1.5rem;
}

/* ── Service section ── */
.service-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--orange);
}
.service-section h2 {
    font-size: 1.3rem;
    color: var(--blue);
    margin-bottom: 1rem;
}
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.service-stat {
    text-align: center;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 8px;
}
.service-stat .val {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--blue);
}
.service-stat .lbl {
    font-size: .8rem;
    color: var(--gray-600);
}

/* ── Calculateur ── */
.calc-box {
    background: var(--blue-pale);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2rem 0;
}
.calc-box h2 { color: var(--blue); margin-bottom: 1.25rem; }
.calc-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: .35rem;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: .65rem .875rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--white);
    color: var(--gray-800);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--orange);
}

.calc-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}
.calc-result-item {
    background: var(--white);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(30,58,95,.08);
}
.calc-result-item .r-val {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--blue);
}
.calc-result-item .r-lbl {
    font-size: .78rem;
    color: var(--gray-600);
}
.calc-result-item.highlight .r-val { color: var(--orange); }

/* ── Breadcrumb ── */
.breadcrumb {
    padding: .75rem 0;
    font-size: .85rem;
    color: var(--gray-600);
}
.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    align-items: center;
}
.breadcrumb li + li::before { content: '›'; margin-right: .25rem; color: var(--gray-400); }
.breadcrumb a { color: rgba(255,255,255,.75); }
.breadcrumb a:hover { color: #fff; }
.breadcrumb .active { color: rgba(255,255,255,.5); font-weight: 500; }
.breadcrumb li + li::before { color: rgba(255,255,255,.4); }

/* ── Page header ── */
.page-header {
    background: var(--blue);
    color: var(--white);
    padding: 2.5rem 0;
}
.page-header h1 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
.page-header p  { opacity: .85; margin-top: .5rem; font-size: 1.05rem; }

/* ── Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.data-table th {
    background: var(--blue);
    color: var(--white);
    padding: .75rem 1rem;
    text-align: left;
    font-weight: 600;
}
.data-table td {
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--gray-200);
}
.data-table tr:nth-child(even) td { background: var(--gray-50); }
.data-table tr:hover td { background: var(--blue-pale); }

/* ── Footer ── */
.site-footer { background: var(--blue); color: rgba(255,255,255,.8); margin-top: 3rem; }
.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    padding: 3rem 1.25rem 2rem;
}
.footer-logo { font-size: 1.25rem; font-weight: 700; color: var(--white); margin-bottom: .75rem; }
.footer-desc { font-size: .875rem; opacity: .75; line-height: 1.6; }
.footer-col h4 { color: var(--white); font-size: .95rem; margin-bottom: .75rem; font-weight: 600; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: .4rem; }
.footer-col ul a { color: rgba(255,255,255,.7); font-size: .875rem; }
.footer-col ul a:hover { color: var(--orange); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 1.25rem 1.25rem;
    text-align: center;
    font-size: .8rem;
    opacity: .6;
}

/* ── Communes list ── */
.communes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
}
.commune-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: .6rem 1rem;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
    text-decoration: none;
    color: var(--gray-800);
}
.commune-chip:hover {
    border-color: var(--orange);
    box-shadow: 0 2px 8px rgba(249,115,22,.15);
    color: var(--blue);
}
.commune-chip .npa { font-size: .75rem; color: var(--gray-400); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .subvention-box { flex-direction: column; }
    .hero { padding: 2.5rem 0; }
    .intro-grid { grid-template-columns: 1fr !important; }

    .nav-toggle { display: block; }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--blue);
        flex-direction: column;
        padding: .75rem 1.25rem 1rem;
        gap: .25rem;
        box-shadow: 0 4px 12px rgba(0,0,0,.3);
    }
    .header-inner.nav-open .main-nav { display: flex; }
    .main-nav a { padding: .5rem .75rem; font-size: .95rem; }
    .nav-dropdown { width: 100%; }
    .nav-dropdown-btn { width: 100%; text-align: left; padding: .5rem .75rem; font-size: .95rem; }
    .nav-dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        background: rgba(255,255,255,.08);
        border-radius: 6px;
        margin-top: .25rem;
    }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown-menu a { color: rgba(255,255,255,.85); padding: .4rem 1.25rem; font-size: .9rem; }
    .nav-dropdown-menu a:hover { background: rgba(255,255,255,.1); color: var(--white); }
}

@media (max-width: 480px) {
    .footer-inner { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr; }
}

/* ── Utilitaires ── */
.text-orange { color: var(--orange); }
.text-blue   { color: var(--blue); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.fw-bold { font-weight: 700; }
