/* ═══════════════════════════════════════════════════════════════
   PERFERRO — MAIN STYLESHEET
   Theme: CSS Variables + Light/Dark Mode
═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --color-bg:          #ffffff;
    --color-bg-alt:      #f5f6f7;
    --color-surface:     #ffffff;
    --color-border:      #e0e0e0;
    --color-text:        #1a1a2e;
    --color-text-muted:  #6b7280;
    --color-accent:      #cc2b2b;
    --color-accent-dark: #a52020;
    --color-heading:     #0f172a;
    --color-link:        #cc2b2b;
    --color-nav-bg:      #1a2f4e;
    --color-nav-text:    #e2e8f0;
    --color-nav-active:  #cc2b2b;
    --shadow-sm:         0 1px 3px rgba(0,0,0,.08);
    --shadow-md:         0 4px 12px rgba(0,0,0,.1);
    --radius:            6px;
    --max-width:         1160px;
    --font-sans:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:         'SFMono-Regular', Consolas, monospace;
    --transition:        0.2s ease;
}

[data-theme="dark"] {
    --color-bg:          #0f172a;
    --color-bg-alt:      #1e293b;
    --color-surface:     #1e293b;
    --color-border:      #334155;
    --color-text:        #e2e8f0;
    --color-text-muted:  #94a3b8;
    --color-heading:     #f1f5f9;
    --color-nav-bg:      #070e1c;
    --shadow-sm:         0 1px 3px rgba(0,0,0,.3);
    --shadow-md:         0 4px 12px rgba(0,0,0,.4);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.65;
    transition: background var(--transition), color var(--transition);
}
img { max-width: 100%; display: block; }
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { color: var(--color-heading); margin-top: 0; line-height: 1.25; }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
    background: var(--color-nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 1.5rem;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}
.brand-icon {
    width: 34px; height: 34px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}
.brand-name { letter-spacing: .03em; }
.brand-logo { height: 36px; width: auto; display: block; }
.brand-svg { height: 32px; width: auto; display: block; }
.main-nav { display: flex; gap: 0.25rem; }
.nav-link {
    color: var(--color-nav-text);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.92rem;
    transition: background var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.nav-link.active { color: #fff; background: var(--color-accent); }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,.25);
    color: var(--color-nav-text);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color var(--transition);
}
.theme-toggle:hover { border-color: rgba(255,255,255,.5); }
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem;
}
.mobile-nav {
    display: none;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.1);
    flex-direction: column;
    gap: 0.25rem;
}
.mobile-nav.open { display: flex; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
    background: var(--color-nav-bg);
    color: var(--color-nav-text);
    padding: 2rem 0;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    opacity: 0.8;
}
.footer-admin a { color: var(--color-nav-text); opacity: 0.5; }
.footer-admin a:hover { opacity: 1; }

/* ── Sections ───────────────────────────────────────────────── */
.section { padding: 4rem 0; }
.section-alt { background: var(--color-bg-alt); }
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}
.section-header h2 { margin: 0; }
.section-header p { color: var(--color-text-muted); margin: 0; }
.section-link { color: var(--color-accent); font-weight: 500; font-size: 0.95rem; }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
    background: var(--color-nav-bg);
    color: #fff;
    padding: 6rem 0;
}
.hero-label {
    display: inline-block;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    margin-bottom: 1.25rem;
}
.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 1.25rem;
    line-height: 1.1;
}
.hero-sub {
    font-size: 1.15rem;
    color: rgba(255,255,255,.75);
    max-width: 540px;
    margin: 0 0 2rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Page Hero ─────────────────────────────────────────────── */
.page-hero {
    background: var(--color-nav-bg);
    color: #fff;
    padding: 3.5rem 0;
}
.page-hero h1 { color: #fff; margin: 0 0 0.5rem; font-size: 2.25rem; }
.page-sub { color: rgba(255,255,255,.7); margin: 0; font-size: 1.05rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.btn-primary:hover { background: var(--color-accent-dark); border-color: var(--color-accent-dark); text-decoration: none; color: #fff; }
.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-outline:hover { border-color: #fff; text-decoration: none; color: #fff; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

/* ── Cards ──────────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { text-decoration: none; }
.card-icon { font-size: 1.75rem; margin-bottom: 1rem; }
.card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.card p { color: var(--color-text-muted); margin: 0; font-size: 0.93rem; }
.card-tag {
    display: inline-block;
    background: rgba(204,43,43,.1);
    color: var(--color-accent);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
}
.card-arrow { float: right; color: var(--color-accent); font-size: 1.1rem; margin-top: 0.5rem; }

/* ── CTA Section ────────────────────────────────────────────── */
.section-cta { background: var(--color-bg-alt); }
.cta-box {
    text-align: center;
    padding: 3rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    max-width: 600px;
    margin: 0 auto;
}
.cta-box h2 { margin: 0 0 0.75rem; }
.cta-box p { color: var(--color-text-muted); margin: 0 0 1.5rem; }
.cta-box .btn { margin: 0 0.25rem; }
.cta-box .btn-outline { color: var(--color-text); border-color: var(--color-border); }
.cta-box .btn-outline:hover { border-color: var(--color-text); color: var(--color-text); }

/* ── Page Content ───────────────────────────────────────────── */
.page-content h2 { margin-top: 2rem; }
.page-content h3 { margin-top: 1.5rem; }
.page-content ul, .page-content ol { padding-left: 1.5rem; }
.case-body h3 { margin-top: 2rem; color: var(--color-accent); }
.case-body ul { padding-left: 1.5rem; }
.case-header-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.case-client { color: rgba(255,255,255,.6); font-size: 0.9rem; }

/* ── Case List ──────────────────────────────────────────────── */
.case-list { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.case-item {
    display: block;
    padding: 1.75rem 2rem;
    background: var(--color-surface);
    text-decoration: none;
    color: inherit;
    transition: background var(--transition);
    border-bottom: 1px solid var(--color-border);
}
.case-item:last-child { border-bottom: none; }
.case-item:hover { background: var(--color-bg-alt); text-decoration: none; }
.case-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.case-title { margin: 0 0 0.5rem; font-size: 1.3rem; }
.case-excerpt { color: var(--color-text-muted); margin: 0 0 0.75rem; }
.case-read { color: var(--color-accent); font-weight: 600; font-size: 0.9rem; }

/* ── Process Steps ──────────────────────────────────────────── */
.process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}
.step { padding: 1.5rem; }
.step-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-accent);
    opacity: 0.3;
    line-height: 1;
    margin-bottom: 0.75rem;
}
.step h3 { margin: 0 0 0.5rem; }
.step p { color: var(--color-text-muted); margin: 0; font-size: 0.93rem; }

/* ── Contact ────────────────────────────────────────────────── */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
}
.contact-details p { color: var(--color-text-muted); }
.contact-details strong { display: block; color: var(--color-text); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    color: var(--color-text);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(204,43,43,.1);
}
.form-check label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.form-hint { color: var(--color-text-muted); font-size: 0.82rem; margin-top: 0.35rem; display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.93rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
[data-theme="dark"] .alert-success { background: #14532d; color: #86efac; border-color: #166534; }
[data-theme="dark"] .alert-error   { background: #450a0a; color: #fca5a5; border-color: #991b1b; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-nav { display: none; }
    .nav-toggle { display: block; }
    .section { padding: 2.5rem 0; }
    .hero { padding: 3.5rem 0; }
    .contact-layout { grid-template-columns: 1fr; gap: 2rem; }
    .form-row { grid-template-columns: 1fr; }
    .section-header { flex-direction: column; gap: 0.5rem; }
    .footer-inner { flex-direction: column; text-align: center; }
    .cta-box { padding: 2rem 1.25rem; }
}
