/* ============================================
   DR. RYAN CROKE PORTFOLIO
   Design System: Academic Brutalism / Computational Minimalism
   "A beautifully typeset LaTeX paper inside a code editor"
   ============================================ */

/* --- DESIGN SYSTEM VARIABLES --- */
:root {
    --bg-color: #fdfbf7;
    --grid-line: #e5e5e5;
    --text-main: #1a1a1a;

    /* SEMANTIC COLORS */
    --col-project: #005cc5;    /* Engineering Blue */
    --col-blog: #e3a008;       /* Warning/Note Yellow */
    --col-research: #6f42c1;   /* Academic Purple */
    --col-terminal: #00ff41;   /* Matrix Green */

    --font-serif: "Computer Modern Serif", serif;
    --font-mono: "JetBrains Mono", monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 20px 20px;
    color: var(--text-main);
    font-family: var(--font-serif);
    line-height: 1.6;
}

/* --- NAVIGATION (Code Editor Toolbar) --- */
nav {
    position: sticky;
    top: 0;
    background: var(--bg-color);
    border-bottom: 1px solid #000;
    z-index: 1000;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: #666;
    transition: color 0.2s ease;
}

nav a:hover {
    color: var(--text-main);
}

nav a::before {
    content: '';
    transition: content 0.2s ease;
}

nav a:hover::after {
    content: '_';
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.nav-left a {
    color: var(--text-main);
    font-weight: bold;
}

.nav-right {
    display: flex;
    gap: 1.5rem;
}

/* --- MAIN CONTENT --- */
main {
    padding: 2rem;
}

/* --- TYPOGRAPHY --- */
h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    font-weight: normal;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: normal;
}

h3 {
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 3rem;
    display: block;
}

/* --- GRID --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- BASE CARD --- */
.card {
    background: white;
    border: 1px solid #000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

/* --- CARD VARIANTS --- */

/* PROJECT CARDS (Technical) */
.card.project {
    border-top: 6px solid var(--col-project);
}

.card.project .tag {
    color: var(--col-project);
    background: #f0f7ff;
}

/* BLOG CARDS (Notes) */
.card.blog {
    border-top: 6px solid var(--col-blog);
    background-color: #fffdf5;
}

.card.blog .tag {
    color: var(--col-blog);
    background: #fff8c5;
}

/* RESEARCH CARDS (Academic) */
.card.research {
    border-top: 6px solid var(--col-research);
}

.card.research .tag {
    color: var(--col-research);
    background: #f3f0ff;
}

/* --- CARD INTERNALS --- */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.date {
    color: #999;
}

.card p {
    font-size: 1rem;
    color: #444;
    margin-bottom: 1.5rem;
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Links inside cards */
.card-link {
    margin-top: auto;
    text-decoration: none;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

.project .card-link { color: var(--col-project); }
.blog .card-link { color: var(--col-blog); }
.research .card-link { color: var(--col-research); }

/* --- IMAGE STYLES: THE XEROX EFFECT --- */
.card-image-container {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-bottom: 1px solid #000;
    position: relative;
    background: #000;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(120%) brightness(90%);
    transition: all 0.3s ease;
    mix-blend-mode: luminosity;
    opacity: 0.8;
}

.card:hover .card-image {
    filter: grayscale(0%) contrast(100%);
    opacity: 1;
    transform: scale(1.05);
}

/* --- TINTING (Duotone Effects) --- */
.card.project .card-image-container {
    background-color: var(--col-project);
}

.card.project .card-image {
    mix-blend-mode: multiply;
}

.card.blog .card-image-container {
    background-color: var(--col-blog);
}

.card.blog .card-image {
    mix-blend-mode: multiply;
}

.card.research .card-image-container {
    background-color: #000;
}

.card.research .card-image {
    filter: grayscale(100%) invert(1);
}

/* --- FALLBACK PATTERNS --- */

/* Blueprint (Engineering) */
.pattern-blueprint {
    width: 100%;
    height: 100%;
    background-color: var(--col-project);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Blackboard (Math/Research) */
.pattern-math {
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    overflow: hidden;
}

.pattern-math .katex-display {
    margin: 0;
    overflow: hidden;
}

/* Draft (Blog) */
.pattern-draft {
    width: 100%;
    height: 100%;
    background-color: var(--col-blog);
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.1) 10px,
        transparent 10px,
        transparent 20px
    );
}

/* --- FOOTER (Citation Style) --- */
footer {
    margin-top: 4rem;
    padding: 2rem;
    border-top: 1px solid #000;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

footer a {
    color: var(--text-main);
    text-decoration: none;
    margin-left: 1rem;
}

footer a:hover {
    text-decoration: underline;
}

/* --- CALCULATOR WIDGET --- */
#calc-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    border: 2px solid black;
    width: 200px;
    font-family: var(--font-mono);
    z-index: 100;
    box-shadow: 6px 6px 0px #000;
}

#calc-display {
    background: #000;
    color: var(--col-terminal);
    padding: 10px;
    text-align: right;
    border-bottom: 2px solid black;
    font-family: 'Courier New', monospace;
}

#calc-input {
    width: 100%;
    border: none;
    padding: 10px;
    outline: none;
    font-family: inherit;
}

/* --- DETAIL PAGE STYLES --- */
.page-header {
    max-width: 1200px;
    margin: 0 auto 3rem auto;
    padding-top: 3rem;
}

/* Article layout (Tufte-inspired) */
article {
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
}

article h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

article h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
}

article p {
    margin-bottom: 1.5rem;
}

article ul, article ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

article li {
    margin-bottom: 0.5rem;
}

/* Code blocks (Terminal style) */
pre, code {
    font-family: var(--font-mono);
}

code {
    background: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background: #1a1a1a;
    color: var(--col-terminal);
    padding: 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid #000;
}

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

/* Math blocks */
.katex-display {
    margin: 2rem 0;
    overflow-x: auto;
}

/* Tags list */
.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* Back link */
.back-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #666;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 1rem;
}

.back-link:hover {
    color: var(--text-main);
}

/* --- ABOUT PAGE STYLES --- */
.about-section {
    margin-bottom: 3rem;
}

.about-section h2 {
    border-bottom: 1px solid #000;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.job {
    margin-bottom: 2rem;
    padding-left: 1rem;
    border-left: 3px solid var(--col-project);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.job-title {
    font-weight: bold;
    font-size: 1.1rem;
}

.job-dates {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #666;
}

.job-company {
    color: var(--col-project);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.job ul {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.skill-category h3 {
    font-size: 1rem;
    font-family: var(--font-mono);
    color: var(--col-project);
    margin-bottom: 0.5rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    nav {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .nav-right {
        gap: 1rem;
    }

    main {
        padding: 1rem;
    }

    footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    footer div:last-child {
        text-align: center;
    }

    footer a {
        margin: 0 0.5rem;
    }

    #calc-widget {
        display: none;
    }

    article {
        font-size: 1rem;
    }
}
