/**
 * Monospace Web Portfolio
 * Inspired by getbindu.com / Oskar Wickström's Monospace Web
 * Adapted for a personal portfolio
 **/
@import url('https://fonts.cdnfonts.com/css/jetbrains-mono-2');

:root {
    --font-family: "JetBrains Mono", monospace;
    --line-height: 1.20rem;
    --border-thickness: 2px;
    --text-color: #fff;
    --text-color-alt: #888;
    --background-color: #000;
    --background-color-alt: #111;
    --accent-color: #fff;
    --accent-color-alt: #ccc;
    --accent-glow: rgba(255, 255, 255, 0.05);
    --success-color: #34d399;
    --warning-color: #fbbf24;

    font-family: var(--font-family);
    font-optical-sizing: auto;
    font-weight: 500;
    font-style: normal;
    font-variant-numeric: tabular-nums lining-nums;
    font-size: 16px;

    scroll-behavior: smooth;
}

:root[data-theme="light"] {
    --text-color: #1a1a2e;
    --text-color-alt: #555;
    --background-color: #faf9f7;
    --background-color-alt: #eeedeb;
    --accent-color: #5b4cc4;
    --accent-color-alt: #7c6aef;
    --accent-glow: rgba(91, 76, 196, 0.1);
}

* {
    box-sizing: border-box;
}

*+* {
    margin-top: var(--line-height);
}

html {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    flex-direction: column;
    align-items: center;
    background: var(--background-color);
    color: var(--text-color);
}

body {
    position: relative;
    width: 100%;
    margin: 0;
    padding: var(--line-height) 2ch;
    max-width: calc(min(80ch, round(down, 100%, 1ch)));
    line-height: var(--line-height);
    overflow-x: hidden;
}

@media screen and (max-width: 480px) {
    :root {
        font-size: 14px;
    }

    body {
        padding: var(--line-height) 1ch;
    }
}

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

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

h1 {
    font-size: 2rem;
    line-height: calc(2 * var(--line-height));
    margin-bottom: calc(var(--line-height) * 2);
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-color-alt), var(--success-color));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

h2 {
    font-size: 1rem;
    text-transform: uppercase;
    color: var(--accent-color);
}

h3 {
    font-size: 0.95rem;
    color: var(--accent-color-alt);
}

/* ============== HORIZONTAL RULE ============== */

hr {
    position: relative;
    display: block;
    height: var(--line-height);
    margin: calc(var(--line-height) * 1.5) 0;
    border: none;
    color: var(--text-color);
}

hr:after {
    display: block;
    content: "";
    position: absolute;
    top: calc(var(--line-height) / 2 - var(--border-thickness));
    left: 0;
    width: 100%;
    border-top: calc(var(--border-thickness) * 3) double var(--accent-color);
    height: 0;
    opacity: 0.4;
}

/* ============== LINKS ============== */

a {
    text-decoration-thickness: var(--border-thickness);
    color: var(--accent-color);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:link,
a:visited {
    color: var(--accent-color);
}

a:hover {
    color: var(--accent-color-alt);
    text-shadow: 0 0 12px var(--accent-glow);
}

/* ============== TEXT ============== */

p {
    margin-bottom: var(--line-height);
    word-break: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

strong {
    font-weight: 800;
    color: var(--accent-color-alt);
}

em {
    font-style: italic;
}

blockquote {
    border-left: calc(var(--border-thickness) * 2) solid var(--accent-color);
    padding-left: 2ch;
    margin: var(--line-height) 0;
    color: var(--text-color-alt);
    font-style: italic;
    position: relative;
}

blockquote::before {
    content: ">";
    position: absolute;
    left: 0.5ch;
    color: var(--accent-color);
    opacity: 0.5;
}

/* ============== TABLE / HEADER ============== */

table {
    position: relative;
    top: calc(var(--line-height) / 2);
    width: calc(round(down, 100%, 1ch));
    border-collapse: collapse;
    margin: 0 0 calc(var(--line-height) * 2);
}

th,
td {
    border: var(--border-thickness) solid var(--text-color);
    padding:
        calc((var(--line-height) / 2)) calc(1ch - var(--border-thickness) / 2) calc((var(--line-height) / 2) - (var(--border-thickness)));
    line-height: var(--line-height);
    vertical-align: top;
    text-align: left;
}

table tbody tr:first-child>* {
    padding-top: calc((var(--line-height) / 2) - var(--border-thickness));
}

th {
    font-weight: 700;
}

.width-min {
    width: 0%;
}

.width-auto {
    width: 100%;
}

.header {
    margin-bottom: calc(var(--line-height) * 2);
    border-color: var(--accent-color);
}

.header td {
    border-color: var(--accent-color);
}

.header h1 {
    margin: 0;
}

.header tr td:last-child {
    text-align: right;
}

.header tr td:last-child a {
    transition: all 0.2s ease;
}

.header tr td:last-child a:hover {
    color: var(--accent-color-alt);
    text-shadow: 0 0 20px var(--accent-glow);
}

/* ============== SUBTITLE ============== */

.subtitle {
    color: var(--text-color-alt);
    font-size: 0.85rem;
}

/* ============== CODE / PRE ============== */

pre {
    white-space: pre;
    overflow-x: auto;
    margin: var(--line-height) 0;
    overflow-y: hidden;
}

figure pre {
    margin: 0;
}

pre,
code {
    font-family: var(--font-family);
}

code {
    font-weight: 600;
    color: var(--accent-color-alt);
}

/* ============== FIGURE ============== */

figure {
    margin: calc(var(--line-height) * 2) 3ch;
    overflow-x: auto;
    overflow-y: hidden;
}

figcaption {
    display: block;
    font-style: italic;
    margin-top: var(--line-height);
    color: var(--text-color-alt);
}

/* ============== LISTS ============== */

ul,
ol {
    padding: 0;
    margin: 0 0 var(--line-height);
}

ul {
    list-style-type: square;
    padding: 0 0 0 2ch;
}

ul li::marker {
    color: var(--accent-color);
}

ol {
    list-style-type: none;
    counter-reset: item;
    padding: 0;
}

ol ul,
ol ol,
ul ol,
ul ul {
    padding: 0 0 0 3ch;
    margin: 0;
}

ol li:before {
    content: counters(item, ".") ". ";
    counter-increment: item;
    font-weight: 600;
    color: var(--accent-color);
}

li {
    margin: 0;
    padding: 0;
}

li::marker {
    line-height: 0;
}

/* ============== IMAGES / MEDIA ============== */

img,
video {
    display: block;
    width: 100%;
    object-fit: contain;
    overflow: hidden;
}

img {
    font-style: italic;
    color: var(--text-color-alt);
}

/* ============== DETAILS / ACCORDION ============== */

details {
    border: var(--border-thickness) solid var(--accent-color);
    padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
    margin-bottom: var(--line-height);
    transition: background 0.2s ease;
}

details:hover {
    background: var(--accent-glow);
}

summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--accent-color-alt);
}

details[open] summary {
    margin-bottom: var(--line-height);
}

details ::marker {
    display: inline-block;
    content: '▶';
    margin: 0;
}

details[open] ::marker {
    content: '▼';
}

details :last-child {
    margin-bottom: 0;
}

/* ============== SCROLLBAR ============== */

::-webkit-scrollbar {
    height: var(--line-height);
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color-alt);
}

/* ============== INPUT / BUTTONS ============== */

input,
button,
textarea {
    border: var(--border-thickness) solid var(--text-color);
    padding:
        calc(var(--line-height) / 2 - var(--border-thickness)) calc(1ch - var(--border-thickness));
    margin: 0;
    font: inherit;
    font-weight: inherit;
    height: calc(var(--line-height) * 2);
    width: auto;
    overflow: visible;
    background: var(--background-color);
    color: var(--text-color);
    line-height: normal;
    -webkit-font-smoothing: inherit;
    -moz-osx-font-smoothing: inherit;
    -webkit-appearance: none;
}

button {
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    border-color: var(--accent-color);
    transition: all 0.2s ease;
}

button:hover {
    background: var(--accent-color);
    color: var(--background-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

button:active {
    transform: translate(2px, 2px);
}

button:focus,
input:focus {
    --border-thickness: 3px;
    outline: none;
    border-color: var(--accent-color);
}

/* ============== STATUS INDICATOR ============== */

.status {
    display: inline-block;
    width: 1ch;
    height: 1ch;
    border-radius: 50%;
    margin-right: 1ch;
    animation: pulse 2s ease-in-out infinite;
}

.status.available {
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.status.busy {
    background: var(--warning-color);
    box-shadow: 0 0 8px var(--warning-color);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============== SKILL TAGS ============== */

.skill-tag {
    display: inline-block;
    border: var(--border-thickness) solid var(--accent-color);
    padding: 0 1ch;
    margin: 0 0.5ch calc(var(--line-height) / 2) 0;
    font-size: 0.8rem;
    color: var(--accent-color-alt);
    transition: all 0.2s ease;
}

.skill-tag:hover {
    background: var(--accent-color);
    color: var(--background-color);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: translateY(-1px);
}

/* ============== PROJECT CARDS ============== */

.project-card {
    border: var(--border-thickness) solid var(--text-color);
    padding: calc(var(--line-height)) 2ch;
    margin-bottom: var(--line-height);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-color), var(--accent-color-alt));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover {
    border-color: var(--accent-color);
    background: var(--accent-glow);
    transform: translateX(4px);
}

.project-card:hover::before {
    opacity: 1;
}

.project-card h3 {
    margin-top: 0;
    margin-bottom: calc(var(--line-height) / 2);
}

.project-card .project-meta {
    color: var(--text-color-alt);
    font-size: 0.8rem;
    margin-top: 0;
}

.project-card p {
    margin-top: calc(var(--line-height) / 2);
}

/* ============== EXPERIENCE TIMELINE ============== */

.timeline-item {
    position: relative;
    padding-left: 3ch;
    margin-bottom: calc(var(--line-height) * 2);
}

.timeline-item::before {
    content: "●";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-color);
    font-size: 1.2rem;
}

.timeline-item::after {
    content: "";
    position: absolute;
    left: 0.45ch;
    top: var(--line-height);
    width: var(--border-thickness);
    height: calc(100% + var(--line-height));
    background: linear-gradient(180deg, var(--accent-color), transparent);
}

.timeline-item:last-child::after {
    display: none;
}

.timeline-date {
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
}

.timeline-role {
    font-weight: 800;
    margin-top: 0;
}

.timeline-company {
    color: var(--text-color-alt);
    margin-top: 0;
}

/* ============== CONTACT LINK ROW ============== */

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1ch;
    margin-top: var(--line-height);
}

.contact-links a {
    border: var(--border-thickness) solid var(--accent-color);
    padding: calc(var(--line-height) / 2) 2ch;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.contact-links a:hover {
    background: var(--accent-color);
    color: var(--background-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ============== FADE IN ANIMATION ============== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
    opacity: 0;
}

.fade-in:nth-child(1) {
    animation-delay: 0.1s;
}

.fade-in:nth-child(2) {
    animation-delay: 0.2s;
}

.fade-in:nth-child(3) {
    animation-delay: 0.3s;
}

.fade-in:nth-child(4) {
    animation-delay: 0.4s;
}

.fade-in:nth-child(5) {
    animation-delay: 0.5s;
}

.fade-in:nth-child(6) {
    animation-delay: 0.6s;
}

/* ============== ASCII ART SECTION ============== */

.ascii-art {
    color: var(--accent-color);
    opacity: 0.6;
    font-size: 0.75rem;
    line-height: 1.1;
    margin: calc(var(--line-height) * 2) 0;
    transition: opacity 0.3s ease;
}

.ascii-art:hover {
    opacity: 1;
}

/* ============== TABLE OF CONTENTS ============== */

nav#TOC {
    border: var(--border-thickness) solid var(--accent-color);
    padding: var(--line-height) 2ch;
    margin-bottom: calc(var(--line-height) * 2);
    background: var(--accent-glow);
}

nav#TOC h2 {
    margin-top: 0;
    margin-bottom: var(--line-height);
}

nav#TOC ul {
    list-style-type: none;
    padding-left: 0;
}

nav#TOC li {
    margin-bottom: calc(var(--line-height) / 2);
}

nav#TOC li::before {
    content: "├── ";
    color: var(--accent-color);
    opacity: 0.5;
}

nav#TOC li:last-child::before {
    content: "└── ";
}

nav#TOC a {
    text-decoration: none;
    transition: all 0.2s ease;
}

nav#TOC a:hover {
    color: var(--accent-color-alt);
    text-shadow: 0 0 12px var(--accent-glow);
}

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

.footer {
    margin-top: calc(var(--line-height) * 3);
    padding-top: var(--line-height);
    border-top: var(--border-thickness) solid var(--accent-color);
    color: var(--text-color-alt);
    font-size: 0.8rem;
    text-align: center;
    opacity: 0.6;
}

/* ============== DEBUG GRID (kept for development) ============== */

.debug .debug-grid {
    --color: color-mix(in srgb, var(--text-color) 10%, var(--background-color) 90%);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-image:
        repeating-linear-gradient(var(--color) 0 1px, transparent 1px 100%),
        repeating-linear-gradient(90deg, var(--color) 0 1px, transparent 1px 100%);
    background-size: 1ch var(--line-height);
    margin: 0;
}

.debug .off-grid {
    background: rgba(255, 0, 0, 0.1);
}

/* ============== THEME TOGGLE BUTTON ============== */

.theme-toggle {
    display: block;
    margin-left: auto;
    margin-top: var(--line-height);
    border: var(--border-thickness) solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    padding: calc(var(--line-height) / 2) 2ch;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    height: auto;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--accent-color);
    color: var(--background-color);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Background glow removed for clean black look */

/* ============== SELECTION ============== */

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