/* ============================================================
 * SomAgents — Estils principals del tema
 *
 * Estructura:
 *   1. Variables CSS (paleta, tipografia, espais, ombres)
 *   2. Reset i base
 *   3. Tipografia
 *   4. Layout (container, sections, grids)
 *   5. Components: header, footer
 *   6. Components: botons, sector-cards, pillars, demo-block
 *   7. Pàgines especials: hero, page-header, legal-content
 *   8. Utilitats
 *   9. Responsive
 * ============================================================ */

/* =============== 1. VARIABLES =============== */
:root {
    /* Paleta */
    --primary:        #1F3A5F;
    --primary-hover:  #15294a;
    --accent:         #7C5FB5;
    --accent-hover:   #6a4fa3;
    --accent-soft:    #B89DD9;
    --white:          #FFFFFF;
    --offwhite:       #FAFBFC;
    --gray-soft:      #F4F6F9;
    --gray-border:    #D8DDE3;
    --gray-text:      #5A6678;
    --text:           #1F2933;
    --success:        #2A7A4F;
    --warn:           #B54A1D;

    /* Tipografia */
    --font-base: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

    /* Espais */
    --space-xs:  0.5rem;
    --space-sm:  1rem;
    --space-md:  1.5rem;
    --space-lg:  2.5rem;
    --space-xl:  4rem;
    --space-2xl: 6rem;

    /* Radi */
    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-full: 999px;

    /* Ombres */
    --shadow-sm: 0 1px 3px  rgba(31, 58, 95, 0.06);
    --shadow-md: 0 4px 16px rgba(31, 58, 95, 0.08);
    --shadow-lg: 0 12px 40px rgba(31, 58, 95, 0.10);
}

/* =============== 2. RESET + BASE =============== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-base);
    color: var(--text);
    line-height: 1.6;
    font-size: 17px;
    background: var(--white);
    font-feature-settings: "ss01" on, "cv11" on;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =============== 3. TIPOGRAFIA =============== */
h1, h2, h3, h4 {
    font-family: var(--font-base);
    color: var(--primary);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); margin-bottom: var(--space-md); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin-bottom: var(--space-md); }
h3 { font-size: 1.3rem; margin-bottom: var(--space-sm); font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

p { margin-bottom: var(--space-sm); color: var(--text); }
.lead { font-size: 1.2rem; color: var(--gray-text); line-height: 1.5; }
.muted { color: var(--gray-text); }
.accent-text { color: var(--accent); font-weight: 600; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color .2s;
}
a:hover { color: var(--accent); }

ul, ol { padding-left: 1.3rem; margin-bottom: var(--space-sm); }
li { margin-bottom: 0.3rem; }

strong { font-weight: 700; color: var(--text); }

/* =============== 4. LAYOUT =============== */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}
.container-narrow { max-width: 820px; }

section { padding: var(--space-2xl) 0; }
.section { padding: var(--space-2xl) 0; }
.section-soft { background: var(--offwhite); }
.section-alt  { background: var(--offwhite); }
.section-tall { padding: var(--space-2xl) 0 calc(var(--space-2xl) * 1.5); }
.section-dark {
    background: var(--primary);
    color: var(--white);
}
.section-dark h1, .section-dark h2, .section-dark h3 { color: var(--white); }
.section-dark p { color: rgba(255,255,255,0.85); }

.text-center { text-align: center; }

/* =============== 5. HEADER + FOOTER =============== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-border);
}
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    gap: var(--space-md);
}
/* Logo (imatge)
   Logos cropats a 800x227 (proporció ~3.5:1 — wordmark horitzontal). */
.site-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.logo-img {
    max-height: 56px;
    max-width: 220px;
    width: auto;
    height: auto;
    display: block;
}
.footer-logo {
    display: inline-block;
    margin-bottom: 0.8rem;
}
.footer-logo .logo-img {
    max-height: 48px;
    max-width: 200px;
}
/* Reduïm padding del header per compensar logo més gran */
.site-header .nav { padding: 0.8rem 0; }

@media (max-width: 700px) {
    .logo-img { max-height: 44px; max-width: 170px; }
    .footer-logo .logo-img { max-height: 40px; max-width: 160px; }
}

.nav-menu-wrapper { display: flex; }
.nav-menu {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
    padding: 0;
    margin: 0;
}
.nav-menu li { margin: 0; }
.nav-menu a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-right {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}
.lang-switcher {
    display: flex;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--gray-text);
}
.lang-switcher a, .lang-switcher span {
    text-decoration: none;
    color: var(--gray-text);
}
.lang-switcher .active,
.lang-switcher a.active {
    color: var(--primary);
    font-weight: 600;
}

/* Footer */
.site-footer {
    background: var(--primary);
    color: rgba(255,255,255,0.85);
    padding: var(--space-xl) 0 var(--space-md);
}
.site-footer h4 {
    color: var(--white);
    margin-bottom: var(--space-sm);
    font-size: 1rem;
}
.site-footer a {
    color: rgba(255,255,255,0.75);
    display: block;
    padding: 0.3rem 0;
    font-size: 0.9rem;
}
.site-footer a:hover { color: var(--accent-soft); }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-tagline {
    color: rgba(255,255,255,0.7);
    margin-top: 0.8rem;
    font-size: 0.95rem;
}
.footer-bottom {
    display: flex;
    justify-content: space-between;
    padding-top: var(--space-md);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.footer-lang { color: rgba(255,255,255,0.6); }
.footer-lang a { display: inline; color: rgba(255,255,255,0.75); }
.footer-lang strong { color: var(--white); font-weight: 600; }

/* =============== 6. COMPONENTS =============== */
/* Botons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1.6rem;
    font-family: var(--font-base);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .25s;
    text-decoration: none;
    gap: 0.5rem;
    line-height: 1.2;
}
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-accent {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
}
.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--white);
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}
.btn-light {
    background: var(--white);
    color: var(--primary);
    border-color: var(--white);
}
.btn-light:hover { background: var(--offwhite); color: var(--primary); }

.btn-sm { padding: 0.6rem 1.2rem; font-size: 0.85rem; }
.btn-lg { padding: 1.1rem 2rem; font-size: 1.05rem; }
.btn-sub {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.85;
    margin-top: 4px;
}
.btn-block {
    display: inline-flex;
    flex-direction: column;
    padding: 1.2rem 2.5rem;
    border-radius: var(--radius-md);
}

/* Sector cards (a la home, bloc "soy...") — 4 columnes x 2 files = 8 sectors */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-md);
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}
.sector-card {
    background: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-sm);
    text-align: center;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    transition: all .25s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.sector-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    color: var(--primary);
}
.sector-card .sector-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}
.sector-card .sector-icon svg {
    width: 100%;
    height: 100%;
    stroke: var(--accent);   /* força lila directament */
    transition: stroke .25s;
}
.sector-card:hover .sector-icon svg {
    stroke: var(--primary);   /* a hover passa a blau marí */
}
.sector-card .sector-label {
    font-size: 0.95rem;
    line-height: 1.2;
}

@media (max-width: 700px) {
    .sector-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Pilars */
.pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
}
.pillar {
    text-align: left;
    padding: var(--space-lg);
}
.pillar-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

/* Demo block (illa fosca) */
.demo-block {
    background: linear-gradient(135deg, #1F3A5F 0%, #2A4A7F 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
    text-align: center;
    color: var(--white);
}
.demo-block::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
    opacity: 0.4;
    border-radius: 50%;
    pointer-events: none;
}
.demo-block h2 {
    color: var(--white);
    margin-bottom: var(--space-sm);
    position: relative;
}
.demo-block .sub {
    color: var(--accent-soft);
    font-size: 1.1rem;
    margin-bottom: var(--space-lg);
    position: relative;
}
.demo-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 0.8rem;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}
.demo-form input,
.demo-form select {
    padding: 0.9rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.95);
    font-family: var(--font-base);
    font-size: 0.95rem;
    color: var(--text);
}
.demo-form input:focus,
.demo-form select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.demo-disclaimer {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: var(--space-md);
    position: relative;
    color: rgba(255,255,255,0.8);
}

/* =============== 7. PÀGINES ESPECIALS =============== */
/* Hero */
.hero {
    padding: var(--space-2xl) 0;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-xl);
    align-items: center;
}
.hero h1 { margin-bottom: var(--space-sm); }
.hero .lead { margin-bottom: var(--space-lg); }
/* Hero image — sense container amb fons (la imatge flota neta) */
.hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-image img,
.hero-image .hero-img {
    width: 100%;
    height: auto;
    max-width: 480px;
    display: block;
    /* Sense border-radius ni ombra: la imatge ja té el seu propi fons clar
       que coincideix amb el fons del hero, així s'integra sense costures. */
}
.hero-image-placeholder {
    color: var(--gray-text);
    font-size: 0.9rem;
    padding: 1rem;
    text-align: center;
}

/* Page header (per a pàgines genèriques: legal, casos, etc.) */
.page-header {
    padding: var(--space-xl) 0 var(--space-lg);
    background: var(--offwhite);
    text-align: center;
}
.page-header h1 { margin-bottom: 0; }
.page-header-image {
    max-width: 220px;
    margin: 0 auto var(--space-md);
}

/* Contingut legal (Política, Aviso legal, etc.) */
.legal-content {
    max-width: 760px;
    margin: 0 auto;
}
.legal-content h2 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    font-size: 1.5rem;
}
.legal-content h3 {
    margin-top: var(--space-md);
    margin-bottom: 0.5rem;
}
.legal-content p { margin-bottom: var(--space-sm); }
.legal-content ul { margin-bottom: var(--space-sm); }
.legal-content em { color: var(--gray-text); font-size: 0.9rem; }

/* =============== 8. UTILITATS =============== */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* =============== 9. RESPONSIVE =============== */
@media (max-width: 900px) {
    .nav-menu { gap: var(--space-md); }
    .nav-menu a { font-size: 0.9rem; }
}

@media (max-width: 800px) {
    .hero-grid { grid-template-columns: 1fr; gap: var(--space-lg); }
    .hero-image { max-width: 380px; margin: 0 auto; }
    section { padding: var(--space-xl) 0; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
    .nav-menu { display: none; }  /* TODO Fase 2: menú hamburger mòbil */
    .demo-form { grid-template-columns: 1fr; }
    .demo-block { padding: var(--space-lg) var(--space-md); }
}

@media (max-width: 500px) {
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
}
