/* VARIABLES */
@font-face {
    font-family: "JetBrains Mono";
    src: url('./fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}


:root {
    /* Color Palette */
    --bg-color: #101010;
    --text-color: #dfdfdf;
    --link-color: #59bb9a; /* #2fd0c0; */
    --accent-color: #903355;
    
    /* Code Snippet Colors */
    --code-text: #b0b0b0;      /* The grey you requested */
    --code-bg:   #252525;      /* Darker background for contrast */
    --type-speed: 1s;
    --delay-ciao: 1.5s;
    --rain-color: rgba(255, 255, 255, 0.2);

    /* Typography */
    --font-main: "JetBrains Mono", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    
    /* Layout */
    --max-width: 800px;
    --spacing-unit: 1rem;
}


/*---------*/
.terminal-prompt h1 code {
    display: flex;         /* Use flexbox to keep items side-by-side */
    flex-wrap: nowrap;     /* Force a single line */
    align-items: center;   /* Keep text vertically aligned */
    width: auto;
}
/* 2. Animate ONLY the 'whoami' span */
.type-this{
    display: inline-block;
    vertical-align: bottom;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    margin-left: 6px;
    animation: 
        typing-command 0.6s steps(6) forwards, /* 6 steps for 6 letters in 'whoami' */
        cursor-blink 0.5s step-end infinite;
}

.ciao {
   display: inline-block;
    vertical-align: bottom;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: 
        typing-command 0.6s steps(6) forwards, /* 6 steps for 6 letters in 'whoami' */


}

/* 3. The "Ciao" Heading Animation */
h1.ciao{
    font-size: 2.0rem; 
    font-weight: 700; 
    overflow: hidden;
    white-space:nowrap;
    width: 0;
    margin-left: 0px;
    animation: typing-ciao 0.6s steps(15) forwards;
    animation-delay: 0.8s; /* Starts after whoami finishes */
}

/* 4. The Last Prompt (Hidden until the end) */
.terminal-prompt:last-of-type {
    opacity: 0;
    animation: show-last-prompt 0.1s forwards;
    animation-delay: 1.5s;
}

/* Keyframes */
@keyframes typing-command {
    from { width: 0; }
    to { width: 7ch; border-right-color: transparent; } /* 7ch covers the text + a tiny bit of space */
}

@keyframes typing-ciao {
    from { width: 0; }
    to { width: max-content; }
}

@keyframes cursor-blink {
    50% { border-color: transparent; }
}

@keyframes show-last-prompt {
    to { opacity: 1; }
}



/*----------*/





.terminal-prompt {
    margin-bottom: 0.5rem;
    font-size: 1.2rem; /* Sized to look like a heading */
}

.terminal-prompt code {
    background: transparent; /* Remove the gray box so it looks integrated */
    border: none;
    padding: 0;
    color: var(--text-color);
}

.terminal-prompt.static-prompt {
    opacity: 1 !important;
    animation: none !important;
}

.prompt {
    color: var(--link-color);
    font-weight: bold;
}

.cursor {
    color: var(--link-color);
    margin-left: 4px;
    /* This makes it blink "sharply" (on or off) */
    animation: block-blink 1.2s steps(2, start) infinite;
}


.cd {
    color: var(--accent-color);
}

@keyframes block-blink {
    to { opacity: 0; }
}



/* 2. BASE STYLES */
body {
    /* This creates a soft glow from the top center */
/*    background: radial-gradient(ellipse at top, #1e1e1e 0%,rgba(30, 30, 30, 0.7) 30%, rgba(30, 30, 30, 0.3) 80%, var(--bg-color) 100%, transparent 10%);*/
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background-attachment: fixed; /* Keeps the glow in place as you scroll */
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 18px;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem var(--spacing-unit);
}



@keyframes pageFadeIn {
  from {
    opacity: 0; 
    transform: translateY(5px);/* Optional: slight slide up effect */
    filter: blur(1px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}


/* 3. HEADINGS */
h1, h2, h3 {
    line-height: 1.2;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h1 { 
    font-size: 2.5rem; 
    font-weight: 700; 
    letter-spacing: -0.05rem; 
    
}

h2 { 
    font-size: 1.75rem;
    /* This creates a line that fades out to the right */
    border-bottom: 2px solid;
    border-image: linear-gradient(to right, var(--accent-color), transparent) 1;
    padding-bottom: 0.5rem;
}

h3 { 
    font-size: 1.25rem;
    /* This creates a line that fades out to the right */
    border-bottom: 2px solid;
    border-image: linear-gradient(to right, var(--accent-color), transparent) 1;
    padding-bottom: 0.5rem;
}


/* 4. LINKS */
a {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: background-color 0.2s; /* Subtle hover effect */
}

a:hover {
    background-color: var(--code-bg);
    color: #fff;
    text-decoration: none;
}


a[href^="http"]::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.6;
}

p { margin-bottom: 1.5rem; }

/* 5. NAVIGATION */
nav {
    display: flex;
    gap: 1.0rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid;
    border-image: linear-gradient(to right, var(--accent-color), transparent) 1;
    padding-bottom: 0.5rem;

    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    
}


/* Hide the scrollbar for a cleaner look while keeping the functionality */
nav::-webkit-scrollbar {
    display: none;
}

nav a {
    text-decoration: none;
    font-weight: 600;
    color: var(--text-color);
}

.static-nav {
  opacity: 1; /* Always visible */
}

.page-content {
  opacity: 0;
  animation: pageFadeIn 1.0s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  /* --- Glassmorphism Effect --- */
  background: rgba(255, 255, 255, 0.01); /* Very slight white tint */
  backdrop-filter: blur(10px);           /* The "frosted" look */
  -webkit-backdrop-filter: blur(10px);    /* Safari support */
  border: 1px solid rgba(255, 255, 255, 0.02); /* Thin edge highlight */
  border-radius: 12px;                   /* Rounded corners */
  padding: 1.0rem;                         /* Space inside the box */
  box-shadow: 10px 10px 16px 0 rgba(0, 0, 0, 0.37); /* Depth */
}

nav a:hover { 
    color: var(--accent-color); 
    background-color: transparent; /* Override standard link hover */
}


ul {
    list-style: none; /* Remove default bullets */
    padding-left: 0;
}

li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.8rem;
}

/* Create a custom diamond or dash marker */
li::before {
    content: "⋄"; 
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}




/* MODULAR COMPONENTS */

/* Code Blocks */
code {
    font-family: var(--font-mono);
    color: var(--code-text);       /* Applies the grey color */
    background: var(--code-bg);    /* Applies the dark background */
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #333;        /* Subtle border to make it pop */
}



/* Image Framing */
.image-frame {
    border: 1px solid rgba(255, 255, 255, 0.02);
    background: rgba(255, 255, 255, 0.08); /* Very slight white tint */
    backdrop-filter: blur(8px);           /* The "frosted" look */
    padding: 0.5rem;
    border-radius: 8px;
    margin: 1rem auto;
    box-shadow: 13px 13px 10px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    width: fit-content;
}

.image-frame img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    /* Optional: subtle grayscale or sepia for the terminal look */
    filter: brightness(1) contrast(1.1);
    transition: filter 0.3s ease;
}

.image-frame img:hover {
    filter: none /* Brings back full color/brightness on hover */
}

.image-caption {
    font-size: 0.9rem;
    color: var(--code-text);
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
    font-family: var(--font-mono);
}

/* Doc Framing */

.doc-frame {
    border: 1px solid rgba(255, 255, 255, 0.02);
    background: rgba(255, 255, 255, 0.005); /* Very slight white tint */
    backdrop-filter: blur(8px);           /* The "frosted" look */
    padding: 0.5rem;
    border-radius: 8px;
    margin: 1rem auto;
    box-shadow: 13px 13px 10px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    width: fit-content;
}


/* Blockquotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    background-color: #1a1a1a;
    margin: 1.5rem 0;
    padding: 1rem;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    font-size: 0.9rem;
    color: #666;
    border-top: 2px solid;
    border-image: linear-gradient(to right, var(--accent-color), transparent) 1;
    
}



/* WRITINGS LIST */
.post-list {
    list-style: none;
    padding: 0;
}

.post-item {
    display: flex;
    align-items: flex-start; /* Keeps the date aligned with the first line of text */
    gap: 15px;
    margin-bottom: 1.2rem;
}

.post-date {
    flex-shrink: 0; /* Prevents the date box from squishing */
}


pre.ascii-center {
    width: fit-content;
    max-width: 100%;
    margin: 2rem auto;
    text-align: left;
    
    /* The Magic Trick: Fluid Typography */
    /* clamp(minimum_size, preferred_dynamic_size, maximum_size) */
    font-size: clamp(0.5rem, 2.5vw, 1rem); 
    
    /* Keeps the lines tightly connected as the text shrinks */
    line-height: 1.2;
}

pre.ascii {
    white-space: pre-wrap;
    width: fit-content;
    word-break: break-all;
    overflow-wrap: break-word;
    max-width: 99%;
    margin: 0.0rem auto;
    text-align: left;
    max-width: 100%;
    
    /* The Magic Trick: Fluid Typography */
    /* clamp(minimum_size, preferred_dynamic_size, maximum_size) */
    font-size: clamp(3vw, 4vw, 6rem); 
    
    /* Keeps the lines tightly connected as the text shrinks */
    line-height: 1.1;
}


/* RESPONSIVENESS */
@media (max-width: 700px) {
    body { font-size: 6vw; padding: 2vw; }
    h1 { font-size: 6vw; }
    .container, .main, section, header, nav {
      width: auto !important;
      float: none !important;
      padding: 1px;
      padding-bottom: 0.5rem;
      margin: 0;
      margin-left: 0 !important;
      margin-right: 0 !important;
      margin-bottom: 20px;
      gap: 1rem;
    }
    p, h1, h2, h3 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    h1.ciao {
        font-size: 6.0vw !important; /* Reduces the size specifically for mobile */
        white-space: normal;           /* Allows text to wrap if the name is long */
        width: auto;                  /* Prevents the typing animation from clipping */
        animation: typing-ciao 1.6s steps(15) forwards;
    }

    li {
	font-size: 5.0vw !important;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis; /* Optional: adds ... if still too long */
    }

    .page-content {
        padding: 1rem;
        margin: 0;
        width: 100%; 
        box-sizing: border-box; /* Ensures padding doesn't add to width */
    }

    /* If Flexbox, stack items vertically */
    .flex-container, [style*="display: flex"] {
        flex-direction: column !important;
    }

    .terminal-prompt {
        font-size: 1rem; /* Shrink the prompt size so it fits */
    }
    .terminal-prompt h1 code {
	display: flex;
        flex-wrap: nowrap; !important; /* Do not break if the screen is tiny */
	font-size: 6.0vw;            /* Scales down the text to prevent overflow */
    }


    .post-item {
        flex-direction: column; /* Stacks the date on top of the title */
        gap: 5px;               /* Closer spacing between date and title */
    
    }

    ::selection {
        background: var(--accent-color);
        color: #fff;
    }

}
