/* ==========================================================================
   Carlenius AI theme (dark default, light optional)
   ========================================================================== */

:root {
    --bg: #060706;
    --bg-elevated: #0d0f0d;
    --bg-glass: rgba(13, 15, 13, 0.75);

    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* brand green, sampled from the logo */
    --accent: #2ecc55;
    --accent-strong: #63e883;
    --accent-dim: rgba(46, 204, 85, 0.35);
    --accent-glow: rgba(46, 204, 85, 0.18);
    --btn-primary-text: #04150a;

    --text: #eef2ef;
    --text-dim: #9fb0a6;
    --text-faint: #64726a;

    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --header-h: 100px;
    --max-w: 1180px;
}

html[data-theme="light"] {
    --bg: #f6f8f6;
    --bg-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.8);

    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);

    --accent: #1f9c46;
    --accent-strong: #17803a;
    --accent-dim: rgba(31, 156, 70, 0.3);
    --accent-glow: rgba(31, 156, 70, 0.15);
    --btn-primary-text: #f4fbf6;

    --text: #12140f;
    --text-dim: #4b564f;
    --text-faint: #78837c;
}

/* ------------------ RESET ------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--mono);
    overflow-wrap: break-word;
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(ellipse 1200px 600px at 50% 0%, color-mix(in srgb, var(--bg-elevated) 60%, transparent) 0%, transparent 60%),
        var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
}

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

a {
    color: inherit;
}

/* subtle scanline texture — decorative only */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2000;
    background: repeating-linear-gradient(
        0deg,
        rgba(127, 127, 127, 0.03) 0px,
        rgba(127, 127, 127, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: var(--accent);
    margin-bottom: 14px;
}

.cursor {
    display: inline-block;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 32px;
    min-width: 0;
}

/* ------------------ SKIP LINK ------------------ */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--btn-primary-text);
    padding: 10px 16px;
    z-index: 3000;
    font-weight: 700;
}

.skip-link:focus {
    left: 16px;
    top: 16px;
}

/* ------------------ ICONS ------------------ */
.icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ------------------ HEADER ------------------ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.site-header .container {
    display: grid;
    /* Equal outer tracks (not "auto") so the nav in the middle is truly
       centered in the header, regardless of the logo and the actions
       cluster being different widths. */
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 24px;
    width: 100%;
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

.logo {
    justify-self: start;
}

.logo img {
    height: 90px;
}

.logo-light {
    display: none;
}

html[data-theme="light"] .logo-dark {
    display: none;
}

html[data-theme="light"] .logo-light {
    display: block;
}

.site-nav {
    justify-self: center;
    min-width: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 26px;
    list-style: none;
}

.nav-links a {
    position: relative;
    display: inline-block;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding-bottom: 4px;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
    /* Animate with a transform, not width — animating width forces a layout
       recalculation on every frame, which under the header's
       backdrop-filter blur was rendering as an inconsistent/broken line. */
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active {
    color: var(--text);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
    transform: scaleX(1);
}

.nav-login {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-faint);
    border: 1px solid var(--border-strong);
    padding: 8px 14px;
    border-radius: 6px;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.nav-login:hover,
.nav-login:focus-visible {
    border-color: var(--accent-dim);
    color: var(--accent);
}

.header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-utils {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    border-color: var(--accent-dim);
    color: var(--accent);
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    width: 36px;
    height: 36px;
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
}

/* theme toggle icon swap */
.theme-toggle .icon-moon {
    display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun {
    display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
    display: block;
}

/* ------------------ LANGUAGE DROPDOWN ------------------ */
.lang-dropdown {
    position: relative;
}

.lang-btn {
    width: auto;
    padding: 0 10px;
}

.lang-btn .chevron {
    width: 10px;
    height: 10px;
    transition: transform 0.2s ease;
}

.lang-btn[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.lang-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 150px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 6px;
    list-style: none;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 1100;
}

.lang-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: none;
    border: none;
    color: var(--text-dim);
    font: 600 13px var(--mono);
    padding: 9px 10px;
    border-radius: 5px;
    cursor: pointer;
    text-align: left;
}

.lang-option:hover,
.lang-option:focus-visible {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--text);
}

.lang-option.active {
    color: var(--accent);
}

.lang-option .check {
    width: 12px;
    height: 12px;
    opacity: 0;
}

.lang-option.active .check {
    opacity: 1;
}

/* ------------------ BUTTONS ------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    padding: 13px 24px;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--btn-primary-text);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-strong);
    box-shadow: 0 0 0 4px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    transform: translateY(-1px);
}

/* ------------------ HERO ------------------ */
/* Hero always renders in the vivid dark/hacker palette, independent of the
   site-wide light/dark toggle, since it sits on a dimmed photo background. */
.hero {
    --accent: #2ecc55;
    --accent-strong: #63e883;
    --accent-dim: rgba(46, 204, 85, 0.35);
    --accent-glow: rgba(46, 204, 85, 0.18);
    --btn-primary-text: #04150a;
    --text: #eef2ef;
    --text-dim: #c9d6cd;

    position: relative;
    min-height: 100vh;
    padding-top: var(--header-h);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    animation: heroFade 12s infinite;
    filter: brightness(0.45);
}

.hero-bg img:nth-child(1) { animation-delay: 0s; }
.hero-bg img:nth-child(2) { animation-delay: 4s; }
.hero-bg img:nth-child(3) { animation-delay: 8s; }

@keyframes heroFade {
    0% { opacity: 0; }
    10% { opacity: 1; }
    35% { opacity: 1; }
    45% { opacity: 0; }
    100% { opacity: 0; }
}

.hero-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(6, 7, 6, 0.35), rgba(6, 7, 6, 0.8)),
        linear-gradient(0deg, rgba(46, 204, 85, 0.14), transparent 55%);
}

.hero-text {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin-left: max(32px, 8vw);
    padding: 40px;
    background: rgba(13, 15, 13, 0.7);
    backdrop-filter: blur(20px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 60px var(--accent-glow);
    animation: heroFloat 6s ease-in-out infinite;
    min-width: 0;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.hero h1 {
    font-size: clamp(2rem, 4.2vw, 3.1rem);
    font-weight: 800;
    line-height: 1.18;
    margin-bottom: 22px;
    color: var(--accent);
    hyphens: auto;
}

.hero-lead {
    font-size: 18px;
    line-height: 1.7;
    color: var(--text-dim);
    margin-bottom: 34px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* ------------------ SECTIONS ------------------ */
.section {
    padding: 110px 0;
}

.section-head {
    max-width: 640px;
    margin-bottom: 56px;
}

.section-head h2 {
    font-size: clamp(2.5rem, 4.6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.2;
    hyphens: auto;
}

/* ------------------ SERVICES ------------------ */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.service-card {
    min-width: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 30px;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.25s ease;
}

.service-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-dim);
}

.service-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    hyphens: auto;
}

.service-card p {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-dim);
}

/* ------------------ ABOUT ------------------ */
.about-body p {
    color: var(--text-dim);
    font-size: 17px;
    line-height: 1.85;
    margin-bottom: 20px;
    max-width: 72ch;
}

.about-body strong {
    color: var(--text);
}

/* ------------------ CONTACT ------------------ */
.contact {
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 4%, transparent));
    border-top: 1px solid var(--border);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.card {
    min-width: 0;
    display: block;
    background: var(--bg-elevated);
    padding: 28px 30px;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.25s ease;
}

a.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-dim);
}

.card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 10px;
}

.card-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

/* ------------------ FOOTER ------------------ */
footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    transition: border-color 0.25s ease;
}

footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

footer p {
    font-size: 13px;
    color: var(--text-faint);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 22px;
    list-style: none;
    flex-wrap: wrap;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-faint);
    text-decoration: none;
    white-space: nowrap;
}

.footer-links a:hover {
    color: var(--accent);
}

/* ------------------ RESPONSIVE ------------------ */
@media (max-width: 760px) {
    :root {
        --header-h: 72px;
    }

    .logo img {
        height: 40px;
    }

    .site-header .container {
        padding-left: 18px;
        padding-right: 18px;
        column-gap: 8px;
    }

    .header-actions {
        gap: 6px;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
    }

    /* icon-only on mobile: the "EN"/"NO" label and chevron would blow the
       header width out once Login sits permanently in this same row */
    .lang-btn {
        width: 34px;
        padding: 0;
    }

    .lang-btn span,
    .lang-btn .chevron {
        display: none;
    }

    /* Top bar is already tight (theme + language + Login + hamburger);
       GitHub is secondary and still reachable from the footer. */
    .github-btn {
        display: none;
    }

    .nav-login {
        padding: 6px 9px;
        font-size: 10.5px;
    }

    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
    }

    .site-nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        width: 100%;
        background: color-mix(in srgb, var(--bg) 97%, transparent);
        backdrop-filter: blur(14px);
        border-bottom: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease;
    }

    .site-nav.open {
        max-height: 320px;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 8px 32px 20px;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        padding: 14px 0;
        width: 100%;
    }

    .hero-text {
        max-width: none;
        margin: 0 20px;
        padding: 28px;
    }

    .section {
        padding: 72px 0;
    }

    .container {
        padding: 0 22px;
    }
}

/* ------------------ MOTION SAFETY ------------------ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
