/* ==========================================================================
   GLOBAL STYLES
   Design tokens and shared defaults used by every page.
   ========================================================================== */

:root {
    --navy: #012169;
    --light-blue: #9BCBEB;
    --accent-gold: #F0B323;
    --accent-gold-text: #D48900;
    --teal: #0f766e;
    --text-dark: #333;
    --bg-light: #f4f7f9;
    --highlight: rgba(240, 179, 35, 0.3);
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --border-gray: #eeeeee;
    --surface-bg: #ffffff;
    --surface-muted: #f4f7f9;
    --soft-text: #666666;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    margin: 0;
    color: var(--text-dark);
    background: var(--white);
    scroll-behavior: smooth;
}

/* Shared transition behavior for interactive and theme-sensitive components. */
html,
body,
nav,
footer,
.archive-section,
.project-archive,
.resume-container,
.cs-metadata,
.modal-content,
.archive-item,
.grid-card,
.card-content,
.cs-image,
.image-container,
.ui-spec-frame,
.sort-btn,
.menu-toggle,
.theme-toggle,
.nav-links a,
.logo,
.company-info,
.skill-cat p,
.legacy-label,
.caption,
.close-modal,
.case-study h2,
.case-study strong,
.resume-container h2,
.grid-card h3,
.role-title,
.skill-cat h4,
.feature-step h4,
.optimized-label,
.card-hero,
.archive-hero,
.ia-column li,
.step,
.download-btn,
.case-study-link {
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

/* Skip link stays off-canvas until keyboard focus makes it visible. */
.skip-link {
    position: absolute;
    left: 0.75rem;
    top: -9999px;
    background: var(--navy);
    color: var(--white);
    padding: 0.6rem 0.85rem;
    border-radius: 4px;
    text-decoration: none;
    z-index: 4000;
}

.skip-link:focus-visible {
    top: 0.75rem;
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

/* ==========================================================================
   GLOBAL NAVIGATION
   Shared nav shell, links, theme toggle, and mobile trigger.
   ========================================================================== */

nav {
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Brand lockup style in the sticky top navigation. */
.logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--navy);
    text-decoration: none;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Primary navigation links in desktop and expanded mobile states. */
.nav-links a {
    margin-left: 2rem;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
}

/* Compact theme picker button that sits with nav links. */
.nav-links .theme-toggle {
    margin-left: 2rem;
    border: 1px solid var(--border-gray);
    background: var(--surface-bg);
    color: var(--text-dark);
    font: inherit;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
}

/* Theme toggle glyph sizing alignment. */
.theme-icon {
    font-size: 0.95em;
    line-height: 1;
}

.theme-label {
    line-height: 1;
}

/* Link hover feedback for primary navigation. */
.nav-links a:hover {
    color: var(--accent-gold-text);
}

/* Hover affordance for the theme toggle control. */
.nav-links .theme-toggle:hover {
    border-color: var(--accent-gold);
}

/* Active-page nav indicator. */
.nav-links a.nav-current {
    color: var(--navy);
    border-bottom: 2px solid var(--accent-gold);
}

/* Mobile menu trigger, hidden at larger breakpoints. */
.menu-toggle {
    display: none;
    border: 1px solid var(--navy);
    background: var(--white);
    color: var(--navy);
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

/* ==========================================================================
   INDEX
   homepage hero and intro copy.
   ========================================================================== */

.portfolio-header {
    padding: 4rem 5%;
    background: linear-gradient(135deg, var(--navy) 0%, #001542 100%);
    color: var(--white);
    text-align: center;
}

/* Homepage title scale and spacing. */
.portfolio-header h1 {
    font-size: 3.5rem;
    margin: 0;
}

/* Intro paragraph width/legibility treatment. */
.portfolio-header .bio {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 1.5rem auto;
    line-height: 1.8;
}

/* ==========================================================================
   CASE STUDIES
   Case study hero shell and metadata card.
   ========================================================================== */

.cs-hero {
    padding: 10rem 5% 5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    background-color: var(--navy);
    color: var(--white);
}

/* Case study hero headline prominence. */
.cs-hero h1 {
    font-size: 4rem;
    margin: 1rem 0;
    line-height: 1.1;
}

/* Accent tag color when used inside hero context. */
.cs-hero .tag {
    color: var(--light-blue);
}

/* Hero summary copy constraints for readability. */
.cs-intro {
    font-size: 1.2rem;
    opacity: 0.8;
    line-height: 1.6;
    max-width: 600px;
}

/* Hero disclaimer copy styling on dark backgrounds. */
.cs-disclaimer {
    margin-top: 1rem;
    max-width: 620px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.78);
}

/* Metadata card layout presented beside hero text. */
.cs-metadata {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
}

/* Metadata labels (role, timeline, scope, etc.). */
.meta-item strong {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-gold-text);
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

/* Metadata values paired with label rows. */
.meta-item p {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
}


/* ==========================================================================
   GLOBAL SHARED UI
   Reusable contact rows and button treatments across pages.
   ========================================================================== */

.personal-info h1 {
    color: var(--navy);
    margin: 0;
}

/* Secondary personal subtitle text. */
.personal-info p {
    margin: 0.5rem 0 0;
    font-weight: 600;
    color: var(--accent-gold-text);
}

/* Shared font sizing across contact stacks. */
.contact-strip,
.contact-info {
    font-size: 0.9rem;
}

/* Vertical spacing for stacked contact paragraphs. */
.contact-info p {
    margin-top: 10px;
}

/* Horizontal contact links row. */
.contact-strip {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

/* Base link treatment for contact zones. */
.contact-strip a,
.contact-info a {
    color: var(--teal);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

/* Contact strip override for hero-context link contrast. */
.contact-strip a {
    color: var(--light-blue);
}

/* Primary call-to-action button style. */
.download-btn {
    background-color: var(--accent-gold);
    color: var(--navy) !important;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s ease, background-color 0.2s ease;
    margin-right: 15px;
}

/* CTA hover feedback. */
.download-btn:hover {
    transform: translateY(-2px);
    background-color: #d49a1a;
}

/* Secondary Button Variant (from Index) */
/* Outline button variant for secondary actions. */
.download-btn.outline {
    background: transparent;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold) !important;
}

/* Outline variant hover fill. */
.download-btn.outline:hover {
    background: rgba(240, 179, 35, 0.1);
}

/* shared case study layout modules reused in index and template pages. */
/* Outer section wrapper for each featured case study. */
.case-study {
    padding: 6rem 5%;
    border-bottom: 1px solid #eee;
}

/* Alternating background treatment for visual rhythm. */
.case-study:nth-child(even) {
    background-color: var(--bg-light);
}

/* Main index case study grid defaults to single column. */
.case-study-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr; /* Default: Stacked for mobile */
    gap: 3rem;
    align-items: center;
}

/* Generic two-column utility for case-study sublayouts. */
.grid-2 {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

/* Specific Grid alignment for Template */
/* Template variant aligns content to the top instead of center. */
.cs-section .grid-2 {
    align-items: flex-start;
}

/* Utility class to force centered grid alignment where needed. */
.align-center {
    align-items: center !important;
}

/* Reusable uppercase tag/chip style. */
.tag {
    color: var(--accent-gold-text);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

/* Shared heading color treatment across case-study and resume contexts. */
.case-study h2,
.case-study strong,
.resume-container h2 {
    color: var(--navy);
    margin-top: 0.5rem;
}

/* Case study section heading sizing. */
.case-study h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
}

/* Intro lead emphasis block under section heading. */
.case-study strong {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

/* Inline text link used for deep case study navigation. */
.case-study-link {
    border-bottom: 2px solid var(--accent-gold);
    color: var(--navy);
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 1.5rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Case-study link hover accent shift. */
.case-study-link:hover {
    color: var(--accent-gold-text);
}

/* Informational banner used to call out context/disclaimers. */
.dev-info-banner {
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(1, 33, 105, 0.2);
    background: rgba(240, 179, 35, 0.15);
    color: var(--navy);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Circular "info" icon preceding info banner content. */
.dev-info-banner::before {
    content: "i";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    flex-shrink: 0;
    align-self: center;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

/* Case study disclaimers live on a navy hero background, so use a high-contrast banner treatment there. */
.cs-hero .cs-disclaimer.dev-info-banner {
    background: rgba(121, 198, 255, 0.12);
    border-color: rgba(121, 198, 255, 0.38);
    color: #d6ecff;
}

/* Sections & Containers */
/* Base case-study page section spacing and full-width behavior. */
.cs-section {
    padding: 8rem 5%;
    clear: both;
    width: 100%;
    box-sizing: border-box;
}

/* Constrained inner content container for case-study sections. */
.cs-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* Utility background token for light section variants. */
.cs-bg-light {
    background-color: var(--bg-light);
}

/* Utility background token for navy section variants. */
.cs-bg-navy {
    background-color: var(--navy);
    color: var(--white);
}

/* ==========================================================================
   CASE STUDY AUTO SECTION THEMING
   ========================================================================== */

/* Cycles section backgrounds: navy -> white -> gray */
.case-study-page main > .cs-section {
    --section-bg: var(--white);
    --section-text: var(--text-dark);
    --section-accent: var(--accent-gold);
    background-color: var(--section-bg);
    color: var(--section-text);
}

/* Compatibility: some case studies use `cs-container` on the section itself
   for the challenge block. Keep full-width background and center inner content. */
.case-study-page main > .cs-section.cs-container {
    max-width: 100%;
    margin: 0;
}

/* Re-center grid content when a section is also marked as container. */
.case-study-page main > .cs-section.cs-container > .grid-2 {
    max-width: 1100px;
    margin: 0 auto;
}

.case-study-page main > .cs-section:nth-of-type(3n + 1) {
    --section-bg: var(--white);
    --section-text: var(--text-dark);
    --section-accent: var(--accent-gold-text);
}

/* Second row in the color cycle: soft gray surface. */
.case-study-page main > .cs-section:nth-of-type(3n + 2) {
    --section-bg: var(--bg-light);
    --section-text: var(--text-dark);
    --section-accent: var(--accent-gold-text);
}

/* Third row in the color cycle: navy inversion with light accents. */
.case-study-page main > .cs-section:nth-of-type(3n) {
    --section-bg: var(--navy);
    --section-text: var(--white);
    --section-accent: var(--light-blue);
}

/* Inherit computed section text token across nested content elements. */
.case-study-page main > .cs-section h2,
.case-study-page main > .cs-section h3,
.case-study-page main > .cs-section p,
.case-study-page main > .cs-section li,
.case-study-page main > .cs-section .step h4,
.case-study-page main > .cs-section .ia-column h4,
.case-study-page main > .cs-section .feature-step h4,
.case-study-page main > .cs-section .legacy-label,
.case-study-page main > .cs-section .optimized-label {
    color: var(--section-text);
}

/* Apply section accent token to metadata labels and numeric callouts. */
.case-study-page main > .cs-section .tag,
.case-study-page main > .cs-section .meta-item strong,
.case-study-page main > .cs-section .step-num,
.case-study-page main > .cs-section .spec-list h4,
.case-study-page main > .cs-section .impact-card h4 {
    color: var(--section-accent);
}

/* Section-aware link color/border adaptation. */
.case-study-page main > .cs-section .case-study-link {
    color: var(--section-text);
    border-bottom-color: var(--section-accent);
}

/* Hover state tied to the same section accent token. */
.case-study-page main > .cs-section .case-study-link:hover {
    color: var(--section-accent);
}

/* Dark-row placeholder fallback when imagery is missing. */
.case-study-page main > .cs-section:nth-of-type(3n) .image-placeholder {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px dashed var(--light-blue);
}

/* shared image frames, placeholders, and background utility classes. */
/* Generic image frame shell used across cards and sections. */
.image-container {
    background: #ddd;
    border-radius: 12px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
    padding: 0px;
}

/* Removes frame padding when a real image is present. */
.image-container.has-image {
    padding: 0;
}

/* Cover-mode image rendering for framed assets. */
.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder label text within empty image frames. */
.image-container p {
    color: var(--navy);
    font-weight: bold;
}

/* Full-bleed image block wrapper. */
.image-full {
    max-width: 1200px;
    margin: 4rem auto;
    text-align: center;
}

/* Neutral placeholder used before screenshots/assets are available. */
.image-placeholder {
    background: var(--gray-light);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    border: 1px solid var(--border-gray);
    color: #999;
    font-weight: bold;
}

/* Shared framed image treatment for case-study visuals. */
.cs-image {
    background: var(--white);
    border: 1px solid var(--border-gray);
    border-radius: 16px;
    overflow: hidden;
    margin: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Ensures case-study images fill their frame. */
.cs-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hero frame height baseline. */
.hero-image-frame {
    height: 400px;
}

/* Default focal point for hero/workspace/collaboration images. */
.hero-image-frame img,
.workspace-frame img,
.collab-placeholder img {
    object-position: top center;
}

/* Placeholder inversion for navy-background sections. */
.cs-bg-navy .image-placeholder {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border: 1px dashed var(--light-blue);
}

/* Optional caption style beneath visual assets. */
.caption {
    margin-top: 1.5rem;
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
}

/* Background Utilities for Case Studies */
/* Quick utility backgrounds for one-off section overrides. */
.bg-light-blue { background-color: var(--light-blue) !important; }
.bg-accent-gold { background-color: var(--accent-gold) !important; }
.bg-soft-gray { background-color: #eef2f5 !important; }
.bg-lighter-gray { background-color: #eee !important; }
.bg-navy-blue { background-color: var(--navy) !important; }

/* Handle text color inside dark backgrounds */
.bg-navy-blue p { color: var(--white) !important; }

/* ==========================================================================
   ARCHIVE
   Archive listing grid, card states, and modal presentation.
   ========================================================================== */

.archive-section {
    padding: 5rem 5%;
    text-align: center;
    background: var(--white);
}

/* Vertical spacing around full archive region wrapper. */
.project-archive { margin-top: 4rem; margin-bottom: 4rem; }

/* Archive card grid for list view. */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 3rem auto 0;
}

/* Interactive archive card base state. */
.archive-item {
    appearance: none;
    background: var(--white);
    font: inherit;
    width: 100%;
    text-align: left;
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* Archive card hover state (elevation + tint). */
.archive-item:hover {
    border-color: var(--accent-gold);
    background-color: rgba(240, 179, 35, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Tiny date label at top of each archive card. */
.archive-item .date {
    font-size: 0.75rem;
    color: var(--accent-gold-text);
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
}

/* Hero slot used above archive modal content. */
.archive-hero {
    width: 100%;
    height: 250px;
    background: #eef2f5;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--light-blue);
    color: var(--navy);
    font-weight: bold;
}

/* Collage layout shell for archive hero image composites. */
.archive-hero-collage {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
}

/* Single-image collage mode. */
.archive-hero-collage.layout-single {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

/* Two-up split collage mode. */
.archive-hero-collage.layout-split-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

/* Mosaic layout tuned for five tiles. */
.archive-hero-collage.layout-mosaic-5 {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* Mosaic layout tuned for six tiles. */
.archive-hero-collage.layout-mosaic-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* Explicit span rules to balance five-tile mosaic composition. */
.archive-hero-collage.layout-mosaic-5 .archive-collage-tile:nth-child(1) { grid-column: span 2; }
.archive-hero-collage.layout-mosaic-5 .archive-collage-tile:nth-child(2) { grid-column: span 2; }
.archive-hero-collage.layout-mosaic-5 .archive-collage-tile:nth-child(3) { grid-column: span 2; }
.archive-hero-collage.layout-mosaic-5 .archive-collage-tile:nth-child(4) { grid-column: span 3; }
.archive-hero-collage.layout-mosaic-5 .archive-collage-tile:nth-child(5) { grid-column: span 3; }

/* Shared tile presentation for collage cells. */
.archive-collage-tile {
    border-radius: 6px;
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* Archive project-specific collage image source mapping. */
.tile-trirx { background-image: url('../images/archive/trirx.png'); }
.tile-ibio { background-image: url('../images/archive/ibio.png'); }
.tile-northway { background-image: url('../images/archive/northwaybiotech.png'); }
.tile-albemarle { background-image: url('../images/archive/albemarle.png'); }
.tile-formulated { background-image: url('../images/archive/formulatedsolutions.png'); }
.tile-polpharma { background-image: url('../images/archive/polpharma.png'); }
.tile-capscanada { background-image: url('../images/archive/capscanada.png'); }
.tile-roadtobio { background-image: url('../images/archive/roadtobio.png'); }
.tile-servier { background-image: url('../images/archive/servier.png'); }
.tile-alcaminow { background-image: url('../images/archive/alcaminow.png'); }

.tile-omms { background-image: url('../images/archive/omms.png'); }
.tile-ncpop { background-image: url('../images/archive/ncpop.png'); }
.tile-rims { background-image: url('../images/archive/rims.png'); }
.tile-centervention { background-image: url('../images/archive/centervention.png'); }
.tile-3cmarketplace { background-image: url('../images/archive/3cmarket.png'); }

.tile-dietchef { background-image: url('../images/archive/dietchef.png'); background-position: top center; }

.tile-torres { background-image: url('../images/archive/fernandotorres.png'); }
.tile-bestbuy { background-image: url('../images/archive/bestbuy.png'); }

.tile-bofa { background-image: url('../images/archive/bankofamerica.png'); }
.tile-biltmore { background-image: url('../images/archive/biltmore.png'); }
.tile-georgiapower { background-image: url('../images/archive/georgiapower.png'); }
.tile-lucas { background-image: url('../images/archive/lucasgroup.png'); }
.tile-bootcamp { background-image: url('../images/archive/bootcampforacure.png'); }
.tile-trainstrong { background-image: url('../images/archive/trainstrong.png'); }
.tile-goods { background-image: url('../images/archive/goodsforyou.png'); }
.tile-mccarthy { background-image: url('../images/archive/mccarthyjennerich.png'); }
.tile-sequoia { background-image: url('../images/archive/sequoiayacht.png'); }
.tile-cda { background-image: url('../images/archive/cdaarchitecture.png'); }
.tile-carnival { background-image: url('../images/archive/carnivaltribe.png'); }
.tile-cpi { background-image: url('../images/archive/cpilondon.png'); }
.tile-ipn { background-image: url('../images/archive/ipnglobal.png'); }
.tile-zico { background-image: url('../images/archive/zico.png'); }

/* Full-screen modal overlay used for archive details. */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(1, 33, 105, 0.9);
    overflow-y: auto;
}

/* Toggle class that makes modal visible. */
.modal.is-open {
    display: block;
}

/* Prevents page scroll while modal is open. */
body.modal-open {
    overflow: hidden;
}

/* Modal dialog container dimensions and spacing. */
.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 3rem;
    width: 80%;
    max-width: 800px;
    border-radius: 12px;
    position: relative;
}

/* Modal heading spacing reset. */
.modal-title {
    margin: 0.5rem 0 1.5rem 0;
}

/* Comfortable line-length/leading for modal body copy. */
.modal-description {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Top margin before modal outbound link(s). */
.modal-link {
    margin-top: 20px;
}

/* Dismiss button placement in the dialog corner. */
.close-modal {
    position: absolute;
    right: 2rem;
    top: 1.5rem;
    font-size: 2rem;
    border: 0;
    background: transparent;
    line-height: 1;
    cursor: pointer;
    color: #888;
}

/* Shared keyboard focus ring for interactive controls. */
.archive-item:focus-visible,
.sort-btn:focus-visible,
.close-modal:focus-visible,
.download-btn:focus-visible,
.case-study-link:focus-visible,
.theme-toggle:focus-visible,
.menu-toggle:focus-visible,
.nav-links a:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

/* --- Archive Grid Styles --- */
/* Filtering/sorting controls row above archive results. */
.controls { margin: 2rem 0; display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.sort-btn { padding: 0.5rem 1rem; border: 1px solid var(--navy); background: none; cursor: pointer; transition: 0.3s; }
.sort-btn.active { background: var(--navy); color: white; }
.archive-grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2.5rem; }
/* --- Base Card State --- */
/* Base archive grid card structure for JS-rendered cards. */
.grid-card {
    background-color: var(--white); /* Start at white/transparent */
    border: 1px solid var(--border-gray);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Persistent Highlight (Static) --- */
/* Pinned highlight state to keep selected cards emphasized. */
.highlight-active {
    background-color: var(--highlight) !important; /* Your gold highlight color */
    border: 2px solid var(--accent-gold) !important;
    position: relative;
    z-index: 10;
}
/* Visual hero block for each archive grid card. */
.card-hero { height: 180px; background-color: #f4f4f4; background-size: cover; background-position: top center; background-repeat: no-repeat; border-bottom: 1px solid #eee; }

/* Specific Project Image Mapping */
/* Per-project background-image mapping for archive card heroes. */
.hero-trirx { background-image: url('../images/archive/trirx.png'); }
.hero-ibio { background-image: url('../images/archive/ibio.png'); }
.hero-northway { background-image: url('../images/archive/northwaybiotech.png'); }
.hero-albemarle { background-image: url('../images/archive/albemarle.png'); }
.hero-formulated { background-image: url('../images/archive/formulatedsolutions.png'); }
.hero-polpharma { background-image: url('../images/archive/polpharma.png'); }
.hero-capscanada { background-image: url('../images/archive/capscanada.png'); }
.hero-roadtobio { background-image: url('../images/archive/roadtobio.png'); }
.hero-alcamivirtual { background-image: url('../images/archive/alcami360.png'); }
.hero-servier { background-image: url('../images/archive/servier.png'); }
.hero-alcaminow { background-image: url('../images/archive/alcaminow.png'); }
.hero-thatsnice { background-image: url('../images/archive/thatsnice.png'); }
.hero-omms { background-image: url('../images/archive/omms.png'); }
.hero-ncpop { background-image: url('../images/archive/ncpop.png'); }
.hero-rims { background-image: url('../images/archive/rims.png'); }
.hero-centervention { background-image: url('../images/archive/centervention.png'); }
.hero-3cmarketplace { background-image: url('../images/archive/3cmarket.png'); }
.hero-dietchef { background-image: url('../images/archive/dietchef.png'); }
.hero-torres { background-image: url('../images/archive/fernandotorres.png'); }
.hero-bestbuy { background-image: url('../images/archive/bestbuy.png'); }
.hero-bofa { background-image: url('../images/archive/bankofamerica.png'); }
.hero-biltmore { background-image: url('../images/archive/biltmore.png'); }
.hero-georgiapower { background-image: url('../images/archive/georgiapower.png'); }
.hero-lucas { background-image: url('../images/archive/lucasgroup.png'); }
.hero-bootcamp { background-image: url('../images/archive/bootcampforacure.png'); }
.hero-trainstrong { background-image: url('../images/archive/trainstrong.png'); }
.hero-goods { background-image: url('../images/archive/goodsforyou.png'); }
.hero-mccarthy { background-image: url('../images/archive/mccarthyjennerich.png'); }
.hero-sequoia { background-image: url('../images/archive/sequoiayacht.png'); }
.hero-cda { background-image: url('../images/archive/cdaarchitecture.png'); }
.hero-carnival { background-image: url('../images/archive/carnivaltribe.png'); }
.hero-cpi { background-image: url('../images/archive/cpilondon.png'); }
.hero-ipn { background-image: url('../images/archive/ipnglobal.png'); }
.hero-zico { background-image: url('../images/archive/zico.png'); }

/* Archive grid text/content layout internals. */
.card-content { padding: 1.5rem; flex-grow: 1; }
.grid-card .tag { float: right; }
.grid-card h3 { margin: 0.5rem 0; color: var(--navy); }
.grid-card .company { font-weight: bold; color: var(--teal); font-size: 0.9rem; }
.grid-card.highlight-active .company { color: var(--text-dark); }

/* ==========================================================================
   RESUME
   Resume page layout, typography, and experience highlight behavior.
   ========================================================================== */

.resume-container {
    max-width: 900px;
    margin: 4rem auto;
    background: var(--white);
    padding: 5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
}

/* Resume header row with identity and contact summary. */
.resume-container header {
    border-bottom: 2px solid var(--navy);
    padding-bottom: 2rem;
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

/* Resume section heading style. */
.resume-container h2 {
    font-size: 1.4rem;
    border-left: 4px solid var(--accent-gold);
    padding-left: 1rem;
    margin-top: 4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Employment/education date range label treatment. */
.date-range {
    color: var(--accent-gold-text);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

/* Wrapper per role/experience entry. */
.experience-block {
    margin-bottom: 3.5rem;
    transition: background-color 0.3s ease;
}

/* Role heading row with title and date alignment. */
.experience-block h3 {
    margin: 0 0 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.1rem;
    scroll-margin-top: 100px;
}

/* Emphasized role title styling. */
.role-title {
    font-weight: 700;
    color: var(--navy);
}

/* Three-column skills matrix on large screens. */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
}

/* Skill category heading style. */
.skill-cat h4 {
    margin-bottom: 0.5rem;
    color: var(--navy);
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3rem;
    font-size: 0.9rem;
}

/* Skill category body copy style. */
.skill-cat p {
    font-size: 0.85rem;
    margin: 0;
    color: #555;
}

/* Temporary highlight when deep-linking to a role heading. */
.experience-block:has(h3:target) {
    animation: highlight-fade 3s ease-in-out;
    background-color: var(--highlight);
    border-radius: 8px;
    padding: 15px;
    margin-left: -15px;
    margin-right: -15px;
}

/* Fade animation for targeted experience highlight state. */
@keyframes highlight-fade {
    0% { background-color: var(--accent-gold); }
    100% { background-color: transparent; }
}

/* ==========================================================================
   PAGE LEVEL: INDIVIDUAL CASE STUDY PAGES
   Explicit image/object-position mapping by page and section.
   ========================================================================== */

/* Index card image focal point overrides. */
.img-index-fct-card {
    object-position: top center;
    /*filter: blur(3px);*/
}
.img-index-portfolio-card { object-position: top center; }
.img-index-hackathon-card { object-position: top center; }
.img-index-dataverse-card { object-position: top center; }
.img-index-metlife-card { object-position: top center; }
.img-index-lenovo-card { object-position: top center; }

/* Finance Control Tower image focal points. */
.img-fct-hero { object-position: top center; }
.img-fct-research { object-position: top center; }
.img-fct-infra { object-position: top center; }
.img-fct-key-feature { object-position: top center; }
.img-fct-evolution-optimized { object-position: top center; }
.img-fct-technical { object-position: top center; }
.img-fct-collaboration { object-position: top center; }
.img-fct-workspace { object-position: top center; }

/* Hackathon image focal points. */
.img-hackathon-hero { object-position: top center; }
.img-hackathon-research { object-position: top center; }
.img-hackathon-infra { object-position: 0% 20%; }
.img-hackathon-architecture { object-position: top center; }
.img-hackathon-risk-readiness { object-position: top right; }
.img-hackathon-supply-chain { object-position: top right; }
.img-hackathon-workspace { object-position: top center; }

/* DataVerse image focal points. */
.img-dataverse-hero { object-position: top center; }
.img-dataverse-blueprint { object-position: t0% 42%; }
.img-dataverse-architecture { object-position: top center; }
.img-dataverse-turning-point { object-position: top right; }
.img-dataverse-craft { object-position: top right; }
.img-dataverse-evolution-legacy { object-position: top center; }
.img-dataverse-evolution-optimized { object-position: top center; }
.img-dataverse-ia-img { object-position: top center; }

/* MetLife image focal points. */
.img-metlife-hero { object-position: top center; }
.img-metlife-research { object-position: top center; }
.img-metlife-infra { object-position: 0% 20%; }
.img-metlife-legacy { object-position: top center; }
.img-metlife-optimized { object-position: top center; }

/* Lenovo image focal points. */
.img-lenovo-hero { object-position: top center; }
.img-lenovo-research { object-position: top center; }
.img-lenovo-infra { object-position: 0 19%; }
.img-lenovo-architecture { object-position: top center; }
.img-lenovo-localization { object-position: top center; }
.img-lenovo-technical { object-position: 0% 50%; }
.img-lenovo-evolution-legacy { object-position: top center; }
.img-lenovo-evolution-optimized { object-position: top center; }

/* Portfolio refresh image focal points and fit behavior. */
.img-pr-hero-home { object-position: top center; }
.img-pr-theme-toggle-light { object-position: 100% 4%; }
.img-pr-theme-dark { object-position: top center; }
.img-pr-evolution-legacy,
.img-pr-evolution-current {
    object-fit: contain;
    object-position: top center;
}
.img-pr-theme-switch-light,
.img-pr-theme-switch-dark,
.img-pr-theme-switch-auto,
.img-pr-theme-switch-focused {
    object-fit: cover;
    object-position: 100% 0%;
}
.img-pr-skip-link-focus {
    object-fit: cover;
    object-position: 0% 0%;
}
.img-pr-theme-toggle-focus { object-position: 100% 2%; }
.img-pr-archive-modal { object-position: 50% 10%; }
.img-pr-archive-controls { object-position: 50% 0%; }
.img-pr-archive-highlight-cards { object-position: 50% 0%; }
.img-pr-archive-highlight-full { object-position: 50% 0%; }

.img-pr-theme-toggle-light,
.img-pr-theme-toggle-focus,
.img-pr-archive-controls {
    object-fit: contain;
}

.pr-frame-theme-control { height: 220px; }
.pr-frame-theme-dark { height: 300px; }
.pr-frame-evolution { height: 330px; }
.pr-frame-accessibility-main { height: 250px; }
.pr-frame-control-focus { height: 220px; }
.pr-frame-modal-closeup { height: 300px; }
.pr-frame-archive-controls { height: 220px; }
.pr-frame-archive-highlight { height: 320px; }
.pr-frame-archive-full { height: 520px; }

/* Typography Helpers */
/* Utility text alignment helper. */
.text-center {
    text-align: center;
}

/* ==========================================================================
   PAGE LEVEL SECTIONS: CHALLENGE, RESEARCH, INFRASTRUCTURE, IMPACT
   Section modules reused within individual case study narratives.
   ========================================================================== */


.process-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-top: 5rem;
}

/* Single process step card with top border visual anchor. */
.step {
    position: relative;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
}

/* Numeric marker for process steps. */
.step-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-gold-text);
    margin-bottom: 1rem;
    display: block;
}

/* Step heading typographic treatment. */
.step h4 {
    margin: 0.5rem 0;
    font-size: 1.25rem;
    color: var(--navy);
}

/* Step supporting copy style. */
.step p {
    font-size: 0.95rem;
    opacity: 0.8;
}

/* User Research / Personas */
/* Container for persona callout block. */
.persona-callout {
    margin-top: 3rem;
}

/* Persona bulleted list styled as left-rule callout. */
.persona-list {
    margin-top: 1.5rem;
    border-left: 3px solid var(--accent-gold);
    padding-left: 1.5rem;
    list-style: none;
}

/* Individual persona bullet row spacing and rhythm. */
.persona-list li {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* infrastructure and architecture blocks, including interactive IA controls. */
/* Information architecture columns grid. */
.ia-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* IA column vertical spacing baseline. */
.ia-column {
    padding-top: 2rem;
}

/* Remove top spacing from first IA column. */
.ia-column:first-child {
    padding-top: 0;
}

/* IA column heading style. */
.ia-column h4 {
    color: var(--navy);
    border-bottom: 2px solid #ddd;
    padding-bottom: 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

/* Accent variant for top-level IA heading. */
.ia-column .top-level {
    border-bottom-color: var(--accent-gold);
}

/* Reset list presentation inside IA columns. */
.ia-column ul {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    font-size: 0.85rem;
}

/* IA list item card appearance and hover animation baseline. */
.ia-column li {
    padding: 10px;
    background: var(--white);
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-gray);
    color: var(--text-dark);
    transition: transform 0.2s ease;
    cursor: default;
}

/* Preserve text color inheritance inside auto-themed sections. */
.case-study-page main > .cs-section .ia-column li {
    color: var(--text-dark);
}

/* Hover nudge for IA list items. */
.ia-column li:hover {
    transform: translateX(5px);
    border-color: var(--accent-gold);
}

/* Lenovo/DataVerse IA list reset for button-based options. */
#lenovo-ia-grid .ia-column li,
#dataverse-ia-grid .ia-column li {
    padding: 0;
    border: 0;
    background: transparent;
    margin-bottom: 10px;
}

/* Interactive IA option button styles (Lenovo/DataVerse). */
#lenovo-ia-grid .ia-option-btn,
#dataverse-ia-grid .ia-option-btn {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border-gray);
    background: var(--white);
    border-radius: 4px;
    color: inherit;
    font: inherit;
    line-height: 1.35;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

/* IA option hover treatment. */
#lenovo-ia-grid .ia-option-btn:hover,
#dataverse-ia-grid .ia-option-btn:hover {
    transform: translateX(5px);
    border-color: var(--accent-gold);
}

/* Accessible focus ring on IA option buttons. */
#lenovo-ia-grid .ia-option-btn:focus-visible,
#dataverse-ia-grid .ia-option-btn:focus-visible {
    outline: 2px solid #0d63ff;
    outline-offset: 2px;
}

/* Active IA option state. */
#lenovo-ia-grid .ia-option-btn.is-active,
#dataverse-ia-grid .ia-option-btn.is-active {
    background: var(--white);
    border: 2px solid var(--navy);
    color: inherit;
}

/* DataVerse-specific IA column ratio. */
#dataverse-ia-grid {
    grid-template-columns: 1fr 2fr;
}

/* DataVerse architecture frame spans one column in custom IA grid. */
#dataverse-ia-grid .architecture-frame {
    grid-column: auto;
}

/* Feature bullets section spacing. */
.feature-bullets {
    margin-top: 2rem;
}

/* Feature bullets heading style. */
.feature-bullets h4 {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    color: var(--navy);
}

/* Two-column technical specs grid. */
.spec-list {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Spec label style. */
.spec-list h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--accent-gold-text);
    margin-bottom: 0.5rem;
}

/* Spec value/body copy style. */
.spec-list p {
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0.7;
}

/* stakeholder collaboration and quantified impact callouts. */
.collab-visual {
    padding: 20px;
    position: relative;
}

/* Quant callout badge over collaboration visual. */
.iteration-badge {
    position: absolute;
    bottom: -20px;
    right: -20px;
    background: var(--accent-gold);
    color: var(--navy);
    padding: 20px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.5rem;
}

/* Responsive impact KPI grid. */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin: 4rem 0;
}

/* Large numeric KPI heading style. */
.impact-card h4 {
    font-size: 4rem;
    color: var(--accent-gold-text);
    margin: 0;
    font-weight: 800;
}

/* KPI descriptor copy styling. */
.impact-card p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* template-level section overrides for research, evolution, and feature walkthroughs. */
.cs-section-header {
    max-width: 800px;
    margin-bottom: 4rem;
}

/* Section header title inversion on dark contexts. */
.cs-section-header h2 {
    color: var(--white);
}

/* Section header supporting copy tone on dark contexts. */
.cs-section-header p {
    color: rgba(255,255,255,0.7);
}

.cs-bg-navy .tag {
    color: var(--light-blue);
}

.cs-bg-navy h2 {
    color: var(--white);
}

/* Research section grid spacing. */
.research-grid {
    margin-top: 3rem;
}

/* Fixed height for research imagery cards. */
.research-image {
    height: 300px;
}

/* Strong labels inside research profile copy. */
.research-profile p strong {
    display: block;
    margin-top: 1.5rem;
}

/* Research goals list with accent rule. */
.research-goals {
    margin-top: 1.5rem;
    border-left: 3px solid var(--accent-gold);
    padding-left: 1.5rem;
    list-style: none;
}

/* Research goals item spacing. */
.research-goals li {
    margin-bottom: 1rem;
}

/* Alternate IA header accent for top-level headers. */
.ia-column .top-level-header {
    border-bottom: 2px solid var(--accent-gold);
}

/* Individual feature step block spacing. */
.feature-step {
    margin-bottom: 1.5rem;
}

/* Feature step heading color treatment. */
.feature-step h4 {
    color: var(--navy);
}

/* Feature step supporting copy size. */
.feature-step p {
    font-size: 0.9rem;
}

/* Before/after comparison grid spacing overrides. */
.comparison-grid {
    margin-top: 4rem;
    gap: 2rem;
}

/* Legacy label tone. */
.legacy-label {
    margin-top: 1rem;
    color: #666;
}

/* Optimized label tone. */
.optimized-label {
    margin-top: 1rem;
    color: var(--navy);
}

/* Legacy frame border treatment. */
.legacy-frame, .optimized-frame {
    height: 350px;
    border: 1px solid #ccc;
}

/* UI spec frame sizing and container styling. */
.ui-spec-frame {
    height: 450px;
    background: var(--white);
    border: 1px solid var(--border-gray);
}

/* Infrastructure frame sizing and container styling. */
.infra-frame {
    height: 550px;
    background: var(--white);
    border: 1px solid var(--border-gray);
}

/* Architecture frame span and sizing defaults. */
.architecture-frame {
    grid-column: span 2;
    height: 550px;
    background: var(--white);
    border: 1px solid var(--border-gray);
}

/* Ensure architecture images cover frame area. */
.architecture-frame img {
    object-fit: cover;
}

/* Workspace screenshot frame height. */
.workspace-frame {
    height: 600px;
}

/* Collaboration visual placeholder height. */
.collab-placeholder {
    height: 300px;
}

/* Back-link styling for dark hero contexts. */
.back-link {
    color: var(--white);
    border-color: var(--accent-gold);
}

/* ==========================================================================
   GLOBAL FOOTER
   ========================================================================== */
footer {
    padding: 4rem 5%;
    background: var(--navy);
    color: var(--white);
    text-align: center;
}

/* Optional trailing text in footer that wraps on very small screens. */
.footer-tail {
    display: inline;
}

/* ==========================================================================
   GLOBAL THEME VARIANTS
   Dark theme token remapping and component-specific dark overrides.
   ========================================================================== */

[data-theme="dark"] {
    color-scheme: dark;
    --text-dark: #e5ebf4;
    --bg-light: #101a2a;
    --gray-light: #101a2a;
    --border-gray: #273247;
    --surface-bg: #0c1524;
    --surface-muted: #111c2d;
    --soft-text: #b7c3d6;
    --highlight: rgba(240, 179, 35, 0.18);
}

/* Dark-mode page background override. */
[data-theme="dark"] body {
    background: #08101d;
}

/* Dark surface/background mapping for container components. */
[data-theme="dark"] nav,
[data-theme="dark"] .archive-section,
[data-theme="dark"] .project-archive,
[data-theme="dark"] .resume-container,
[data-theme="dark"] .cs-metadata,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .archive-item,
[data-theme="dark"] .grid-card,
[data-theme="dark"] .card-content,
[data-theme="dark"] .cs-image,
[data-theme="dark"] .image-container,
[data-theme="dark"] .ui-spec-frame {
    background: var(--surface-bg);
    color: var(--text-dark);
}

/* Dark variant for alternate light utility/background sections. */
[data-theme="dark"] .case-study:nth-child(even),
[data-theme="dark"] .cs-bg-light,
[data-theme="dark"] .bg-soft-gray,
[data-theme="dark"] .bg-lighter-gray {
    background-color: var(--surface-muted) !important;
}

/* Dark auto-theme cycle: slot 1. */
[data-theme="dark"] .case-study-page main > .cs-section:nth-of-type(3n + 1) {
    --section-bg: var(--surface-bg);
    --section-text: var(--text-dark);
    --section-accent: var(--light-blue);
}

/* Dark auto-theme cycle: slot 2. */
[data-theme="dark"] .case-study-page main > .cs-section:nth-of-type(3n + 2) {
    --section-bg: var(--surface-muted);
    --section-text: var(--text-dark);
    --section-accent: var(--light-blue);
}

/* Dark auto-theme cycle: slot 3 (deep navy). */
[data-theme="dark"] .case-study-page main > .cs-section:nth-of-type(3n) {
    --section-bg: #0b1830;
    --section-text: var(--text-dark);
    --section-accent: var(--light-blue);
}

/* Border token remapping in dark mode for key framed components. */
[data-theme="dark"] .archive-item,
[data-theme="dark"] .grid-card,
[data-theme="dark"] .card-hero,
[data-theme="dark"] .sort-btn,
[data-theme="dark"] .menu-toggle,
[data-theme="dark"] .nav-links .theme-toggle,
[data-theme="dark"] .cs-image,
[data-theme="dark"] .resume-container,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .image-placeholder,
[data-theme="dark"] .ia-column li,
[data-theme="dark"] .step {
    border-color: var(--border-gray);
}

/* Hover effect tuning for archive cards in dark mode. */
[data-theme="dark"] .archive-item:hover {
    border-color: var(--accent-gold);
    background-color: rgba(240, 179, 35, 0.14);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

/* Persistent highlight fill in dark mode. */
[data-theme="dark"] .grid-card.highlight-active,
[data-theme="dark"] .grid-card.highlight-active .card-content {
    background-color: var(--highlight) !important;
}

/* Muted text tone mapping for supporting content in dark mode. */
[data-theme="dark"] .nav-links a,
[data-theme="dark"] .company-info,
[data-theme="dark"] .skill-cat p,
[data-theme="dark"] .legacy-label,
[data-theme="dark"] .caption,
[data-theme="dark"] .close-modal {
    color: var(--soft-text);
}

/* Current-page nav state in dark mode. */
[data-theme="dark"] .nav-links a.nav-current {
    color: var(--text-dark);
    border-bottom-color: var(--accent-gold);
}

/* Hover color override for nav links in dark mode. */
[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .nav-links a.nav-current:hover {
    color: var(--light-blue);
    border-bottom-color: var(--light-blue);
}

/* Primary text color mapping for key headings in dark mode. */
[data-theme="dark"] .logo,
[data-theme="dark"] .case-study h2,
[data-theme="dark"] .case-study strong,
[data-theme="dark"] .resume-container h2,
[data-theme="dark"] .grid-card h3,
[data-theme="dark"] .role-title,
[data-theme="dark"] .skill-cat h4,
[data-theme="dark"] .feature-step h4,
[data-theme="dark"] .optimized-label {
    color: var(--text-dark);
}

/* Neutral dark surfaces for small controls. */
[data-theme="dark"] .menu-toggle,
[data-theme="dark"] .sort-btn,
[data-theme="dark"] .nav-links .theme-toggle {
    background: var(--surface-bg);
    color: var(--text-dark);
}

/* IA card content color/surface correction in dark mode. */
[data-theme="dark"] .case-study-page main > .cs-section .ia-column li {
    background: var(--surface-bg);
    color: var(--text-dark);
}

/* Keep special IA list wrappers transparent. */
[data-theme="dark"] #lenovo-ia-grid .ia-column li {
    background: transparent;
}

[data-theme="dark"] #lenovo-ia-grid .ia-column li,
[data-theme="dark"] #dataverse-ia-grid .ia-column li {
    background: transparent;
}

/* Dark-mode IA option button surfaces and borders. */
[data-theme="dark"] #lenovo-ia-grid .ia-option-btn,
[data-theme="dark"] #dataverse-ia-grid .ia-option-btn {
    background: #0b1830;
    border-color: var(--border-gray);
    color: var(--text-dark);
}

/* Dark-mode active IA option button state. */
[data-theme="dark"] #lenovo-ia-grid .ia-option-btn.is-active,
[data-theme="dark"] #dataverse-ia-grid .ia-option-btn.is-active {
    background: #0b1830;
    border-color: var(--light-blue);
    color: var(--text-dark);
}

/* Active sort button colors in dark mode. */
[data-theme="dark"] .sort-btn.active {
    background: var(--accent-gold-text);
    border-color: var(--accent-gold-text);
    color: var(--white);
}

/* Dark fallback backgrounds for archive/card hero regions. */
[data-theme="dark"] .archive-hero,
[data-theme="dark"] .card-hero {
    background-color: #0e1a2e;
}

/* Personal header color remap in dark mode. */
[data-theme="dark"] .personal-info h1 {
    color: var(--text-dark);
}

/* Personal subtitle color remap in dark mode. */
[data-theme="dark"] .personal-info p {
    color: var(--light-blue);
}

/* Resume header divider color remap in dark mode. */
[data-theme="dark"] .resume-container header {
    border-bottom-color: var(--border-gray);
}

/* Link color remap across contact and case-study links in dark mode. */
[data-theme="dark"] .contact-strip a,
[data-theme="dark"] .contact-info a,
[data-theme="dark"] .case-study-link {
    color: var(--light-blue);
}

/* Home page tags in dark mode. */
[data-theme="dark"] .home-page .tag {
    color: var(--light-blue);
}

/* Border color remap for case-study links in dark mode. */
[data-theme="dark"] .case-study-link {
    border-bottom-color: var(--light-blue);
}

/* Hover color for case-study links in dark mode. */
[data-theme="dark"] .case-study-link:hover {
    color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}

/* Prevent unintended archive background fills in dark mode. */
[data-theme="dark"] .project-archive {
    background: transparent;
}

/* Info-banner dark-mode palette adjustments. */
[data-theme="dark"] .dev-info-banner {
    background: rgba(121, 198, 255, 0.12);
    border-color: rgba(121, 198, 255, 0.35);
    color: var(--light-blue);
}

/* Hero disclaimer banner dark-mode palette adjustments. */
[data-theme="dark"] .cs-hero .cs-disclaimer.dev-info-banner {
    background: rgba(121, 198, 255, 0.14);
    border-color: rgba(121, 198, 255, 0.45);
    color: #dff2ff;
}

/* Footer text remap in dark mode. */
[data-theme="dark"] .footer-tail,
[data-theme="dark"] footer {
    color: var(--text-dark);
}

/* ==========================================================================
   MEDIA QUERIES
   Accessibility motion preferences first, then viewport breakpoints, then print.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    html,
    body,
    nav,
    footer,
    .archive-section,
    .project-archive,
    .resume-container,
    .cs-metadata,
    .modal-content,
    .archive-item,
    .grid-card,
    .card-content,
    .cs-image,
    .image-container,
    .ui-spec-frame,
    .sort-btn,
    .menu-toggle,
    .theme-toggle,
    .nav-links a,
    .logo,
    .company-info,
    .skill-cat p,
    .legacy-label,
    .caption,
    .close-modal,
    .case-study h2,
    .case-study strong,
    .resume-container h2,
    .grid-card h3,
    .role-title,
    .skill-cat h4,
    .feature-step h4,
    .optimized-label,
    .card-hero,
    .archive-hero,
    .ia-column li,
    .step,
    .download-btn,
    .case-study-link {
        transition: none;
    }
}

/* Landscape Tablet and Above (1024px+) */
@media (min-width: 1024px) {
    /* Promote case-study layout to two columns on larger displays. */
    .case-study-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6rem; /* Slightly wider gap for landscape/desktop breathing room */
    }

    .text-content {
        margin-bottom: 0; /* Remove mobile margin when side-by-side */
    }

    /* Alternate layout direction for even sections. */
    .case-study:nth-child(even) .text-content {
        grid-column: 2; /* Move text to the right */
    }

    .case-study:nth-child(even) .image-container {
        grid-column: 1; /* Move image to the left */
        grid-row: 1;    /* Ensure it aligns on the same row */
    }

    /* Case-study page side-by-side rows: reverse even rows on desktop. */
    .case-study-page main > .cs-side-by-side:nth-child(odd of .cs-side-by-side) .text-content {
        grid-column: 2;
    }

    .case-study-page main > .cs-side-by-side:nth-child(odd of .cs-side-by-side) .image-container {
        grid-column: 1;
        grid-row: 1;
    }
}

/* Tablet and below (<= 1023px) */
@media (max-width: 1023px) {
    /* Keep archive gutters consistent on tablet widths. */
    .project-archive {
        padding-left: 5%;
        padding-right: 5%;
        box-sizing: border-box;
    }
}

@media (max-width: 1023px) {
    /* Collapse multi-column systems into single-column stacks. */
    .case-study-grid, .cs-hero, .grid-2, .process-steps, .ia-grid, .spec-list {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    #dataverse-ia-grid {
        grid-template-columns: 1fr;
    }
    /* Tablet typography and frame-height reductions. */
    .portfolio-header h1 { font-size: 2.5rem; }
    .cs-hero { padding-top: 6rem; }
    .cs-hero h1 { font-size: 3rem; }
    .cs-section { padding: 4rem 5%; }
    .hero-image-frame { height: 320px; }
    .architecture-frame { min-height: 260px; }
    .workspace-frame { height: 420px; }
    .img-lenovo-hero { object-position: 50% 4%; }
    .img-lenovo-localization { object-position: 50% 4%; }
    .pr-frame-theme-control,
    .pr-frame-theme-dark,
    .pr-frame-evolution,
    .pr-frame-accessibility-main,
    .pr-frame-control-focus,
    .pr-frame-modal-closeup,
    .pr-frame-archive-controls,
    .pr-frame-archive-highlight,
    .pr-frame-archive-full {
        height: 240px;
    }
    .resume-container { padding: 2rem 1.5rem; margin: 1rem; }
    .resume-container header { flex-direction: column; align-items: flex-start; }
    .skills-grid { grid-template-columns: 1fr; }
}

/* Mobile and below (<= 767px) */
@media (max-width: 767px) {
    /* Nav shifts from inline links to flyout trigger/menu. */
    nav {
        position: relative;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Collapsed nav panel container. */
    body.js-enabled nav .nav-links {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 5%;
        left: auto;
        width: min(240px, 84vw);
        background: var(--surface-bg);
        border: 1px solid var(--border-gray);
        border-radius: 8px;
        box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14);
        padding: 0.75rem 1rem;
        z-index: 1100;
    }

    /* Slightly stronger overlay shadow in dark theme. */
    [data-theme="dark"] body.js-enabled nav .nav-links {
        box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
    }

    /* Expanded nav panel when menu is open. */
    body.js-enabled nav.nav-open .nav-links {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    /* Tighten link spacing inside compact mobile menu. */
    body.js-enabled nav .nav-links a {
        margin-left: 0;
        padding: 0.3rem 0;
    }

    body.js-enabled nav .nav-links .theme-toggle {
        margin-left: 0;
        width: fit-content;
    }

    body.js-enabled nav .nav-links a.nav-current {
        padding-left: 0.4rem;
    }

    /* Scale KPI numerals down for smaller screens. */
    .impact-card h4 { font-size: 2rem; }

    #lenovo-ia-grid {
        grid-template-columns: 1fr !important;
    }

    #lenovo-ia-grid .architecture-frame {
        grid-column: auto;
    }
}

/* Small mobile and below (<= 479px) */
@media (max-width: 479px) {
    /* Allow trailing footer text to wrap to its own line. */
    .footer-tail {
        display: block;
    }
}

/* Extra small mobile and below (<= 359px) */
@media (max-width: 359px) {
    /* Prevent button crowding on extremely narrow viewports. */
    .download-btn { margin-bottom: 15px !important; }
}

/* Hidden by default and only surfaced in print context. */
.print-only {
    display: none !important;
}

/* ==========================================================================
   PDF PRINT OPTIMIZATION
   ========================================================================== */
@media print {
    /* Reveal print-only tokens inside generated PDF/output. */
    .print-only {
        display: inline !important;
    }

    nav, footer, .download-btn, .contact-strip, nav.nav-links, .close-modal, .modal { display: none !important; }
    body { background: var(--white) !important; color: #000 !important; font-size: 9.5pt !important; line-height: 1.25 !important; }
    .resume-container { margin: 0 !important; padding: 0 !important; box-shadow: none !important; width: 100% !important; max-width: 100% !important; }
    .resume-container header { border-bottom: 2px solid #000 !important; padding-bottom: 0.5rem !important; margin-bottom: 1rem !important; display: block !important; }
    .personal-info { display: inline-block; }
    .personal-info h1 { font-size: 20pt !important; margin: 0 !important; display: block; color: var(--navy) !important; }
    .personal-info p { display: inline-block; margin: 0 !important; font-weight: bold; font-size: 9pt !important; text-transform: uppercase; color: #D48900 !important; }
    .personal-info p:after { content: " | "; margin: 0 4px; font-weight: normal; color: #000 !important; }
    .contact-info { display: inline-block !important; margin-left: 5px; font-size: 9pt !important; }
    .contact-info p { display: inline !important; margin: 0 !important; }
    .contact-info br { display: none !important; }
    .contact-info a, .contact-info span { display: inline; color: #000 !important; text-decoration: none !important; }
    .contact-info p > span:after, .contact-info p > a:not(:last-child):after { content: " | "; margin: 0 4px; font-weight: normal; }
    h2 { font-size: 13pt !important; margin-top: 1rem !important; margin-bottom: 0.3rem !important; padding-left: 0.5rem !important; border-left: 4px solid #D48900 !important; text-transform: uppercase; color: var(--navy) !important; }
    .experience-block { margin-bottom: 1rem !important; page-break-inside: avoid; }
    .experience-block h3 { font-size: 10pt !important; margin: 0 !important; display: flex; justify-content: space-between; }
    .role-title { font-weight: 700; color: var(--navy) !important; }
    .date-range { color: #D48900 !important; font-weight: bold; font-size: 8pt !important; }
    .experience-block p { margin: 0 !important; }
    .early-career, .education-dates { display: none; }
    ul { margin-top: 0.1rem !important; }
    li { margin-bottom: 0.1rem !important; }
    .skills-grid { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 1rem !important; margin-top: 0.3rem !important; }
    .skill-cat { margin-bottom: 0.4rem !important; }
    .skill-cat h4 { margin-bottom: 0.2rem !important; margin-top: 0.2rem !important; font-size: 9pt !important; border-bottom: 1px solid #eee !important; color: var(--navy) !important; }
    .skill-cat p { font-size: 8.5pt !important; color: #000 !important; }
}
