/*
 * Custom Hugo Theme CSS
 * A clean, extendable CSS foundation based on the console theme
 */

/* ========== VARIABLES ========== */
:root {
    /* Forces dark mode rendering */
    color-scheme: dark only !important;

    /* Font settings */
    --font-stack: monospace;
    --global-font-size: 16px;
    --global-line-height: 1.4em;

    /* Dark theme colors */
    --background-color: #1d2021;
    --font-color: #ddc7a1;
    --primary-color: #a9b665;
    --secondary-color: #a89984;
    --error-color: #ea6962;

    /* Layout */
    --global-space: 10px;
    --page-width: 60em;
}

/* Prevents browsers from auto-applying light styles */
@media (prefers-color-scheme: light) {
    :root {
        /* Restate your dark theme colors here to override any light mode preferences */
        --background-color: #1d2021 !important;
        --font-color: #ddc7a1 !important;
        --primary-color: #a9b665 !important;
        --secondary-color: #a89984 !important;
        --error-color: #ea6962 !important;
    }
}

/* ========== BASE STYLES ========== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-stack) !important;
    font-size: var(--global-font-size) !important;
    color: var(--font-color) !important;
    line-height: var(--global-line-height) !important;
    background-color: var(--background-color) !important;
    margin: 0;
    padding: 0;
}

a {
    color: var(--primary-color) !important;
    text-decoration: none;
}

a:hover {
    background-color: var(--primary-color) !important;
    color: var(--background-color) !important;
}

h1, h2, h3, h4, h5, h6 {
    line-height: var(--global-line-height);
    font-weight: 600;
    margin: calc(var(--global-space) * 2) 0;
}

p {
    margin: 0 0 var(--global-line-height);
}

/* ========== LAYOUT ========== */
.container {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 calc(var(--global-space) * 2);
}

/* ========== TERMINAL NAVIGATION ========== */
.terminal-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 20px 0;
}

.terminal-logo, .logo {
    font-weight: normal;
    margin: 0;
    padding: 0;
}

.terminal-prompt {
    position: relative;
    white-space: nowrap;
}

/* Blinking cursor effect */
.terminal-prompt::after {
    content: "";
    animation: cursor 1000ms infinite;
    background: var(--primary-color);
    display: inline-block;
    height: 1em;
    margin-left: 0.2em;
    width: 0.6em;
    bottom: -2px;
    position: relative;
}

@keyframes cursor {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.terminal-menu {
    margin-left: 0;
    margin-top: 10px;
}

.terminal-menu ul {
    display: flex;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.terminal-menu li {
    margin-right: 20px;
}

.terminal-menu li:last-child {
    margin-right: 0;
}

.terminal-menu li a {
    color: var(--secondary-color);
}

.terminal-menu li a:hover,
.terminal-menu li a.active {
    color: var(--font-color);
    background-color: transparent;
}

/* Footer styling */
.footer {
    clear: both;
    margin-top: 50px;
    padding-top: 0px;
    border-top: 1px solid var(--secondary-color);
    color: var(--secondary-color); /* Changed to secondary-color for darker text */
    font-size: 0.6rem;
}

.footer-content {
    opacity: 0.4;
}

/* Image styling - left alignment by default */
figure {
  display: block;
  text-align: left;
  margin: 1.5em 0;  /* Vertical margin only */
  width: 100%;
}

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

/* ========== CODE HIGHLIGHTING ========== */
pre {
    background-color: #282a36;  /* Dracula background */
    padding: calc(var(--global-space) * 1.5);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: var(--global-space) 0 calc(var(--global-space) * 2) 0;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
}

code {
    font-family: var(--font-stack);
    padding: 0.1em 0.2em;
    border-radius: 3px;
    background-color: #282828;
}

pre code {
    background-color: transparent;
    padding: 0;
}

:not(pre) > code {
    color: #e78a4e;  /* Light orange */
    font-weight: bold;
}

/* ========== TABLE STYLING ========== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--global-space) 0 calc(var(--global-space) * 2) 0;
    overflow-x: auto;
    display: block;
}

table th,
table td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid #3d3d3d;
}

table th {
    background-color: #2a2a2a;
    color: #e78a4e;
    font-weight: bold;
}

table td {
    background-color: #1a1a1a;
}

/* Style code within tables */
table code {
    color: #d8a657;
    background: transparent;
    padding: 0;
}

/* Add alternating row colors for better readability */
table tr:nth-child(even) td {
    background-color: #222222;
}

/* Add hover effect */
table tr:hover td {
    background-color: #2c2c2c;
}

/* Table caption styling */
table caption {
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Post metadata styling */
.post-metadata {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: var(--global-space);
    font-size: 0.9em;
    color: var(--secondary-color);
}

.published-date, .edited-date {
    margin-right: 20px;
}

/* ========== MOBILE RESPONSIVE ========== */
@media only screen and (max-width: 850px) {
    :root {
        --global-font-size: 14px;
    }

    .terminal-nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .terminal-menu ul {
        flex-direction: row;
        margin-top: 10px;
    }

    .site-name {
        width: 2ch;
        overflow: hidden;
        display: inline-block;
    }
}

@media only screen and (max-width: 850px) {
    .footer {
        margin-top: 50px;
        padding-top: 0px;
    }
}

@media (min-width: 768px) {
    table {
        display: table;
    }
}

@media only screen and (max-width: 800px) {
  figure img {
    width: 100%;  /* Full width on very small screens */
  }
}

@media only screen and (max-width: 850px) {
    .post-metadata {
        flex-direction: column;
    }

    .published-date, .edited-date {
        margin-bottom: 5px;
    }
}
