/*
 * Kanshin Fansub - tema Ghost v2
 * Uma cor de destaque (Accent color do Ghost), uma fonte, fundo neutro.
 */

/* Tokens
   ========================================================================== */
:root {
    --accent: var(--ghost-accent-color, #283183);
    --accent-text: var(--accent);
    --on-accent: #ffffff;

    --bg: #ffffff;
    --surface: #f4f5f7;
    --text: #16181d;
    --muted: #646b78;
    --border: #e4e6ea;

    --font-body: var(--gh-font-body, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
    --font-heading: var(--gh-font-heading, var(--font-body));

    --radius: 10px;
    --container: 1120px;
    --narrow: 720px;
    --gutter: 20px;

    color-scheme: light;
}

:root[data-color-scheme="Escuro"] {
    --accent-text: color-mix(in srgb, var(--accent), #ffffff 50%);
    --bg: #101216;
    --surface: #1a1d23;
    --text: #e8eaee;
    --muted: #9ba2ae;
    --border: #2a2e36;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-color-scheme="Automático"] {
        --accent-text: color-mix(in srgb, var(--accent), #ffffff 50%);
        --bg: #101216;
        --surface: #1a1d23;
        --text: #e8eaee;
        --muted: #9ba2ae;
        --border: #2a2e36;
        color-scheme: dark;
    }
}

/* Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.25;
    margin: 0 0 0.5em;
}

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

a { color: var(--accent-text); }

:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: 2px;
}

.icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
}
.skip-link:focus {
    left: var(--gutter);
    top: var(--gutter);
    z-index: 100;
    padding: 8px 12px;
    background: var(--bg);
    color: var(--text);
    border-radius: var(--radius);
}

/* Layout
   ========================================================================== */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
    padding: 40px 0 64px;
}

.container,
.container-narrow {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}
.container { max-width: calc(var(--container) + 2 * var(--gutter)); }
.container-narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }

/* Botões
   ========================================================================== */
.button,
.gh-content .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    text-decoration: none;
    transition: opacity 0.15s;
}
.button:hover,
.gh-content .btn:hover { opacity: 0.88; }

.button-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

/* Cabeçalho
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    color: var(--text);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
}
.site-header .site-brand img { max-height: 40px; width: auto; }

.site-nav { flex: 1; }

.site-nav .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav .nav a {
    display: block;
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
}
.site-nav .nav a:hover { color: var(--text); background: var(--surface); }
.site-nav .nav-current a { color: var(--text); }

.site-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}
.icon-button:hover { background: var(--surface); }

.nav-toggle { display: none; }

@media (max-width: 767px) {
    .nav-toggle { display: inline-flex; }

    .site-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        padding: 8px var(--gutter) 16px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
    }
    .is-nav-open .site-nav { display: block; }

    .site-nav .nav { flex-direction: column; }
    .site-nav .nav a { padding: 10px 12px; font-size: 1.05rem; }
}

/* Títulos de seção
   ========================================================================== */
.section-header { margin-bottom: 28px; }

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}
.section-header .section-title { margin-bottom: 4px; }

.section-description { color: var(--muted); margin: 0; }

/* Grade de cards
   ========================================================================== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 32px 24px;
}

.post-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.post-card-media {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
}
.post-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.post-card-link:hover .post-card-media img { transform: scale(1.03); }

.post-card-body { padding-top: 12px; }

.post-card-tag {
    display: block;
    margin-bottom: 2px;
    color: var(--accent-text);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 4px;
}
.post-card-link:hover .post-card-title { text-decoration: underline; text-underline-offset: 3px; }

.post-card-date { color: var(--muted); font-size: 0.875rem; }

/* Paginação
   ========================================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 48px;
}
.pagination-info { color: var(--muted); font-size: 0.9rem; }

/* Post / página
   ========================================================================== */
.article-header { margin-bottom: 28px; }

.article-tag {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.article-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.article-meta { color: var(--muted); font-size: 0.95rem; }
.article-meta a { color: inherit; }

.article-image { margin-top: 0; margin-bottom: 32px; }
.article-image img { width: 100%; border-radius: var(--radius); }
.article-image figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.875rem;
    text-align: center;
}

.related {
    margin-top: 64px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.comments { margin-top: 56px; }

/* Conteúdo do editor
   ========================================================================== */
.gh-content { font-size: 1.0625rem; }

.gh-content > * + * { margin-top: 1.1em; }
.gh-content p,
.gh-content ul,
.gh-content ol,
.gh-content figure,
.gh-content blockquote { margin-bottom: 0; }
.gh-content > :first-child { margin-top: 0; }

.gh-content h2 { font-size: 1.5rem; margin-top: 1.8em; }
.gh-content h3 { font-size: 1.25rem; margin-top: 1.6em; }

.gh-content img { border-radius: var(--radius); }

.gh-content figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.875rem;
    text-align: center;
}

.gh-content blockquote {
    margin-left: 0;
    padding-left: 16px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}

.gh-content hr {
    border: 0;
    border-top: 1px solid var(--border);
}

.gh-content iframe { max-width: 100%; }

.gh-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.gh-content th,
.gh-content td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.kg-width-wide,
.kg-width-full {
    position: relative;
    width: 100%;
}
.kg-width-wide img,
.kg-width-full img { width: 100%; }

/* Compatibilidade com o conteúdo migrado do WordPress
   (bloco "Faça o Download" com classes do Bootstrap e ícones do Font Awesome) */
.gh-content .titulo-secundario {
    width: auto;
    max-width: none;
    margin: 2em 0 0.75em;
    padding: 0;
    background: none;
    color: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: none;
}
.gh-content .titulo-secundario ~ .btn { margin: 0 8px 8px 0; }
.gh-content [class^="fa"],
.gh-content [class*=" fa-"] { display: none; }

/* Lista de episódios dentro da página do projeto (vem do campo "episodios" do WP) */
.gh-content .lista-episodios {
    list-style: none;
    margin-left: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.gh-content .lista-episodios li {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    align-items: center;
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.gh-content .lista-episodios img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
}

.lista-episodios-info strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.gh-content .lista-episodios-links .btn {
    margin: 0 6px 6px 0;
    padding: 6px 12px;
    font-size: 0.85rem;
}

@media (max-width: 479px) {
    .gh-content .lista-episodios li { grid-template-columns: 110px 1fr; gap: 12px; }
}

/* Projeto (página da tag)
   ========================================================================== */
.project-header {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    align-items: start;
    margin-bottom: 48px;
}
.project-header:not(:has(.project-cover)) { grid-template-columns: 1fr; }

.project-cover {
    width: 100%;
    border-radius: var(--radius);
}

.project-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
}

.project-synopsis { color: var(--text); max-width: var(--narrow); }

@media (max-width: 639px) {
    .project-header { grid-template-columns: 1fr; gap: 20px; }
    .project-cover { max-width: 260px; }
}

.episode-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.episode-row {
    display: grid;
    grid-template-columns: 96px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}
.episode-row:hover .episode-title { color: var(--accent-text); }

.episode-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 6px;
    background: var(--surface);
}
.episode-thumb img { width: 100%; height: 100%; object-fit: cover; }

.episode-title { font-weight: 600; }
.episode-date { color: var(--muted); font-size: 0.875rem; white-space: nowrap; }

@media (max-width: 479px) {
    .episode-row { grid-template-columns: 72px 1fr; }
    .episode-date { grid-column: 2; margin-top: -12px; }
}

/* Erro
   ========================================================================== */
.error { padding-top: 40px; padding-bottom: 40px; }
.error-code {
    margin: 0;
    color: var(--accent-text);
    font-size: 1rem;
    font-weight: 700;
}

/* Rodapé
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.95rem;
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 32px;
    padding-top: 40px;
    padding-bottom: 32px;
}

.footer-about { max-width: 520px; }
.footer-about p { margin: 12px 0 0; }
.site-footer .site-brand img { max-height: 48px; width: auto; }

.footer-social {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.footer-social a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}
.footer-social a:hover { color: var(--accent-text); }

.footer-bottom {
    padding-top: 16px;
    padding-bottom: 24px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}
