/* Stackaris Text Case Converter — scoped, responsive, dependency-free */
.tc-tool {
    --tc-primary:     #2563eb;
    --tc-primary-2:   #14b8a6;
    --tc-accent:      #f97316;
    --tc-bg:          #f3f7fb;
    --tc-bg-soft:     #ffffff;
    --tc-card:        rgba(255, 255, 255, 0.94);
    --tc-input:       #fbfdff;
    --tc-text:        #111827;
    --tc-muted:       #637083;
    --tc-faint:       #93a1b3;
    --tc-border:      rgba(17, 24, 39, 0.1);
    --tc-shadow:      0 20px 54px rgba(15, 23, 42, 0.1);
    --tc-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --tc-radius:      14px;
    --tc-radius-sm:   8px;
    --tc-font:        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --tc-mono:        ui-monospace, "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
    background:
        linear-gradient(180deg, rgba(37, 99, 235, 0.07), transparent 300px),
        var(--tc-bg);
    color: var(--tc-text);
    font-family: var(--tc-font);
    line-height: 1.6;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100vw;
}

/* ── Dark theme ── */
.tc-tool[data-theme="dark"] {
    --tc-bg:      #0d1320;
    --tc-bg-soft: #111a2b;
    --tc-card:    rgba(18, 27, 44, 0.94);
    --tc-input:   rgba(10, 16, 28, 0.96);
    --tc-text:    #edf4ff;
    --tc-muted:   #afbacb;
    --tc-faint:   #78869b;
    --tc-border:  rgba(226, 232, 240, 0.12);
    --tc-shadow:      0 24px 60px rgba(0, 0, 0, 0.36);
    --tc-shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ── Reset ── */
.tc-tool,
.tc-tool *,
.tc-tool *::before,
.tc-tool *::after { box-sizing: border-box; }

.tc-tool h1,
.tc-tool h2,
.tc-tool h3,
.tc-tool p { margin-top: 0; }

.tc-sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
    clip: rect(0 0 0 0);
}

/* ── Shared eyebrow ── */
.tc-eyebrow {
    color: var(--tc-primary);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════
   HERO
═══════════════════════════════════════ */
.tc-hero {
    padding: 44px 20px 20px;
}

.tc-hero__inner,
.tc-workspace,
.tc-content,
.tc-faq,
.tc-related {
    margin-left: auto;
    margin-right: auto;
    max-width: 1240px;
    width: calc(100% - 40px);
}

.tc-hero h1 {
    color: var(--tc-text);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    letter-spacing: -0.01em;
    line-height: 1.06;
    margin-bottom: 14px;
    max-width: 820px;
}

.tc-hero p:not(.tc-eyebrow) {
    color: var(--tc-muted);
    font-size: 1rem;
    margin-bottom: 0;
    max-width: 780px;
}

/* ═══════════════════════════════════════
   AD SLOTS
═══════════════════════════════════════ */
.tc-ad-slot {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0)),
        var(--tc-card);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow-soft);
    color: var(--tc-faint);
    display: flex;
    gap: 10px;
    justify-content: center;
    min-height: 86px;
    padding: 16px;
    text-align: center;
}

.tc-tool[data-theme="dark"] .tc-ad-slot {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(20, 184, 166, 0.05)),
        var(--tc-card);
}

.tc-ad-slot span {
    border: 1px solid var(--tc-border);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    padding: 5px 9px;
    text-transform: uppercase;
}

.tc-ad-slot strong {
    color: var(--tc-muted);
    font-size: 0.9rem;
}

.tc-ad-slot--top,
.tc-ad-slot--wide {
    margin: 0 auto;
    max-width: 970px;
    width: calc(100% - 40px);
}

.tc-ad-slot--side {
    border-radius: 0 0 var(--tc-radius) var(--tc-radius);
    border-width: 1px 0 0;
    box-shadow: none;
    min-height: 140px;
}

.tc-ad-slot--wide {
    margin-bottom: 18px;
}

/* ═══════════════════════════════════════
   WORKSPACE GRID
═══════════════════════════════════════ */
.tc-workspace {
    align-items: stretch;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
    padding: 18px 0;
}

/* ── Shared card surface ── */
.tc-editor-panel,
.tc-side-panel {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0)),
        var(--tc-card);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow-soft);
}

.tc-tool[data-theme="dark"] .tc-editor-panel,
.tc-tool[data-theme="dark"] .tc-side-panel {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(20, 184, 166, 0.05)),
        var(--tc-card);
}

/* ═══════════════════════════════════════
   EDITOR PANEL
═══════════════════════════════════════ */
.tc-editor-panel {
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.tc-editor-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--tc-border);
    display: flex;
    gap: 14px;
    justify-content: space-between;
    padding: 16px 20px;
}

.tc-editor-toolbar__meta h2 {
    font-size: 1.02rem;
    line-height: 1.25;
    margin-bottom: 0;
}

.tc-editor-toolbar__controls {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

.tc-save-state {
    background: rgba(20, 184, 166, 0.12);
    border: 1px solid rgba(20, 184, 166, 0.24);
    border-radius: 999px;
    color: var(--tc-primary-2);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 7px 11px;
    white-space: nowrap;
}

/* Theme toggle */
.tc-theme-toggle {
    align-items: center;
    background: var(--tc-bg-soft);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    color: var(--tc-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    gap: 8px;
    min-height: 38px;
    padding: 7px 12px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.tc-theme-toggle:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
}

.tc-theme-toggle:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.32); outline-offset: 3px; }

.tc-theme-toggle__switch {
    background: linear-gradient(135deg, var(--tc-primary), var(--tc-primary-2));
    border-radius: 999px;
    flex-shrink: 0;
    height: 18px;
    position: relative;
    width: 34px;
}

.tc-theme-toggle__switch::after {
    background: #ffffff;
    border-radius: 50%;
    content: "";
    height: 14px;
    left: 2px;
    position: absolute;
    top: 2px;
    transition: transform 0.2s ease;
    width: 14px;
}

.tc-tool[data-theme="dark"] .tc-theme-toggle__switch::after {
    transform: translateX(16px);
}

/* ── Case buttons strip ── */
.tc-cases {
    border-bottom: 1px solid var(--tc-border);
    display: grid;
    gap: 7px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 12px 14px;
}

.tc-case-btn {
    align-items: center;
    background: var(--tc-bg-soft);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    color: var(--tc-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    justify-content: center;
    min-height: 36px;
    padding: 6px 8px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tc-case-btn--code {
    font-family: var(--tc-mono);
    font-size: 0.75rem;
}

.tc-case-btn:hover {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.32);
    color: var(--tc-primary);
    transform: translateY(-1px);
}

.tc-case-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.32); outline-offset: 3px; }

.tc-case-btn--active,
.tc-case-btn[aria-pressed="true"] {
    background: linear-gradient(135deg, var(--tc-primary), var(--tc-primary-2));
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.26);
    color: #ffffff;
    transform: translateY(-1px);
}

.tc-case-btn--active:hover,
.tc-case-btn[aria-pressed="true"]:hover {
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.34);
    transform: translateY(-2px);
}

/* ── Active case indicator ── */
.tc-active-case {
    align-items: center;
    background: rgba(37, 99, 235, 0.04);
    border-bottom: 1px solid var(--tc-border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 40px;
    padding: 8px 16px;
}

.tc-tool[data-theme="dark"] .tc-active-case {
    background: rgba(37, 99, 235, 0.08);
}

.tc-active-case__label {
    color: var(--tc-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.tc-active-case__example {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 6px;
    color: var(--tc-primary);
    display: block;
    font-family: var(--tc-mono);
    font-size: 0.76rem;
    font-weight: 700;
    max-width: 60%;
    overflow: hidden;
    padding: 3px 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-active-case__example:empty { display: none; }

/* ── Textarea ── */
.tc-editor {
    background: var(--tc-input);
    border: 0;
    border-bottom: 1px solid var(--tc-border);
    color: var(--tc-text);
    display: block;
    flex: 1 1 auto;
    font-family: var(--tc-font);
    font-size: 1.04rem;
    line-height: 1.78;
    min-height: 480px;
    padding: 22px 24px;
    resize: vertical;
    width: 100%;
}

.tc-editor::placeholder { color: var(--tc-faint); }

.tc-editor:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: -3px;
}

/* ── Editor footer ── */
.tc-editor-footer {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 16px;
}

.tc-counters {
    align-items: center;
    color: var(--tc-muted);
    display: flex;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 8px;
}

.tc-counters strong { color: var(--tc-text); }
.tc-counters__sep   { color: var(--tc-faint); }

.tc-footer-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tc-action-btn {
    align-items: center;
    background: var(--tc-bg-soft);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    color: var(--tc-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    justify-content: center;
    min-height: 36px;
    padding: 6px 13px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.tc-action-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
}

.tc-action-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.32); outline-offset: 3px; }

.tc-action-btn--primary {
    background: linear-gradient(135deg, var(--tc-primary), var(--tc-primary-2));
    border-color: transparent;
    color: #ffffff;
}

.tc-action-btn--primary:hover {
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.26);
    transform: translateY(-1px);
}

.tc-action-btn--upload {
    background: var(--tc-bg-soft);
    cursor: pointer;
}

.tc-action-btn--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.32);
    color: #dc2626;
}

/* ═══════════════════════════════════════
   STATS SIDEBAR
═══════════════════════════════════════ */
.tc-side-panel {
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.tc-side-panel__header {
    border-bottom: 1px solid var(--tc-border);
    padding: 17px 20px;
}

.tc-side-panel__header h2 {
    font-size: 1.02rem;
    line-height: 1.25;
    margin-bottom: 0;
}

.tc-stat-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
}

.tc-stat-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    min-height: 90px;
    padding: 13px;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.tc-tool[data-theme="dark"] .tc-stat-card {
    background: rgba(255, 255, 255, 0.04);
}

.tc-stat-card:hover {
    border-color: rgba(37, 99, 235, 0.3);
    transform: translateY(-2px);
}

.tc-stat-card span {
    color: var(--tc-muted);
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.tc-stat-card strong {
    color: var(--tc-text);
    display: block;
    font-size: clamp(1.15rem, 2.5vw, 1.72rem);
    font-weight: 900;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tc-stat-card small {
    color: var(--tc-faint);
    display: block;
    font-size: 0.72rem;
    font-weight: 750;
    margin-top: 6px;
}

.tc-stat-card--primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(20, 184, 166, 0.12));
}

.tc-tool[data-theme="dark"] .tc-stat-card--primary {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.22), rgba(20, 184, 166, 0.14));
}

/* ═══════════════════════════════════════
   SEO CONTENT SECTIONS
═══════════════════════════════════════ */
.tc-content,
.tc-faq,
.tc-related {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.72), rgba(255,255,255,0)),
        var(--tc-card);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow-soft);
    margin-bottom: 18px;
}

.tc-tool[data-theme="dark"] .tc-content,
.tc-tool[data-theme="dark"] .tc-faq,
.tc-tool[data-theme="dark"] .tc-related {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(20, 184, 166, 0.04)),
        var(--tc-card);
}

.tc-section-heading {
    border-bottom: 1px solid var(--tc-border);
    padding: 18px 22px;
}

.tc-section-heading h2 {
    font-size: 1.06rem;
    line-height: 1.25;
    margin-bottom: 0;
}

/* Content grids */
.tc-content__grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 18px 20px 20px;
}

.tc-content__grid--wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tc-content article {
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    padding: 16px;
}

.tc-tool[data-theme="dark"] .tc-content article {
    background: rgba(255, 255, 255, 0.04);
}

.tc-content h3 {
    font-size: 0.96rem;
    margin-bottom: 7px;
}

.tc-content p {
    color: var(--tc-muted);
    font-size: 0.92rem;
    margin-bottom: 0;
}

.tc-content em {
    color: var(--tc-text);
    font-family: var(--tc-mono);
    font-size: 0.86rem;
    font-style: normal;
}

/* Examples grid */
.tc-examples-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px 20px 20px;
}

.tc-example-card {
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    padding: 13px 14px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.tc-tool[data-theme="dark"] .tc-example-card {
    background: rgba(255, 255, 255, 0.04);
}

.tc-example-card:hover {
    border-color: rgba(37, 99, 235, 0.28);
    transform: translateY(-1px);
}

.tc-example-card__label {
    color: var(--tc-muted);
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.tc-example-card__text {
    color: var(--tc-primary);
    display: block;
    font-family: var(--tc-mono);
    font-size: 0.8rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── FAQ ── */
.tc-faq details {
    border-bottom: 1px solid var(--tc-border);
    padding: 0 22px;
}

.tc-faq details:last-child { border-bottom: 0; }

.tc-faq summary {
    color: var(--tc-text);
    cursor: pointer;
    font-size: 0.96rem;
    font-weight: 850;
    list-style: none;
    padding: 16px 0;
    position: relative;
    padding-right: 28px;
}

.tc-faq summary::-webkit-details-marker { display: none; }

.tc-faq summary::after {
    border-bottom: 2px solid var(--tc-primary);
    border-right: 2px solid var(--tc-primary);
    content: "";
    height: 8px;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.2s ease;
    width: 8px;
}

.tc-faq details[open] summary::after {
    transform: translateY(-35%) rotate(-135deg);
}

.tc-faq summary:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.32); outline-offset: 3px; }

.tc-faq details p {
    color: var(--tc-muted);
    font-size: 0.94rem;
    margin-bottom: 17px;
}

/* ── Related tools ── */
.tc-related__grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 18px 20px 20px;
}

.tc-related a {
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius-sm);
    color: var(--tc-primary);
    display: block;
    font-weight: 850;
    padding: 16px;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.tc-tool[data-theme="dark"] .tc-related a {
    background: rgba(255, 255, 255, 0.04);
}

.tc-related a:hover {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.28);
    transform: translateY(-2px);
}

.tc-related a:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.32); outline-offset: 3px; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 1080px) {
    .tc-workspace {
        grid-template-columns: minmax(0, 1.5fr) minmax(290px, 0.75fr);
    }
    .tc-cases {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    .tc-examples-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 880px) {
    .tc-workspace {
        grid-template-columns: 1fr;
    }
    .tc-cases {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .tc-hero { padding-top: 28px; }

    .tc-hero__inner,
    .tc-workspace,
    .tc-content,
    .tc-faq,
    .tc-related,
    .tc-ad-slot--top,
    .tc-ad-slot--wide {
        width: calc(100% - 24px);
    }

    .tc-editor-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .tc-editor-toolbar__controls {
        width: 100%;
    }

    .tc-theme-toggle {
        flex: 1;
        justify-content: center;
    }

    .tc-cases {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        padding: 10px;
    }

    .tc-editor {
        font-size: 1rem;
        min-height: 360px;
        padding: 18px;
    }

    .tc-editor-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .tc-footer-actions {
        width: 100%;
    }

    .tc-action-btn {
        flex: 1;
        justify-content: center;
    }

    .tc-content__grid,
    .tc-content__grid--wide {
        grid-template-columns: 1fr;
    }

    .tc-examples-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tc-related__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .tc-cases {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tc-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tc-examples-grid {
        grid-template-columns: 1fr;
    }

    .tc-related__grid {
        grid-template-columns: 1fr;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .tc-tool *,
    .tc-tool *::before,
    .tc-tool *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
