:root,
html[data-theme="light"] {
  color-scheme: light;
  --theme-bg-start: #F8FAFC;
  --theme-bg-mid: #E7EBF0;
  --theme-bg-end: #D9E0E7;
  --theme-surface: rgba(248, 250, 252, 0.82);
  --theme-surface-strong: rgba(248, 250, 252, 0.96);
  --theme-surface-muted: rgba(231, 235, 240, 0.82);
  --theme-text: #0D1A34;
  --theme-text-soft: #0D1A34;
  --theme-muted: #3D485C;
  --theme-border: rgba(13, 26, 52, 0.14);
  --theme-border-strong: rgba(13, 26, 52, 0.24);
  --theme-accent: #263142;
  --theme-accent-2: #3D485C;
  --theme-contrast: #F8FAFC;
  --theme-shadow: 0 22px 64px rgba(13, 26, 52, 0.12);
  --theme-shadow-soft: 0 14px 38px rgba(13, 26, 52, 0.08);
  --bg: #F8FAFC;
  --bg-soft: #E7EBF0;
  --surface: rgba(248, 250, 252, 0.84);
  --surface-solid: #F8FAFC;
  --surface-muted: #E7EBF0;
  --text: #0D1A34;
  --text-soft: #0D1A34;
  --muted: #3D485C;
  --border: rgba(13, 26, 52, 0.13);
  --border-strong: rgba(13, 26, 52, 0.22);
  --primary: #3D485C;
  --primary-dark: #263142;
  --primary-soft: #D9E0E7;
  --accent: #E7EBF0;
  --accent-soft: #E7EBF0;
  --warm: #F8FAFC;
  --shadow: var(--theme-shadow);
  --shadow-soft: var(--theme-shadow-soft);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --theme-bg-start: #263142;
  --theme-bg-mid: #263142;
  --theme-bg-end: #3D485C;
  --theme-surface: rgba(38, 49, 66, 0.82);
  --theme-surface-strong: rgba(38, 49, 66, 0.96);
  --theme-surface-muted: rgba(61, 72, 92, 0.68);
  --theme-text: #F8FAFC;
  --theme-text-soft: #E7EBF0;
  --theme-muted: #D9E0E7;
  --theme-border: rgba(248, 250, 252, 0.14);
  --theme-border-strong: rgba(248, 250, 252, 0.24);
  --theme-accent: #E7EBF0;
  --theme-accent-2: #D9E0E7;
  --theme-contrast: #0D1A34;
  --theme-shadow: 0 24px 70px rgba(13, 26, 52, 0.34);
  --theme-shadow-soft: 0 16px 42px rgba(13, 26, 52, 0.24);
  --bg: #263142;
  --bg-soft: #3D485C;
  --surface: rgba(38, 49, 66, 0.82);
  --surface-solid: #263142;
  --surface-muted: #3D485C;
  --text: #F8FAFC;
  --text-soft: #E7EBF0;
  --muted: #D9E0E7;
  --border: rgba(248, 250, 252, 0.14);
  --border-strong: rgba(248, 250, 252, 0.24);
  --primary: #E7EBF0;
  --primary-dark: #D9E0E7;
  --primary-soft: #3D485C;
  --accent: #F8FAFC;
  --accent-soft: #3D485C;
  --warm: #263142;
  --shadow: var(--theme-shadow);
  --shadow-soft: var(--theme-shadow-soft);
}

html.theme-ready body,
html.theme-ready .header,
html.theme-ready .nav-links,
html.theme-ready .card,
html.theme-ready .content-card,
html.theme-ready .project-card,
html.theme-ready .skill-card,
html.theme-ready .timeline-card,
html.theme-ready .contact-card,
html.theme-ready .cert-card,
html.theme-ready .profile-card,
html.theme-ready .metric-card,
html.theme-ready .mini-card,
html.theme-ready .quote-panel,
html.theme-ready .footer,
html.theme-ready .btn,
html.theme-ready .theme-switch {
  transition: color var(--theme-transition), background-color var(--theme-transition), border-color var(--theme-transition), box-shadow var(--theme-transition);
}

html.theme-ready .theme-switch{--toggle-size:11px;--container-width:5.625em;--container-height:2.5em;--container-radius:6.25em;--container-light-bg:#7897B0;--container-night-bg:#1D2433;--circle-container-diameter:3.375em;--sun-moon-diameter:2.125em;--sun-bg:#E7D27A;--moon-bg:#D9E0E7;--spot-color:#8D96A8;--circle-container-offset:calc((var(--circle-container-diameter) - var(--container-height))/2*-1);--stars-color:#F8FAFC;--clouds-color:#F8FAFC;--back-clouds-color:#C8D4DE;--transition:.5s cubic-bezier(0,-.02,.4,1.25);--circle-transition:.3s cubic-bezier(0,-.02,.35,1.17);display:inline-flex;align-items:center;flex:0 0 auto;cursor:pointer}
.theme-switch,.theme-switch *,.theme-switch *::before,.theme-switch *::after{box-sizing:border-box}
.theme-switch__checkbox{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.theme-switch__container{position:relative;width:var(--container-width);height:var(--container-height);overflow:hidden;border:1px solid rgba(13,26,52,.12);border-radius:var(--container-radius);background:var(--container-light-bg);box-shadow:0 -.062em .062em rgba(0,0,0,.18),0 .062em .125em rgba(255,255,255,.72);font-size:var(--toggle-size);transition:var(--transition)}
.theme-switch__container::before{content:"";position:absolute;z-index:1;inset:0;border-radius:inherit;box-shadow:0 .05em .187em rgba(0,0,0,.22) inset;pointer-events:none}
.theme-switch__circle-container{position:absolute;top:var(--circle-container-offset);left:var(--circle-container-offset);display:flex;width:var(--circle-container-diameter);height:var(--circle-container-diameter);border-radius:var(--container-radius);background:rgba(255,255,255,.1);box-shadow:inset 0 0 0 3.375em rgba(255,255,255,.08),0 0 0 .625em rgba(255,255,255,.08),0 0 0 1.25em rgba(255,255,255,.06);transition:var(--circle-transition);pointer-events:none}
.theme-switch__sun-moon-container{position:relative;z-index:2;width:var(--sun-moon-diameter);height:var(--sun-moon-diameter);margin:auto;overflow:hidden;border-radius:var(--container-radius);background:var(--sun-bg);box-shadow:.062em .062em .062em rgba(254,255,239,.61) inset,0 -.062em .062em #A1872A inset;filter:drop-shadow(.062em .125em .125em rgba(0,0,0,.22))}
.theme-switch__moon{position:relative;width:100%;height:100%;border-radius:inherit;background:var(--moon-bg);box-shadow:.062em .062em .062em rgba(254,255,239,.61) inset,0 -.062em .062em #969696 inset;transform:translateX(100%);transition:var(--transition)}
.theme-switch__spot{position:absolute;top:.75em;left:.312em;width:.75em;height:.75em;border-radius:var(--container-radius);background:var(--spot-color);box-shadow:0 .0312em .062em rgba(0,0,0,.25) inset}
.theme-switch__spot:nth-of-type(2){top:.937em;left:1.375em;width:.375em;height:.375em}.theme-switch__spot:nth-of-type(3){top:.312em;left:.812em;width:.25em;height:.25em}
.theme-switch__clouds{position:absolute;bottom:-.625em;left:.312em;width:1.25em;height:1.25em;border-radius:var(--container-radius);background:var(--clouds-color);box-shadow:.937em .312em var(--clouds-color),-.312em -.312em var(--back-clouds-color),1.437em .375em var(--clouds-color),.5em -.125em var(--back-clouds-color),2.187em 0 var(--clouds-color),1.25em -.062em var(--back-clouds-color),2.937em .312em var(--clouds-color),2em -.312em var(--back-clouds-color),3.625em -.062em var(--clouds-color),2.625em 0 var(--back-clouds-color),4.5em -.312em var(--clouds-color),3.375em -.437em var(--back-clouds-color);transition:var(--transition)}
.theme-switch__stars-container{position:absolute;top:-100%;left:.312em;width:2.75em;color:var(--stars-color);transition:var(--transition)}.theme-switch__stars-container svg{display:block;width:100%;height:auto}
.theme-switch__checkbox:checked+.theme-switch__container{background:var(--container-night-bg)}.theme-switch__checkbox:checked+.theme-switch__container .theme-switch__circle-container{left:calc(100% - var(--circle-container-offset) - var(--circle-container-diameter))}.theme-switch__checkbox:checked+.theme-switch__container .theme-switch__moon{transform:translateX(0)}.theme-switch__checkbox:checked+.theme-switch__container .theme-switch__clouds{bottom:-4.062em}.theme-switch__checkbox:checked+.theme-switch__container .theme-switch__stars-container{top:50%;transform:translateY(-50%)}
.theme-switch:hover .theme-switch__circle-container{left:calc(var(--circle-container-offset) + .187em)}.theme-switch:hover .theme-switch__checkbox:checked+.theme-switch__container .theme-switch__circle-container{left:calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - .187em)}
.theme-switch__checkbox:focus-visible+.theme-switch__container{outline:3px solid rgba(148,135,233,.52);outline-offset:3px}

.brand-mark {
  color: #F8FAFC;
  background: linear-gradient(135deg, #263142 0%, #3D485C 100%);
  box-shadow: 0 12px 28px rgba(13, 26, 52, .20);
}

html[data-theme="dark"] .brand-mark {
  color: #0D1A34;
  background: linear-gradient(135deg, #F8FAFC 0%, #E7EBF0 100%);
}

.btn-primary,
.gallery-btn.is-active,
.filter-btn:hover,
.filter-btn.is-active,
.tab.active {
  color: #F8FAFC;
  background: linear-gradient(135deg, #263142 0%, #3D485C 100%);
  border-color: #263142;
  box-shadow: 0 16px 34px rgba(13, 26, 52, .20);
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .gallery-btn.is-active,
html[data-theme="dark"] .filter-btn:hover,
html[data-theme="dark"] .filter-btn.is-active,
html[data-theme="dark"] .tab.active {
  color: #0D1A34;
  background: linear-gradient(135deg, #F8FAFC 0%, #E7EBF0 100%);
  border-color: #E7EBF0;
  box-shadow: 0 16px 34px rgba(13, 26, 52, .28);
}

.btn-secondary,
.btn-ghost,
.gallery-btn,
.filter-btn,
.tab {
  color: var(--theme-text-soft);
  background: color-mix(in srgb, var(--theme-surface-strong) 78%, transparent);
  border-color: var(--theme-border-strong);
}

.section-kicker,
.hero-eyebrow,
.pill,
.tech-list span,
.chip,
.timeline-status,
.timeline-status.muted,
.timeline-meta span,
.hero-sector-tags span,
.goals-list li,
.portfolio-cat {
  color: var(--theme-text-soft);
  background: color-mix(in srgb, var(--theme-surface-muted) 74%, transparent);
  border-color: var(--theme-border);
}

.section-kicker::before,
.pill::before,
.clean-list li::before,
.goals-list li::before,
.goals-clean-list li::before,
.marquee-item::before,
.service-mark::after {
  background: var(--theme-accent-2);
  box-shadow: none;
}

.card,
.content-card,
.project-card,
.skill-card,
.timeline-card,
.contact-card,
.cert-card,
.profile-card,
.metric-card,
.mini-card,
.contact-item,
.experience-metric-card,
.project-gallery-item,
.modal-panel,
.detail-card {
  color: var(--theme-text);
  background: var(--theme-surface);
  border-color: var(--theme-border);
  box-shadow: var(--theme-shadow-soft);
}

.profile-card {
  background: linear-gradient(145deg, color-mix(in srgb, var(--theme-surface-strong) 92%, transparent), color-mix(in srgb, var(--theme-bg-mid) 70%, transparent));
}

.profile-card::before,
.profile-card::after,
.metric-card::after,
.timeline-card::after,
.experience-metric-card::after {
  background: radial-gradient(circle, color-mix(in srgb, var(--theme-bg-end) 56%, transparent), transparent 68%);
}

.profile-frame,
.project-visual,
.quote-panel,
.cta,
.site-footer-cta,
.cta-full-section {
  background: radial-gradient(circle at top right, rgba(248, 250, 252, .10), transparent 34%), linear-gradient(135deg, #263142 0%, #3D485C 100%);
  color: #F8FAFC;
}

html[data-theme="dark"] .profile-frame,
html[data-theme="dark"] .project-visual,
html[data-theme="dark"] .quote-panel,
html[data-theme="dark"] .cta,
html[data-theme="dark"] .site-footer-cta,
html[data-theme="dark"] .cta-full-section {
  background: radial-gradient(circle at top right, rgba(248, 250, 252, .08), transparent 34%), linear-gradient(145deg, #263142 0%, #3D485C 100%);
}

.quote-panel p,
.cta p,
.site-footer-cta p,
.cta-full-content p,
.cta-service-item p {
  color: rgba(248, 250, 252, .82);
}

.portfolio,
.featured-portfolio,
.tools-section,
.section.footer-contact-section {
  background: linear-gradient(135deg, color-mix(in srgb, var(--theme-bg-start) 96%, transparent) 0%, color-mix(in srgb, var(--theme-bg-mid) 82%, transparent) 58%, color-mix(in srgb, var(--theme-bg-end) 66%, transparent) 100%);
}

.marquee-strip {
  border-color: var(--theme-border);
  background: linear-gradient(90deg, color-mix(in srgb, var(--theme-bg-start) 88%, transparent), color-mix(in srgb, var(--theme-surface-strong) 86%, transparent), color-mix(in srgb, var(--theme-bg-start) 88%, transparent));
}

.marquee-strip::before {
  background: linear-gradient(90deg, var(--theme-bg-start), transparent);
}

.marquee-strip::after {
  background: linear-gradient(270deg, var(--theme-bg-start), transparent);
}

.marquee-item {
  color: var(--theme-text-soft);
  background: color-mix(in srgb, var(--theme-surface-strong) 78%, transparent);
  border-color: var(--theme-border);
}

.footer {
  color: var(--theme-text);
  background: color-mix(in srgb, var(--theme-surface-strong) 62%, transparent);
  border-color: var(--theme-border);
}

.footer-contact-title,
.section-title,
.page-title,
.hero-title,
.timeline-role,
.timeline-company,
.project-title,
.skill-card h3,
.contact-card h3,
.cert-card h3 {
  color: var(--theme-text);
}

.footer-contact-description,
.section-description,
.page-description,
.hero-description,
.timeline-card p,
.project-card p,
.skill-card p,
.contact-card p,
.cert-card p,
.goals-clean-list li {
  color: var(--theme-text-soft);
}

.field input,
.field textarea {
  color: var(--theme-text);
  background: color-mix(in srgb, var(--theme-surface-strong) 88%, transparent);
  border-color: var(--theme-border-strong);
}

.field input:focus,
.field textarea:focus {
  background: var(--theme-surface-strong);
  border-color: var(--theme-accent-2);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-accent-2) 22%, transparent);
}

.project-gallery-item img,
.project-gallery-item figcaption,
.image-viewer-image,
.image-viewer-panel img,
.image-viewer-close,
.image-viewer-nav {
  background: var(--theme-surface-strong);
}

.project-gallery-item figcaption,
.image-viewer-close,
.image-viewer-nav {
  color: var(--theme-text-soft);
}

.image-viewer {
  background: rgba(13, 26, 52, .90);
}

.area-card .line,
.timeline::before {
  background: linear-gradient(90deg, #263142 0%, #3D485C 100%);
}

html[data-theme="dark"] .area-card .line,
html[data-theme="dark"] .timeline::before {
  background: linear-gradient(90deg, #D9E0E7 0%, #F8FAFC 100%);
}

.timeline-card::before {
  background: var(--theme-accent-2);
  border-color: var(--theme-surface-strong);
  box-shadow: 0 0 0 1px var(--theme-border-strong);
}

::selection {
  color: #F8FAFC;
  background: #263142;
}

html[data-theme="dark"]::selection {
  color: #0D1A34;
  background: #E7EBF0;
}

@media (max-width: 1040px) {
  .nav-links {
    background: color-mix(in srgb, var(--theme-surface-strong) 96%, transparent);
    box-shadow: var(--theme-shadow);
  }
}

@media (max-width: 620px) {
  .nav-actions {
    gap: 7px;
  }

  .theme-switch { --toggle-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html.theme-ready body,
  html.theme-ready * {
    transition-duration: 0.01ms !important;
  }
}
