/* ===================================
   CSS Variables
   =================================== */
:root {
    --ef-bg: #272e33;
    --ef-bg-muted: #2d353b;
    --ef-bg-lighter: #374145;
    --ef-bg-green: #3C4841;
    --ef-fg: #d3c6aa;
    --ef-red: #e67e80;
    --ef-green: #a7c080;
    --ef-yellow: #dbbc7f;
    --ef-blue: #7fbbb3;
    --ef-purple: #d699b6;
    --ef-aqua: #83c092;
    --ef-orange: #e69875;
    --ef-grey: #859289;
    --ef-muted: #7a8478;
    --content-max-width: 800px;
    --content-padding: 1ch;
    --border-radius: 5px;
    --font-size-base: 16px;
    --line-height-base: 1.6;
    --line-height-content: 1.6;
}

/* ===================================
   Reset & Base Styles
   =================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

@font-face {
    font-family: DepartureMono-Regular;
    src: url("/fonts/DepartureMono-Regular.woff2") format("woff2"),
        url("/fonts/DepartureMono-Regular.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: fallback;
}

html {
    color: var(--ef-fg);
    font-family: DepartureMono-Regular, ui-monospace, monospace;
    /* font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace; */
    /* font-family: system-ui, sans-serif; */
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    scroll-behavior: smooth;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    background: var(--ef-bg);
    color: var(--ef-fg);
    transition: background-color 0.2s ease, color 0.2s ease;
}

::selection,
::-moz-selection {
    background: var(--ef-green);
    color: var(--ef-bg);
    text-shadow: none;
}

/* ===================================
   Typography
   =================================== */
p {
    line-height: var(--line-height-content);
    margin-block: 1em;
}

hr {
    border: 0;
    border-block-start: 1px solid var(--ef-muted);
    margin-block: 1em;
}

blockquote {
    border-inline-start: 3px solid var(--ef-blue);
    padding-inline-start: 1em;
    margin: 0;
    font-style: italic;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ef-fg);
    margin-block: 1.5em 0.5em;
    line-height: 1.2;
}

h1 {
    font-size: 1.7em;
}

h2 {
    font-size: 1.35em;
}

h3,
h4,
h5,
h6 {
    font-size: 1.2em;
}

h1::before {
    content: '# ';
}

h2::before {
    content: '## ';
}

h3::before {
    content: '### ';
}

h4::before {
    content: '#### ';
}

h5::before {
    content: '##### ';
}

h6::before {
    content: '###### ';
}

h1::before,
h2::before,
h3::before,
h4::before,
h5::before,
h6::before {
    color: var(--ef-green);
}

a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-color: var(--ef-green);
    /* border-block-end: 1.75px solid var(--ef-green); */
    transition: background-color 0.2s ease, color 0.2s ease;
}

a:hover,
a:focus {
    background: var(--ef-green);
    color: var(--ef-bg);
    outline: 2px solid var(--ef-green);
    outline-offset: 2px;
}

/* Override underline for main/header links */
header .main a {
    border-block-end: none !important;
}

ul li::marker {
    font-weight: bold;
    color: var(--ef-red);
}

ol li::marker {
    color: var(--ef-red);
}

/* ===================================
   Media & Figures
   =================================== */
img {
    max-inline-size: 100%;
    block-size: auto;
}

figure {
    display: inline-block;
    margin: 0;
    max-inline-size: 100%;
}

figure img {
    max-block-size: 500px;
}

figure h4 {
    font-size: 1rem;
    font-style: italic;
    font-weight: 300;
    text-align: center;
    margin-block: 0 1em;
}

figure h4::before {
    content: '↳ ';
    color: var(--ef-red);
}

@media (min-width: 37.5em) {
    figure {
        padding-inline: 2.5rem;
    }
}

/* ===================================
   Code & Syntax Highlighting
   =================================== */
code {
    font-family: DepartureMono-Regular;
    background: var(--ef-bg-green);
    color: var(--ef-fg);
    padding: 0 0.15em;
    border: 1.75px solid var(--ef-green);
    font-size: 100%;
}

pre {
    background: var(--ef-bg-green);
    color: var(--ef-fg);
    line-height: 1.4;
    overflow-x: auto;
    padding: 0.75em;
    border: 1.75px solid var(--ef-green);
}

pre code {
    background: inherit;
    color: inherit;
    padding: 0;
    border: none;
}

.highlight {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.highlight pre ::selection {
    background: var(--ef-green);
}

.highlight pre code[class*="language-"]::before {
    content: attr(class);
    background: #000;
    color: var(--ef-fg);
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.025rem;
    padding: 0.1rem 0.5rem;
    position: absolute;
    top: 0;
    right: 1rem;
    border-radius: 0 0 0.25rem 0.25rem;
    text-transform: uppercase;
}

/* Language badges */
.highlight pre code[class*="language-js"]::before,
.highlight pre code[class="language-javascript"]::before {
    content: "js";
    background: #f7df1e;
    color: #000;
}

.highlight pre code[class*="language-ts"]::before {
    content: "ts";
    background: #3178c6;
    color: #fff;
}

.highlight pre code[class*="language-py"]::before,
.highlight pre code[class*="language-python"]::before {
    content: "python";
    background: #3776ab;
    color: #fff;
}

.highlight pre code[class*="language-go"]::before {
    content: "go";
    background: #00add8;
    color: #fff;
}

.highlight pre code[class*="language-css"]::before {
    content: "css";
    background: #1572b6;
    color: #fff;
}

.highlight pre code[class*="language-html"]::before {
    content: "html";
    background: #e34f26;
    color: #fff;
}

.highlight pre code[class*="language-json"]::before {
    content: "json";
    background: #000;
    color: #fff;
}

.highlight pre code[class*="language-yml"]::before,
.highlight pre code[class*="language-yaml"]::before {
    content: "yaml";
    background: #cc1018;
    color: #fff;
}

.highlight pre code[class*="language-shell"]::before,
.highlight pre code[class*="language-bash"]::before,
.highlight pre code[class*="language-sh"]::before {
    content: "shell";
    background: #4eaa25;
    color: #fff;
}

.highlight pre code[class*="language-md"]::before,
.highlight pre code[class*="language-markdown"]::before {
    content: "markdown";
    background: #083fa1;
    color: #fff;
}

/* ===================================
   Components
   =================================== */
.callout {
    padding: .5em 1em;
    margin-block: 1em;
    background: var(--ef-bg-lighter);
    border-left: 3px solid;
}

.callout-inner {
    display: flex;
    flex-direction: column;
}

.callout-header {
    margin-bottom: 0.5em;
}

.callout-body {
    color: var(--ef-fg);
}

.callout-note {
    border-color: var(--ef-green);
    color: var(--ef-green);
}

.callout-tip {
    border-color: var(--ef-aqua);
    color: var(--ef-aqua);
}

.callout-important {
    border-color: var(--ef-purple);
    color: var(--ef-purple);
}

.callout-warning {
    border-color: var(--ef-yellow);
    color: var(--ef-yellow);
}

.callout-caution {
    border-color: var(--ef-red);
    color: var(--ef-red);
}

.callout-custom {
    border-color: var(--ef-muted);
    color: var(--ef-muted);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
}

table {
    inline-size: 100%;
    margin-block: 1rem;
    border-collapse: collapse;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th,
td {
    padding: 0.75rem;
    border: 1px solid var(--ef-green);
    text-align: start;
}

th {
    background: var(--ef-bg-green);
    font-weight: bold;
    color: var(--ef-fg);
}

td {
    color: var(--ef-fg);
}

tr:nth-child(even) {
    background: var(--ef-bg-lighter);
}

.draft-label {
    background: var(--ef-red);
    color: var(--ef-bg);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    margin-inline-start: 0.375rem;
    font-size: 0.8em;
    font-weight: bold;
}

/* Footnotes Section */
.footnotes {
    font-size: 0.9em;
    color: var(--ef-muted);
}

.footnotes ol {
    margin: 0;
    padding-left: 1.6em;
}

.footnote-ref {
    border-block-end: none;
    text-decoration: none;
    color: var(--ef-green);
}

.footnote-backref {
    color: var(--ef-green);
    border-block-end: none;
    text-decoration: none;
}

/* ===================================
   Layout & Structure
   =================================== */
/* Main content container */
.content {
    max-inline-size: var(--content-max-width);
    margin-inline: auto;
    margin-block-end: 4em;
    padding-inline: var(--content-padding);
    overflow-wrap: break-word;
    flex: 1;
}

/* Header layout */
header {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin-block: 2em 1em;
    padding-block-end: 2em;
    gap: 1rem;
    border-block-end: 2px solid var(--ef-muted);
}

header .main {
    flex-shrink: 0;
    font-size: 2.2rem;
    font-weight: bold;
}

header .a-image img {
    height: 100px;
    width: auto;
    object-fit: contain;
    display: block;
}

header-nav {
    font-size: 1em;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem 1.5rem;
    line-height: 1.4;
}

header-nav a {
    white-space: nowrap;
}

header-nav a.active {
    background: var(--ef-green);
    color: var(--ef-bg);
    border-color: var(--ef-green);
}

@media (min-width: 660px) {
    header {
        justify-content: center;
    }

    header img {
        margin-right: 0.5em;
    }

    header-nav {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        justify-items: left;
        gap: 0.75rem 0.75rem;
    }

}
.post-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    align-items: flex-start;
}

@media (min-width: 60em) {
    .post-container {
        grid-template-columns: 1fr auto;
    }
}

.post-content {
    min-inline-size: 0;
    overflow-wrap: break-word;
}

.toc {
    background: var(--ef-bg-muted);
    border: 1px solid var(--ef-green);
    color: var(--ef-fg);
    max-inline-size: 13rem;
    overflow-y: auto;
    padding: 0.75rem;
}

.toc ul {
    padding-left: 1em;
    font-size: .95em;
}

@media (min-width: 60em) {
    .toc {
        /* font-size: 0.9rem; */
        position: sticky;
        top: 1.25rem;
    }
}

@media (max-width: 59.99em) {
    .toc {
        position: sticky;
        order: -1;
        max-inline-size: 20rem;
        margin-inline: auto;
    }
}

/* ===================================
   Navigation & Icons
   =================================== */
nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    line-height: 1.4em;
}


/* ===================================
   Footer
   =================================== */
.site-footer {
    max-inline-size: 800px;
    margin-inline: auto;
    padding-inline: var(--content-padding);
    margin-block-start: 2em;
    padding-block-start: 1em;
    border-block-start: 2px solid var(--ef-muted);
    margin-block-end: 1.5rem;
}

.footer-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

.footer-upper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 2em;
    flex-wrap: wrap;
}

.footer-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

.footer-cc {
    color: var(--ef-grey);
    text-align: center;
    font-size: 0.9rem;
}

.footer-cc a {
    color: var(--ef-grey);
}

.footer-social {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1em;
}

.footer-social a {
    border-block-end: none;
    outline: none;
    background: none;
}

.icon {
    inline-size: 24px;
    block-size: 24px;
    /* filter: invert(95%) sepia(9%) saturate(832%) hue-rotate(341deg) brightness(88%) contrast(86%); */
    filter: brightness(0) saturate(100%) invert(51%) sepia(12%) saturate(287%) hue-rotate(64deg) brightness(97%) contrast(88%);
    transition: filter 0.15s;
}

.icon:hover {
    filter: brightness(0) saturate(100%) invert(75%) sepia(41%) saturate(291%) hue-rotate(42deg) brightness(92%) contrast(86%);
}

.footer-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.footer-qr span {
    font-size: 0.8rem;
    color: var(--ef-muted);
}

.qr {
    display: block;
    width: 5em;
    height: 5em;
    filter: invert(1);
}

.footer-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    line-height: 0em;
    gap: .5em;
}

.footer-buttons a {
    text-decoration: none;
    border-block-end: none;
    outline: none;
    background: none;
}

.button {
    width: 88px;
    height: 31px;
}

/* ===================================
    Gallery & Lightbox
   =================================== */
.gallery {
    column-count: 3;
    column-gap: 8px;
}

.gallery a {
    display: block;
    margin-block-end: 8px;
    border-block-end: none;
    text-decoration: none;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s;
}

.gallery a:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.gallery img {
    inline-size: 100%;
    display: block;
    border-radius: inherit;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s, visibility 0.4s;
    z-index: 1000;
}

.lightbox:target {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-inline-size: 96%;
    max-block-size: 96vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.lightbox .close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font: bold 40px/1 sans-serif;
    text-decoration: none;
}

.lightbox .close:hover {
    background: none;
    outline: none;
    color: var(--ef-green);
}

@media (max-width: 800px) {
    .gallery {
        column-count: 2;
    }
}

@media (max-width: 500px) {
    .gallery {
        column-count: 1;
    }
}

/* ===================================
    Micro Blog
   =================================== */
.micro-board {
    column-count: 2;
    column-gap: 1rem;
    orphans: 1;
    widows: 1;
}

.micro-card {
    background: var(--ef-bg-muted);
    border: 1px solid var(--ef-muted);
    border-radius: 16px;
    padding: 1rem 1rem;
    margin-block-end: 1rem;
    break-inside: avoid;
    display: inline-block;
    inline-size: 100%;
    transition: all 0.25s ease;
}

.micro-card--latest {
    background: var(--ef-bg-lighter);
    border-color: var(--ef-green);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
    .micro-board {
        column-count: 1;
    }
}

.micro-header {
    display: flex;
    align-items: flex-start;
    position: relative;
}

.micro-user strong {
    color: var(--ef-fg);
    font-weight: 700;
    font-size: 1.02rem;
    display: block;
}

.handle {
    color: var(--ef-muted);
    font-size: 0.94rem;
}

.micro-date {
    position: absolute;
    top: 0.6rem;
    right: 0;
    font-size: 0.9rem;
    color: var(--ef-muted);
}

.micro-body {
    font-size: 1rem;
    color: var(--ef-fg);
}

.micro-body p {
    margin-block: 0.4em;
}

.micro-body p:last-child {
    margin-block-end: 0;
}

/* ===================================
    Homepage Layout
   =================================== */
.home-grid {
    display: grid;
    gap: 2rem;
}

.home-grid h1 {
    margin-block: 0 1rem;
}

.home-section {
    background: var(--ef-bg);
}

@media (min-width: 700px) {
    .home-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 699px) {
    .home-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ===================================
    Miscellaneous & Responsive
   =================================== */
.meta,
.date,
time {
    color: var(--ef-muted);
}

.meta,
time {
    font-size: 0.9em;
}

.date {
    font-size: 0.85em;
}

.title h1 {
    margin-block-end: 0;
}

article .title {
    margin-block: 0.5em 1em;
}

.recent-posts h1 {
    margin-block-start: 1em;
}

.site-title a {
    color: var(--ef-fg);
    text-decoration: none;
}

.site-description {
    margin-block: 2em;
    text-align: center;
}
