/* =========================================================
   TCDevHub — JSON Toolkit
   Tema claro + escuro | Responsivo | Acessível
   Compatível com o HTML atual e com o theme.js global
========================================================= */

/* RESET */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

:root {
    color-scheme: light;

    --tool-bg: var(--bg, #f7f9fc);
    --tool-surface: var(--surface, #ffffff);
    --tool-surface-soft: var(--surface-soft, #fbfcfe);
    --tool-surface-muted: var(--surface-hover, #f1f5f9);

    --tool-border: var(--border, #e1e7ef);
    --tool-border-soft: var(--border-soft, #e8edf3);
    --tool-border-input: var(--border, #d5dde8);
    --tool-border-hover: var(--border-strong, #b8c5d6);

    --tool-text: var(--text, #111827);
    --tool-text-strong: var(--text-strong, #0f172a);
    --tool-text-body: var(--text-secondary, #334155);
    --tool-text-muted: var(--text-secondary, #64748b);
    --tool-text-light: var(--text-muted, #94a3b8);
    --tool-placeholder: var(--text-muted, #9ca3af);

    --tool-blue: var(--accent, #2563eb);
    --tool-blue-dark: var(--button-primary-hover, #1d4ed8);
    --tool-blue-soft: var(--accent-soft, rgba(37, 99, 235, .08));
    --tool-blue-border: var(--accent-border, #93c5fd);

    --tool-header-bg: var(--header-bg, rgba(255, 255, 255, .92));
    --tool-footer-bg: var(--surface, #ffffff);

    --tool-shadow: var(--shadow-sm, rgba(15, 23, 42, .04));
    --tool-focus-shadow: var(--accent-soft, rgba(37, 99, 235, .12));

    --tool-success: #15803d;
    --tool-success-bg: #f0fdf4;
    --tool-error: #b91c1c;
    --tool-error-bg: #fef2f2;
}

[data-theme="dark"] {
    color-scheme: dark;

    --tool-bg: var(--bg, #202124);
    --tool-surface: var(--surface, #292a2d);
    --tool-surface-soft: var(--surface-soft, #252629);
    --tool-surface-muted: var(--surface-hover, #303134);

    --tool-border: var(--border, #3c4043);
    --tool-border-soft: var(--border-soft, #3c4043);
    --tool-border-input: var(--border, #5f6368);
    --tool-border-hover: var(--border-strong, #80868b);

    --tool-text: var(--text, #e8eaed);
    --tool-text-strong: var(--text-strong, #f8f9fa);
    --tool-text-body: var(--text-secondary, #e8eaed);
    --tool-text-muted: var(--text-secondary, #bdc1c6);
    --tool-text-light: var(--text-muted, #9aa0a6);
    --tool-placeholder: var(--text-muted, #80868b);

    --tool-blue: var(--accent, #8ab4f8);
    --tool-blue-dark: var(--button-primary-hover, #aecbfa);
    --tool-blue-soft: var(--accent-soft, rgba(138, 180, 248, .12));
    --tool-blue-border: var(--accent-border, #8ab4f8);

    --tool-header-bg: var(--header-bg, rgba(32, 33, 36, .94));
    --tool-footer-bg: var(--surface, #202124);

    --tool-shadow: var(--shadow-sm, rgba(0, 0, 0, .20));
    --tool-focus-shadow: var(--accent-soft, rgba(138, 180, 248, .12));

    --tool-success: #81c995;
    --tool-success-bg: #1e3528;
    --tool-error: #f28b82;
    --tool-error-bg: #3c2525;
}

/* BASE */

body {
    min-height: 100vh;
    background: var(--tool-bg);
    color: var(--tool-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color .2s ease, color .2s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
textarea,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

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

[hidden] {
    display: none !important;
}

/* ACESSIBILIDADE */

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 1000;
    padding: 10px 14px;
    background: var(--tool-surface);
    color: var(--tool-text-strong);
    border: 1px solid var(--tool-border);
    border-radius: 7px;
}

.skip-link:focus {
    top: 12px;
}

/* CABEÇALHO */

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

.header-inner {
    width: min(1180px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.logo img {
    display: block;
    width: 178px;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}

/* Não aplicar filtros às logos.
   O theme.js global seleciona o SVG correto para cada tema. */

/* CONTEÚDO PRINCIPAL */

main {
    width: 100%;
}

.hero,
.workspace-section,
.features-section,
.faq-section {
    width: min(1080px, calc(100% - 48px));
    margin-right: auto;
    margin-left: auto;
}

/* HERO */

.hero {
    min-height: 330px;
    padding: 66px 0 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.hero-copy {
    flex: 1;
    min-width: 0;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--tool-blue);
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
}

.eyebrow-dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    background: var(--tool-blue);
    border-radius: 50%;
}

.hero h1 {
    margin-top: 15px;
    color: var(--tool-text-strong);
    font-size: clamp(42px, 6vw, 62px);
    font-weight: 750;
    line-height: 1.05;
    letter-spacing: -.055em;
    overflow-wrap: anywhere;
}

.title-period {
    color: var(--tool-blue);
}

.hero-description {
    max-width: 600px;
    margin-top: 19px;
    color: var(--tool-text-muted);
    font-size: 15px;
    line-height: 1.8;
}

.hero-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 23px;
}

.hero-meta span {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    background: var(--tool-surface);
    color: var(--tool-text-muted);
    border: 1px solid var(--tool-border);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 500;
}

/* ILUSTRAÇÃO */

.hero-mark {
    position: relative;
    width: 210px;
    height: 210px;
    flex: 0 0 210px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-mark-card {
    width: 150px;
    height: 166px;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    padding: 20px;
    background: var(--tool-surface);
    border: 1px solid var(--tool-border);
    border-radius: 12px;
    box-shadow: 0 16px 40px var(--tool-shadow);
    transform: rotate(3deg);
}

.hero-mark-card > span {
    margin-bottom: 4px;
    color: var(--tool-blue);
    font-family: "IBM Plex Mono", monospace;
    font-size: 35px;
    font-weight: 600;
    line-height: 1;
}

.hero-mark-card i {
    display: block;
    width: 100%;
    height: 5px;
    background: var(--tool-border);
    border-radius: 5px;
}

.hero-mark-card i:nth-of-type(2) {
    width: 72%;
}

.hero-mark-card i:nth-of-type(3) {
    width: 86%;
}

.hero-mark-badge {
    position: absolute;
    right: 0;
    bottom: 24px;
    padding: 9px 13px;
    background: var(--tool-blue);
    color: #ffffff;
    border: 4px solid var(--tool-bg);
    border-radius: 7px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
}

/* TÍTULOS DE SEÇÃO */

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.section-heading > div {
    min-width: 0;
}

.section-heading h2 {
    color: var(--tool-text-strong);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.035em;
}

.section-heading p {
    margin-top: 6px;
    color: var(--tool-text-muted);
    font-size: 13px;
    line-height: 1.7;
}

/* BOTÕES */

.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    background: var(--tool-surface);
    color: var(--tool-text-body);
    border: 1px solid var(--tool-border);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease,
        border-color .18s ease, transform .18s ease;
}

.button:hover:not(:disabled) {
    background: var(--tool-surface-muted);
    border-color: var(--tool-border-hover);
}

.button:active:not(:disabled) {
    transform: translateY(1px);
}

.button-primary {
    background: var(--tool-blue);
    color: #ffffff;
    border-color: var(--tool-blue);
}

.button-primary:hover:not(:disabled) {
    background: var(--tool-blue-dark);
    color: #ffffff;
    border-color: var(--tool-blue-dark);
}

.button-quiet {
    background: transparent;
    border-color: transparent;
}

.button-quiet:hover:not(:disabled) {
    background: var(--tool-surface-muted);
    border-color: var(--tool-border);
}

.button-small {
    min-height: 35px;
    padding: 0 11px;
    font-size: 11px;
}

.button-icon {
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 600;
}

/* ÁREA DE TRABALHO */

.workspace-section {
    padding-top: 18px;
}

.tool-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
    align-items: stretch;
    gap: 17px;
    padding: 20px;
    background: var(--tool-surface);
    border: 1px solid var(--tool-border);
    border-radius: 10px;
    box-shadow: 0 8px 28px var(--tool-shadow);
}

.editor-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.editor-topline {
    min-height: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.editor-topline label {
    color: var(--tool-text-body);
    font-size: 12px;
    font-weight: 700;
}

.editor-caption {
    color: var(--tool-text-light);
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
    text-align: right;
}

.editor-panel textarea {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 290px;
    flex: 1;
    padding: 14px;
    resize: vertical;
    background: var(--tool-surface-soft);
    color: var(--tool-text-strong);
    border: 1px solid var(--tool-border-input);
    border-radius: 7px;
    outline: none;
    font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
    line-height: 1.8;
    tab-size: 2;
    transition: border-color .18s ease, background-color .18s ease,
        box-shadow .18s ease;
}

.editor-panel textarea:hover {
    border-color: var(--tool-border-hover);
}

.editor-panel textarea:focus {
    background: var(--tool-surface);
    border-color: var(--tool-blue-border);
    box-shadow: 0 0 0 3px var(--tool-focus-shadow);
}

.editor-panel textarea::placeholder {
    color: var(--tool-placeholder);
    opacity: 1;
}

.editor-panel textarea[readonly] {
    cursor: default;
}

.editor-panel textarea[readonly]:focus {
    background: var(--tool-surface-soft);
    box-shadow: none;
}

.editor-footer {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 9px;
    color: var(--tool-text-light);
    font-family: "IBM Plex Mono", monospace;
    font-size: 9px;
}

.editor-footer > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.editor-footer #input-help {
    font-family: Inter, sans-serif;
    font-size: 10px;
}

#input-count,
#output-count {
    flex-shrink: 0;
    text-align: right;
}

/* PAINEL DE AÇÕES */

.action-rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 35px;
}

.action-rail .button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 0 8px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.action-rail .button-icon {
    flex-shrink: 0;
}

.action-divider {
    height: 1px;
    flex-shrink: 0;
    margin: 5px 0;
    background: var(--tool-border-soft);
}

/* RESULTADO */

.output-panel {
    min-width: 0;
}

.status {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tool-text-muted);
    font-family: Inter, sans-serif;
    font-size: 10px;
}

.status-indicator {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    background: var(--tool-text-light);
    border-radius: 50%;
}

.status.success {
    color: var(--tool-success);
}

.status.success .status-indicator {
    background: var(--tool-success);
}

.status.error {
    color: var(--tool-error);
}

.status.error .status-indicator {
    background: var(--tool-error);
}

.output-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding-top: 5px;
}

.output-actions .button {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
}

/* PRIVACIDADE */

.privacy-note {
    margin-top: 15px;
    padding: 13px 15px;
    background: var(--tool-surface);
    color: var(--tool-text-muted);
    border: 1px solid var(--tool-border-soft);
    border-radius: 7px;
    font-size: 11px;
    line-height: 1.8;
}

.privacy-note strong {
    color: var(--tool-text-body);
    font-weight: 650;
}

/* RECURSOS */

.features-section {
    padding-top: 82px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.feature-card {
    min-width: 0;
    padding: 19px 16px;
    background: var(--tool-surface);
    border: 1px solid var(--tool-border);
    border-radius: 9px;
    transition: border-color .18s ease, transform .18s ease;
}

.feature-card:hover {
    border-color: var(--tool-border-hover);
    transform: translateY(-2px);
}

.feature-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 17px;
    background: var(--tool-blue-soft);
    color: var(--tool-blue);
    border-radius: 7px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 13px;
    font-weight: 700;
}

.feature-card h3 {
    color: var(--tool-text-strong);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -.015em;
}

.feature-card p {
    margin-top: 8px;
    color: var(--tool-text-muted);
    font-size: 11px;
    line-height: 1.8;
}

/* PERGUNTAS FREQUENTES */

.faq-section {
    padding-top: 82px;
    padding-bottom: 90px;
}

.faq-list {
    border-top: 1px solid var(--tool-border);
}

.faq-list details {
    border-bottom: 1px solid var(--tool-border);
}

.faq-list summary {
    position: relative;
    padding: 19px 32px 19px 0;
    color: var(--tool-text-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

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

.faq-list summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 5px;
    color: var(--tool-text-muted);
    font-size: 20px;
    font-weight: 400;
    transform: translateY(-50%);
}

.faq-list details[open] summary::after {
    content: "−";
}

.faq-list details p {
    max-width: 780px;
    padding: 0 24px 19px 0;
    color: var(--tool-text-muted);
    font-size: 12px;
    line-height: 1.9;
}

/* RODAPÉ */

.site-footer {
    background: var(--tool-footer-bg);
    border-top: 1px solid var(--tool-border);
}

.footer-inner {
    width: min(1080px, calc(100% - 48px));
    min-height: 160px;
    margin: 0 auto;
    padding: 28px 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 28px;
    row-gap: 13px;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    grid-row: 1;
    justify-self: start;
}

.footer-brand img {
    display: block;
    width: 150px;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}

.footer-inner > p {
    color: var(--tool-text-muted);
    font-size: 11px;
    text-align: right;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.footer-links a {
    color: var(--tool-text-muted);
    font-size: 11px;
    transition: color .18s ease;
}

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

.footer-inner small {
    color: var(--tool-text-light);
    font-size: 10px;
    text-align: right;
}

/* FOCO ACESSÍVEL */

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--tool-blue);
    outline-offset: 3px;
}

/* MOVIMENTO REDUZIDO */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* TABLET */

@media (max-width: 900px) {
    .hero {
        gap: 20px;
    }

    .hero-mark {
        width: 165px;
        height: 180px;
        flex-basis: 165px;
    }

    .hero-mark-card {
        width: 125px;
        height: 145px;
        padding: 17px;
    }

    .tool-workspace {
        grid-template-columns: minmax(0, 1fr) 125px minmax(0, 1fr);
        gap: 12px;
        padding: 15px;
    }

    .action-rail .button {
        font-size: 10px;
    }

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

/* CELULARES E TABLETS PEQUENOS */

@media (max-width: 680px) {
    .header-inner {
        width: calc(100% - 32px);
        min-height: 64px;
    }

    .logo img {
        width: 155px;
    }

    .hero,
    .workspace-section,
    .features-section,
    .faq-section {
        width: calc(100% - 32px);
    }

    .hero {
        min-height: 0;
        padding: 39px 0 42px;
    }

    .hero-mark {
        display: none;
    }

    .hero h1 {
        font-size: clamp(39px, 10vw, 52px);
    }

    .hero-description {
        font-size: 14px;
    }

    .hero-meta {
        gap: 8px;
    }

    .section-heading {
        align-items: flex-start;
        gap: 12px;
    }

    .section-heading h2 {
        font-size: 18px;
    }

    .section-heading p {
        font-size: 12px;
    }

    .section-heading > .button {
        flex-shrink: 0;
    }

    .workspace-section {
        padding-top: 4px;
    }

    .tool-workspace {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        padding: 14px;
    }

    .editor-panel textarea {
        min-height: 220px;
        font-size: 11px;
    }

    .action-rail {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding-top: 0;
    }

    .action-rail .button {
        min-height: 40px;
        font-size: 11px;
    }

    .action-divider {
        display: none;
    }

    .output-actions {
        gap: 8px;
    }

    .output-actions .button {
        min-width: 0;
        white-space: normal;
    }

    .features-section,
    .faq-section {
        padding-top: 62px;
    }

    .faq-section {
        padding-bottom: 62px;
    }

    .footer-inner {
        width: calc(100% - 32px);
        min-height: 0;
        padding: 25px 0;
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .footer-brand {
        grid-row: auto;
    }

    .footer-inner > p,
    .footer-inner small {
        text-align: left;
    }
}

/* CELULARES PEQUENOS */

@media (max-width: 380px) {
    .hero,
    .workspace-section,
    .features-section,
    .faq-section {
        width: calc(100% - 24px);
    }

    .header-inner,
    .footer-inner {
        width: calc(100% - 24px);
    }

    .logo img {
        width: 140px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .hero-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading {
        flex-direction: column;
    }

    .section-heading > .button {
        align-self: flex-start;
    }

    .tool-workspace {
        padding: 10px;
    }

    .action-rail {
        grid-template-columns: 1fr;
    }

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

    .editor-footer {
        align-items: flex-start;
    }

    .editor-footer #input-help {
        max-width: 70%;
        overflow-wrap: anywhere;
    }
}
