/* =========================================
   Kreidler Engineering – Site Styles
   Faithful to original design, mobile-ready
   ========================================= */

:root {
    --ke-blue:       #547EB3;
    --ke-blue-dark:  #3d6090;
    --ke-nav:        #707070;
    --ke-nav-hover:  #898989;
    --ke-border:     #cacaca;
    --ke-bg:         #3a3a3a;
    --ke-white:      #ffffff;
    --ke-text:       #000000;
    --ke-cookie:     #b36154;
    --ke-font:       Arial, "Helvetica Neue", Helvetica, Verdana, sans-serif;
}

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

/* ── Body & Background ── */
body {
    background: url("../images/bg.jpg") no-repeat center center fixed;
    background-size: cover;
    background-color: var(--ke-bg);
    color: var(--ke-text);
    font-family: var(--ke-font);
    font-size: 0.9rem;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Fixed Header ── */
.site-header {
    background: var(--ke-white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Logo bar */
.logo-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
}

.site-logo { display: inline-flex; align-items: center; line-height: 0; }
.site-logo img { display: block; height: 34px; width: auto; max-width: 100%; }
.site-logo:hover { opacity: 0.85; }

/* Hamburger toggle (mobile only) */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background: var(--ke-nav);
    border-radius: 2px;
    transition: 0.25s;
}

/* Nav bar */
.nav-bar {
    background: var(--ke-nav);
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
}

.nav-list {
    list-style: none;
    display: flex;
    align-items: stretch;          /* every item shares the full bar height */
    justify-content: center;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
}

.nav-list li { display: flex; flex: 1 1 auto; margin: 0; }   /* margin:0 overrides the global li bottom margin */

.nav-list a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ke-white);
    text-decoration: none;
    padding: 14px 10px;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.nav-list a:hover,
.nav-list a.active {
    background: linear-gradient(to bottom, #EAEAEA 10%, #CACACA 90%);
    color: var(--ke-blue);
    font-weight: bold;
    text-decoration: none;
}

/* Language switch: a compact button, vertically + horizontally centred in the bar
   (not stretched to full height like the menu links). */
.nav-list li.nav-lang { align-items: center; justify-content: center; }
.nav-lang a {
    flex: 0 0 auto;
    gap: 6px;
    color: var(--ke-white);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1;
    padding: 8px 10px;
    transition: opacity 0.15s;
}
.nav-lang a:hover,
.nav-lang a.active {
    background: none;
    color: var(--ke-white);
    opacity: 0.75;
}

/* ── Page content wrapper ── */
.page-wrapper {
    /* offset for fixed header; height set via JS / CSS custom property */
    padding-top: var(--header-height, 115px);
    padding-bottom: 30px;
    min-height: 100vh;
}

/* ── Content box (white card) ── */
.content-box {
    background: var(--ke-white);
    border: 2px solid var(--ke-border);
    border-radius: 10px;
    margin: 20px auto;
    max-width: 860px;
    padding: 30px 36px;
    overflow: hidden;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 { color: var(--ke-blue); }

h1 { font-size: 2rem;   padding-bottom: 0.6em; }
h2 { font-size: 1.5rem; padding: 0.8em 0 0.4em; }
h3 { font-size: 1.2rem; padding: 0.6em 0 0.3em; }

h1.center, h2.center { text-align: center; }

p { padding-bottom: 1em; }
p:last-child { padding-bottom: 0; }

a { color: var(--ke-blue); font-weight: bold; text-decoration: none; }
a:hover { text-decoration: underline; }

ul { padding: 0 0 1em 1.5em; }
li { margin-bottom: 0.3em; }

/* ── Homepage special styles ── */
.home-center {
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    line-height: 2em;
}

.hero-logo {
    display: block;
    width: min(340px, 85%);
    height: auto;
    margin: 18px auto 10px;
}

.slogan {
    color: var(--ke-blue);
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 20px;
}

.blue { color: var(--ke-blue); font-weight: bold; }

/* ── Services gallery grid ── */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.service-card {
    border: 1px solid var(--ke-border);
    border-radius: 6px;
    padding: 20px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.service-card:hover {
    box-shadow: 0 4px 12px rgba(84,126,179,0.15);
    border-color: var(--ke-blue);
}

.service-card i {
    font-size: 2rem;
    color: var(--ke-blue);
    margin-bottom: 10px;
    display: block;
}

.service-card h3 {
    font-size: 1rem;
    padding: 0 0 6px;
}

.service-card p {
    font-size: 0.85rem;
    color: #555;
    padding-bottom: 0;
}

/* ── Contact form ── */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 32px;
    align-items: start;
}

.contact-info p { margin-bottom: 8px; padding-bottom: 0; }
.contact-info i { color: var(--ke-blue); margin-right: 6px; }

.form-label { display: block; font-size: 0.85rem; margin-bottom: 3px; font-weight: bold; }

.form-control {
    border: 1px solid #898989;
    border-radius: 2px;
    padding: 0.4em;
    width: 100%;
    font-family: var(--ke-font);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--ke-blue);
    box-shadow: 0 0 0 2px rgba(84,126,179,0.2);
}

textarea.form-control { height: 140px; resize: vertical; }

.form-row { margin-bottom: 14px; }
.form-row-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.form-check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.form-check input { margin-top: 3px; flex-shrink: 0; }

.btn {
    background: var(--ke-nav);
    border: none;
    border-radius: 2px;
    color: var(--ke-white);
    cursor: pointer;
    font-family: var(--ke-font);
    font-size: 0.9rem;
    font-weight: bold;
    padding: 0.65em 1.5em;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:hover { background: var(--ke-nav-hover); color: var(--ke-white); text-decoration: none; }
.btn-primary { background: var(--ke-blue); }
.btn-primary:hover { background: var(--ke-blue-dark); }
.btn-full { width: 100%; justify-content: center; }

.alert {
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-success { background: #e8f5e9; border: 1px solid #a5d6a7; color: #2e7d32; }
.alert-danger  { background: #ffebee; border: 1px solid #ef9a9a; color: #c62828; }

.field-error { color: red; font-size: 0.8rem; margin-top: 2px; display: block; }

.validation-summary { margin-bottom: 14px; }

/* Honeypot: kept in the DOM for bots but removed from view and the tab order. */
.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.validation-summary ul { padding-left: 1.2em; }
.validation-summary li { color: red; font-size: 0.85rem; }

/* ── Footer inside content box ── */
.site-footer-inner {
    border-top: 1px solid var(--ke-nav);
    margin-top: 24px;
    padding-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8rem;
}

.footer-left { color: #333; width: 100%; }
.footer-left a { color: var(--ke-blue); font-weight: normal; }
.footer-left .sep { color: var(--ke-nav); }

/* Address line spread across the full width — separators get dynamic spacing. */
.footer-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; width: 100%; margin-top: 4px; }
.footer-contact-item { display: inline-flex; align-items: center; }

/* Second footer row across the full width: social icons left, legal links right. */
.footer-bottom { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 12px; flex-wrap: wrap; }

/* ── Error pages (404 / 500 / …) ── */
.error-page { text-align: center; padding: 24px 0 8px; }
.error-page .error-code { font-size: 4rem; font-weight: 700; color: var(--ke-blue); line-height: 1; margin-bottom: 6px; }
.error-page h1 { padding-bottom: 0.3em; }
.error-actions { margin-top: 22px; }

.footer-links { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--ke-blue); font-size: 0.8rem; font-weight: normal; }
.footer-links a:hover { text-decoration: underline; }
.footer-links .sep { color: var(--ke-nav); }

.footer-consent { margin: 0; }
.footer-consent a { color: var(--ke-blue); font-size: 0.8rem; font-weight: normal; cursor: pointer; }
.footer-consent a:hover { text-decoration: underline; }

/* ── Consent banner (first layer) ── */
.consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    background: #1a1a2e;
    color: var(--ke-white);
    border-top: 3px solid var(--ke-blue);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.35);
    padding: 18px 20px;
    font-size: 0.85rem;
    line-height: 1.5;
}
.consent-banner[hidden] { display: none; }
.consent-banner .consent-inner {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.consent-banner .consent-text { flex: 1 1 320px; margin: 0; }
.consent-banner a { color: #00e5e5; font-weight: 600; }
.consent-banner a:hover { text-decoration: underline; }
.consent-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Consent buttons — equal prominence for accept/reject (legal requirement) */
.consent-btn {
    font-family: var(--ke-font);
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.6em 1.2em;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.consent-btn-primary { background: var(--ke-blue); color: #fff; }
.consent-btn-primary:hover { background: var(--ke-blue-dark); }
.consent-btn-secondary { background: #3a3a52; color: #fff; }
.consent-btn-secondary:hover { background: #4a4a68; }
.consent-btn-link {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}
.consent-btn-link:hover { background: rgba(255,255,255,0.12); }

/* ── Consent settings modal (second layer) ── */
.consent-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0,0,0,0.55);
}
.consent-modal[hidden] { display: none; }
.consent-dialog {
    background: #fff;
    color: var(--ke-text);
    border-radius: 10px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.consent-dialog h2 { color: var(--ke-blue); font-size: 1.3rem; padding: 0 0 0.5em; }
.consent-dialog p { font-size: 0.88rem; }
.consent-category {
    border: 1px solid var(--ke-border);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.consent-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.consent-category-head strong { color: var(--ke-blue); }
.consent-category p { margin: 6px 0 0; color: #555; padding: 0; }
.consent-switch { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.consent-switch input { width: 18px; height: 18px; }
.consent-switch input:disabled { opacity: 0.6; }
.consent-dialog-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 18px;
}

@media (max-width: 560px) {
    .consent-actions, .consent-dialog-actions { width: 100%; }
    .consent-actions .consent-btn, .consent-dialog-actions .consent-btn { flex: 1 1 auto; }
}

/* ── Privacy / Imprint long text ── */
.legal-section { margin-bottom: 1.5em; }
.legal-section h2 { font-size: 1.1rem; padding: 0 0 0.3em; }
.legal-section p, .legal-section ul { font-size: 0.9rem; }

/* ── Profile image ── */
img.profile {
    border: 1px solid var(--ke-border);
    border-radius: 10px;
    float: right;
    margin: 0 0 20px 20px;
    width: 200px;
    height: auto;
    aspect-ratio: 1 / 1;       /* square portrait, avoids layout shift before load */
    object-fit: cover;
}

/* ── Service gallery (image tiles with hover caption) ── */
.gallery {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    padding: 0;
    margin: 20px 0;
}

.gallery li {
    position: relative;
    height: 140px;
    border-radius: 6px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

/* Caption as a permanent bar along the bottom — readable on every device, keeps the
   image visible, and needs no hover (so it works on touch/mobile too). */
.gallery li span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px;
    background: rgba(61, 96, 144, 0.85);
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    transition: background 0.2s;
}

/* Desktop pointer: slightly deepen the bar on hover for feedback. */
.gallery li:hover span {
    background: rgba(61, 96, 144, 0.95);
}

.gallery .advise        { background-image: url("../images/services/advise.jpg"); }
.gallery .documentation { background-image: url("../images/services/documentation.jpg"); }
.gallery .drawing2d     { background-image: url("../images/services/2d.jpg"); }
.gallery .drawing3d     { background-image: url("../images/services/3d.jpg"); }
.gallery .list          { background-image: url("../images/services/list.jpg"); }
.gallery .journey       { background-image: url("../images/services/journey.jpg"); }

/* ── References ── */
.reference {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}
.reference:last-child { border-bottom: none; }

.reference .ref-logo {
    flex: 0 0 200px;
    max-width: 200px;
    min-height: 60px;
    display: flex;
    align-items: center;
}
.reference .ref-logo img { max-width: 100%; height: auto; }
.reference .ref-logo span { color: #333; font-weight: bold; }

/* Make it obvious the reference logos are clickable: a subtle bordered tile that
   lifts and highlights on hover/focus. (Plain-text references have no <a>, so they
   stay unstyled.) */
.reference .ref-logo a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--ke-border);
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

/* "opens a link" cue (Ionicons open-outline). On desktop the hover effect already signals
   the link, so the icon is shown only where there is no hover (touch) or on narrow/mobile. */
@media (hover: none), (max-width: 700px) {
    .reference .ref-logo a::after {
        content: "";
        position: absolute;
        top: 5px;
        right: 6px;
        width: 15px;
        height: 15px;
        opacity: 0.75;
        background-repeat: no-repeat;
        background-size: contain;
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%20512%20512'%3E%3Cpath%20d%3D'M384%20224v184a40%2040%200%2001-40%2040H104a40%2040%200%2001-40-40V168a40%2040%200%200140-40h167.48M336%2064h112v112M224%20288L440%2072'%20fill%3D'none'%20stroke%3D'%23547EB3'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20stroke-width%3D'32'%2F%3E%3C%2Fsvg%3E");
    }
}
.reference .ref-logo a:hover,
.reference .ref-logo a:focus-visible {
    border-color: var(--ke-blue);
    box-shadow: 0 2px 10px rgba(84, 126, 179, 0.25);
    transform: translateY(-2px);
    outline: none;
}

/* Touch feedback: tapping/pressing a reference shows it is a link (no hover on mobile). */
.reference .ref-logo a:active {
    border-color: var(--ke-blue);
    background: rgba(84, 126, 179, 0.10);
    box-shadow: 0 2px 10px rgba(84, 126, 179, 0.25);
    transform: scale(0.98);
}
.reference .ref-description { flex: 1 1 200px; color: #555; }

@media (max-width: 480px) {
    .reference .ref-logo { flex-basis: 100%; }
}

/* ── Inline SVG icons (Ionicons sprite) ── */
.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;        /* filled icons + unstroked parts; outline strokes use currentColor */
    vertical-align: -0.125em;
    flex-shrink: 0;
}
.footer-icon { color: var(--ke-blue); margin-right: 5px; vertical-align: -0.2em; }

/* ── Social icons in footer ── */
.social-icons { display: flex; gap: 14px; align-items: center; }
.social-icons a {
    display: inline-flex;
    color: var(--ke-blue);
    opacity: 0.85;
    transition: opacity 0.15s, transform 0.15s;
}
.social-icons a:hover { opacity: 1; transform: translateY(-1px); }
.social-icons .icon { width: 22px; height: 22px; }

/* ── Utility ── */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-muted-sm { font-size: 0.8rem; color: #666; }
.clearfix::after { content: ""; display: table; clear: both; }

/* Off-screen inline icon sprite (no inline style, for CSP). */
.icon-sprite { position: absolute; }

/* ─────────────────────────────────────────
   RESPONSIVE – Mobile first breakpoints
───────────────────────────────────────── */

/* Tablet: nav wraps nicely */
@media (max-width: 700px) {
    .nav-toggle { display: flex; }

    .nav-bar { display: none; }
    .nav-bar.open { display: block; }

    .nav-list { flex-direction: column; align-items: stretch; }
    .nav-list li { border-bottom: 1px solid #888; }
    .nav-list a { padding: 12px 20px; justify-content: flex-start; }
    .nav-list li.nav-lang { justify-content: flex-start; }
    .nav-list li.nav-lang a { padding: 12px 20px; }

    .content-box { margin: 12px; padding: 20px 16px; border-radius: 6px; }

    .contact-grid { grid-template-columns: 1fr; }

    .form-row-half { grid-template-columns: 1fr; }

    /* Address stacks one item per line (no separators); the social icons and legal
       links stay on one row (icons left, links right). */
    .footer-contact { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 3px; }
    .footer-contact .sep { display: none; }
    .footer-bottom { gap: 12px; }
}

@media (max-width: 480px) {
    .site-logo img { height: 26px; }
    h1 { font-size: 1.5rem; }
    .slogan { font-size: 1rem; }
    .content-box { margin: 8px; padding: 16px 12px; }
    .site-footer-inner { flex-direction: column; align-items: flex-start; }
}

/* Header height compensation via JS (fallback values) */
@media (min-width: 701px) {
    .page-wrapper { padding-top: 120px; }
}
@media (max-width: 700px) {
    .page-wrapper { padding-top: 72px; }
}
