/*
Theme Name:  Zaknafeintheme
Theme URI:   https://github.com/
Author:      Bastacrittare
Author URI:  #
Description: Tema inkpunk/manoscritto per un blog di fantasy, D&D e tecnologia. Layout classico, atmosfera da diario di campagna scritto a mano.
Version:     1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: zaknafeintheme
Tags:        blog, fantasy, dark, serif, two-columns, right-sidebar
*/

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', 'Georgia', 'Times New Roman', serif;
    font-size: 1rem;
    line-height: 1.75;
    color: #2c1a0e;
    background-color: #1a120a;
    background-image:
        linear-gradient(rgba(10, 6, 2, 0.62), rgba(10, 6, 2, 0.62)),
        url('images/background.jpg');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: 'IM Fell English', 'Palatino Linotype', 'Palatino', 'Book Antiqua', serif;
    font-weight: 400;
    line-height: 1.2;
    color: #3d1f0d;
    letter-spacing: 0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p {
    margin-bottom: 1.25rem;
}

a {
    color: #7a3b12;
    text-decoration: underline;
    text-decoration-color: rgba(122, 59, 18, 0.4);
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover,
a:focus {
    color: #a0520e;
    text-decoration-color: rgba(160, 82, 14, 0.8);
    outline: none;
}

ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

li {
    margin-bottom: 0.3rem;
}

blockquote {
    border-left: 3px solid #c4a882;
    margin: 1.5rem 0;
    padding: 0.75rem 1.25rem;
    background: rgba(196, 168, 130, 0.12);
    font-style: italic;
    color: #4a2a10;
}

blockquote cite {
    display: block;
    font-size: 0.85rem;
    font-style: normal;
    margin-top: 0.5rem;
    color: #7a5530;
}

hr {
    border: none;
    border-top: 1px solid #c4a882;
    margin: 2rem 0;
    opacity: 0.5;
}

code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    background: rgba(196, 168, 130, 0.2);
    padding: 0.1em 0.4em;
    border-radius: 2px;
    color: #5a3010;
}

pre {
    background: rgba(196, 168, 130, 0.15);
    border: 1px solid rgba(196, 168, 130, 0.3);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
    border-radius: 2px;
}

pre code {
    background: none;
    padding: 0;
}

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

strong { color: #3d1f0d; font-weight: 700; }
em { font-style: italic; }

/* ============================================================
   LAYOUT PRINCIPALE
   ============================================================ */

.site-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.site-content-area {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2.5rem;
    padding: 2rem 0 3rem;
    align-items: start;
}

/* ============================================================
   TESTATA / HEADER
   ============================================================ */

.site-header {
    background-color: #120c06;
    border-bottom: 2px solid #5a3a1a;
    padding: 1.5rem 0 1rem;
    position: relative;
}

.site-header::after {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(to right, transparent, #c4a882, #8b5e2a, #c4a882, transparent);
    margin-top: 1rem;
}

.site-header .site-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-branding {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-title {
    font-family: 'IM Fell English', 'Palatino Linotype', serif;
    font-size: 2.25rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    line-height: 1;
}

.site-title a {
    color: #e8d4a8;
    text-decoration: none;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

.site-title a:hover {
    color: #f5e6c8;
}

.site-description {
    font-family: 'Lora', serif;
    font-size: 0.875rem;
    font-style: italic;
    color: #9a7a50;
    letter-spacing: 0.03em;
}

/* ============================================================
   NAVIGAZIONE
   ============================================================ */

.main-navigation {
    margin-top: 0.75rem;
}

.main-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.main-navigation ul li a {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    color: #c4a882;
    text-decoration: none;
    font-family: 'IM Fell English', serif;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.main-navigation ul li a:hover,
.main-navigation ul li.current-menu-item > a {
    color: #f5e6c8;
    border-color: rgba(196, 168, 130, 0.4);
    background: rgba(196, 168, 130, 0.08);
}

/* ============================================================
   PARCHMENT — area contenuto
   ============================================================ */

.content-parchment {
    background-color: #f5e6c8;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    border: 1px solid #c4a882;
    border-top: 3px solid #8b5e2a;
    box-shadow: 2px 2px 12px rgba(0,0,0,0.35), inset 0 0 40px rgba(196, 168, 130, 0.1);
    padding: 2rem 2.25rem;
    min-height: 400px;
}

/* ============================================================
   LOOP / LISTA ARTICOLI (Homepage & Archive)
   ============================================================ */

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post-card {
    padding: 1.75rem 0;
    border-bottom: 1px solid rgba(196, 168, 130, 0.5);
    position: relative;
}

.post-card:first-child {
    padding-top: 0;
}

.post-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.post-card-category {
    display: inline-block;
    font-family: 'IM Fell English', serif;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a3b12;
    background: rgba(122, 59, 18, 0.08);
    border: 1px solid rgba(122, 59, 18, 0.25);
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.post-card-category:hover {
    background: rgba(122, 59, 18, 0.15);
    color: #5a2a08;
}

.post-card-title {
    font-size: 1.45rem;
    margin-bottom: 0.35rem;
}

.post-card-title a {
    color: #3d1f0d;
    text-decoration: none;
}

.post-card-title a:hover {
    color: #7a3b12;
    text-decoration: underline;
    text-decoration-color: rgba(122, 59, 18, 0.4);
}

.post-card-meta {
    font-size: 0.8rem;
    color: #7a5530;
    font-style: italic;
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.post-card-meta .sep {
    opacity: 0.4;
}

.post-card-excerpt {
    font-size: 0.95rem;
    color: #3a2010;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.read-more-link {
    display: inline-block;
    font-family: 'IM Fell English', serif;
    font-size: 0.875rem;
    font-style: italic;
    color: #7a3b12;
    text-decoration: none;
    border-bottom: 1px solid rgba(122, 59, 18, 0.4);
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

.read-more-link::after {
    content: ' \2192';
}

.read-more-link:hover {
    color: #a0520e;
    border-color: rgba(160, 82, 14, 0.7);
}

/* Nessun post trovato */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #7a5530;
    font-style: italic;
}

/* ============================================================
   PAGINAZIONE
   ============================================================ */

.posts-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(196, 168, 130, 0.5);
    font-family: 'IM Fell English', serif;
    font-size: 0.9rem;
}

.posts-pagination a {
    color: #7a3b12;
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(122, 59, 18, 0.35);
    transition: background 0.2s, color 0.2s;
}

.posts-pagination a:hover {
    background: rgba(122, 59, 18, 0.1);
    color: #3d1f0d;
}

/* ============================================================
   SINGOLO ARTICOLO
   ============================================================ */

.single-post-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(196, 168, 130, 0.5);
}

.single-post-header .post-category {
    display: inline-block;
    font-family: 'IM Fell English', serif;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a3b12;
    background: rgba(122, 59, 18, 0.08);
    border: 1px solid rgba(122, 59, 18, 0.25);
    padding: 0.1rem 0.5rem;
    margin-bottom: 0.75rem;
    text-decoration: none;
}

.single-post-title {
    font-size: 2rem;
    color: #3d1f0d;
    margin-bottom: 0.5rem;
    line-height: 1.25;
}

.single-post-meta {
    font-size: 0.82rem;
    color: #7a5530;
    font-style: italic;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.single-post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #2c1a0e;
    max-width: 68ch;
}

.single-post-content h2,
.single-post-content h3,
.single-post-content h4 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.single-post-content p:first-child::first-letter {
    font-family: 'IM Fell English', serif;
    font-size: 3.5em;
    font-weight: 400;
    float: left;
    line-height: 0.75;
    margin: 0.05em 0.08em 0 0;
    color: #7a3b12;
}

/* Tags del post */
.post-tags {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(196, 168, 130, 0.5);
    font-size: 0.85rem;
    color: #7a5530;
}

.post-tags a {
    display: inline-block;
    margin: 0.15rem;
    padding: 0.15rem 0.5rem;
    border: 1px solid rgba(122, 59, 18, 0.3);
    color: #7a3b12;
    text-decoration: none;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.post-tags a:hover {
    background: rgba(122, 59, 18, 0.1);
}

/* Navigazione post successivo/precedente */
.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(196, 168, 130, 0.5);
    font-size: 0.875rem;
}

.post-navigation a {
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(196, 168, 130, 0.4);
    color: #3d1f0d;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.post-navigation a:hover {
    background: rgba(196, 168, 130, 0.1);
    border-color: rgba(196, 168, 130, 0.7);
}

.post-navigation .nav-prev { text-align: left; }
.post-navigation .nav-next { text-align: right; }

.post-navigation .nav-label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9a7a50;
    font-family: 'IM Fell English', serif;
    margin-bottom: 0.25rem;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.site-sidebar {
    position: sticky;
    top: 1.5rem;
}

.sidebar-parchment {
    background-color: #f0ddb0;
    border: 1px solid #c4a882;
    border-top: 3px solid #8b5e2a;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.3), inset 0 0 30px rgba(196, 168, 130, 0.08);
    padding: 1.5rem 1.25rem;
}

.widget {
    margin-bottom: 2rem;
}

.widget:last-child {
    margin-bottom: 0;
}

.widget-title {
    font-family: 'IM Fell English', serif;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3d1f0d;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(196, 168, 130, 0.6);
    position: relative;
}

.widget-title::after {
    content: '';
    display: block;
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 2rem;
    height: 2px;
    background: #8b5e2a;
}

/* Widget link esterni */
.widget-external-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget-external-links li {
    border-bottom: 1px dashed rgba(196, 168, 130, 0.5);
    margin-bottom: 0;
}

.widget-external-links li:last-child {
    border-bottom: none;
}

.widget-external-links li a {
    display: block;
    padding: 0.45rem 0.25rem;
    color: #5a2a08;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s, padding-left 0.2s;
}

.widget-external-links li a::before {
    content: '\2767\0020';
    color: #c4a882;
    font-size: 0.75em;
}

.widget-external-links li a:hover {
    color: #a0520e;
    padding-left: 0.35rem;
}

/* Widget categorie */
.widget_categories ul,
.widget_archive ul,
.widget_recent_entries ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget_categories li,
.widget_archive li,
.widget_recent_entries li {
    border-bottom: 1px dashed rgba(196, 168, 130, 0.5);
}

.widget_categories li:last-child,
.widget_archive li:last-child,
.widget_recent_entries li:last-child {
    border-bottom: none;
}

.widget_categories li a,
.widget_archive li a,
.widget_recent_entries li a {
    display: block;
    padding: 0.4rem 0.25rem;
    color: #5a2a08;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s, padding-left 0.2s;
}

.widget_categories li a:hover,
.widget_archive li a:hover,
.widget_recent_entries li a:hover {
    color: #a0520e;
    padding-left: 0.35rem;
}

.widget_categories .post-count {
    float: right;
    color: #9a7a50;
    font-size: 0.8rem;
}

/* ============================================================
   INTESTAZIONE ARCHIVIO
   ============================================================ */

.archive-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(196, 168, 130, 0.5);
}

.archive-title {
    font-size: 1.6rem;
    color: #3d1f0d;
}

.archive-description {
    font-size: 0.9rem;
    color: #7a5530;
    font-style: italic;
    margin-top: 0.35rem;
    margin-bottom: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    background: #120c06;
    border-top: 2px solid #5a3a1a;
    padding: 1.25rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #7a5530;
    font-style: italic;
    letter-spacing: 0.03em;
}

.site-footer a {
    color: #9a7a50;
}

.site-footer a:hover {
    color: #c4a882;
}

/* ============================================================
   WIDGET SEARCH
   ============================================================ */

.widget_search .search-form,
.widget_search form {
    display: flex;
    gap: 0;
}

/* Nasconde la label "Cerca" visibile prima del campo */
.widget_search label,
.widget_search .screen-reader-text:not(:focus):not(:active) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.widget_search .search-field,
.widget_search input[type="search"],
.widget_search input[type="text"] {
    flex: 1;
    font-family: 'Lora', serif;
    font-size: 0.85rem;
    font-style: italic;
    color: #3d1f0d;
    background: rgba(245, 230, 200, 0.7);
    border: 1px solid #c4a882;
    border-right: none;
    padding: 0.45rem 0.65rem;
    outline: none;
    transition: background 0.2s, border-color 0.2s;
    min-width: 0;
}

.widget_search .search-field::placeholder,
.widget_search input[type="search"]::placeholder {
    color: #9a7a50;
}

.widget_search .search-field:focus,
.widget_search input[type="search"]:focus {
    background: rgba(245, 230, 200, 0.95);
    border-color: #8b5e2a;
}

.widget_search .search-submit,
.widget_search button[type="submit"],
.widget_search input[type="submit"] {
    font-family: 'IM Fell English', serif;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    color: #f5e6c8;
    background: #5a3010;
    border: 1px solid #8b5e2a;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    /* Rimuove stile browser nativo */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

.widget_search .search-submit:hover,
.widget_search button[type="submit"]:hover,
.widget_search input[type="submit"]:hover {
    background: #7a3b12;
    color: #fff8ee;
}

/* ============================================================
   ACCESSIBILITA'
   ============================================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3d1f0d;
    color: #f5e6c8;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    z-index: 9999;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* ============================================================
   CLASSI ALLINEAMENTO WORDPRESS
   ============================================================ */

.alignleft  { float: left; margin: 0.5rem 1.5rem 1rem 0; }
.alignright { float: right; margin: 0.5rem 0 1rem 1.5rem; }
.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
.alignnone { float: none; }

.wp-caption {
    max-width: 100%;
    background: rgba(196, 168, 130, 0.1);
    border: 1px solid rgba(196, 168, 130, 0.3);
    padding: 0.5rem;
}

.wp-caption-text {
    font-size: 0.8rem;
    font-style: italic;
    color: #7a5530;
    text-align: center;
    margin: 0.35rem 0 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 800px) {
    .site-content-area {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1.5rem 0 2rem;
    }

    .site-sidebar {
        position: static;
    }

    .site-title {
        font-size: 1.75rem;
    }

    .content-parchment {
        padding: 1.5rem 1.25rem;
    }

    .single-post-title {
        font-size: 1.6rem;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }

    .post-navigation .nav-next {
        text-align: left;
    }
}

@media (max-width: 500px) {
    html { font-size: 15px; }

    .site-wrapper {
        padding: 0 1rem;
    }

    .content-parchment {
        padding: 1.25rem 1rem;
    }

    .single-post-content p:first-child::first-letter {
        font-size: 2.8em;
    }
}
