.header-flex {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 2.5rem;
  text-align: left;
}

.header-flex .headshot {
  margin-left: 4rem;
  margin-top: 5rem;
  position: relative;
  z-index: 3;
}
.header-flex .header-info {
  margin-top: 5rem;
}
.header-info {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.header-info h1 {
  font-size: clamp(2.2rem, 1.65vw + 1.65rem, 3rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  max-width: 600px;
  position: relative;
}

.header-info h3 {
  font-size: clamp(1rem, 0.85vw + 0.7rem, 1.4rem);
  white-space: nowrap;
  max-width: 650px;
  position: relative;
}

.header-info h3 + h3 {
  margin-top: -1rem;
}


/* Header Monitor Look */
header.header-flex {
  background: radial-gradient(ellipse at center, #353535 0%, #141414 100%) !important;
  position: relative;           
  color: #fff;
  padding-left: max(1rem, calc((100% - 800px) / 2 + 1rem));
  padding-right: max(1rem, calc((100% - 800px) / 2 + 1rem));
  min-height: 100vh;
  min-height: 100dvh; /* modern browsers: dynamic viewport on mobile */
  min-height: 100svh; /* small viewport height to avoid URL bar issues */
}

/* Scanline overlay for header background */
header.header-flex::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    transparent 1px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 3px
  );
  pointer-events: none;
  z-index: 2;
  -webkit-mask-image: radial-gradient(
    circle 120px at calc(100% - 70px) 65px,
    transparent 0 70px,
    rgba(0, 0, 0, 1) 78px 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-image: radial-gradient(
    circle 120px at calc(100% - 70px) 65px,
    transparent 0 70px,
    rgba(0, 0, 0, 1) 78px 100%
  );
  mask-repeat: no-repeat;
}

/* Header terminal */
#headerTerminalWrapper {
  position: absolute;
  top: 0.5rem;
  left: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding-left: 0.2rem;
}

#headerTerminal {
  position: relative;
  margin-top: 0;
  margin-left: 0;
  pointer-events: auto;
  font-size: 14px;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  width: min(50vw, 420px);
  max-width: min(50vw, 420px);
  max-height: clamp(320px, 75vh, 900px);
  height: clamp(320px, 75vh, 900px);
  overflow-y: auto;
  overflow-x: hidden;
  white-space: normal;
  word-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable both-edges;
  overscroll-behavior: contain;
  scroll-padding-top: 1.55rem;
}

@media (hover: none) {
  #headerTerminal {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

#headerTerminal:hover {
  scrollbar-color: rgba(245, 247, 255, 0.95) transparent;
}

#headerTerminal::-webkit-scrollbar {
  width: 3px;
  background: transparent;
}

#headerTerminal::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

#headerTerminal::-webkit-scrollbar-track {
  background: transparent;
}

#headerTerminal::-webkit-scrollbar-thumb {
  background: rgba(245, 247, 255, 0);
  border-radius: 4px;
  opacity: 0;
  transition: background-color 0.18s ease, opacity 0.18s ease;
}

#headerTerminal:hover::-webkit-scrollbar-thumb {
  background: rgba(245, 247, 255, 0.9);
  opacity: 1;
}

#headerTerminal .term-line       { white-space: pre-wrap; word-wrap: break-word; margin-bottom: 2px; }
#headerTerminal .prompt          { color: #34d26d; font-weight: bold; white-space: nowrap; }
#headerTerminal .typed           { color: var(--primary); font-weight: bold; }
body:not(.fr) #headerTerminal .typed { color: #d5bcff; }
body.fr #headerTerminal .typed { color: #9bc9ff; }
#headerTerminal .term-output     { color: #fff; }
#headerTerminalHint {
  color: #e8ecff;
  font-style: italic;
  padding: 0.25rem 0.45rem;
  position: relative;
  top: auto;
  left: auto;
  z-index: 11;
  margin-left: 0.12rem;
  white-space: normal;
  pointer-events: none;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 900;
  transform: none;
  background: rgba(40, 44, 52, 0.9);
  box-shadow: none;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-shadow: 0 1px 3px rgba(8, 12, 24, 0.65);
}
#headerTerminal .term-output a.term-link {
  color: #7aabff;
  text-decoration: underline;
  font-weight: inherit;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
#headerTerminal .term-output a.term-link:hover,
#headerTerminal .term-output a.term-link:focus-visible {
  color: #2c5bbb;
  text-decoration: underline;
}

/* Interactive terminal input */
#headerTerminal .term-input-line {
  display: block;
  white-space: normal;
}

#headerTerminal .term-input-container {
  display: inline;
  position: relative;
}

#headerTerminal .term-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--primary);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: inherit;
  font-weight: bold;
  padding: 0;
  margin: 0;
  caret-color: transparent;
  display: inline;
  width: auto;
  min-width: 1ch;
}

body:not(.fr) #headerTerminal .term-input {
  color: #d5bcff;
}

body.fr #headerTerminal .term-input {
  color: #9bc9ff;
}

/* Custom thick cursor block */
#headerTerminal .term-cursor-block {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--primary);
  vertical-align: text-bottom;
  margin-left: -1ch;
  animation: cursorBlink 1s steps(1, end) infinite;
}

body:not(.fr) #headerTerminal .term-cursor-block {
  background: #d5bcff;
}

body.fr #headerTerminal .term-cursor-block {
  background: #9bc9ff;
}

@keyframes cursorBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
/*Scroll hint arrow */
.header-scroll-indicator {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.4rem;
  pointer-events: auto;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: indicatorBounce 1.8s ease-in-out infinite;
}

.header-scroll-indicator.hidden {
  opacity: 0;
  transform: translate(-50%, 10px);
  animation: none;
  pointer-events: none;
}

.header-scroll-indicator span {
  line-height: 1;
}

@keyframes indicatorBounce {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* Force JetBrains Mono on header terminal */
header.header-flex h1,
header.header-flex h3{
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
  -webkit-font-smoothing: antialiased;
}

header.header-flex #headerTerminal,
header.header-flex #headerTerminal .term-line,
header.header-flex #headerTerminal .prompt,
header.header-flex #headerTerminal .typed,
header.header-flex #headerTerminal .term-output {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
  -webkit-font-smoothing: antialiased;
  font-size: 13px !important;
  font-weight: bold !important;
}

/* Main navigation links */
nav a {
  color:#fff;
  text-decoration:none;
  margin-right:.75rem;
  font-weight:bold;
}
nav a:last-child {margin-right:0;}
nav a:hover {text-decoration:underline;}

h1 {
    font-size: 3rem;         
  }

/* Profile image styling */
.headshot {
  width:220px;       
  height:auto;         
  border-radius:8px;   
  object-fit:cover;
  border:4px solid #fff;
  background:#fff;
}

/* Flex container for content rows */
.content-row {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin: 2rem 0;
  flex-wrap: wrap; 
}

/* Floated content blocks */
.content-float {
  overflow: auto;
  margin-bottom: 0.5rem;
}

/* Standard float images */
.float-img {
  width: 300px;
  margin: 0 1.5rem 1rem 1.5rem;
  border-radius: 12px;
}

/* Larger float images */
.float-bigimg {
  width: 340px;
  margin-left: 0.1rem;
  border-radius: 5px;
}

/* Floats: right */
.float-right .float-img {
  float: right;
  margin-left: 1.5rem;
  margin-right: 0;
  margin-bottom: 0.5rem;
}
.float-right .float-bigimg {
  float: right;
  margin-left: 1.5rem;
  margin-right: 0;
  margin-bottom: 0.5rem;
}

/* Floats: left */
.float-left .float-img {
  float: left;
  margin-right: 1.5rem;
  margin-left: 0;
  margin-bottom: 0.5rem;
}
.float-left .float-bigimg {
  float: left;
  margin-right: 1.5rem;
  margin-left: 0;
  margin-bottom: 0.5rem;
}

/* About section hover cards */
.about-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 2.5rem 0;
}

.about-highlight-card {
  position: relative;
  display: flex;
  align-items: center; 
  justify-content: flex-start; 
  min-height: 320px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  background: #0f0f12;
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  outline: none;
  isolation: isolate;
  aspect-ratio: 1 / 1;
}

.about-highlight-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto; 
  image-rendering: -webkit-optimize-contrast;
  backface-visibility: hidden; 
  transition: transform 0.45s ease, filter 0.35s ease;
  z-index: 0;
}

.about-highlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.15) 25%, rgba(6, 6, 10, 0.8) 90%);
  z-index: 1;
  transition: opacity 0.35s ease;
  opacity: 0.4;
}

.hover-card-prompt {
  position: absolute; 
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.2rem;
  margin: 0;
  left: 1rem;
  bottom: 1rem;
  background: transparent;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.8rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hover-card-prompt::after {
  content: "";
  display: inline-block;
  border: 6px solid transparent;
  border-left-color: currentColor;
}

.hover-card-text {
  position: absolute; 
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center; 
  justify-content: flex-start;
  text-align: left;
  z-index: 2;
  margin: 0;
  padding: 1.75rem; 
  font-size: 1.05rem;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.about-highlight-card:hover,
.about-highlight-card:focus {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(20, 21, 35, 0.35);
}

.about-highlight-card:hover img,
.about-highlight-card:focus img {
  transform: scale(1.02); 
  filter: brightness(0.65); 
}

.about-highlight-card:hover::before,
.about-highlight-card:focus::before {
  opacity: 1;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.55) 0%, rgba(6, 6, 10, 0.9) 100%); 
}

.about-highlight-card:hover .hover-card-text,
.about-highlight-card:focus .hover-card-text {
  opacity: 1;
  transform: translateY(0);
}

.about-highlight-card:hover .hover-card-prompt,
.about-highlight-card:focus .hover-card-prompt {
  opacity: 0;
  transform: translateY(-6px);
}

.about-highlight-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

/* Text container within flex layout */
.content-text {
  flex: 1;
  min-width: 250px;
  margin-bottom: 0.2rem;
}

/* Hide sidebar and keep terminal responsive on smaller windows */
@media (max-width: 1450px) {

  #headerTerminal {
    max-width: min(520px, 80vw);
    font-size: clamp(11px);
  }
}

@media (max-width: 1250px) {
   #sidebar {
    display: none;
  }

  .header-flex {
    gap: 4rem;
  }

  .header-flex .headshot {
    width: 190px;
    margin-left: clamp(4rem, 12vw, 8rem);
    margin-top: clamp(6rem, 10vh, 8rem);
  }

  .header-flex .header-info {
    margin-top: clamp(6rem, 10vh, 8rem);
  }

  .header-info h3 {
    white-space: normal;
    max-width: 480px;
  }

  #headerTerminal {
    max-width: min(48vw, 430px);
    font-size: clamp(8px);
  }
}

@media (max-width: 1050px) {
  .project-card-summary-thumb {
    width: 100%;
  }
}

/* TextBox link styling in header */
header a.textBox {
  display:inline-flex;
  align-items:center;
  gap:0.45rem;
  color: var(--link-blue);
  background:#fff;
  padding:0.4rem 0.9rem;
  border-radius:4px;
  text-decoration:none;
  font-weight:bold;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  -webkit-font-smoothing: antialiased;
  margin-top:0.5rem;
  transition:background 0.2s ease-in-out;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

header a.textBox:hover {
  background:#e2e6ea;
}
.textBox-icon {
  width:20px;
  height:20px;
  display:block;
}

/* Navigation container margin */
nav {
  margin-top:1.2rem;
}

/* removed content-wrap grid (reverted) */

/* Main content area constraints */
main {
  max-width:800px;
  margin:2rem auto;
  padding:0 1rem;
}

.content-rain-wrapper {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
  overflow: visible;
}

.content-rain-wrapper > main {
  position: relative;
  z-index: 1;
}

.content-rain-canvas {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  display: block;
  z-index: 0;
}

.content-rain-canvas--left {
  left: auto;
  right: calc(100% - var(--rain-left-offset, 0px));
  width: var(--rain-left-width, clamp(60px, 12vw, 260px));
}

.content-rain-canvas--right {
  left: calc(100% - var(--rain-right-offset, 0px));
  width: var(--rain-right-width, clamp(60px, 12vw, 260px));
}

body.dark-mode .content-rain-canvas {
  opacity: 0.85;
}

@media (max-width: 768px) {
  .content-rain-wrapper {
    padding-left: 0;
    padding-right: 0;
  }

  .content-rain-canvas {
    display: none;
  }
}

/* Section spacing */
section {
  margin-bottom:2.5rem;
}

/* Section headings */
section h2 {
  color:var(--primary);
  margin-bottom:0.5rem;
  border-bottom:2px solid var(--accent);
  display:inline-block;
  padding-bottom:0.25rem;
}

/* Paragraph max width */
main p {
  max-width:1200px;
}

.lang-toggle {
  position: absolute;
  top: 12px;
  right: 24px;
  z-index: 4000;
  isolation: isolate;
}

.lang-toggle::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: rgba(22, 33, 48, 0.16);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  z-index: -1;
  filter: saturate(0.9);
}

.header-info { position: static !important; }

.lang-button {
  --toggle-padding: 3px;
  --toggle-gap: 5px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
  gap: var(--toggle-gap);
  padding: var(--toggle-padding);
  min-width: 170px;
  min-height: 38px;
  background-color: #c7cad2;
  color: #6b7280;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  cursor: pointer;
  transition: box-shadow 0.3s ease, transform 0.25s ease, background-color 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 10px 26px rgba(0,0,0,0.16);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  overflow: hidden;
}

.lang-button:focus-visible {
  outline: 2px solid var(--link-blue);
  outline-offset: 3px;
}

.lang-button .lang-slider {
  position: absolute;
  inset: var(--toggle-padding);
  width: calc((100% - (var(--toggle-padding) * 2) - var(--toggle-gap)) / 2);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 6px 12px rgba(0,0,0,0.16);
  transition: transform 0.28s ease, background-color 0.28s ease, box-shadow 0.28s ease;
  transform: translateX(calc(100% + var(--toggle-gap)));
}

body.fr .lang-button .lang-slider {
  transform: translateX(0);
}

.lang-button .lang-label {
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.01em;
  z-index: 1;
  transition: color 0.28s ease;
  user-select: none;
  color: #7b8193;
}

.lang-button .lang-label--en,
.lang-button .lang-label--fr {
  padding: 0.2rem 0.5rem;
}

body.fr .lang-button .lang-label--fr {
  color: #4f86c6; /* Active French */
}

body.fr .lang-button .lang-label--en {
  color: #7b8193; /* Inactive English */
}

body:not(.fr) .lang-button .lang-label--fr {
  color: #7b8193; /* Inactive French */
}

body:not(.fr) .lang-button .lang-label--en {
  color: #9a72e0; /* Active English */
}

.lang-button:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  background: #cdd1db;
}

/* Timeline styling */
figure.timeline {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}
.timeline ul {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline ul::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0;
  bottom: 118px;
  width: 4px;
  background: var(--primary);
}

.timeline li {
  position: relative;
  margin: 2.5rem 0;
  padding-left: 80px;
  transition: transform 0.3s;
}
.timeline li .icon {
  position: absolute;
  left: 12px;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--primary);
  background: white;
}
.timeline li .icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.timeline li:hover {
  transform: translateX(10px);
}
.timeline time {
  display: block;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.timeline .content {
  background: var(--light-bg);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.timeline h3 {
  margin-top: 0;
  color: var(--text-dark);
}
.timeline p {
  margin: 0.5rem 0 0;
  line-height: 1.4;
}

/* Footer */
footer {
  text-align:center;
  padding:1rem;
  background:var(--dark);
  color:#fff;
  font-size:0.9rem;
}

/* Sidebar positioning */
#sidebar {
  position: absolute;
  top: 100px;
  left: 20px;
  width: 180px;
  background: #1f1f1f;
  color: #ffffff;
  padding: 1rem;
  border-radius: 8px;
  z-index: 1000;
  overflow: hidden;
  /* Prevent flash-of-unpositioned sidebar before JS positions it */
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, width 0.2s ease;
}

/* Smooth sidebar movement during project collapse */
#sidebar.collapsing-projects {
  transition: top 0.65s cubic-bezier(0.23, 1, 0.32, 1),
              opacity 0.2s ease,
              width 0.2s ease;
}

#sidebar nav {
  position: relative;
  z-index: 1;
}

#sidebar nav a {
  display: block;
  color: #ffffff;
  text-decoration: none;
  margin-bottom: 0.75rem;
  font-weight: bold;
  transition: opacity 0.2s;
}

.sidebar-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  margin-bottom: 0;
}

.sidebar-item > a {
  flex: none;
  display: inline-block;
  margin-bottom: 0;
  padding-right: 0.2rem;
}

.sidebar-toggle {
  appearance: none;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.sidebar-dropdown {
  display: block;
  background: #2a2a2a;
  border: 1px solid rgba(223, 212, 241, 0.18);
  border-radius: 10px;
  padding: 0 0.75rem;
  margin: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.26s ease,
              transform 0.3s ease,
              padding 0.3s ease,
              margin 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  will-change: max-height, opacity, transform;
}

.sidebar-dropdown.open {
  max-height: 420px;
  opacity: 1;
  pointer-events: auto;
  padding: 0.75rem;
  margin: 0.35rem 0 0.1rem;
  transform: translateY(0);
}

.sidebar-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-dropdown a {
  display: block;
  color: #ffffff;
  text-decoration: none;
  padding: 0.45rem 0.35rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-dropdown a:hover,
.sidebar-dropdown a:focus-visible {
  background: rgba(223, 212, 241, 0.2);
  color: #ffffff;
}

#sidebar.sidebar-expanded {
  width: 240px;
  transition: width 0.2s ease;
}

body.fr #sidebar {
  width: 205px;
}

body.fr #sidebar.sidebar-expanded {
  width: 265px;
}

body.fr #sidebar nav a {
  color: #ffffff;
}

body.fr .sidebar-toggle {
  color: #ffffff;
}

body.fr .sidebar-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
}

body.fr .sidebar-dropdown a:hover,
body.fr .sidebar-dropdown a:focus-visible {
  background: rgba(204, 228, 255, 0.2);
}
#sidebar nav a:hover {
  opacity: 0.8;
}

#sidebarRainCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Work history See-More toggle effect */
.more-jobs {
  max-height: 120px;
  overflow: hidden;
  position: relative;
  filter: blur(3px);
  opacity: 0.8;
  transition: max-height 0.5s ease, filter 0.4s ease, opacity 0.4s ease;
}

.more-jobs::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 80px;
  background: linear-gradient(rgba(248,249,250,0), var(--light) 60%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.more-jobs.show {
  max-height: 1000px; 
  filter: none;
  opacity: 1;
}

.more-jobs.show::after {
  opacity: 0;
}

/* Ensure consistent gap between visible and revealed jobs */
.more-jobs > li:first-child {
  margin-top: 0;
}

.see-more {
  margin: 0.1rem auto;
}

.work-history-cta {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0 0.5rem;
}

.see-more.see-more--less {
  background: #d2d6dc;
  color: #1f1f1f;
  border: none;
  box-shadow: none;
}

.see-more.see-more--less:hover {
  background: #c4c8cf;
}

/* Project hover cards */
.project-stack {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 0.5rem;
  position: relative;
}

.project-stack-controls {
  display: flex;
  justify-content: center;
  margin-top: 0.4rem;
}

.collapse-projects-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.95rem;
  color: #7a7a7a;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: inherit;
  outline: none;
  transition: color 0.2s ease;
}

.collapse-projects-btn:hover,
.collapse-projects-btn:focus-visible {
  color: #4a4a4a;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.project-card {
  position: relative;
  border-radius: 14px;
  padding: clamp(1.3rem, 2.1vw, 2rem);
  border: 1px solid rgba(83, 67, 104, 0.18);
  background: var(--light-bg);
  box-shadow: 0 14px 40px rgba(16, 19, 32, 0.08);
  transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.45s ease,
              border-color 0.35s ease;
  transform-origin: center;
  isolation: isolate;
}

.project-card:focus {
  outline: none;
}

.project-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
}

.project-card:hover,
.project-card:focus-within,
.project-card.is-open {
  transform: translateY(-1rem) scale(1.012);
  box-shadow: 0 30px 70px rgba(10, 12, 28, 0.23);
  border-color: rgba(83, 67, 104, 0.4);
  z-index: 10;
}

.project-card-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
}

.project-card-summary-info {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1 1 320px;
  min-width: min(320px, 100%);
}

.project-card-title {
  margin: 0;
  font-size: clamp(1.3rem, 1vw + 1.1rem, 1.9rem);
  line-height: 1.25;
}

.project-tech {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 2px solid rgba(83, 67, 104, 0.4);
  background: rgba(83, 67, 104, 0.08);
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  width: fit-content;
}

.project-card-summary-thumb {
  flex: 0 0 auto;
  width: clamp(150px, 22vw, 230px);
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(18, 20, 34, 0.25);
}

.project-card-summary-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
}

.project-card-details {
  border-top: 1px solid rgba(83, 67, 104, 0.25);
  margin-top: 0.4rem;
  padding-top: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transition: max-height 0.65s ease, opacity 0.35s ease, padding-top 0.35s ease, margin-top 0.35s ease;
}

.project-card:hover .project-card-details,
.project-card:focus-within .project-card-details,
.project-card.is-open .project-card-details {
  max-height: 4000px;
  opacity: 1;
  pointer-events: auto;
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  overflow: visible;
}

.project-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  justify-content: flex-start;
  padding-left: 0.3rem;
}

.project-card-body {
  display: block;
}

.project-card-text p {
  margin-bottom: 0.95rem;
}

.project-card-text::after {
  content: "";
  display: block;
  clear: both;
}

.project-card .btn-report,
.project-card .btn-video,
.project-card .btn-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 12px;
  padding: 0.6rem 1.35rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  min-width: 150px;
  transform: scale(1);
  transition: transform 0.25s ease, color 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  will-change: transform, box-shadow;
  box-shadow: 0 8px 18px rgba(87, 126, 132, 0.25);
  box-sizing: border-box;
  flex: 0 0 12.5rem;
  width: 12.5rem;
  min-width: 12.5rem;
  max-width: 12.5rem;
}

.project-card .btn-report,
.project-card .btn-video {
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--accent);
}

.project-card .btn-code {
  background: transparent;
  color: var(--dark);
  border: 2px solid var(--accent);
}

.see-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.6rem 1.35rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  min-width: 150px;
  transform: scale(1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  will-change: transform, box-shadow;
  box-shadow: 0 8px 18px rgba(87, 126, 132, 0.25);
  box-sizing: border-box;
}

.work-history-cta .see-more {
  padding: 0.5rem 1.1rem;
  min-width: 135px;
  font-size: 0.95rem;
}

.project-card .btn-report:hover,
.project-card .btn-video:hover,
.project-card .btn-report:focus-visible,
.project-card .btn-video:focus-visible,
.see-more:hover,
.see-more:focus-visible {
  transform: scale(1.05);
  box-shadow: 0 14px 26px rgba(87, 126, 132, 0.35);
}

.project-card .btn-code:hover,
.project-card .btn-code:focus-visible {
  transform: scale(1.05);
  background: var(--accent);
  color: #fff;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  /* Stack the about highlight boxes on small screens */
  .about-highlight-grid {
    grid-template-columns: 1fr;
  }
  .about-highlight-card {
    min-height: 260px;
  }

  main {
    padding: 0 1.3rem; 
  }
  main p {
    max-width: 100%; 
  }

  header.header-flex {
    padding-top: clamp(3rem, 6vw, 4rem);
    padding-left: clamp(1rem, 5vw, 1.8rem);
    padding-right: clamp(1rem, 5vw, 1.8rem);
  }

  .header-flex {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 1.1rem; /* reduce space after headshot on mobile */
    word-break: break-word;
    width: 100%;
  }

  .header-info {
    align-items: flex-start;
    width: 100%;
  }

  .project-tech {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
    white-space: normal;
  }

  .project-card {
    padding: 1.15rem;
  }

  .project-card-summary {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 1rem;
  }

  .project-card-summary-info {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .project-card-summary-thumb {
    width: 100%;
  }

  .project-card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .project-card .btn-report,
  .project-card .btn-video,
  .project-card .btn-code {
    width: 100%;
    min-width: 0;
    max-width: none;
    justify-content: center;
    flex: 1 1 auto;
    margin: 0.2rem 0;
  }

  .header-info h1 {
    font-size: 2.5rem;         
    line-height: 1.2;
    margin: 0.5rem 0 0.25rem;
    max-width: 100%;
    white-space: normal;
    word-wrap: break-word;
    text-align: left;
  }
  .header-info h3 {
    font-size: 1rem;
    line-height: 1.35;
    max-width: 100%;
    margin: 0;
    text-align: left;
  }
  
  .headshot {
    width: 130px;
    height: auto;
  }
  .header-flex .headshot {
    margin-left: 0 !important;
    margin-top: 0 !important;
  }
  .header-flex .header-info {
    margin-left: 0 !important;
    margin-top: 0 !important;
  }

  #headerTerminalWrapper {
    position: relative;
    top: 0;
    left: 0;
    order: 3;
    width: 100%;
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-left: 0;
  }

  #headerTerminal {
    position: relative;
    width: min(100%, 520px);
    max-width: 100%;
    max-height: none;
    height: auto;
    margin: 0;
    margin-left: 0;
    padding: 1rem 1.25rem;
    font-size: clamp(8px, 2vw, 10px) !important;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    scrollbar-gutter: auto;
  }

  #headerTerminalHint {
    position: relative;
    bottom: auto;
    left: auto;
    margin-left: 0.1rem;
    margin-bottom: 0;
    padding: 0.22rem 0.4rem;
    display: inline-flex;
    transform: none;
  }

  #headerTerminal .term-line {
    white-space: pre-wrap;
    word-break: break-word;
  }
 
  header a.textBox {
    flex-wrap: wrap;
    justify-content: flex-start;
    font-size: 80%;
  }
  .float-left .float-img,
  .float-right .float-bigimg,
  .float-left .float-bigimg,
  .float-right .float-img {
    float: none !important;        
    display: block;               
    width: 75%;                   
    margin: 0 auto 1rem;             
  }

  .hover-card-text {
  font-size: 15px; 
  }

.lang-toggle {
    position: absolute !important;
    top: 6px !important;
    right: 12px !important;
    z-index: 4001 !important;
    isolation: isolate;
    margin-top: 0 !important;
    align-self: auto !important;
  }
}

/* Inline media viewer */
.media-modal[hidden] {
  display: none !important;
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 2vw, 2rem);
  pointer-events: none;
}

.media-modal.is-open {
  pointer-events: auto;
}

.media-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 20, 0.85);
  backdrop-filter: blur(6px);
}

.media-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1200px, 96vw);
  max-height: 96vh;
  height: min(96vh, 960px);
  background: #0e0d15;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
  padding: clamp(1rem, 1.5vw, 1.5rem);
  padding-top: clamp(3rem, 3.5vw, 3.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  transition: opacity 180ms ease, transform 200ms ease;
}

.media-modal.is-open .media-modal__dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.media-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 1.1rem;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

.media-modal__close:hover,
.media-modal__close:focus-visible {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.media-modal__content {
  flex: 1 1 auto;
  min-height: clamp(420px, 85vh, 1100px);
  max-height: 92vh;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-modal__content iframe,
.media-modal__content embed {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  background: #fff;
}

.media-modal__content video {
  width: 100%;
  height: 100%;
  outline: none;
  background: #000;
}

body.media-modal-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .media-modal__dialog {
    width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    padding-top: 2.25rem;
  }

}

/*Custom Scrollbar */
:root {
  --scrollbar-color: var(--primary);
}

html {
  scrollbar-width: thin; 
  scrollbar-color: var(--scrollbar-color) transparent; 
}

/* WebKit-based browsers */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-color);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}


/* Hide old scrollbar */
html { scrollbar-width: none; }
::-webkit-scrollbar { width: 0; height: 0; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }

#scrollbarOverlay {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: calc(env(safe-area-inset-right, 0px) + 6px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  width: 10px;
  background: transparent;
  z-index: 2000;
  pointer-events: auto;
}
#scrollbarThumb {
  position: absolute;
  right: 0;
  width: 100%;
  min-height: 32px;
  border-radius: 8px;
  background: var(--scrollbar-color);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.08) inset;
  will-change: transform;
  cursor: grab;
  transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1),
              height 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

#scrollbarThumb.dragging {
  transition: none;
  cursor: grabbing;
}

/* On small screens/touch, slim scrollbar and add small right padding to header */
  @media (max-width: 768px), (pointer: coarse) {
    #scrollbarOverlay { width: 6px; }
    .header-flex { padding-right: 12px; }
  }


/*Digital Rain */
:root {
  --rain-color: rgba(0, 255, 140, 0.75);
  --rain-glow: rgba(0, 255, 140, 0.25);
  --sidebar-rain-color: rgba(0, 255, 140, 0.5);
  --sidebar-rain-glow: rgba(0, 255, 140, 0.20);
}

header {
  position: relative;
  overflow: hidden; /* keep the rain clipped to header */
}

.header-flex > *:not(.header-scroll-indicator) {
  position: relative;
  z-index: 1;
  transition: filter 200ms ease;
}

/* Keep critical header UI elements above the scanline overlay */
header.header-flex .headshot {
  z-index: 4;
}

header.header-flex .lang-toggle {
  z-index: 4000;
}

header.header-flex .header-info {
  z-index: auto;
}


header.header-rain-active .header-flex > *:not(.header-scroll-indicator) {
  filter: saturate(0.95) brightness(0.98);
}

#headerRainCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Dark mode overrides triggered via terminal command */
body.dark-mode {
  background-color: var(--light);
  color: var(--dark);
}

body.dark-mode .headshot {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(10, 14, 26, 0.6);
}

body.dark-mode header a.textBox {
  background: rgba(213, 231, 255, 0.18);
  color: #f6fbff;
  border: 1px solid rgba(213, 231, 255, 0.5);
  box-shadow: 0 12px 30px rgba(6, 9, 20, 0.55);
}

body.dark-mode header a.textBox:hover {
  background: rgba(213, 231, 255, 0.32);
  color: #0b182d;
}

body.dark-mode .lang-button {
  background-color: rgba(227, 245, 255, 0.12);
  color: #dcecff;
  border: 1px solid rgba(227, 245, 255, 0.25);
  box-shadow: 0 12px 30px rgba(7, 9, 20, 0.65);
}

body.dark-mode .lang-button .lang-slider {
  background: rgba(10, 18, 32, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
}

body.dark-mode .lang-button:hover {
  background-color: rgba(227, 245, 255, 0.18);
  color: #eaf4ff;
}

body.dark-mode .lang-button .lang-label {
  color: #9aa4bf;
}

body.dark-mode.fr .lang-button .lang-label--fr {
  color: #4f86c6;
}

body.dark-mode.fr .lang-button .lang-label--en {
  color: #9aa4bf;
}

body.dark-mode:not(.fr) .lang-button .lang-label--fr {
  color: #9aa4bf;
}

body.dark-mode:not(.fr) .lang-button .lang-label--en {
  color: #9a72e0;
}

body.dark-mode .timeline .content {
  background: rgba(32, 40, 66, 0.85);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

body.dark-mode .timeline li .icon {
  background: rgba(9, 12, 24, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .project-card {
  background: var(--light-bg);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

body.dark-mode .project-card-summary-thumb {
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.65);
}

body.dark-mode .project-tech {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: var(--primary);
}

body.dark-mode .project-card-details {
  border-color: rgba(255, 255, 255, 0.18);
}

body.dark-mode .project-card .btn-report,
body.dark-mode .project-card .btn-video,
body.dark-mode .project-card .btn-code,
body.dark-mode .see-more {
  background: rgba(158, 213, 255, 0.18);
  color: #f7fbff;
  border: 2px solid rgba(158, 213, 255, 0.5);
  box-shadow: 0 9px 22px rgba(7, 9, 20, 0.45);
}

body.dark-mode .project-card .btn-code {
  border-color: rgba(158, 213, 255, 0.6);
}

body.dark-mode .project-card .btn-code:hover,
body.dark-mode .project-card .btn-code:focus-visible,
body.dark-mode .project-card .btn-report:hover,
body.dark-mode .project-card .btn-video:hover,
body.dark-mode .project-card .btn-report:focus-visible,
body.dark-mode .project-card .btn-video:focus-visible,
body.dark-mode .see-more:hover,
body.dark-mode .see-more:focus-visible {
  background: rgba(158, 213, 255, 0.35);
  color: #081224;
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.55);
}

body.dark-mode .see-more.see-more--less {
  background: rgba(255, 255, 255, 0.08);
  color: #f7fbff;
  border: none;
  box-shadow: none;
}

body.dark-mode .see-more.see-more--less:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #f7fbff;
}

body.dark-mode #sidebar {
  background: linear-gradient(180deg, rgba(48, 52, 78, 0.96), rgba(26, 30, 51, 0.96));
  color: #f4f7ff;
  border: 1px solid rgba(171, 192, 233, 0.35);
  box-shadow: 0 20px 50px rgba(4, 6, 16, 0.75);
}

body.dark-mode #sidebar nav a {
  color: #f4f7ff;
}

body.dark-mode .sidebar-toggle {
  color: #f4f7ff;
}

body.dark-mode #sidebarRainCanvas {
  display: none;
}

body.dark-mode footer {
  background: rgba(4, 5, 10, 0.95);
  color: var(--dark);
}
