/* ==========================================================================
   Duarte — Portfólio de Desenvolvimento Web
   Design system: minimalista, tema escuro inspirado em editor de código.
   ========================================================================== */

:root {
    --bg: #0b0f14;
    --bg-alt: #0e141c;
    --surface: #131a24;
    --surface-hover: #182130;
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .16);
    --text: #e6edf3;
    --text-muted: #8b98a5;
    --accent: #34e0a1;
    --accent-strong: #1fbf87;
    --accent-2: #7c8cff;
    --danger: #ff6b6b;
    --radius: 12px;
    --radius-sm: 8px;
    --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --max-width: 1120px;
    --shadow: 0 20px 40px -20px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(124, 140, 255, .08), transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(52, 224, 161, .07), transparent 40%);
    color: var(--text);
    font-family: var(--sans);
    font-size: 1rem; /* escala com o controle de fonte do painel de acessibilidade */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

h1, h2, h3, h4 {
    font-family: var(--sans);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 .5em;
    letter-spacing: -.02em;
}

code, .mono { font-family: var(--mono); }

.wrap {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* -- Eyebrow / section labels, styled like a code comment -------------- */
.eyebrow {
    display: inline-block;
    font-family: var(--mono);
    font-size: .82rem;
    color: var(--accent);
    background: rgba(52, 224, 161, .08);
    border: 1px solid rgba(52, 224, 161, .25);
    border-radius: 999px;
    padding: .3em .9em;
    margin-bottom: 1em;
}

.eyebrow::before { content: '// '; color: var(--text-muted); }

/* -- Header / nav -------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(11, 15, 20, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.logo {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .5em;
}

.logo .brackets { color: var(--accent); }

.logo-img { max-height: 36px; width: auto; display: block; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-links a {
    color: var(--text-muted);
    font-size: .95rem;
    font-weight: 500;
}

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

.nav-links a.is-active { color: var(--accent); }

/* Botão "Fale comigo" do menu: texto preto, #e6edf3 ao passar o mouse. */
.nav-links a.btn-primary { color: #000; }
.nav-links a.btn-primary:hover { color: #e6edf3; }

.header-tools { display: flex; align-items: center; gap: 10px; position: relative; }

/* -- Painel de acessibilidade ------------------------------------------- */
.a11y-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(300px, 88vw);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
}

.a11y-panel[hidden] { display: none; }

.a11y-title {
    margin: 0 0 4px;
    font-family: var(--mono);
    font-size: .85rem;
    color: var(--accent);
}

.a11y-font {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.a11y-font-value { font-family: var(--mono); font-size: .85rem; color: var(--text-muted); }

.a11y-step, .a11y-option, .a11y-reset {
    font-family: var(--sans);
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .55em .9em;
    cursor: pointer;
    text-align: left;
}

.a11y-step { min-width: 56px; text-align: center; }

.a11y-step:hover, .a11y-option:hover, .a11y-reset:hover,
.a11y-step:focus-visible, .a11y-option:focus-visible, .a11y-reset:focus-visible {
    border-color: var(--accent);
}

.a11y-option[aria-pressed="true"] {
    border-color: var(--accent);
    background: rgba(52, 224, 161, .12);
    color: var(--accent);
}

.a11y-reset { margin-top: 4px; color: var(--text-muted); text-align: center; }

/* Modos ativados pelo painel (classes aplicadas no <html>) */
html.a11y-contrast {
    --bg: #000; --bg-alt: #000; --surface: #000; --surface-hover: #111;
    --text: #fff; --text-muted: #fff;
    --accent: #ffea00; --accent-strong: #ffd400; --accent-2: #7fdbff;
    --border: #fff; --border-strong: #fff;
}
html.a11y-contrast body { background-image: none; }
html.a11y-contrast .site-header { background: #000; }
html.a11y-contrast .nav-links a.btn-primary:hover { color: #000; }

html.a11y-gray { filter: grayscale(1); }

html.a11y-links a { text-decoration: underline !important; }

html.a11y-dyslexia { --sans: Verdana, Tahoma, 'Trebuchet MS', sans-serif; }
html.a11y-dyslexia body { line-height: 1.85; word-spacing: .12em; }
html.a11y-dyslexia * { letter-spacing: .03em !important; }

html.a11y-still *, html.a11y-still *::before, html.a11y-still *::after {
    animation: none !important;
    transition: none !important;
}
html.a11y-still { scroll-behavior: auto; }

.a11y-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.a11y-toggle:hover, .a11y-toggle:focus-visible { border-color: var(--accent); color: var(--accent); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: .4em .6em;
    font-size: 1.1rem;
    cursor: pointer;
}

/* -- Buttons --------------------------------------------------------------*/
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5em;
    font-family: var(--sans);
    font-weight: 600;
    font-size: .95rem;
    padding: .75em 1.5em;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--accent);
    color: #04140d;
}

.btn-primary:hover { background: var(--accent-strong); color: #04140d; }

.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

.btn-sm { padding: .45em 1em; font-size: .85rem; }
.btn-danger { background: transparent; border-color: rgba(255,107,107,.4); color: var(--danger); }
.btn-danger:hover { background: rgba(255,107,107,.1); border-color: var(--danger); }

/* -- Hero ------------------------------------------------------------------*/
.hero {
    padding: 96px 0 72px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
}

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

@keyframes blink { 50% { opacity: 0; } }

.hero p.lead {
    max-width: 640px;
    margin: 0 auto 2em;
    color: var(--text-muted);
    font-size: 1.15rem;
}

.hero-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* -- Terminal-window card motif --------------------------------------------*/
.terminal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--text-muted);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }

.terminal-body { padding: 24px; }

/* -- Section --------------------------------------------------------------*/
.section { padding: 72px 0; }
.section-head { text-align: center; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-head p { color: var(--text-muted); max-width: 560px; margin: 0 auto; }

.section-foot { text-align: center; margin-top: 40px; }

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, transform .15s ease;
}

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

.card-media {
    aspect-ratio: 16 / 9;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: .85rem;
    overflow: hidden;
}

.card-media img { width: 100%; height: 100%; object-fit: cover; }

.card-body { padding: 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.card-body h3 { font-size: 1.15rem; margin: 0; }
.card-body h3 a { color: var(--text); }
.card-body h3 a:hover { color: var(--accent); }

.card-body p { color: var(--text-muted); margin: 0; font-size: .95rem; }

.card-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .82rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* -- Cartão de projeto: imagem de fundo por baixo, logo PNG por cima ---------- */
/* Grade de projetos e de posts: cards pequenos, 3 por linha; a última linha
   incompleta fica centralizada. O Blog (.post-grid/.post-card) segue a mesma
   estrutura de tamanho e centralização usada nos Projetos. */
.project-grid, .post-grid {
    --project-gap: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--project-gap);
    max-width: 960px;
    margin: 0 auto;
}

.project-grid > .project-card, .post-grid > .post-card {
    flex: 0 0 calc((100% - 2 * var(--project-gap)) / 3);
    max-width: calc((100% - 2 * var(--project-gap)) / 3);
}

@media (max-width: 820px) {
    .project-grid > .project-card, .post-grid > .post-card {
        flex-basis: calc((100% - var(--project-gap)) / 2);
        max-width: calc((100% - var(--project-gap)) / 2);
    }
}

@media (max-width: 520px) {
    .project-grid > .project-card, .post-grid > .post-card { flex-basis: 100%; max-width: 100%; }
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, transform .15s ease;
}

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

.project-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background-color: var(--bg-alt);
    background-size: cover;
    background-position: center;
    overflow: hidden;
    color: var(--text);
}

/* Camada escura suave entre o fundo e a logo, para a logo ganhar destaque. */
.project-cover::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(11, 15, 20, .25), rgba(11, 15, 20, .55));
}

.project-cover.no-bg {
    background-image:
        radial-gradient(circle at 20% 15%, rgba(124, 140, 255, .25), transparent 55%),
        radial-gradient(circle at 85% 85%, rgba(52, 224, 161, .2), transparent 55%);
}

.project-cover.no-bg::before { display: none; }

.project-logo {
    position: relative;
    z-index: 1;
    max-width: 70%;
    max-height: 70%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .45));
}

.project-logo-text {
    position: relative;
    z-index: 1;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
}

.project-cat {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 12px;
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--text);
    background: rgba(11, 15, 20, .72);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: .2em .8em;
    backdrop-filter: blur(4px);
}

.project-info {
    padding: 10px 14px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-info h3 { margin: 0; font-size: .85rem; line-height: 1.3; }
.project-link { font-size: .75rem; white-space: nowrap; }

/* -- Cartão de post (blog): mesmo tamanho e estrutura do cartão de projeto ---- */
.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, transform .15s ease;
}

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

.post-cover {
    aspect-ratio: 16 / 10;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: .78rem;
    overflow: hidden;
}

.post-cover img { width: 100%; height: 100%; object-fit: cover; }

.post-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }

.post-info h3 { margin: 0; font-size: .85rem; line-height: 1.3; }
.post-info h3 a { color: var(--text); }
.post-info h3 a:hover { color: var(--accent); }

.post-date { font-family: var(--mono); font-size: .72rem; color: var(--text-muted); }

/* -- Tech tags ---------------------------------------------------------------*/
.tags { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--accent-2);
    background: rgba(124, 140, 255, .1);
    border: 1px solid rgba(124, 140, 255, .25);
    border-radius: 6px;
    padding: .25em .6em;
}

/* -- Forms -------------------------------------------------------------------*/
.form-grid { display: grid; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: .88rem; font-weight: 600; color: var(--text); }

.field .hint { font-size: .8rem; color: var(--text-muted); }

input[type=text], input[type=email], input[type=url], input[type=password],
input[type=number], input[type=file], textarea, select {
    background: var(--bg-alt);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: .7em .9em;
    color: var(--text);
    font-family: var(--sans);
    font-size: .95rem;
    width: 100%;
}

textarea { resize: vertical; min-height: 120px; font-family: var(--sans); }

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 224, 161, .15);
}

.checkbox-field { flex-direction: row; align-items: center; gap: 10px; }
.checkbox-field input { width: auto; }

.error-message { color: var(--danger); font-size: .82rem; }

.input.error input, .input.error textarea { border-color: var(--danger); }

/* -- Cloudflare Turnstile: widget centralizado no formulário -------------- */
.turnstile-box {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 4px 0;
}

.turnstile-box .cf-turnstile { max-width: 100%; }

/* -- Social icons row ---------------------------------------------------------*/
.socials { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-family: var(--mono);
    font-size: .8rem;
}

.social-link:hover { border-color: var(--accent); color: var(--accent); }

/* -- Footer --------------------------------------------------------------------*/
.site-footer {
    border-top: 1px solid var(--border);
    padding: 40px 0;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: .9rem;
}

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

.site-footer .mono { color: var(--text-muted); }

/* -- Flash messages ---------------------------------------------------------------*/
.flash-message {
    max-width: var(--max-width);
    margin: 16px auto 0;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: .92rem;
    border: 1px solid var(--border);
}

.message.success { background: rgba(52, 224, 161, .1); border-color: rgba(52, 224, 161, .35); color: var(--accent); }
.message.error { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .35); color: var(--danger); }
.message.info, .message.warning { background: rgba(124, 140, 255, .1); border-color: rgba(124, 140, 255, .35); color: var(--accent-2); }

/* -- Pagination -------------------------------------------------------------------*/
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; list-style: none; padding: 0; font-family: var(--mono); font-size: .88rem; }
.pagination li a, .pagination li.current { padding: .5em .9em; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); color: var(--text-muted); }
.pagination li.current { background: var(--accent); color: #04140d; border-color: var(--accent); }
.pagination li a:hover { border-color: var(--accent); color: var(--accent); }
.pagination li.disabled { display: none; }

/* -- Post/project detail content -------------------------------------------------*/
.prose { font-size: 1.02rem; color: var(--text); }
.prose p { margin: 0 0 1.2em; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.6em; }

/* Content produced by the Quill editor (templates/element/Admin/Posts/form.php) —
   quill.core.css supplies the .ql-editor structural rules (lists, indent steps,
   alignment); these just adapt them to the site's dark palette. */
.prose.ql-editor {
    padding: 0;
    min-height: 0;
    font-family: var(--sans);
}
.prose.ql-editor a { color: var(--accent); }
.prose.ql-editor strong { color: var(--text); }
.prose.ql-editor blockquote {
    border-left: 3px solid var(--accent);
    margin: 1.2em 0;
    padding-left: 1em;
    color: var(--text-muted);
}
.prose.ql-editor pre.ql-syntax {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1em;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: .88rem;
}
.prose.ql-editor ul, .prose.ql-editor ol { margin: 0 0 1.2em; }

.breadcrumb { font-family: var(--mono); font-size: .85rem; color: var(--text-muted); margin-bottom: 24px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-family: var(--mono);
}

@media (max-width: 720px) {
    /* Abaixo de 720px o menu do cabeçalho some; quem mostra os links é a
       gaveta lateral (.mobile-drawer, ver mais abaixo). */
    .nav-links { display: none; }
    .nav-toggle { display: inline-flex; }
    .site-footer .wrap { flex-direction: column; align-items: flex-start; }
}

/* -- Gaveta lateral do menu (celular) --------------------------------------
   Fica FORA do <header> no HTML de propósito — ver o comentário em
   templates/element/header.php sobre por que o backdrop-filter do cabeçalho
   quebraria um "position: fixed" que estivesse dentro dele. */
.mobile-drawer { display: none; }

@media (max-width: 720px) {
    .mobile-drawer { display: block; }

    .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 70;
        border: 0;
        margin: 0;
        padding: 0;
        background: rgba(5, 7, 10, .6);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .mobile-drawer-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 71;
        width: min(300px, 82vw);
        background: var(--bg);
        border-left: 1px solid var(--border-strong);
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        padding: 8px 20px 24px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform .2s ease;
    }

    .mobile-drawer.is-open .mobile-drawer-backdrop { opacity: 1; pointer-events: auto; }
    .mobile-drawer.is-open .mobile-drawer-panel { transform: translateX(0); }

    .mobile-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 56px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 4px;
    }

    .mobile-drawer-title { font-family: var(--mono); font-size: .85rem; color: var(--text-muted); }

    .mobile-drawer-close {
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: 1px solid var(--border-strong);
        border-radius: var(--radius-sm);
        color: var(--text);
        cursor: pointer;
    }
    .mobile-drawer-close:hover, .mobile-drawer-close:focus-visible { border-color: var(--accent); color: var(--accent); }

    /* Linhas de largura total, alinhadas, com toque grande — mesma estrutura
       já usada para deixar a lista organizada em vez de itens soltos. */
    .mobile-drawer-panel a {
        display: flex;
        align-items: center;
        min-height: 56px;
        font-size: 1.05rem;
        border-bottom: 1px solid var(--border);
    }

    .mobile-drawer-panel a.btn-primary {
        justify-content: center;
        min-height: 48px;
        margin-top: 16px;
        border-bottom: none;
    }
}
