/* ═══ LOCAL FONTS ═══ */

@font-face {
    font-family: 'Inter';
    src: url('/static/fonts/InterVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/static/fonts/InterVariable-Italic.woff2') format('woff2');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Charter';
    src: url('/static/fonts/charter_regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Charter';
    src: url('/static/fonts/charter_italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Charter';
    src: url('/static/fonts/charter_bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Charter';
    src: url('/static/fonts/charter_bold_italic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('/static/fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}


/* ═══ BASE ═══
   Page-level tokens come from /static/brand_tokens.css via [data-context="company"].
   Dark mode is auto-detected via the inline script in layout.php, which mirrors
   prefers-color-scheme onto <html data-mode>. Light is the default.
   ═══════════════════════════════════════════════════════════════════ */

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg);
    line-height: 1.65;
    font-weight: var(--weight-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ─── ANCHOR BUTTONS ─── */
/* brand_tokens.css defines .btn for <button>; ensure anchors styled as buttons
   don't get default underlines. */
a.btn { text-decoration: none; }


/* ─── NAV ─── */

.site-nav {
    position: sticky; top: 0; z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-4) var(--sp-8);
}

.nav-logo {
    color: var(--text-primary); text-decoration: none;
    display: flex; align-items: center;
}
.nav-logo-icon {
    display: inline-block;
    height: 1.8rem;
    aspect-ratio: 2107 / 486;
    background-color: currentColor;
    -webkit-mask: url('/static/logo.svg') center/contain no-repeat;
            mask: url('/static/logo.svg') center/contain no-repeat;
}

.nav-right { display: flex; align-items: center; gap: var(--sp-8); }
.nav-links { display: flex; gap: var(--sp-8); align-items: center; }

.nav-links a {
    font-size: var(--text-sm); color: var(--text-secondary); text-decoration: none;
    letter-spacing: 0.02em; font-weight: var(--weight-medium);
    transition: color 0.2s; position: relative;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a::after {
    content: ''; position: absolute; bottom: -4px; left: 0;
    width: 0; height: 1px; background: var(--text-primary);
    transition: width 0.3s ease;
}
.nav-links a:hover::after { width: 100%; }

/* Language switcher */
.lang-switch {
    display: flex; align-items: center; gap: 0.15rem;
    font-size: var(--text-xs); letter-spacing: 0.05em;
    font-weight: var(--weight-medium); margin-left: var(--sp-2);
    border-left: 1px solid var(--border);
    padding-left: var(--sp-4);
}
.lang-switch a {
    color: var(--text-secondary); text-decoration: none;
    padding: 0.2rem 0.35rem; transition: color 0.2s;
}
.lang-switch a:hover { color: var(--text-primary); }
.lang-switch a.active-lang { color: var(--text-primary); font-weight: var(--weight-semibold); }
.lang-switch .sep { color: var(--border); font-weight: var(--weight-normal); }

/* Mobile toggle */
.nav-mobile-toggle {
    display: none; background: none; border: none;
    cursor: pointer; padding: var(--sp-2);
}
.nav-mobile-toggle span {
    display: block; width: 20px; height: 2px;
    background: var(--text-primary); transition: all 0.3s;
}
.nav-mobile-toggle span + span { margin-top: 5px; }


/* ─── HERO ─── */

.hero {
    max-width: 1200px; margin: 0 auto;
    padding: var(--sp-24) var(--sp-8) var(--sp-16);
    display: grid; grid-template-columns: 1fr 1fr;
    gap: var(--sp-16); align-items: center;
    min-height: 85vh;
}

.hero-text h1 {
    font-size: var(--text-6xl); font-weight: var(--weight-heavy);
    line-height: 1.05; letter-spacing: -0.04em;
    color: var(--text-primary); margin-bottom: var(--sp-4);
}
.hero-text h1 strong { font-weight: inherit; color: inherit; }
.hero-text p {
    font-size: var(--text-lg); color: var(--text-secondary); line-height: 1.6;
    max-width: 480px; margin-bottom: var(--sp-8);
}

.hero-cta { display: inline-flex; gap: var(--sp-4); flex-wrap: wrap; }

.hero-image {
    aspect-ratio: 4/5; background: var(--bg-secondary);
    position: relative; overflow: hidden;
    border-radius: var(--radius-lg);
}
.hero-image img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover; object-position: top center;
}


/* ─── SECTIONS ─── */

.section {
    max-width: 1200px; margin: 0 auto;
    padding: var(--sp-16) var(--sp-8);
}

.section-divider {
    width: 100%; height: 1px; background: var(--border);
    max-width: 1200px; margin: 0 auto;
}

.section-label {
    font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-tertiary); font-weight: var(--weight-semibold);
    margin-bottom: var(--sp-4);
}

.section-heading {
    font-size: var(--text-4xl); font-weight: var(--weight-heavy);
    letter-spacing: -0.03em; line-height: 1.1;
    color: var(--text-primary); margin-bottom: var(--sp-4);
    max-width: 720px;
}
.section-heading strong { font-weight: inherit; color: inherit; }

.section-intro {
    font-size: var(--text-lg); color: var(--text-secondary); line-height: 1.55;
    max-width: 600px; margin-bottom: var(--sp-16);
}

.section-body {
    font-size: var(--text-md); color: var(--text-secondary); line-height: 1.7;
    max-width: 600px; margin-top: var(--sp-8);
}


/* ─── PRODUCTS — editorial layout (no cards) ─── */

.products-grid {
    display: grid; grid-template-columns: 1fr; gap: 0;
    max-width: 720px;
    margin-top: var(--sp-8);
}

.product-item {
    padding: var(--sp-8) 0;
}
.product-item + .product-item {
    border-top: 1px solid var(--border);
}
.product-item:last-child { padding-bottom: 0; }

.product-item-head {
    display: flex; align-items: center; gap: var(--sp-4);
    margin-bottom: var(--sp-4);
}

.product-icon {
    width: 2rem; height: 2rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.product-icon img { width: 100%; height: 100%; object-fit: contain; }

.product-item h3 {
    font-size: var(--text-2xl); font-weight: var(--weight-bold);
    letter-spacing: -0.02em; color: var(--text-primary);
}

.product-item p {
    font-size: var(--text-md); color: var(--text-secondary);
    line-height: 1.65; margin-bottom: var(--sp-4); max-width: 600px;
}

.product-link {
    display: inline-flex; align-items: center; gap: var(--sp-1);
    font-size: var(--text-sm); color: var(--link);
    text-decoration: none; font-weight: var(--weight-semibold);
    transition: gap 0.2s;
}
.product-link:hover { gap: var(--sp-2); }


/* ─── BLOG GRID ─── */

.blog-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-8);
}

.blog-card {
    cursor: pointer; text-decoration: none; color: inherit;
    display: block;
}

.blog-card-image {
    aspect-ratio: 16/10; background: var(--bg-secondary);
    margin-bottom: var(--sp-4); transition: opacity 0.3s;
    background-size: cover; background-position: center;
    border-radius: var(--radius-md);
    filter: saturate(0.65) sepia(0.12);
}
.blog-card:hover .blog-card-image { opacity: 0.85; }

.blog-card-date {
    font-size: var(--text-xs); color: var(--text-tertiary);
    letter-spacing: 0.06em; text-transform: uppercase;
    font-weight: var(--weight-semibold);
    margin-bottom: var(--sp-2);
}

.blog-card h3 {
    font-size: var(--text-lg); font-weight: var(--weight-bold);
    letter-spacing: -0.01em; line-height: 1.3;
    color: var(--text-primary); margin-bottom: var(--sp-2);
}

.blog-card p {
    font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.55;
}


/* ─── CONTACT ─── */

.contact-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-8);
}

.contact-block h3 {
    font-size: var(--text-xs); letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-tertiary);
    font-weight: var(--weight-semibold); margin-bottom: var(--sp-4);
}

.contact-block p {
    font-size: var(--text-md); line-height: 1.7; color: var(--text-primary);
}

.contact-block a {
    color: var(--link); text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.2s;
}
.contact-block a:hover { border-color: var(--link); }
.eml { cursor: pointer; }
.em-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }


/* ─── FOOTER ─── */

.site-footer {
    border-top: 1px solid var(--border);
    max-width: 1200px; margin: 0 auto;
    padding: var(--sp-8);
    display: flex; justify-content: space-between; align-items: center;
}

.footer-left { font-size: var(--text-sm); color: var(--text-tertiary); }

.footer-right { display: flex; gap: var(--sp-4); }
.footer-right a {
    font-size: var(--text-sm); color: var(--text-tertiary);
    text-decoration: none; letter-spacing: 0.02em;
    transition: color 0.2s;
}
.footer-right a:hover { color: var(--text-primary); }


/* ─── BLOG POST ─── */

.blog-post-content {
    max-width: 680px; margin: 0 auto;
    padding: var(--sp-16) var(--sp-8);
}

.post-hero-image {
    width: 100%; aspect-ratio: 16/10;
    background-size: cover; background-position: center;
    border-radius: var(--radius-md); margin-bottom: var(--sp-2);
    filter: saturate(0.65) sepia(0.12);
}

.post-image-credit {
    font-size: var(--text-xs); color: var(--text-tertiary);
    text-align: right; margin-bottom: var(--sp-8);
    letter-spacing: 0.04em;
}

.post-image-credit a {
    color: var(--text-tertiary); text-decoration: underline;
}

.blog-post-content .post-meta {
    font-size: var(--text-xs); color: var(--text-tertiary);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em; text-transform: uppercase;
    margin-bottom: var(--sp-4);
}

.blog-post-content h1 {
    font-size: var(--text-4xl); font-weight: var(--weight-heavy);
    letter-spacing: -0.03em; line-height: 1.1;
    color: var(--text-primary); margin-bottom: var(--sp-8);
}

.blog-post-content .post-body p {
    font-family: var(--font-serif);
    font-size: var(--text-xl); line-height: 1.55; color: var(--text-primary);
    margin-bottom: var(--sp-4);
}

.blog-post-content .post-body h2 {
    font-size: var(--text-2xl); font-weight: var(--weight-bold);
    margin: var(--sp-8) 0 var(--sp-4);
    letter-spacing: -0.01em; color: var(--text-primary);
}

.blog-post-content .post-body ul,
.blog-post-content .post-body ol {
    margin: var(--sp-2) 0 var(--sp-4) var(--sp-4);
    font-family: var(--font-serif);
    font-size: var(--text-xl); line-height: 1.55;
    color: var(--text-primary);
}
.blog-post-content .post-body li { margin-bottom: 0.3rem; }

.blog-post-content .post-body blockquote {
    border-left: 2px solid var(--accent);
    padding-left: var(--sp-4); margin: var(--sp-4) 0;
    font-family: var(--font-serif);
    font-style: italic; color: var(--text-secondary);
}

.blog-post-content .post-body hr {
    border: none; height: 1px; background: var(--border);
    margin: var(--sp-16) 0;
}

.blog-post-content .post-body a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent);
    text-underline-offset: 2px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.blog-post-content .post-body a:hover {
    text-decoration-color: var(--link);
}

.blog-post-content .post-body em {
    color: var(--text-secondary);
}

/* Code blocks — recessed (emboss-well) per brand spec */
.blog-post-content .post-body pre {
    margin: var(--sp-4) 0 var(--sp-8);
    padding: var(--sp-4);
    border-radius: var(--radius-md);
    overflow: auto;
    font-size: var(--text-base);
    line-height: 1.65;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    box-shadow: var(--emboss-well);
    color: #adbac7;
}

/* When highlight.js hasn't loaded, provide fallback styling */
.blog-post-content .post-body pre:not(:has(.hljs)) {
    padding: var(--sp-4);
}
.blog-post-content .post-body pre:not(:has(.hljs)) code {
    color: #adbac7;
}

.blog-post-content .post-body pre code {
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    background: none; padding: 0;
}

/* Inline code */
.blog-post-content .post-body code:not(pre code) {
    font-family: var(--font-mono);
    font-variant-ligatures: none;
    font-size: 0.85em; background: var(--bg-well);
    padding: 0.15em 0.4em; color: var(--text-primary);
    border-radius: var(--radius-sm);
}

/* Tables */
.blog-post-content .post-body table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--sp-8);
    margin-bottom: var(--sp-16);
    font-size: var(--text-base);
    line-height: 1.55;
    transition: width 0.3s ease;
}

/* Wide tables (set via JS for >4 columns) */
.blog-post-content .post-body table.wide-table {
    width: 150%;
    margin-left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 1100px) {
    .blog-post-content .post-body table.wide-table {
        width: 100%;
        margin-left: 0;
        transform: none;
    }
}

@media (max-width: 600px) {
    .blog-post-content .post-body table {
        font-size: var(--text-xs);
    }
    .blog-post-content .post-body th,
    .blog-post-content .post-body td {
        padding: var(--sp-1) var(--sp-2);
    }
}

.blog-post-content .post-body th,
.blog-post-content .post-body td {
    padding: var(--sp-2) var(--sp-4); text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    overflow-wrap: break-word; word-break: break-word;
}

.blog-post-content .post-body th {
    font-size: var(--text-xs); font-weight: var(--weight-semibold);
    letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--text-tertiary); border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
}

.blog-post-content .post-body tr:last-child td { border-bottom: none; }
.blog-post-content .post-body tr:hover td { background: var(--bg-secondary); }

.blog-post-content .post-body .table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    margin: var(--sp-4) 0 var(--sp-8);
}
.blog-post-content .post-body .table-wrap table { margin: 0; }


/* Post navigation */
.post-nav {
    margin-top: var(--sp-16); padding-top: var(--sp-8);
    border-top: 1px solid var(--border);
}


/* ─── ANIMATIONS ─── */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.6s ease forwards; opacity: 0; }
.fade-in:nth-child(2) { animation-delay: 0.15s; }


/* ─── RESPONSIVE ─── */

@media (max-width: 768px) {
    .nav-mobile-toggle { display: block; }

    .nav-right {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: var(--sp-4) var(--sp-8);
        flex-direction: column; gap: var(--sp-4);
    }
    .nav-right.open { display: flex; }

    .nav-links { flex-direction: column; gap: var(--sp-2); }
    .nav-links a { font-size: var(--text-md); }
    .nav-links a::after { display: none; }

    .lang-switch {
        border-left: none; padding-left: 0;
        border-top: 1px solid var(--border);
        padding-top: var(--sp-4); margin-left: 0;
    }

    .hero {
        grid-template-columns: 1fr;
        padding: var(--sp-16) var(--sp-4) var(--sp-8);
        min-height: auto; gap: var(--sp-8);
    }
    .hero-text h1 { font-size: var(--text-4xl); }
    .hero-image { aspect-ratio: 4/5; }

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

    .section { padding: var(--sp-16) var(--sp-4); }
    .section-heading { font-size: var(--text-3xl); }

    .blog-post-content { padding: var(--sp-16) var(--sp-4); }
    .blog-post-content h1 { font-size: var(--text-3xl); }

    .blog-post-content .post-body table {
        display: block; overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .blog-post-content .post-body th,
    .blog-post-content .post-body td { white-space: normal; min-width: 8rem; }

    .site-footer {
        flex-direction: column; gap: var(--sp-4);
        text-align: center;
    }
}


/* ─── HIGHLIGHT.JS: GITHUB DARK DIMMED ─── */

.hljs { color: #adbac7; background: transparent; display: block; overflow-x: auto; padding: var(--sp-4); }

.hljs-doctag, .hljs-keyword, .hljs-meta .hljs-keyword,
.hljs-template-tag, .hljs-template-variable, .hljs-type,
.hljs-variable.language_ { color: #f47067; }

.hljs-title, .hljs-title.class_, .hljs-title.class_.inherited__,
.hljs-title.function_ { color: #dcbdfb; }

.hljs-attr, .hljs-attribute, .hljs-literal, .hljs-meta,
.hljs-number, .hljs-operator, .hljs-selector-attr,
.hljs-selector-class, .hljs-selector-id, .hljs-variable { color: #6cb6ff; }

.hljs-meta .hljs-string, .hljs-regexp, .hljs-string { color: #96d0ff; }

.hljs-built_in, .hljs-symbol { color: #f69d50; }

.hljs-code, .hljs-comment, .hljs-formula { color: #768390; }

.hljs-name, .hljs-quote, .hljs-selector-pseudo,
.hljs-selector-tag { color: #8ddb8c; }

.hljs-subst { color: #adbac7; }

.hljs-section { color: #316dca; font-weight: bold; }

.hljs-bullet { color: #eac55f; }

.hljs-emphasis { color: #adbac7; font-style: italic; }

.hljs-strong { color: #adbac7; font-weight: bold; }

.hljs-addition { color: #b4f1b4; background-color: #1b4721; }

.hljs-deletion { color: #ffd8d3; background-color: #78191b; }
