/* =====================================================================
   Bit's Tales — skin "terminale notturno"
   Caricato DOPO built/screen.css: sovrascrive i colori/font di Casper.
   Palette presa dal logo: blu notte, azzurro, crema + ambra da terminale.
   ===================================================================== */

:root {
    --bt-bg: #081428;
    --bt-bg-2: #0c1f3d;
    --bt-surface: #0f2547;
    --bt-surface-2: #13305c;
    --bt-border: #1f3f70;
    --bt-text: #ece6d8;
    --bt-text-dim: #a9b8d0;
    --bt-muted: #7389ad;
    --bt-blue: #6cb8ff;
    --bt-cyan: #5ee0e6;
    --bt-amber: #ffc457;
    --bt-green: #8ae68a;
    --bt-pink: #ff6b9a;
    --bt-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --bt-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bt-radius: 14px;

    /* variabili di Casper */
    --color-darkmode: var(--bt-bg);
    --ghost-accent-color: var(--bt-blue) !important;
}

/* ---------- base ---------- */
html, html.dark-mode, html.dark-mode body, body {
    background-color: var(--bt-bg);
    color: var(--bt-text);
    color-scheme: dark;
}
body {
    font-family: var(--bt-sans);
    background-image:
        radial-gradient(1200px 600px at 85% -10%, rgba(108, 184, 255, .14), transparent 60%),
        radial-gradient(900px 500px at -10% 10%, rgba(94, 224, 230, .08), transparent 60%),
        linear-gradient(rgba(108, 184, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 184, 255, .045) 1px, transparent 1px);
    background-size: auto, auto, 32px 32px, 32px 32px;
    background-attachment: fixed;
}
::selection { background: var(--bt-amber); color: #081428; }
a { color: var(--bt-blue); }

/* ---------- header ---------- */
html.dark-mode .gh-head, .gh-head {
    background: rgba(8, 20, 40, .78) !important;
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border-bottom: 1px solid var(--bt-border);
    color: var(--bt-text);
    position: sticky;
    top: 0;
    z-index: 150;
}
.gh-head-menu .nav a, .gh-head-link, .gh-icon-btn { color: var(--bt-text-dim) !important; }
.gh-head-menu .nav a {
    font-family: var(--bt-mono);
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}
.gh-head-menu .nav a::before { content: "./"; color: var(--bt-muted); }
.gh-head-menu .nav a:hover { color: var(--bt-amber) !important; opacity: 1; }
.gh-head-menu .nav-current a, .gh-head-menu .nav a[aria-current] { color: var(--bt-text) !important; }

/* logo testuale con cursore lampeggiante */
.bt-brand {
    display: inline-flex !important;
    align-items: center;
    gap: .55em;
    font-family: var(--bt-mono);
    font-size: 1.9rem !important;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--bt-text) !important;
    white-space: nowrap;
}
.home-template.is-head-left-logo .gh-head:not(.is-header-hidden) .gh-head-logo { display: inline-flex !important; }
.bt-brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; object-position: 50% 62%; box-shadow: 0 0 0 1px var(--bt-border); }
.bt-brand .bt-prompt { color: var(--bt-amber); }
.bt-brand .bt-us { color: var(--bt-blue); }
.bt-cursor {
    display: inline-block;
    width: .55em;
    height: 1.05em;
    margin-left: .08em;
    vertical-align: -.15em;
    background: var(--bt-amber);
    animation: bt-blink 1.1s steps(1) infinite;
}
@keyframes bt-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bt-cursor { animation: none; } }

.gh-head-button, html.dark-mode .gh-head-button {
    background: var(--bt-amber) !important;
    color: #081428 !important;
    font-family: var(--bt-mono);
    font-weight: 700;
    border-radius: 8px;
}
.lang-switch { font-family: var(--bt-mono); border-color: var(--bt-border); opacity: 1; color: var(--bt-text-dim); }
html:not([data-lang="it"]) .lang-switch-en,
html[data-lang="it"] .lang-switch-it { background: var(--bt-blue); color: #081428; }

/* ---------- hero home ---------- */
.bt-hero { padding: 7vmin 4vmin 4vmin; }
.bt-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: 5vmin;
    align-items: center;
}
.bt-eyebrow {
    font-family: var(--bt-mono);
    font-size: 1.4rem;
    color: var(--bt-green);
    margin: 0 0 1.4rem;
}
.bt-eyebrow b { color: var(--bt-amber); font-weight: 700; }
.bt-hero-title {
    margin: 0;
    font-family: var(--bt-mono);
    font-weight: 800;
    font-size: clamp(4.2rem, 8vw, 8.4rem);
    line-height: 1;
    letter-spacing: -.045em;
    color: var(--bt-text);
}
.bt-hero-title .bt-q { color: var(--bt-amber); }
.bt-hero-tagline {
    margin: 2.2rem 0 0;
    max-width: 56ch;
    font-size: clamp(1.7rem, 2vw, 2.1rem);
    line-height: 1.55;
    color: var(--bt-text-dim);
}
.bt-hero-tagline em { font-style: normal; color: var(--bt-cyan); }
.bt-chips { display: flex; flex-wrap: wrap; gap: .8rem; margin: 2.8rem 0 0; padding: 0; list-style: none; }
.bt-chips a {
    display: inline-block;
    padding: .55rem 1.2rem;
    font-family: var(--bt-mono);
    font-size: 1.35rem;
    color: var(--bt-text-dim);
    border: 1px solid var(--bt-border);
    border-radius: 999px;
    background: rgba(15, 37, 71, .6);
    transition: all .2s ease;
}
.bt-chips a::before { content: "#"; color: var(--bt-muted); margin-right: .15em; }
.bt-chips a:hover { color: var(--bt-amber); border-color: var(--bt-amber); text-decoration: none; transform: translateY(-1px); }

.bt-window {
    border: 1px solid var(--bt-border);
    border-radius: var(--bt-radius);
    background: var(--bt-surface);
    overflow: hidden;
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7), 0 0 0 1px rgba(108, 184, 255, .06), 0 0 60px -20px rgba(108, 184, 255, .35);
    transform: rotate(1.2deg);
}
.bt-window-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: var(--bt-bg-2);
    border-bottom: 1px solid var(--bt-border);
    font-family: var(--bt-mono);
    font-size: 1.2rem;
    color: var(--bt-muted);
}
.bt-window-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.bt-window-bar i:nth-child(2) { background: #febc2e; }
.bt-window-bar i:nth-child(3) { background: #28c840; margin-right: 8px; }
.bt-window img { display: block; width: 100%; height: auto; }

@media (max-width: 860px) {
    .bt-hero-inner { grid-template-columns: 1fr; }
    .bt-window { transform: none; max-width: 480px; }
}

/* titoli di sezione argomento */
.bt-section-label {
    font-family: var(--bt-mono);
    font-size: 1.3rem;
    color: var(--bt-muted);
    margin: 0 0 2.4rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px dashed var(--bt-border);
}
.bt-section-label b { color: var(--bt-amber); font-weight: 600; }

/* ---------- card dei post ---------- */
.site-main.outer { padding-top: 2vmin; }
.post-feed { gap: 3.2rem 3.2rem; padding-top: 1vmin; }
.post-card {
    background: linear-gradient(180deg, rgba(19, 48, 92, .55), rgba(15, 37, 71, .55));
    border: 1px solid var(--bt-border);
    border-radius: var(--bt-radius);
    padding: 0 0 2rem;
    overflow: hidden;
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.post-card:hover {
    transform: translateY(-3px);
    border-color: rgba(108, 184, 255, .55);
    box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .8), 0 0 40px -18px rgba(108, 184, 255, .5);
}
.post-card-image-link { border-radius: 0 !important; margin-bottom: 0; }
.post-card-content { padding: 2rem 2.2rem 0; }
.post-card-large .post-card-content { padding: 2.6rem 3rem 0 0; }
@media (max-width: 1000px) { .post-card-large .post-card-content { padding: 2rem 2.2rem 0; } }
@media (min-width: 1001px) { .post-card-large { padding: 0; } .post-card-large .post-card-image-link { margin-bottom: 0; } }

.post-card-tags, .article-tag {
    font-family: var(--bt-mono);
    font-size: 1.2rem;
    letter-spacing: .02em;
    text-transform: none;
}
.post-card-primary-tag, .post-card-primary-tag a, html.dark-mode .post-card-primary-tag { color: var(--bt-amber) !important; }
.post-card-primary-tag::before { content: "#"; opacity: .6; }
html.dark-mode .post-card-title, .post-card-title {
    color: var(--bt-text);
    font-family: var(--bt-sans);
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.2;
}
.post-card:hover .post-card-title { color: #fff; }
html.dark-mode .post-card-excerpt, .post-card-excerpt { color: var(--bt-text-dim); font-family: var(--bt-sans); }
html.dark-mode .post-card-meta, .post-card-meta { color: var(--bt-muted); font-family: var(--bt-mono); font-size: 1.2rem; }
.post-card-meta-date::before { content: "› "; color: var(--bt-green); }

/* ---------- articolo ---------- */
.article-header { padding-top: 6vmin; }
html.dark-mode .article-title, .article-title {
    color: var(--bt-text);
    font-family: var(--bt-sans);
    font-weight: 800;
    letter-spacing: -.03em;
}
html.dark-mode .article-excerpt, .article-excerpt { color: var(--bt-text-dim); }
.author-name, html.dark-mode .author-name { color: var(--bt-text); }
.byline-meta-content, html.dark-mode .byline-meta-content { color: var(--bt-muted); font-family: var(--bt-mono); font-size: 1.25rem; }
.article-image img { border-radius: var(--bt-radius); border: 1px solid var(--bt-border); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .8); }
html.dark-mode .gh-button-share, .gh-button-share { border-color: var(--bt-border); color: var(--bt-text-dim); }

.gh-content { font-family: var(--bt-sans); }
html.dark-mode .gh-content > p, html.dark-mode .gh-content > ul, html.dark-mode .gh-content > ol,
.gh-content > p, .gh-content > ul, .gh-content > ol { color: #d9d4c6; font-size: 1.95rem; line-height: 1.7; }
.gh-content > h2, html.dark-mode .gh-content > h2 {
    color: var(--bt-text);
    font-weight: 800;
    letter-spacing: -.02em;
    margin-top: 1.6em;
}
.gh-content > h2::before {
    content: "## ";
    font-family: var(--bt-mono);
    color: var(--bt-amber);
    font-weight: 600;
}
.gh-content > h3, html.dark-mode .gh-content > h3 { color: var(--bt-cyan); }
.gh-content a { color: var(--bt-blue); box-shadow: inset 0 -1px 0 rgba(108, 184, 255, .45); }
.gh-content strong { color: #fff; }
.gh-content em { color: var(--bt-text); }
.gh-content li::marker { color: var(--bt-amber); }
.gh-content hr { border-color: var(--bt-border); }
.gh-content blockquote { border-left: 3px solid var(--bt-amber); color: var(--bt-text-dim); }

/* codice inline */
.gh-content :not(pre) > code, html.dark-mode .gh-content :not(pre) > code {
    font-family: var(--bt-mono);
    font-size: .82em;
    color: var(--bt-amber);
    background: rgba(255, 196, 87, .09);
    border: 1px solid rgba(255, 196, 87, .2);
    border-radius: 5px;
    padding: .1em .35em;
}
/* blocchi di codice come finestre di terminale */
.gh-content pre, html.dark-mode .gh-content pre {
    position: relative;
    font-family: var(--bt-mono);
    font-size: 1.45rem;
    line-height: 1.65;
    color: #d7e3f4;
    background: #050e1e;
    border: 1px solid var(--bt-border);
    border-radius: var(--bt-radius);
    padding: 4.4rem 2.2rem 2rem;
    box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .9);
}
.gh-content pre::before {
    content: "";
    position: absolute;
    top: 14px; left: 16px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: #ff5f57;
    box-shadow: 18px 0 0 #febc2e, 36px 0 0 #28c840;
}
.gh-content pre::after {
    content: attr(data-lang);
    position: absolute;
    top: 10px; right: 16px;
    font-size: 1.15rem;
    color: var(--bt-muted);
}
.gh-content pre code { font-family: inherit; background: none; color: inherit; }

/* tabelle */
.gh-content table:not(.gist table) {
    font-size: 1.5rem;
    border: 1px solid var(--bt-border);
    border-radius: 10px;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(15, 37, 71, .5);
}
.gh-content table:not(.gist table) th, html.dark-mode .gh-content table:not(.gist table) th {
    background: var(--bt-surface-2);
    color: var(--bt-amber);
    font-family: var(--bt-mono);
    font-size: 1.2rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-color: var(--bt-border);
}
.gh-content table:not(.gist table) td, html.dark-mode .gh-content table:not(.gist table) td {
    color: var(--bt-text-dim);
    border-color: var(--bt-border);
}
.gh-content table:not(.gist table) tr:hover td { background: rgba(108, 184, 255, .06); }
html.dark-mode .gh-content table:not(.gist table) td:first-child,
.gh-content table:not(.gist table) td:first-child { background-image: none; }
html.dark-mode .gh-content table:not(.gist table) td:last-child,
.gh-content table:not(.gist table) td:last-child { background-image: none; }

/* articoli correlati / footer */
.read-more-wrap, html.dark-mode .read-more-wrap { background: var(--bt-bg-2); border-top: 1px solid var(--bt-border); }
.footer-cta, html.dark-mode .footer-cta { background: transparent; }
.footer-cta-title, html.dark-mode .footer-cta-title { color: var(--bt-text); font-family: var(--bt-mono); }
.footer-cta-button, html.dark-mode .footer-cta-button { background: var(--bt-surface); border: 1px solid var(--bt-border); color: var(--bt-text-dim); }
.footer-cta-button span { background: var(--bt-amber); color: #081428; }

.site-footer, html.dark-mode .site-footer {
    background: #050e1e;
    color: var(--bt-muted);
    border-top: 1px solid var(--bt-border);
    font-family: var(--bt-mono);
    font-size: 1.25rem;
}
.site-footer a { color: var(--bt-text-dim); }
.site-footer .copyright a::before { content: "© "; }
.bt-footer-motd { color: var(--bt-green); }

.pagination a, html.dark-mode .pagination a { font-family: var(--bt-mono); color: var(--bt-text-dim); }

/* fix: spazio tra logo e menu, chip allineati */
.gh-head-brand { margin-right: 3.2rem; }
.bt-chips li { margin: 0; padding: 0; line-height: 1; }

/* Paragrafi dentro le card HTML bilingue (es. About) */
.gh-content > .lang-it > * + *, .gh-content > .lang-en > * + * { margin-top: 1.4em; }
