/* ==========================================================================
   Monotone Greyscale & OLED Black Design System for Duckquill
   ========================================================================== */

/* --------------------------------------------------------------------------
   Dark Mode: Pure OLED Black with Lighter Monotone Grey Palette
   -------------------------------------------------------------------------- */
:root,
[data-theme="dark"],
:root:not([data-theme="light"]) {
    /* Pure OLED pitch black background */
    --bg-color: #000000;
    --bg-overlay: linear-gradient(rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.95));

    /* Crisp white & lighter monotone grey typography */
    --fg-color: #f4f4f5;
    --fg-contrast: #000000;
    --contrast-color: #000000;
    --fg-muted-1: rgba(255, 255, 255, 0.05);
    --fg-muted-2: rgba(255, 255, 255, 0.09);
    --fg-muted-3: rgba(255, 255, 255, 0.18);
    --fg-muted-4: #a1a1aa;
    --fg-muted-5: #d4d4d8;

    /* Lighter monotone accent */
    --accent-color: #ededed;
    --accent-color-alpha: rgba(255, 255, 255, 0.07);

    /* Glass surfaces on OLED black: deep charcoal with delicate edge definition */
    --glass-bg: rgba(14, 14, 16, 0.85);
    --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.07);
    --shadow-glass: 0 12px 30px -8px rgba(0, 0, 0, 0.95);
    --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 16px rgba(255, 255, 255, 0.06);

    color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Light Mode: Clean Minimalist Paper & Graphite Monotone Palette
   -------------------------------------------------------------------------- */
[data-theme="light"],
:root[data-theme="light"] {
    --bg-color: #fafafa;
    --bg-overlay: linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92));
    --fg-color: #18181b;
    --fg-contrast: #ffffff;
    --contrast-color: #ffffff;
    --fg-muted-1: rgba(0, 0, 0, 0.04);
    --fg-muted-2: rgba(0, 0, 0, 0.08);
    --fg-muted-3: rgba(0, 0, 0, 0.15);
    --fg-muted-4: #71717a;
    --fg-muted-5: #3f3f46;
    --accent-color: #18181b;
    --accent-color-alpha: rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --edge-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.08);
    --shadow-glass: 0 8px 24px -6px rgba(0, 0, 0, 0.08);

    color-scheme: light;
}

/* --------------------------------------------------------------------------
   Global Layout & Background Overrides
   -------------------------------------------------------------------------- */
html,
body {
    background-color: var(--bg-color) !important;
    color: var(--fg-color);
}

/* --------------------------------------------------------------------------
   Navigation Capsule Styling
   -------------------------------------------------------------------------- */
#site-nav::before {
    background-color: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: var(--shadow-glass);
}

#site-nav nav ul {
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 0.35rem;
}

[data-theme="light"] #site-nav::before,
:root[data-theme="light"] #site-nav::before {
    border-color: rgba(0, 0, 0, 0.08);
}

#site-nav nav ul li a.active,
#site-nav nav ul li#home a.active {
    background-color: var(--accent-color) !important;
    color: #000000 !important;
}

#site-nav nav ul li a.active i.icon,
#site-nav nav ul li#home a.active i.icon {
    background-color: #000000 !important;
    color: #000000 !important;
    filter: none !important;
}

[data-theme="light"] #site-nav nav ul li a.active,
[data-theme="light"] #site-nav nav ul li#home a.active,
:root[data-theme="light"] #site-nav nav ul li a.active,
:root[data-theme="light"] #site-nav nav ul li#home a.active {
    background-color: var(--accent-color) !important;
    color: #ffffff !important;
}

[data-theme="light"] #site-nav nav ul li a.active i.icon,
[data-theme="light"] #site-nav nav ul li#home a.active i.icon,
:root[data-theme="light"] #site-nav nav ul li a.active i.icon,
:root[data-theme="light"] #site-nav nav ul li#home a.active i.icon {
    background-color: #ffffff !important;
    color: #ffffff !important;
    filter: none !important;
}

/* --------------------------------------------------------------------------
   Article & Project Cards (#article-list)
   -------------------------------------------------------------------------- */
#article-list article {
    border-radius: 1rem;
    border-start-end-radius: 1.75rem;
    border-end-end-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: var(--glass-bg);
    box-shadow: var(--shadow-glass);
    transition: transform var(--transition), border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}

[data-theme="light"] #article-list article,
:root[data-theme="light"] #article-list article {
    border-color: rgba(0, 0, 0, 0.08);
}

#article-list article:hover {
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: var(--shadow-glow), var(--shadow-glass);
    background-color: rgba(20, 20, 24, 0.95);
}

[data-theme="light"] #article-list article:hover,
:root[data-theme="light"] #article-list article:hover {
    border-color: rgba(0, 0, 0, 0.2);
    background-color: #ffffff;
}

#article-list article h3 {
    color: var(--accent-color);
}

#article-list article p {
    color: var(--fg-muted-4);
    margin-block: 0.5rem;
}

#article-list article .details {
    color: var(--fg-muted-4);
}

/* --------------------------------------------------------------------------
   Tags & Badges
   -------------------------------------------------------------------------- */
.tags a,
a.tag,
span.tag:not(.tags a *) {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background-color: var(--fg-muted-1);
    color: var(--fg-muted-5) !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
    text-decoration: none;
}

/* Remove any wireframe / box styling on inner spans inside tag pills */
.tags a .tag,
.tags a span,
.tags a .count {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.tags a .count {
    opacity: 0.7;
    font-size: 0.8em;
    padding-inline-start: 0.35rem;
    padding-inline-end: 0.5rem;
}

[data-theme="light"] .tags a,
[data-theme="light"] a.tag,
:root[data-theme="light"] .tags a,
:root[data-theme="light"] a.tag {
    border-color: rgba(0, 0, 0, 0.08);
}

.tags a:hover,
a.tag:hover {
    background-color: var(--fg-muted-3) !important;
    color: var(--fg-color) !important;
    border-color: rgba(255, 255, 255, 0.25);
}

#heading .tags {
    justify-content: center;
    margin-block-start: 0.75rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.buttons a,
.buttons button {
    border: 1px solid rgba(255, 255, 255, 0.09);
    background-color: var(--fg-muted-1);
    color: var(--fg-muted-5);
    box-shadow: none;
}

.buttons a:hover,
.buttons button:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background-color: var(--fg-muted-2);
    color: var(--fg-color);
}

.buttons a.colored,
.buttons button.colored {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--fg-color);
}

[data-theme="light"] .buttons a.colored,
[data-theme="light"] .buttons button.colored,
:root[data-theme="light"] .buttons a.colored,
:root[data-theme="light"] .buttons button.colored {
    border-color: rgba(0, 0, 0, 0.18);
    background-color: rgba(0, 0, 0, 0.03);
    color: var(--fg-color);
}

.buttons a.colored:hover,
.buttons button.colored:hover {
    border-color: rgba(255, 255, 255, 0.35);
    background-color: var(--fg-muted-2);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------------------------------------
   Skills Marquee
   -------------------------------------------------------------------------- */
.skills-wrapper {
    width: 100%;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
    margin-block-start: 1rem;
    margin-block-end: 2rem;
}

.skills-track {
    display: flex;
    width: max-content;
    gap: 0.75rem;
    padding-block: 0.5rem;
    animation: marquee 35s linear infinite;
}

.skills-track:hover,
.skills-track:focus-within {
    animation-play-state: paused;
}

.skills-group {
    display: flex;
    gap: 0.75rem;
}

@keyframes marquee {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(-50% - 0.375rem));
    }
}

.skill-tag {
    background-color: var(--fg-muted-1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--rounded-corner-small, 0.5rem);
    padding: 0.5rem 1rem;
    font-size: var(--font-size-small, 0.875rem);
    color: var(--fg-muted-4);
    text-align: center;
    transition: var(--transition, 0.2s);
    flex-shrink: 0;
    white-space: nowrap;
    user-select: none;
    line-height: 1.2;
}

[data-theme="light"] .skill-tag,
:root[data-theme="light"] .skill-tag {
    border-color: rgba(0, 0, 0, 0.08);
}

.skill-tag:hover {
    background-color: var(--fg-muted-2);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--fg-color);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.06);
}

@media (prefers-reduced-motion: reduce) {
    .skills-wrapper {
        mask-image: none;
        -webkit-mask-image: none;
        overflow: visible;
    }

    .skills-track {
        animation: none;
        flex-wrap: wrap;
        width: 100%;
    }

    .skills-track [aria-hidden="true"] {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   Portfolio & Section Spacing
   -------------------------------------------------------------------------- */
.portfolio-section {
    margin-block-start: 3rem;
}

.portfolio-section h2 {
    margin-block-end: 1rem;
    font-size: var(--font-size-x-large, 1.5rem);
    color: var(--accent-color);
    font-family: var(--font-system-ui);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   Education List
   -------------------------------------------------------------------------- */
.education-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.education-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.85rem 1.15rem;
    border-radius: var(--rounded-corner-small, 0.5rem);
    background-color: var(--fg-muted-1);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: var(--transition, 0.2s);
}

[data-theme="light"] .education-item,
:root[data-theme="light"] .education-item {
    border-color: rgba(0, 0, 0, 0.07);
}

.education-item:hover {
    background-color: var(--fg-muted-2);
    border-color: rgba(255, 255, 255, 0.16);
}

.education-title {
    font-weight: 600;
    color: var(--fg-color);
}

.education-meta {
    font-size: var(--font-size-small, 0.875rem);
    color: var(--fg-muted-4);
    text-decoration: none;
}

.education-meta:hover {
    color: var(--fg-color);
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */
.hero-section {
    margin-block-end: 2rem;
}

.hero-section h1 {
    font-size: var(--font-size-xx-large, 2rem);
    margin-block-end: 0.25rem;
    color: var(--fg-color);
    font-family: var(--font-system-ui);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.hero-section .role {
    font-size: var(--font-size-large, 1.25rem);
    color: var(--fg-muted-4);
    margin-block-start: 0;
}

.bio-content p {
    color: var(--fg-muted-5);
    font-size: 1.05rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Code Blocks & Inline Code (Monotone Charcoal / Pitch Black)
   -------------------------------------------------------------------------- */
pre,
.z-d-code {
    background-color: #0c0c0e !important;
    color: #e4e4e7 !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    box-shadow: var(--shadow-glass) !important;
}

code:not(pre code) {
    background-color: rgba(255, 255, 255, 0.07) !important;
    color: #f4f4f5 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

[data-theme="light"] pre,
[data-theme="light"] .z-d-code,
:root[data-theme="light"] pre,
:root[data-theme="light"] .z-d-code {
    background-color: #f4f4f5 !important;
    color: #18181b !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] code:not(pre code),
:root[data-theme="light"] code:not(pre code) {
    background-color: rgba(0, 0, 0, 0.05) !important;
    color: #18181b !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

/* --------------------------------------------------------------------------
   Floating Quick-Action Buttons (#buttons-container)
   -------------------------------------------------------------------------- */
#buttons-container a,
#buttons-container details summary {
    background-color: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: var(--shadow-glass);
}

#buttons-container details > div {
    background-color: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-glass);
}

/* --------------------------------------------------------------------------
   Search Bar Enhancements (Header Search Pill & Section Live Search)
   -------------------------------------------------------------------------- */
#search {
    display: flex;
    align-items: center;
}

.search-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem 0.35rem 0.6rem;
    border-radius: 999px;
    background-color: var(--fg-muted-1);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--fg-muted-4);
    font-family: inherit;
    font-size: var(--font-size-small);
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

[data-theme="light"] .search-pill-btn,
:root[data-theme="light"] .search-pill-btn {
    border-color: rgba(0, 0, 0, 0.08);
    background-color: rgba(0, 0, 0, 0.04);
}

.search-pill-btn:hover {
    background-color: var(--fg-muted-2);
    border-color: rgba(255, 255, 255, 0.22);
    color: var(--fg-color);
}

.search-pill-btn .icon {
    width: 0.95rem;
    height: 0.95rem;
    -webkit-mask-image: var(--icon-search);
    mask-image: var(--icon-search);
    background-color: currentColor;
    display: inline-block;
}

.search-pill-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.search-pill-shortcut {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--fg-muted-5);
    line-height: 1;
    font-family: var(--font-monospace-code);
}

[data-theme="light"] .search-pill-shortcut,
:root[data-theme="light"] .search-pill-shortcut {
    background-color: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   Mobile Responsive Optimizations
   -------------------------------------------------------------------------- */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    grid-template-columns: minmax(0, 100%) !important;
}

main,
#main-content {
    min-width: 0 !important;
    max-width: min(var(--container-width), calc(100% - 2rem)) !important;
    width: 100% !important;
    margin-inline: auto !important;
}

.skills-wrapper {
    max-width: 100% !important;
    overflow: hidden !important;
}

/* Base Navbar Layout */
#site-nav {
    max-width: min(var(--container-width), calc(100% - 1.5rem));
    width: max-content;
    margin: 1rem auto 0;
}

#site-nav nav {
    padding: 0.35rem 0.5rem;
}

#site-nav nav ul {
    display: flex;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
    margin: 0;
    padding: 0;
}

#site-nav nav ul li {
    flex: 0 0 auto !important;
    display: flex;
    align-items: center;
}

#site-nav nav ul li a,
#site-nav nav ul li summary {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Small screens / mobile devices */
@media screen and (max-width: 600px) {
    #site-nav {
        margin: 0.6rem auto 0 !important;
        inset-block-start: 0.5rem !important;
        position: sticky !important;
        border-radius: 999px !important;
        max-width: calc(100% - 1rem) !important;
    }

    #site-nav::before {
        border-radius: 999px !important;
    }

    #site-nav nav {
        padding: 0.25rem 0.35rem !important;
    }

    #site-nav nav ul {
        gap: 0.15rem !important;
    }

    #site-nav nav ul li a,
    #site-nav nav ul li summary {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.8rem !important;
    }

    #site-nav .circle {
        padding: 0.45rem 0.45rem !important;
    }

    /* Condense search pill into compact circle button on mobile */
    .search-pill-btn {
        padding: 0.45rem 0.45rem !important;
        gap: 0 !important;
        border-radius: 50% !important;
        width: 1.95rem !important;
        height: 1.95rem !important;
        justify-content: center !important;
    }

    .search-pill-label,
    .search-pill-shortcut {
        display: none !important;
    }

    .search-pill-btn .icon {
        margin: 0 !important;
        width: 0.875rem !important;
        height: 0.875rem !important;
    }

    /* Main container and vertical rhythm */
    main {
        margin-block-start: 1.5rem !important;
        margin-block-end: 2.5rem !important;
        width: calc(100% - 1.5rem) !important;
    }

    /* Hero section */
    .hero-section {
        margin-block-end: 1.5rem;
    }

    .hero-section h1 {
        font-size: 1.65rem;
    }

    .hero-section .role {
        font-size: 1rem;
    }

    .bio-content p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    /* Section headers */
    .portfolio-section {
        margin-block-start: 2.25rem;
    }

    .portfolio-section h2 {
        font-size: 1.35rem;
        margin-block-end: 0.75rem;
    }

    /* Project & article cards */
    #article-list {
        gap: 0.75rem;
    }

    #article-list article {
        padding: 0.85rem;
        border-start-end-radius: 1.25rem;
        border-end-end-radius: 1.25rem;
    }

    #article-list article h3 {
        font-size: 1.15rem;
        line-height: 1.25;
    }

    #article-list article p {
        font-size: 0.875rem;
        line-height: 1.45;
        margin-block: 0.35rem;
    }

    .tags {
        gap: 0.3rem;
    }

    .tags a,
    a.tag,
    .tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    /* Education list */
    .education-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.75rem 0.85rem;
    }

    .education-title {
        font-size: 0.95rem;
    }

    .education-meta {
        font-size: 0.8rem;
    }

    /* Skills marquee */
    .skills-wrapper {
        margin-block-start: 0.75rem;
        margin-block-end: 1.25rem;
        mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
    }

    .skill-tag {
        padding: 0.35rem 0.65rem;
        font-size: 0.775rem;
    }

    /* Search dropdown overlay */
    #search-container {
        padding: 0 0.25rem 0.4rem;
    }

    #search-bar {
        font-size: 0.85rem;
        height: 2rem;
        padding: 0 0.65rem;
    }

    #search-results-container {
        max-height: 60vh;
    }

    /* Floating actions */
    #buttons-container {
        inset-inline-end: 0.85rem;
        inset-block-end: 0.85rem;
    }

    /* Single article and project views */
    #heading h1 {
        font-size: 1.65rem;
        line-height: 1.25;
    }

    .buttons {
        gap: 0.4rem;
    }

    .buttons a,
    .buttons button {
        padding: 0.55rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Extra small devices (<= 360px) */
@media screen and (max-width: 360px) {
    #site-nav nav {
        padding: 0.2rem 0.25rem !important;
    }

    #site-nav nav ul {
        gap: 0.1rem !important;
    }

    #site-nav nav ul li a,
    #site-nav nav ul li summary {
        padding: 0.35rem 0.38rem !important;
        font-size: 0.75rem !important;
    }

    #site-nav .circle {
        padding: 0.35rem 0.35rem !important;
        width: 1.8rem !important;
        height: 1.8rem !important;
    }

    .search-pill-btn {
        width: 1.8rem !important;
        height: 1.8rem !important;
        padding: 0.35rem !important;
    }
}


/* --------------------------------------------------------------------------
   CRT Monitor Centering
   -------------------------------------------------------------------------- */
.crt {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-inline: auto !important;
}

.crt pre {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin: 0 auto !important;
    text-align: center !important;
    padding: 1.25rem 1rem !important;
}

.crt pre code {
    display: inline-block !important;
    text-align: left !important;
    margin: 0 auto !important;
}
