/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Courier New', 'Courier', monospace;
    line-height: 1.6;
    color: #000;
    background: #fafaf8;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-size: 18px;
    /* Engineering blueprint dot-grid */
    background-image: radial-gradient(circle, #ccc 0.5px, transparent 0.5px);
    background-size: 20px 20px;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    border-bottom: 4px solid #000;
    padding-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

h2::before {
    content: '>';
    color: #555;
    font-weight: 400;
    font-size: 1.4rem;
    animation: prompt-blink 1.2s step-end infinite;
}

@keyframes prompt-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

h3 {
    font-size: 1.2rem;
}

p {
    margin-bottom: 1rem;
}

/* Links */
a {
    color: #000;
    text-decoration: none;
    border-bottom: 2px solid #000;
    transition: all 0.15s;
}

a:hover {
    background-color: #000;
    color: #fff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
}

/* Header and Navigation */
header {
    margin-bottom: 3rem;
    padding: 1rem 0;
    border-bottom: 4px solid #000;
    background: #000;
    color: #fff;
    margin: -20px -20px 3rem -20px;
    padding: 1rem 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Header status indicator */
header::after {
    content: 'ONLINE';
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: #4a4;
    animation: led-blink 3s ease-in-out infinite;
}

nav {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: #fff;
    border-bottom: 2px solid #fff;
}

nav a:hover {
    background-color: #fff;
    color: #000;
}

/* Sections */
section {
    margin-bottom: 4rem;
}

#intro {
    margin-top: 2rem;
    display: flex;
    align-items: flex-end;
    gap: 2rem;
}

#intro-text {
    flex: 1;
    min-width: 0;
}

.arm-container {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.robot-arm-svg {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    cursor: none;
}

.tagline {
    font-size: 1.2rem;
    color: #333;
}

.talks-intro {
    color: #333;
    margin-bottom: 1.5rem;
}

.talks-subtitle {
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* Lists */
ul {
    list-style: none;
    padding: 0;
}

#about ul li,
.links li,
.talks-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #ddd;
    padding-left: 1.4rem;
    position: relative;
}

#about ul li::before,
.links li::before,
.talks-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #555;
}

#about ul li:last-child,
.links li:last-child,
.talks-list li:last-child {
    border-bottom: none;
}

/* PCB board */
.pcb-wrap {
    margin: -1rem 0 3rem 0;
}

.pcb-board {
    display: block;
    width: 100%;
    height: auto;
    border: 2px solid #000;
    box-shadow: 4px 4px 0 #000;
}

.pcb-signal {
    stroke-dasharray: 18 800;
    stroke-dashoffset: 0;
    animation: signal-pulse 2.8s linear infinite;
}

@keyframes signal-pulse {
    from { stroke-dashoffset:  20; }
    to   { stroke-dashoffset: -820; }
}


/* Project Cards */
.project-card {
    border: 2px solid #000;
    padding: 1.8rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 4px 4px 0 #000;
    position: relative;
    background: #fafaf8;
}

/* Industrial corner accents */
.project-card::before,
.project-card::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: #000;
    border-style: solid;
}

.project-card::before {
    top: 4px;
    left: 4px;
    border-width: 2px 0 0 2px;
}

.project-card::after {
    top: 4px;
    right: 4px;
    border-width: 2px 2px 0 0;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.project-title {
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-status {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid #000;
    padding: 0.15rem 0.5rem 0.15rem 1.4rem;
    white-space: nowrap;
    position: relative;
}

.project-status::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #000;
    animation: led-blink 1.8s ease-in-out infinite;
}

@keyframes led-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.1; }
}

.project-desc {
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.project-tags span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid #999;
    padding: 0.1rem 0.4rem;
    color: #666;
}

.project-links a {
    font-weight: 700;
    font-size: 0.9rem;
}

/* Timeline */
.timeline {
    margin-top: 1rem;
}

.job {
    padding: 0.8rem 0;
    border-left: 3px solid #000;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.year {
    display: inline-block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
    margin-right: 0.5rem;
}

.year::before {
    content: '[';
    color: #999;
}

.year::after {
    content: ']';
    color: #999;
}

/* Articles */
.writing-intro {
    color: #333;
    margin-bottom: 2rem;
}

#articles-loading {
    color: #666;
    font-style: italic;
}

.article-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #ddd;
}

.article-item:last-child {
    border-bottom: none;
}

.article-item time {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.article-item h3 {
    margin-bottom: 0.5rem;
}

.article-item h3 a {
    border-bottom: none;
}

.article-item h3 a:hover {
    background-color: transparent;
    color: #000;
    text-decoration: underline;
    text-decoration-color: #888;
}

.article-item p {
    color: #333;
    font-size: 0.95rem;
}

.view-all {
    margin-top: 2rem;
    text-align: right;
    font-weight: 700;
}

/* Footer robot */
.footer-bot {
    display: block;
    margin: 0 auto 0.75rem;
    animation: bot-float 3s ease-in-out infinite;
}

@keyframes bot-float {
    0%, 100% { transform: translateY(0);    }
    50%       { transform: translateY(-5px); }
}

/* Footer */
footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 4px solid #000;
    background: #111;
    color: #aaa;
    text-align: center;
    font-size: 0.85rem;
    margin: 4rem -20px -20px -20px;
    padding: 2rem 20px;
    font-family: 'Courier New', monospace;
}

footer p::before {
    content: '$ ';
    color: #4a4;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 15px;
        font-size: 16px;
    }

    h1 {
        font-size: 1.8rem;
    }

    #intro {
        flex-direction: column;
        align-items: flex-start;
    }

    .arm-container {
        display: none;
    }

    h2 {
        font-size: 1.3rem;
    }

    nav {
        gap: 1rem;
    }

    header {
        margin: -15px -15px 3rem -15px;
        padding: 1rem 15px;
    }

    footer {
        margin: 4rem -15px -15px -15px;
        padding: 2rem 15px;
    }

    .profile-pic {
        width: 100px;
        height: 100px;
        box-shadow: 6px 6px 0 #000;
    }
}

/* Glitch Effect */
@keyframes glitch {
    0% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }

    100% {
        transform: translate(0);
    }
}

@keyframes glitch-text {
    0% {
        text-shadow: 0 0 0 #000;
    }

    20% {
        text-shadow: -2px 0 #00ff00, 2px 0 #ff00ff;
    }

    40% {
        text-shadow: -2px 0 #ff00ff, 2px 0 #00ff00;
    }

    60% {
        text-shadow: 2px 0 #00ff00, -2px 0 #ff00ff;
    }

    80% {
        text-shadow: 2px 0 #ff00ff, -2px 0 #00ff00;
    }

    100% {
        text-shadow: 0 0 0 #000;
    }
}

h1 {
    position: relative;
    display: block;
    cursor: pointer;
}

h1:hover {
    animation: glitch 0.3s infinite, glitch-text 0.3s infinite;
}


/* Typing Animation */
.typing-text {
    overflow: hidden;
    border-right: 3px solid #000;
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
    display: block;
    max-width: fit-content;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: #000;
    }
}

/* Print styles */
@media print {
    body {
        max-width: 100%;
        font-size: 12pt;
        background-image: none;
    }

    a {
        color: #000;
        text-decoration: underline;
        border: none;
    }

    header,
    footer {
        border-color: #000;
    }
}