/* style.css - Frentes Ocultas */

/* Reset básico */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Georgia", "Times New Roman", serif; /* Fonte serifada para texto principal */
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    color: #2b2b2b;
    background-color: #f4eadd; /* Cor de pergaminho/creme leve */
    /* Ruído SVG sutil para textura de pergaminho rústico */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E"),
        linear-gradient(rgba(244, 234, 221, 0.8), rgba(244, 234, 221, 0.8));
    background-attachment: fixed;
}

/* Tipografia de Cabeçalhos */
h1, h2, h3, h4, h5, h6 {
    font-family: "Merriweather", "Georgia", "Times New Roman", serif;
    color: #1a2530; /* Azul marinho escuro */
    margin-bottom: 15px;
    line-height: 1.3;
}

h1 {
    font-size: 2.5em;
    text-transform: uppercase;
    letter-spacing: 2px;
}

h2 {
    font-size: 2em;
    border-bottom: 1px solid #1a2530;
    padding-bottom: 5px;
    margin-top: 30px;
}

h3 {
    font-size: 1.5em;
    margin-top: 25px;
}

/* Links */
a {
    color: #2980b9; /* Azul um pouco mais claro para links, mantendo sobriedade */
    text-decoration: none;
    border-bottom: 1px dotted #2980b9;
    transition: color 0.3s, border-bottom 0.3s;
}

a:hover {
    color: #1a2530; /* Azul marinho ao passar o mouse */
    border-bottom: 1px solid #1a2530;
}

/* Cabeçalho do Site */
header {
    border-bottom: 2px solid #1a2530;
    padding-bottom: 20px;
    margin-bottom: 40px;
    text-align: center;
}

header h1 a {
    color: #1a2530;
    border-bottom: none;
}

header h1 a:hover {
    color: #2c3e50;
    border-bottom: none;
}

header p {
    font-style: italic;
    color: #555;
    font-size: 1.1em;
    margin-top: 10px;
}

/* Conteúdo Principal (Main) */
main {
    background-color: transparent; /* Deixa o fundo do body aparecer */
}

/* Artigos e Listas */
article {
    margin-bottom: 40px;
}

article p {
    margin-bottom: 20px;
    text-indent: 20px; /* Parágrafos com recuo de primeira linha (estilo antigo) */
}

ul, ol {
    margin-bottom: 20px;
    padding-left: 40px;
}

li {
    margin-bottom: 10px;
}

/* Post Cards e Grid */
.post-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.post-card {
    display: flex;
    flex-direction: column;
    background-color: #fbf6f0; /* Creme levemente mais claro que o fundo */
    /* Textura um pouco mais sutil que o body para não poluir o conteúdo */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E"),
        linear-gradient(rgba(251, 246, 240, 0.9), rgba(251, 246, 240, 0.9));
    border: 1px solid #1a2530;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 0; /* Override article margin-bottom in grid */
}

.post-card-header {
    margin-bottom: 10px;
}

.post-card-header h3 {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.3em;
}

.post-card-header h3 a {
    color: #1a2530;
    border-bottom: none;
}

.post-card-header h3 a:hover {
    text-decoration: underline;
}

.post-summary {
    font-size: 0.95em;
    color: #444;
    margin-bottom: 15px;
    text-indent: 0; /* Sem recuo nos resumos do card */
    flex-grow: 1;
}

.post-tags {
    font-size: 0.8em;
    margin-bottom: 15px;
    color: #555;
}

.read-more-btn {
    display: inline-block;
    align-self: flex-start;
    margin-top: auto;
    padding: 5px 10px;
    background-color: transparent;
    color: #1a2530;
    border: 1px solid #1a2530;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background-color 0.3s, color 0.3s;
}

.read-more-btn:hover {
    background-color: #1a2530;
    color: #f4eadd; /* Cor do fundo original */
    border-bottom: 1px solid #1a2530; /* Keep border consistent */
}

.post-meta {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
}

.post-date {
    font-size: 0.85em;
    color: #777;
    font-style: italic;
    display: block;
}

/* Responsividade */
@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
    }
}

/* Rodapé */
footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #1a2530;
    text-align: center;
    font-size: 0.9em;
    color: #555;
}

/* Seção de Compartilhamento */
.share-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 40px;
    padding-top: 20px;
    border-top: 1px solid #1a2530;
}

.share-title {
    font-size: 0.95em;
    font-weight: bold;
    color: #1a2530;
    font-family: "Georgia", "Times New Roman", serif;
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #1a2530;
    border-radius: 4px;
    color: #1a2530;
    background-color: transparent;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, transform 0.2s;
    text-decoration: none; /* overrides default <a> styling */
}

/* Remove bottom dotted border for share links */
a.share-btn {
    border-bottom: 1px solid #1a2530;
}

a.share-btn:hover {
    border-bottom: 1px solid #1a2530;
}

.share-btn:hover {
    background-color: #1a2530;
    color: #f4eadd;
    transform: translateY(-2px);
}

.share-btn svg {
    transition: stroke 0.3s;
}

.share-copy {
    position: relative;
    padding: 0; /* reset button padding */
}

.copy-feedback {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1a2530;
    color: #f4eadd;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}


/* Imagens Históricas */
article img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 30px auto;
    border: 8px solid #f4eadd;
    outline: 1px solid #1a2530;
    box-shadow: 2px 4px 8px rgba(0,0,0,0.4);
    filter: sepia(0.3) contrast(1.1);
    border-radius: 2px;
}

/* ==========================================================================
   MODO NOTURNO (Dark Mode Vintage)
   ========================================================================== */
body.dark-mode {
    background-color: #2b3036; /* Fundo lousa antiga (Slate Dark Grey) */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E"),
        linear-gradient(rgba(43, 48, 54, 0.8), rgba(43, 48, 54, 0.8));
    background-attachment: fixed;
    color: #f4eadd; /* Texto creme claro */
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #e6d8c3; /* Creme ligeiramente mais escuro/saturado para títulos */
}

body.dark-mode h2 {
    border-bottom: 1px solid #e6d8c3;
}

body.dark-mode a {
    color: #5da9e9; /* Azul claro adaptado para fundo escuro */
    border-bottom-color: #5da9e9;
}

body.dark-mode a:hover {
    color: #f4eadd; /* Creme ao passar o mouse */
    border-bottom-color: #f4eadd;
}

body.dark-mode header {
    border-bottom: 2px solid #e6d8c3;
}

body.dark-mode header h1 a {
    color: #e6d8c3;
}

body.dark-mode header h1 a:hover {
    color: #f4eadd;
}

body.dark-mode header p {
    color: #a9b4c0;
}

body.dark-mode .post-card {
    background-color: #343a40; /* Fundo do card um pouco mais claro que o body */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E"),
        linear-gradient(rgba(52, 58, 64, 0.9), rgba(52, 58, 64, 0.9));
    border: 1px solid #4a5568;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5); /* Sombra mais forte no modo escuro */
}

body.dark-mode .post-card-header h3 a {
    color: #e6d8c3;
}

body.dark-mode .post-card-header h3 a:hover {
    color: #f4eadd;
}

body.dark-mode .post-summary {
    color: #d1d5db;
}

body.dark-mode .post-tags {
    color: #9ca3af;
}

body.dark-mode .post-meta,
body.dark-mode .post-date {
    color: #9ca3af;
}

body.dark-mode .read-more-btn {
    color: #e6d8c3;
    border-color: #e6d8c3;
}

body.dark-mode .read-more-btn:hover {
    background-color: #e6d8c3;
    color: #2b3036; /* Cor do fundo escuro */
}

body.dark-mode footer {
    border-top: 1px solid #e6d8c3;
    color: #a9b4c0;
}

body.dark-mode article img {
    border-color: #4a5568; /* Borda ajustada para tema escuro */
    outline-color: #2b3036;
    /* Mantém o sepia original, mas reduz o brilho para não ofuscar */
    filter: sepia(0.3) contrast(1.1) brightness(0.75);
}

/* Ajustes Formulário de Busca - Modo Noturno */
body.dark-mode .search-form input[type="text"] {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f4eadd;
    border-color: #6b7280;
}

body.dark-mode .search-form input[type="text"]:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #e6d8c3;
}

body.dark-mode .search-form button {
    background-color: #4a5568;
    border-color: #6b7280;
    color: #f4eadd;
}

body.dark-mode .search-form button:hover {
    background-color: #e6d8c3;
    color: #2b3036;
}

/* Ajustes Voltar ao Topo - Modo Noturno */
body.dark-mode #back-to-top {
    background-color: #343a40;
    color: #e6d8c3;
    border-color: #e6d8c3;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

body.dark-mode #back-to-top:hover {
    background-color: #e6d8c3;
    color: #2b3036;
}

/* Utilitários de Cabeçalho (Ferramentas) */
.header-tools {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 15px;
}

/* Botão Theme Toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid #1a2530;
    border-radius: 4px;
    color: #1a2530;
    font-size: 1.2em;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.theme-toggle:hover {
    background-color: #1a2530;
    color: #f4eadd;
}

body.dark-mode .theme-toggle {
    border-color: #e6d8c3;
    color: #e6d8c3;
}

body.dark-mode .theme-toggle:hover {
    background-color: #e6d8c3;
    color: #2b3036;
}

/* Formulário de Pesquisa */
.search-form {
    display: flex;
    align-items: center;
}

.search-form input[type="text"] {
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 0.95em;
    padding: 6px 10px;
    border: 1px solid #777;
    border-radius: 3px 0 0 3px;
    background-color: rgba(255, 255, 255, 0.6);
    color: #2b2b2b;
    outline: none;
    width: 200px;
    transition: background-color 0.3s;
}

.search-form input[type="text"]:focus {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: #1a2530;
}

.search-form button {
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 0.95em;
    padding: 6px 15px;
    border: 1px solid #777;
    border-left: none;
    border-radius: 0 3px 3px 0;
    background-color: #1a2530;
    color: #f4eadd;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.search-form button:hover {
    background-color: #2c3e50;
    color: #ffffff;
}

/* Botão Voltar ao Topo */
#back-to-top {
    display: none; /* Inicialmente escondido, Javascript controla */
    opacity: 0;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 0.9em;
    border: 1px solid #1a2530;
    outline: none;
    background-color: #f4eadd;
    color: #1a2530;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    transition: background-color 0.3s, color 0.3s, opacity 0.3s, transform 0.3s;
}

#back-to-top:hover {
    background-color: #1a2530;
    color: #f4eadd;
    transform: translateY(-2px);
}
