/* Design tokens keep light/dark theming centralized. */
:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --fg: #1f2933;
    --accent: #2563eb;
    --muted: #64748b;
    --border: #d4d8dd;
    --max-width: 82ch;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--fg);
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

.noscript-warning {
    margin: 0;
    padding: 1rem;
    background: #fee2e2;
    color: #7f1d1d;
    text-align: center;
}

/* Sticky shell keeps navigation visible for SPA transitions. */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem clamp(1rem, 3vw, 2.5rem);
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

.brand a {
    color: inherit;
    text-decoration: none;
    transition: transform 150ms ease-in-out;
    display: inline-block; /* Needed for transform to apply */
}

.brand a:hover,
.brand a:focus-visible {
    transform: scale(1.03);
    text-decoration: none;
}

/* Horizontal navigation doubles as our active route indicator. */
.site-nav {
    display: flex;
    gap: 1rem;
    font-weight: 500;
}

.site-nav a {
    color: inherit;
    text-decoration: none;
    position: relative;
    padding-bottom: 0.25rem;
}

.site-nav a::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 2px;
    background: transparent;
    transition: background 150ms ease;
}

.site-nav a[data-active="true"] {
    color: var(--accent);
}

.site-nav a[data-active="true"]::after {
    background: var(--accent);
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
    background: var(--accent);
}

/* Constrain readable width and let sections stack vertically. */
.view-container {
    flex: 1;
    width: min(100%, calc(var(--max-width) + 2rem));
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) 4rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.view-container section {
    background: rgba(220, 250, 255, 0.85);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
}

h1, h2, h3 {
    color: #0f172a;
    margin-top: 0;
    line-height: 1.1;
}

p {
    line-height: 1.6;
    color: var(--muted);
    margin-top: 0.75rem;
}

ul, ol {
    margin: 1rem 0 0;
    padding-left: 1.25rem;
    color: var(--fg);
    line-height: 1.6;
}

a {
    color: var(--accent);
}

a:hover,
a:focus-visible {
    text-decoration: underline;
}

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

/* Cards reuse the same surface styling as primary sections. */
.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 120ms ease, transform 120ms ease;
}

.card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}

.card a {
    align-self: flex-start;
    font-weight: 600;
}

.muted {
    color: var(--muted);
}

/* Dark code blocks emphasise the instructional snippets. */
.code-block {
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 10px;
    overflow-x: auto;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1rem clamp(1rem, 3vw, 2.5rem);
    font-size: 0.875rem;
    color: var(--muted);
    text-align: center;
}


/* Notes content experience */
.notes-view {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.notes-header h1 {
    margin-bottom: 0;
}

.notes-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--muted);
}

.notes-breadcrumbs a {
    color: inherit;
    text-decoration: none;
    padding: 0.125rem 0.25rem;
    border-radius: 6px;
}

.notes-breadcrumbs a:hover,
.notes-breadcrumbs a:focus-visible {
    background: rgba(37, 99, 235, 0.12);
    color: var(--accent);
}

.notes-breadcrumbs__sep {
    color: var(--border);
}

.notes-backlink {
    align-self: flex-start;
    font-size: 0.875rem;
    color: var(--accent);
    text-decoration: none;
}

.notes-backlink:hover,
.notes-backlink:focus-visible {
    text-decoration: underline;
}

.notes-directory-lists {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.notes-directory-panel {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notes-directory-panel h2 {
    margin: 0;
}

.notes-directory-panel ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notes-directory-panel li a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.notes-directory-panel li a:hover,
.notes-directory-panel li a:focus-visible {
    text-decoration: underline;
}

.notes-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notes-content figure {
    margin: 0;
}

/* Excalidraw embeds */
.excalidraw-embed {
    width: 100%;
    min-height: 600px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    margin: 1rem 0;
}

.excalidraw-loading {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-style: italic;
}

.excalidraw-embed .excalidraw {
    width: 100%;
    height: 100%;
}

/* Projects section styles */
.project-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 500;
}

.card-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.project-actions {
    margin: 2rem 0;
}

.button-primary,
.button-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    transition: all 150ms ease;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 0.9375rem;
}

.button-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.button-primary:hover {
    background: #d97706;
    border-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(234, 88, 12, 0.2);
}

.button-secondary {
    background: transparent;
    color: var(--accent);
    border-color: var(--border);
}

.button-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--accent);
}

.button-primary svg,
.button-secondary svg {
    width: 16px;
    height: 16px;
}

.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.lead {
    font-size: 1.125rem;
    color: var(--muted);
    line-height: 1.7;
    margin: 1rem 0 2rem;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: 0.75rem 0;
    padding-left: 1.75rem;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.home-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 2rem;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.home-hero.active-hero {
    box-shadow: 0 0 40px 10px rgba(255, 255, 255, 0.5);
    border-color: #ffffff;
}

.home-hero__image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .home-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .home-hero ul {
        display: inline-block;
        text-align: left;
    }
}

/* Code Snippet Styling */
.code-wrapper {
    position: relative;
    background-color: #282c34; /* Dark background for contrast */
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.code-wrapper pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto; /* Horizontal scroll if line is long */
}

.code-wrapper code {
    font-family: 'Courier New', Courier, monospace;
    color: #abb2bf;
}

.inline-code {
    background-color: #f3f4f6;
    font-family: 'Courier New', Courier, monospace;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #1f2933; /* Ensure text is readable */
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    
    /* Button Styling */
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.copy-btn.copied {
    background-color: #4caf50; /* Green */
    border-color: #4caf50;
}
