/* ============================================
   SAW TOOLS — Main stylesheet
   Inspired by sawconcept.fr identity
   ============================================ */

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(180deg, #FFFFFF 0%, #ECECEC 100%);
    color: #000000;
    min-height: 100vh;
    /* iOS Safari dynamic viewport */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Avoid double-tap zoom on interactive elements (Android/iOS) */
button,
a,
input,
select,
textarea,
.toggle,
.tool-card {
    touch-action: manipulation;
}

/* Prevent iOS Safari from auto-zooming on inputs with font-size < 16px */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
    font-size: 16px;
}

/* Ensure tap targets are at least 44×44px on touch devices */
@media (pointer: coarse) {
    .btn,
    .calc-key,
    .toggle,
    .tab,
    .lang-switcher a,
    .ad-sticky-close,
    .calc-angle button {
        min-height: 44px;
    }
}

/* Backdrop-filter fallback for browsers that don't support it (older Firefox) */
@supports not ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
    .header,
    .ad-sticky,
    .footer {
        background: rgba(255, 255, 255, 0.92) !important;
    }
    :root[data-theme="dark"] .header,
    :root[data-theme="dark"] .ad-sticky,
    :root[data-theme="dark"] .footer {
        background: rgba(15, 15, 15, 0.95) !important;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    #particles {
        display: none;
    }
}

/* === BACKGROUND PARTICLES CANVAS === */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* === LAYOUT WRAPPER === */
.page {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

/* === HEADER === */
.header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 2.5rem;
    width: 100%;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #000;
    margin-right: auto; /* pushes nav-primary + lang-switcher to the right */
}

/* Primary nav (Blog, future links). Same visual language as .lang-switcher */
.nav-primary {
    display: flex;
    gap: 1.25rem;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 300;
}

.nav-primary a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}

.nav-primary a:hover { color: #000; }

.nav-primary a.active {
    color: #000;
    border-bottom-color: #000;
}

.brand-mark {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

.brand-name {
    font-size: 0.95rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.lang-switcher {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-weight: 300;
}

.lang-switcher a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}

.lang-switcher a:hover {
    color: #000;
}

.lang-switcher a.active {
    color: #000;
    border-bottom-color: #000;
}

/* === MAIN CONTENT === */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 2rem 7rem; /* extra bottom padding for sticky ad */
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* On tool pages we want the tool above the fold on mobile */
.main--tool {
    padding-top: 1.5rem;
}

/* === HERO (page title) === */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 720px;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 200;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1rem;
    font-weight: 300;
    color: #555;
    line-height: 1.6;
    letter-spacing: 0.02em;
}

/* === HOMEPAGE TAGLINE (effet loupe sawconcept) === */
.tagline {
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2rem 0 4rem;
}

.tagline .char {
    display: inline-block;
    transition: transform 0.6s ease-out;
    cursor: default;
    opacity: 0;
    transform: scale(1.8);
}

.tagline .char.visible {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.tagline .space {
    width: 0.5em;
}

/* === TOOLS GRID (homepage) === */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    width: 100%;
    margin-top: 2rem;
}

.tool-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2rem 1.75rem;
    text-decoration: none;
    color: #000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #000, transparent);
    transition: left 0.6s ease;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.9);
}

.tool-card:hover::before {
    left: 100%;
}

.tool-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.tool-card-title {
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tool-card-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.tool-card-tag {
    display: inline-block;
    margin-top: auto;
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #999;
    padding-top: 0.75rem;
}

/* === TOOL CONTAINER === */
.tool {
    width: 100%;
    max-width: 720px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2.5rem 2rem;
    margin: 0 auto;
}

.tool-output {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.3rem;
    background: #F8F8F8;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    word-break: break-all;
    min-height: 60px;
    display: flex;
    align-items: center;
    user-select: all;
    letter-spacing: 0.05em;
}

.tool-output.empty {
    color: #999;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
}

.tool-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 0.85rem 1.75rem;
    border: 1px solid #000;
    background: transparent;
    color: #000;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn:hover {
    background: #000;
    color: #FFF;
}

.btn-primary {
    background: #000;
    color: #FFF;
}

.btn-primary:hover {
    background: #FFF;
    color: #000;
}

.btn-ghost {
    border-color: rgba(0, 0, 0, 0.2);
    color: #666;
}

.btn-ghost:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

/* === FORM CONTROLS === */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.control-label {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #555;
    flex: 1;
}

.control-value {
    font-size: 0.95rem;
    font-weight: 300;
    min-width: 2.5em;
    text-align: right;
}

.slider {
    flex: 2;
    -webkit-appearance: none;
    appearance: none;
    height: 1px;
    background: #000;
    outline: none;
    margin: 0 1rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    transition: transform 0.2s;
}

.slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    border: none;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.toggle {
    position: relative;
    width: 40px;
    height: 20px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #FFF;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s;
}

.toggle.active {
    background: #000;
}

.toggle.active::after {
    left: 22px;
}

/* === FORM INPUTS === */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.field-label {
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #666;
}

.input,
.select,
.textarea {
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: #FFF;
    color: #000;
    width: 100%;
    transition: border-color 0.2s;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: #000;
}

.textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='none' stroke='%23000' stroke-width='1.2' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px 8px;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* === GRID LAYOUTS for tools === */
.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .row-2,
    .row-3 {
        grid-template-columns: 1fr;
    }
}

.tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 0;
}

.tab {
    background: transparent;
    border: none;
    padding: 0.65rem 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #999;
    cursor: pointer;
    border-bottom: 1px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
    color: #000;
}

.tab.active {
    color: #000;
    border-bottom-color: #000;
}

/* === COLOR SWATCH === */
.swatch {
    width: 100%;
    height: 100px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    transition: background 0.3s;
}

/* === QR CODE preview === */
.qr-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFF;
    padding: 1.5rem;
    margin: 1rem auto;
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: fit-content;
    min-width: 200px;
    min-height: 200px;
}

.qr-preview svg,
.qr-preview canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* === CALCULATOR === */
.calc {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.calc-display {
    background: #F8F8F8;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
}

.calc-expr {
    font-size: 0.85rem;
    color: #888;
    min-height: 1.2em;
    word-break: break-all;
    letter-spacing: 0.04em;
}

.calc-result {
    font-size: 1.7rem;
    font-weight: 300;
    color: #000;
    letter-spacing: 0.02em;
    word-break: break-all;
    margin-top: 0.25rem;
    min-height: 1.4em;
}

.calc-mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.calc-mode-bar .tabs {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.calc-angle {
    display: flex;
    gap: 0.25rem;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.calc-angle button {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #666;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 300;
    letter-spacing: 0.2em;
    transition: all 0.2s;
}

.calc-angle button.active {
    background: #000;
    color: #FFF;
    border-color: #000;
}

.calc-keys {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(4, 1fr);
}

.calc-keys.calc-keys--sci {
    grid-template-columns: repeat(5, 1fr);
}

.calc-key {
    background: #FFF;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: #000;
    padding: 0;
    height: 52px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    letter-spacing: 0.05em;
}

.calc-key:hover {
    background: #F4F4F4;
    border-color: rgba(0, 0, 0, 0.3);
}

.calc-key:active {
    background: #E8E8E8;
    transform: scale(0.97);
}

.calc-key--op {
    color: #555;
    font-size: 1.05rem;
}

.calc-key--func {
    font-size: 0.78rem;
    color: #444;
    letter-spacing: 0.04em;
}

.calc-key--clear {
    color: #C44;
}

.calc-key--equals {
    background: #000;
    color: #FFF;
    border-color: #000;
}

.calc-key--equals:hover {
    background: #222;
    border-color: #222;
}

.calc-key--span2 {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .calc-keys,
    .calc-keys.calc-keys--sci {
        grid-template-columns: repeat(4, 1fr);
    }

    .calc-keys.calc-keys--sci .sci-only {
        font-size: 0.7rem;
    }

    .calc-key {
        height: 48px;
        font-size: 0.85rem;
    }

    .calc-key--func {
        font-size: 0.7rem;
    }
}

/* === MARKDOWN PREVIEW === */
.md-preview {
    background: #FFF;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    min-height: 120px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #000;
    overflow-x: auto;
}

.md-preview h1,
.md-preview h2,
.md-preview h3 {
    font-weight: 400;
    margin: 1rem 0 0.5rem;
}

.md-preview h1 { font-size: 1.6rem; }
.md-preview h2 { font-size: 1.3rem; }
.md-preview h3 { font-size: 1.1rem; }

.md-preview code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1em 0.35em;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.md-preview pre {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.md-preview pre code {
    background: transparent;
    padding: 0;
}

.md-preview ul,
.md-preview ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.md-preview blockquote {
    border-left: 3px solid #000;
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: #555;
}

.md-preview a {
    color: #000;
    text-decoration: underline;
}

/* === STRENGTH METER === */
.strength {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #555;
}

.strength-bar {
    flex: 1;
    height: 2px;
    background: rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    background: #000;
    transition: width 0.4s ease, background 0.4s ease;
}

.strength-level-weak .strength-fill { background: #C44; }
.strength-level-medium .strength-fill { background: #C90; }
.strength-level-strong .strength-fill { background: #2A2; }

/* === AD BANNER (in-content) === */
.ad-banner {
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    margin: 3rem auto;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #BBB;
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* === STICKY BOTTOM AD (always visible) === */
.ad-sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 90;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.ad-sticky-inner {
    width: 100%;
    max-width: 728px;
    min-height: 50px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #BBB;
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    padding: 0.5rem;
}

.ad-sticky-close {
    position: absolute;
    top: 4px;
    right: 8px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
}

.ad-sticky-close:hover {
    color: #000;
}

.ad-sticky.hidden {
    display: none;
}

/* === LANGUAGE SUGGESTION BANNER === */
.lang-suggest {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: #000;
    color: #FFF;
    padding: 0.85rem 1.5rem;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 300;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
    max-width: calc(100% - 2rem);
}

.lang-suggest.visible {
    transform: translateX(-50%) translateY(0);
}

.lang-suggest a {
    color: #FFF;
    text-decoration: underline;
}

.lang-suggest button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #FFF;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.2em;
    transition: all 0.2s;
}

.lang-suggest button:hover {
    background: #FFF;
    color: #000;
}

/* === LEGAL PAGES === */
.legal {
    max-width: 760px;
    margin: 2rem auto 0;
    padding: 2.5rem 2rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    line-height: 1.75;
    color: #333;
    font-size: 0.95rem;
}

.legal h2 {
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 2rem 0 0.75rem;
    color: #000;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.legal h3 {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 1.5rem 0 0.5rem;
    color: #000;
    letter-spacing: 0.02em;
}

.legal p {
    margin-bottom: 0.85rem;
}

.legal ul,
.legal ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0 0.85rem;
}

.legal li {
    margin-bottom: 0.4rem;
}

.legal a {
    color: #000;
    text-decoration: underline;
}

.legal-meta {
    font-size: 0.8rem;
    color: #777;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.88rem;
}

.legal-table th,
.legal-table td {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.6rem 0.85rem;
    text-align: left;
    vertical-align: top;
}

.legal-table th {
    background: rgba(0, 0, 0, 0.04);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

@media (max-width: 600px) {
    .legal {
        padding: 1.5rem 1.25rem;
        font-size: 0.92rem;
    }
    .legal-table {
        font-size: 0.8rem;
    }
}

/* === EXPLAINER (SEO content) === */
.explainer {
    max-width: 720px;
    margin: 4rem auto 2rem;
    padding: 0 1rem;
    line-height: 1.8;
    color: #444;
}

.explainer h2 {
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 2rem 0 1rem;
    color: #000;
}

.explainer h3 {
    font-size: 1.05rem;
    font-weight: 400;
    margin: 1.5rem 0 0.5rem;
    color: #000;
}

.explainer p,
.explainer li {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.explainer ul {
    padding-left: 1.5rem;
}

/* === FAQ (Schema.org FAQPage) === */
/* Inherits the .explainer container width and rhythm so the FAQ feels
   like a continuation of the explainer block, not a different module.
   width:100% is required because .main is flex+align-items:center —
   without it the section would shrink to its widest child, which makes
   the box visibly grow/shrink as questions are opened and closed. */
.faq {
    width: 100%;
    max-width: 720px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
    line-height: 1.8;
    color: #444;
    box-sizing: border-box;
}

.faq h2 {
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 1.5rem;
    color: #000;
}

.faq details {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.1rem 0;
}

.faq details:last-of-type {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Cross-browser marker reset (Chrome/Safari + Firefox) */
.faq summary {
    cursor: pointer;
    font-weight: 400;
    font-size: 1.05rem;
    color: #000;
    list-style: none;
    display: block;
    position: relative;
    padding-right: 2rem;
    transition: color 0.2s ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::marker { content: ''; }

.faq summary::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 200;
    font-size: 1.5rem;
    color: #999;
    transition: color 0.2s ease;
}

.faq details[open] summary::after {
    content: '\2212'; /* minus sign */
}

.faq summary:hover { color: #555; }
.faq summary:hover::after { color: #555; }

.faq details > p,
.faq details > ul {
    margin: 0.75rem 0 0;
    font-size: 0.95rem;
    color: #444;
}

.faq details p code {
    font-size: 0.88em;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.05em 0.3em;
    border-radius: 3px;
}

/* === AFFILIATE COMPARISON (Password Generator only for now) ===
   Inherits the .explainer / .faq rhythm but uses a slightly wider container
   to fit 3-4 comparison cards in a responsive grid.
   width:100% required because .main is flex+align-items:center. */
.affiliate-section {
    width: 100%;
    max-width: 960px;
    margin: 3rem auto 2rem;
    padding: 0 1rem;
    line-height: 1.8;
    color: #444;
    box-sizing: border-box;
}

.affiliate-section h2 {
    font-size: 1.4rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 2rem 0 0.5rem;
    color: #000;
    text-align: center;
}

.affiliate-section .affiliate-intro {
    font-size: 0.95rem;
    text-align: center;
    margin: 0 auto 2rem;
    max-width: 640px;
}

.affiliate-disclosure {
    font-size: 0.78rem;
    color: #888;
    text-align: center;
    font-style: italic;
    margin: 0 auto 2rem;
    max-width: 720px;
    padding: 0.6rem 1rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.affiliate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.affiliate-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 1.25rem 1.1rem 1rem;
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.affiliate-card:hover {
    border-color: rgba(0, 0, 0, 0.18);
    transform: translateY(-2px);
}

.affiliate-card-name {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #000;
    margin: 0 0 0.25rem;
}

.affiliate-card-tagline {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #888;
    margin: 0 0 1rem;
}

.affiliate-card-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    font-size: 0.88rem;
    flex-grow: 1;
}

.affiliate-card-features li {
    margin: 0.4rem 0;
    padding-left: 1.1rem;
    position: relative;
}

.affiliate-card-features li::before {
    content: "›";
    position: absolute;
    left: 0;
    color: #888;
    font-weight: 300;
}

.affiliate-card-price {
    font-size: 0.85rem;
    color: #555;
    margin: 0 0 0.85rem;
}

.affiliate-card-price strong {
    color: #000;
    font-weight: 400;
}

.affiliate-card-cta {
    display: inline-block;
    text-align: center;
    padding: 0.65rem 1rem;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
    background: #000;
    color: #fff;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.affiliate-card-cta:hover {
    opacity: 0.85;
}

.affiliate-card-mention {
    font-size: 0.78rem;
    color: #888;
    text-align: center;
    margin-top: 0.85rem;
    font-style: italic;
}

@media (max-width: 600px) {
    .affiliate-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .affiliate-section h2 {
        font-size: 1.2rem;
    }
}

/* === SHARE BUTTONS (blog articles) === */
.share-buttons {
    width: 100%;
    max-width: 720px;
    margin: 2rem auto 0;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.9rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.share-buttons-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #888;
    margin-right: 0.5rem;
}

.share-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: #555;
    text-decoration: none;
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    cursor: pointer;
    font-family: inherit;
}

.share-button:hover {
    color: #000;
    border-color: rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.85);
}

.share-button svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.share-button.copied {
    color: #2F7A3F;
    border-color: #2F7A3F;
}

/* === BLOG INDEX ===
   Cards are <a> elements wrapping all content. Browser user-agent rules
   for a:link / a:visited (specificity 0,1,1) outrank our class-based
   colours (0,1,0), so we explicitly define :link/:visited here. Children
   get their colours via .blog-card .child selectors (specificity 0,2,0)
   which beat any inherited link colour. */
.blog-index {
    width: 100%;
    max-width: 880px;
    margin: 2.5rem auto 4rem;
    padding: 0 1rem;
    box-sizing: border-box;
}

.blog-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.75rem;
    margin-top: 2.5rem;
}

a.blog-card,
a.blog-card:link,
a.blog-card:visited,
a.blog-card:hover,
a.blog-card:active {
    color: inherit;
    text-decoration: none;
}

.blog-card {
    display: block;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    padding: 2.25rem 2.25rem 2.5rem;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.blog-card:hover {
    border-color: rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.85);
}

.blog-card .blog-card-meta {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #888;
    margin: 0 0 1rem;
}

.blog-card .blog-card-title {
    font-size: 1.35rem;
    font-weight: 400;
    color: #000;
    margin: 0 0 1rem;
    line-height: 1.35;
}

.blog-card .blog-card-excerpt {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.7;
    margin: 0 0 1.6rem;
}

.blog-card .blog-card-readmore {
    display: inline-block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #000;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
}

.blog-empty {
    text-align: center;
    color: #888;
    font-size: 0.92rem;
    padding: 3rem 1rem;
    font-style: italic;
}

/* === FOOTER === */
.footer {
    padding: 2rem 2rem 5.5rem; /* extra bottom for sticky ad clearance */
    text-align: center;
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #999;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.4);
    margin-top: auto;
}

.footer a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s;
}

.footer a:hover {
    color: #000;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    opacity: 0;
    animation: fadeIn 1.2s ease-out forwards;
}

.fade-in-delay-1 { animation-delay: 0.2s; }
.fade-in-delay-2 { animation-delay: 0.4s; }
.fade-in-delay-3 { animation-delay: 0.6s; }
.fade-in-delay-4 { animation-delay: 0.8s; }

/* === THEME TOGGLE BUTTON (header) === */
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: inherit;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
    flex-shrink: 0;
    border-radius: 0;
}

.theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.4);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
    fill: none;
}

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

/* === DARK THEME === */
:root[data-theme="dark"] body {
    background: linear-gradient(180deg, #1a1a1a 0%, #0e0e0e 100%);
    color: #EAEAEA;
}

:root[data-theme="dark"] .header {
    background: rgba(20, 20, 20, 0.55);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .brand {
    color: #EAEAEA;
}

:root[data-theme="dark"] .lang-switcher a {
    color: #777;
}
:root[data-theme="dark"] .lang-switcher a:hover,
:root[data-theme="dark"] .lang-switcher a.active {
    color: #EAEAEA;
}
:root[data-theme="dark"] .lang-switcher a.active {
    border-bottom-color: #EAEAEA;
}

:root[data-theme="dark"] .theme-toggle {
    border-color: rgba(255, 255, 255, 0.2);
}
:root[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.4);
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

:root[data-theme="dark"] .hero p {
    color: #999;
}

:root[data-theme="dark"] .tool-card {
    background: rgba(28, 28, 28, 0.7);
    border-color: rgba(255, 255, 255, 0.08);
    color: #EAEAEA;
}
:root[data-theme="dark"] .tool-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(35, 35, 35, 0.9);
}
:root[data-theme="dark"] .tool-card::before {
    background: linear-gradient(90deg, transparent, #EAEAEA, transparent);
}
:root[data-theme="dark"] .tool-card-desc {
    color: #999;
}
:root[data-theme="dark"] .tool-card-tag {
    color: #777;
}

:root[data-theme="dark"] .tool {
    background: rgba(28, 28, 28, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .tool-output {
    background: #1f1f1f;
    border-color: rgba(255, 255, 255, 0.1);
    color: #EAEAEA;
}
:root[data-theme="dark"] .tool-output.empty {
    color: #777;
}

:root[data-theme="dark"] .btn {
    border-color: #EAEAEA;
    color: #EAEAEA;
}
:root[data-theme="dark"] .btn:hover {
    background: #EAEAEA;
    color: #0a0a0a;
}
:root[data-theme="dark"] .btn-primary {
    background: #EAEAEA;
    color: #0a0a0a;
}
:root[data-theme="dark"] .btn-primary:hover {
    background: transparent;
    color: #EAEAEA;
}
:root[data-theme="dark"] .btn-ghost {
    border-color: rgba(255, 255, 255, 0.2);
    color: #999;
}
:root[data-theme="dark"] .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #EAEAEA;
}

:root[data-theme="dark"] .control-row {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .control-label {
    color: #999;
}

:root[data-theme="dark"] .slider {
    background: #EAEAEA;
}
:root[data-theme="dark"] .slider::-webkit-slider-thumb {
    background: #EAEAEA;
}
:root[data-theme="dark"] .slider::-moz-range-thumb {
    background: #EAEAEA;
}

:root[data-theme="dark"] .toggle {
    background: rgba(255, 255, 255, 0.15);
}
:root[data-theme="dark"] .toggle.active {
    background: #EAEAEA;
}
:root[data-theme="dark"] .toggle::after {
    background: #1a1a1a;
}
:root[data-theme="dark"] .toggle.active::after {
    background: #000;
}

:root[data-theme="dark"] .field-label {
    color: #999;
}

:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea {
    background-color: #1f1f1f;
    border-color: rgba(255, 255, 255, 0.2);
    color: #EAEAEA;
}
:root[data-theme="dark"] .input:focus,
:root[data-theme="dark"] .select:focus,
:root[data-theme="dark"] .textarea:focus {
    border-color: #EAEAEA;
}
:root[data-theme="dark"] .select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='none' stroke='%23EAEAEA' stroke-width='1.2' d='M1 1l5 5 5-5'/></svg>");
}

:root[data-theme="dark"] .tabs {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .tab {
    color: #777;
}
:root[data-theme="dark"] .tab:hover {
    color: #EAEAEA;
}
:root[data-theme="dark"] .tab.active {
    color: #EAEAEA;
    border-bottom-color: #EAEAEA;
}

:root[data-theme="dark"] .swatch {
    border-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .qr-preview {
    /* Garde le fond blanc — un QR code doit rester scannable */
    background: #FFF;
    border-color: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .calc-display {
    background: #1f1f1f;
    border-color: rgba(255, 255, 255, 0.1);
}
:root[data-theme="dark"] .calc-expr {
    color: #777;
}
:root[data-theme="dark"] .calc-result {
    color: #EAEAEA;
}
:root[data-theme="dark"] .calc-angle button {
    border-color: rgba(255, 255, 255, 0.15);
    color: #999;
}
:root[data-theme="dark"] .calc-angle button.active {
    background: #EAEAEA;
    color: #0a0a0a;
    border-color: #EAEAEA;
}
:root[data-theme="dark"] .calc-key {
    background: #1f1f1f;
    border-color: rgba(255, 255, 255, 0.12);
    color: #EAEAEA;
}
:root[data-theme="dark"] .calc-key:hover {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.3);
}
:root[data-theme="dark"] .calc-key:active {
    background: #1a1a1a;
}
:root[data-theme="dark"] .calc-key--op {
    color: #BBB;
}
:root[data-theme="dark"] .calc-key--func {
    color: #CCC;
}
:root[data-theme="dark"] .calc-key--clear {
    color: #E66;
}
:root[data-theme="dark"] .calc-key--equals {
    background: #EAEAEA;
    color: #0a0a0a;
    border-color: #EAEAEA;
}
:root[data-theme="dark"] .calc-key--equals:hover {
    background: #FFF;
    border-color: #FFF;
}

:root[data-theme="dark"] .md-preview {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #EAEAEA;
}
:root[data-theme="dark"] .md-preview h1,
:root[data-theme="dark"] .md-preview h2,
:root[data-theme="dark"] .md-preview h3 {
    color: #EAEAEA;
}
:root[data-theme="dark"] .md-preview code,
:root[data-theme="dark"] .md-preview pre {
    background: rgba(255, 255, 255, 0.06);
}
:root[data-theme="dark"] .md-preview blockquote {
    border-left-color: #EAEAEA;
    color: #999;
}
:root[data-theme="dark"] .md-preview a {
    color: #EAEAEA;
}

:root[data-theme="dark"] .strength {
    color: #999;
}
:root[data-theme="dark"] .strength-bar {
    background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .ad-banner {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #555;
}

:root[data-theme="dark"] .ad-sticky {
    background: rgba(15, 15, 15, 0.95);
    border-top-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}
:root[data-theme="dark"] .ad-sticky-inner {
    border-color: rgba(255, 255, 255, 0.1);
    color: #555;
}
:root[data-theme="dark"] .ad-sticky-close {
    color: #777;
}
:root[data-theme="dark"] .ad-sticky-close:hover {
    color: #EAEAEA;
}

:root[data-theme="dark"] .lang-suggest {
    background: #EAEAEA;
    color: #0a0a0a;
}
:root[data-theme="dark"] .lang-suggest a {
    color: #0a0a0a;
}
:root[data-theme="dark"] .lang-suggest button {
    border-color: rgba(0, 0, 0, 0.3);
    color: #0a0a0a;
}
:root[data-theme="dark"] .lang-suggest button:hover {
    background: #0a0a0a;
    color: #EAEAEA;
}

:root[data-theme="dark"] .legal {
    background: rgba(28, 28, 28, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
    color: #BBB;
}
:root[data-theme="dark"] .legal h2 {
    color: #EAEAEA;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .legal h3 {
    color: #EAEAEA;
}
:root[data-theme="dark"] .legal a {
    color: #EAEAEA;
}
:root[data-theme="dark"] .legal-meta {
    color: #888;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .legal-table th,
:root[data-theme="dark"] .legal-table td {
    border-color: rgba(255, 255, 255, 0.1);
}
:root[data-theme="dark"] .legal-table th {
    background: rgba(255, 255, 255, 0.04);
}

:root[data-theme="dark"] .explainer {
    color: #BBB;
}
:root[data-theme="dark"] .explainer h2,
:root[data-theme="dark"] .explainer h3 {
    color: #EAEAEA;
}

:root[data-theme="dark"] .faq {
    color: #BBB;
}
:root[data-theme="dark"] .faq h2 {
    color: #EAEAEA;
}
:root[data-theme="dark"] .faq details {
    border-top-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .faq details:last-of-type {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .faq summary {
    color: #EAEAEA;
}
:root[data-theme="dark"] .faq summary:hover {
    color: #999;
}
:root[data-theme="dark"] .faq summary::after {
    color: #777;
}
:root[data-theme="dark"] .faq summary:hover::after {
    color: #999;
}
:root[data-theme="dark"] .faq details > p,
:root[data-theme="dark"] .faq details > ul {
    color: #BBB;
}
:root[data-theme="dark"] .faq details p code {
    background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .affiliate-section {
    color: #BBB;
}
:root[data-theme="dark"] .affiliate-section h2 {
    color: #EAEAEA;
}
:root[data-theme="dark"] .affiliate-disclosure {
    color: #777;
    border-top-color: rgba(255, 255, 255, 0.08);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .affiliate-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .affiliate-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
}
:root[data-theme="dark"] .affiliate-card-name {
    color: #EAEAEA;
}
:root[data-theme="dark"] .affiliate-card-tagline {
    color: #777;
}
:root[data-theme="dark"] .affiliate-card-features li::before {
    color: #777;
}
:root[data-theme="dark"] .affiliate-card-price {
    color: #BBB;
}
:root[data-theme="dark"] .affiliate-card-price strong {
    color: #EAEAEA;
}
:root[data-theme="dark"] .affiliate-card-cta {
    background: #EAEAEA;
    color: #0F0F0F;
}
:root[data-theme="dark"] .affiliate-card-mention {
    color: #777;
}
:root[data-theme="dark"] .affiliate-card-mention a {
    color: #BBB;
}

:root[data-theme="dark"] .nav-primary a { color: #777; }
:root[data-theme="dark"] .nav-primary a:hover { color: #EAEAEA; }
:root[data-theme="dark"] .nav-primary a.active {
    color: #EAEAEA;
    border-bottom-color: #EAEAEA;
}

:root[data-theme="dark"] .share-buttons {
    border-top-color: rgba(255, 255, 255, 0.08);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .share-buttons-label { color: #777; }
:root[data-theme="dark"] .share-button {
    color: #BBB;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}
:root[data-theme="dark"] .share-button:hover {
    color: #EAEAEA;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}
:root[data-theme="dark"] .share-button.copied {
    color: #4ADE80;
    border-color: #4ADE80;
}

:root[data-theme="dark"] a.blog-card,
:root[data-theme="dark"] a.blog-card:link,
:root[data-theme="dark"] a.blog-card:visited,
:root[data-theme="dark"] a.blog-card:hover,
:root[data-theme="dark"] a.blog-card:active {
    color: inherit;
}
:root[data-theme="dark"] .blog-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .blog-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.25);
}
:root[data-theme="dark"] .blog-card .blog-card-meta { color: #777; }
:root[data-theme="dark"] .blog-card .blog-card-title { color: #EAEAEA; }
:root[data-theme="dark"] .blog-card .blog-card-excerpt { color: #BBB; }
:root[data-theme="dark"] .blog-card .blog-card-readmore { color: #EAEAEA; }
:root[data-theme="dark"] .blog-empty { color: #777; }

:root[data-theme="dark"] .footer {
    background: rgba(15, 15, 15, 0.4);
    border-top-color: rgba(255, 255, 255, 0.05);
    color: #777;
}
:root[data-theme="dark"] .footer a {
    color: #777;
}
:root[data-theme="dark"] .footer a:hover {
    color: #EAEAEA;
}

/* Inline-styled secondary labels (color converter) — boost contrast in dark mode.
   Inline styles win over class selectors, so we need !important to override them. */
:root[data-theme="dark"] [style*="color:#666"] { color: #999 !important; }
:root[data-theme="dark"] [style*="color:#555"] { color: #BBB !important; }

/* === RESPONSIVE === */
@media (max-width: 720px) {
    .header {
        padding: 0.65rem 1rem;
    }

    .brand-mark {
        width: 28px;
        height: 28px;
    }

    .brand-name {
        font-size: 0.7rem;
        letter-spacing: 0.18em;
    }

    .main {
        padding: 1.5rem 1rem 6rem;
    }

    .main--tool {
        padding-top: 1rem;
    }

    .hero {
        margin-bottom: 1.5rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .tool {
        padding: 1.5rem 1rem;
    }

    .tool-output {
        font-size: 1rem;
        padding: 1rem;
    }

    .tagline {
        font-size: 0.75rem;
        letter-spacing: 0.22em;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .tool-card {
        padding: 1.5rem 1.25rem;
    }

    .control-row {
        flex-wrap: wrap;
    }

    .slider {
        flex: 1 1 100%;
        margin: 0.5rem 0;
    }

    .lang-switcher {
        font-size: 0.7rem;
        letter-spacing: 0.18em;
        gap: 0.65rem;
    }

    .theme-toggle {
        margin-left: 0.65rem;
        width: 30px;
        height: 30px;
    }

    .ad-banner {
        margin: 2rem auto;
    }

    .ad-sticky {
        min-height: 56px;
    }

    .footer {
        padding: 1.5rem 1rem 5rem;
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.55rem 0.85rem;
    }

    /* Hide brand text on very small screens — keep the mark only */
    .brand-name {
        display: none;
    }

    .hero h1 {
        font-size: 1.3rem;
    }

    .tool-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .lang-suggest {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
        font-size: 0.7rem;
        padding: 0.7rem 1rem;
    }
}
