/* =============================================================================
   Minimalist Design - Clean, Elegant, Refined
   ============================================================================= */

/* Font Import */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500&display=swap');

/* CSS Variables */
:root {
    /* Background Colors */
    --bg-primary: #faf9f7;
    --bg-secondary: #f5f4f2;
    --bg-hover: #efeee9;

    /* Text Colors */
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #9a9a9a;

    /* Accent & Dividers */
    --divider: #e0ddd8;
    --border: #d4d1cc;

    /* Layout */
    --sidebar-width: 260px;
    --divider-width: 1px;
    --content-max-width: 800px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-weight: 400;
}

/* =============================================================================
   Layout - CSS Grid
   ============================================================================= */

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) var(--divider-width) 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem 1.5rem;
    background: var(--bg-secondary);
}

/* Vertical Divider */
.divider {
    background: var(--divider);
    width: var(--divider-width);
}

/* Content Area */
.content {
    padding: 3rem;
    max-width: calc(var(--content-max-width) + 6rem);
}

/* =============================================================================
   Navigation
   ============================================================================= */

.global-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--divider);
}

.global-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
}

.global-nav a:hover,
.global-nav a.active {
    color: var(--text-primary);
}

.global-nav a.active {
    font-weight: 500;
}

/* Page Table of Contents */
.page-toc {
    font-size: 0.8125rem;
}

.page-toc h3 {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.page-toc ul {
    list-style: none;
    margin: 0;
}

.page-toc li {
    margin-bottom: 0.5rem;
    position: relative;
}

.page-toc a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.page-toc a:hover,
.page-toc a.active {
    color: var(--text-primary);
}

.page-toc a.active {
    font-weight: 500;
}

/* Nested TOC items */
.page-toc .toc-h3 {
    padding-left: 1rem;
}

/* =============================================================================
   Typography
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    font-weight: 500;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.25rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Links */
a {
    color: var(--text-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Text utilities */
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* =============================================================================
   Components
   ============================================================================= */

/* Section styling */
section {
    margin-bottom: 3rem;
}

section:first-child h2 {
    margin-top: 0;
}

/* Lists */
ul, ol {
    margin-left: 1.25rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.25rem;
}

/* Forms */
.form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
}

.form-row label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

input, textarea, select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    padding: 0.75rem 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

/* Buttons */
button, .btn {
    background: var(--text-primary);
    border: none;
    border-radius: 4px;
    color: var(--bg-primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.15s ease;
}

button:hover, .btn:hover {
    opacity: 0.85;
}

button:active, .btn:active {
    opacity: 0.7;
}

/* Output/Result Area */
.output {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.output p {
    margin-bottom: 0.5rem;
}

.output p:last-child {
    margin-bottom: 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    text-align: left;
}

th {
    background: var(--bg-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

td {
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Page-Specific Components
   ============================================================================= */

/* Counter Section */
.counter-display {
    font-size: 3rem;
    font-weight: 500;
    margin: 1.5rem 0;
    color: var(--text-primary);
}

.counter-buttons {
    display: flex;
    gap: 0.75rem;
}

.counter-buttons button {
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.5rem;
    border-radius: 4px;
}

/* Skills List */
.skills-list {
    list-style: none;
    margin-left: 0;
    columns: 2;
    gap: 1rem;
}

.skills-list li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

/* Experience Entry */
.experience-entry {
    margin-bottom: 2rem;
    padding-left: 1.25rem;
    border-left: 2px solid var(--border);
}

.experience-entry .company {
    font-weight: 500;
    color: var(--text-primary);
}

.experience-entry .role {
    color: var(--text-secondary);
}

.experience-entry .date {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* GitHub Repo List */
.repo-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--divider);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.repo-item:first-child {
    padding-top: 0;
}

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

.repo-name {
    font-weight: 500;
}

.repo-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Quote Item */
.quote-item {
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.quote-item:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--divider);
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--text-muted);
}

footer a:hover {
    color: var(--text-primary);
}

/* =============================================================================
   Blog Styles
   ============================================================================= */

article {
    max-width: 70ch;
}

article h2:first-child {
    margin-top: 0;
}

/* Code blocks */
pre, code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-secondary);
    border-radius: 4px;
}

code {
    padding: 0.2rem 0.4rem;
    font-size: 0.875em;
}

pre {
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
}

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

/* Horizontal rule */
hr {
    border: none;
    border-top: 1px solid var(--divider);
    margin: 2rem 0;
}

/* Details/Summary */
details {
    background: var(--bg-secondary);
    border-radius: 4px;
    margin: 1rem 0;
}

summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: 500;
}

summary:hover {
    background: var(--bg-hover);
}

details[open] summary {
    border-bottom: 1px solid var(--divider);
}

details > *:not(summary) {
    padding: 1rem;
}

/* Image styling */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

.text-right { text-align: right; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.hidden { display: none; }

/* Flex utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }

/* =============================================================================
   Responsive - Mobile (sidebar becomes top nav)
   ============================================================================= */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
    }

    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1px 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        padding: 1rem 1.5rem;
        overflow: visible;
    }

    .global-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .page-toc {
        display: none;
    }

    .divider {
        width: 100%;
        height: var(--divider-width);
    }

    .content {
        padding: 1.5rem;
    }

    .skills-list {
        columns: 1;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    input, textarea, select {
        width: 100%;
    }

    .repo-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .global-nav {
        gap: 0.75rem;
        font-size: 0.8125rem;
    }

    .content {
        padding: 1rem;
    }

    .counter-display {
        font-size: 2rem;
    }
}
