/* Main stylesheet for Massimo Piazza personal site */

/* Import custom fonts for the website */
@font-face {
  font-family: 'TitleDefense';
  src: url('https://fonts.gstatic.com/s/spacegrotesk/v21/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-gOoraIAEj7oUXskPMZBSSJLm2E.woff') format('woff');
  font-display: swap;
}

@font-face {
  font-family: 'BodyDefense';
  src: url('https://fonts.gstatic.com/s/inter/v18/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7W0Q5nw.woff2') format('woff2');
  font-display: swap;
}

/* Root-level CSS variables */
:root {
  --accent-rgb: 22, 97, 135;
  --accent: rgb(var(--accent-rgb));
  --accent-hover-md-url: rgb(134, 163, 186);
  --accent-hover: rgba(var(--accent-rgb), 0.10);
  --dark-hover: rgba(0, 0, 0, 0.10);
  --nav-height: 60px;
  --nav-bar-color-rgb: 5, 24, 33;
  --nav-bar-color: rgb(var(--nav-bar-color-rgb));
  --footer-height: 60px;
  --extra-offset: 10px;
  --accordion-width: 100%;
  --accordion-offset: 1.5rem;
  --button-size: 1.8rem;
  --accordion-gap: 4px;
  --detail-width: 100%;
  --side-margin: 2rem;
  --side-margin-mobile: 1rem;
  --content-max-width: 800px;
  --dock-max-scale: 1.5;
  --dock-min-scale: 1;
  --dock-distance: 64px;
  --spinner-size: 96px;
  /* Padding for hover overlay on accordion links */
  --hover-overlay-padding-vertical: 10px;
  --hover-overlay-padding-horizontal: 6px;
  --hover-overlay-radius: 0.5rem;
  /* Tooltip offset */
  --tooltip-distance: 16px;
  /* Image viewer configuration */
  --image-radius: 8px;
  /* Table styling */
  --table-border: 1px solid #000;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  :root {
    --accordion-width: 70%;
    --detail-width: 55%;
  }
}

/* Reduce footer height on devices without hover (e.g. mobile) to save space */
@media (hover: none) {
  :root {
    --footer-height: 46px;
    /* thinner than default 60px */
  }
}

/* Global resets */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base utility for screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Body layout */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'BodyDefense', sans-serif;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* Wrapper for sliding */
#pageContent {
  transition: transform 0.3s ease;
  position: relative;
  width: 100%;
}

/* Navigation bar */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background: var(--nav-bar-color);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 100;
}

nav a {
  font-family: 'TitleDefense', sans-serif;
  color: #fff;
  text-decoration: none;
  margin-right: 2rem;
  position: relative;
  padding: 0.5rem 0;
}

nav a:last-child {
  margin-right: 0;
}

nav a:hover {
  opacity: 0.8;
}

nav .indicator {
  position: absolute;
  bottom: 0;
  height: 4px;
  width: 0;
  background: var(--accent);
  transition: left 0.3s, width 0.3s;
}

/* Main content area */
main {
  padding-top: var(--nav-height);
  padding-bottom: var(--footer-height);
  flex: 1;
}

section {
  max-width: var(--content-max-width);
  margin: 2rem auto;
  padding: 0 1rem;
  scroll-margin-top: calc(var(--nav-height) + var(--extra-offset));
}

/* Section headings */
h2 {
  font-family: 'TitleDefense', sans-serif;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 2.2rem;
}

h3 {
  font-family: 'TitleDefense', sans-serif;
  margin-bottom: 0.5rem;
  color: #333;
  font-size: 1.2rem;
}

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


/* About section */
#about img {
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
}

.bio-para {
  margin-bottom: 1rem;
}

.bio-extra {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.bio-extra.open {
  max-height: 1000px;
}

.toggle-bio {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 0;
  padding: var(--hover-overlay-padding-vertical) var(--hover-overlay-padding-horizontal);
}

.toggle-bio::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-hover);
  border-radius: var(--hover-overlay-radius);
  opacity: 0;
  transition: opacity 0.3s ease, left 0.3s ease, width 0.3s ease;
  z-index: -1;
}

.toggle-bio:hover::before {
  opacity: 1;
}

.toggle-bio.open::before {
  left: var(--hover-overlay-padding-horizontal);
  width: 1.5rem;
}

.toggle-bio svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

.toggle-bio.open svg {
  transform: rotate(180deg);
}

.toggle-text {
  margin-left: 0.5rem;
  font-family: 'BodyDefense', sans-serif;
  font-size: 0.75rem;
  color: #333;
  text-transform: lowercase;
  transition: background-color 0.3s ease, opacity 0.3s ease;
}


.hover-accent-overlay {
  transition: background-color 0.3s ease;
}

.hover-accent-overlay:hover {
  background-color: var(--dark-hover);
}

.toggle-bio.open .toggle-text {
  opacity: 0;
}

/* Accordion for projects */
.accordion-header {
  position: relative;
  cursor: pointer;
  padding: 1rem 0;
  display: grid;
  grid-template-columns: calc(var(--accordion-width) - var(--accordion-offset)) auto;
  align-items: center;
  font-family: 'TitleDefense', sans-serif;
  transition: transform 1.0s ease;
}

.accordion-header::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--accordion-width);
  border-bottom: 1px solid #ddd;
}

.accordion-header::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--accordion-width);
  border-bottom: 1px solid #ddd;
  transform: translateY(var(--line-move, 0));
  transition: transform 0.5s ease;
}

.accordion-header span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--button-size);
  height: var(--button-size);
  font-size: var(--button-size);
  transform-origin: center center;
  color: var(--accent);
  /* transition: transform 0.5s ease, background-color 0.3s ease; Already in file, just matching context */
  transition: transform 0.5s ease, background-color 0.3s ease;
}

.accordion-header span svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  /* Removes potential inline spacing */
}

.accordion-header.open span {
  transform: rotate(45deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.accordion-content ul {
  margin-top: 0.5rem;
  list-style: disc outside;
  padding-left: var(--accordion-offset);
  margin-bottom: 0;
}

.accordion-content ul li {
  margin-bottom: 0;
}

.accordion-content ul li:last-child {
  margin-bottom: 1.25rem;
}

.accordion-content a {
  color: var(--accent);
  text-decoration: none;
}

.accordion-content a:hover {
  text-decoration: none;
}

.accordion-content a {
  position: relative;
  z-index: 0;
  display: block;
  padding: var(--hover-overlay-padding-vertical) var(--hover-overlay-padding-horizontal);
  /* Constrain width so hover overlay ends at separator line */
  max-width: calc(var(--accordion-width) - var(--accordion-offset));
}

.accordion-content a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-hover);
  border-radius: var(--hover-overlay-radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.accordion-content a:hover::before {
  opacity: 1;
}

/* Consulting section */
#consulting {
  margin-top: 4rem;
}

#consulting p {
  font-style: italic;
}

#consultingSummaryHeading {
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#consultingSummaryHeading.consulting-summary-hidden {
  opacity: 0;
  transform: translateY(-4px);
}

#consultingSummaryHeading.consulting-fast-fade {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Contact form */
#contact {
  margin-top: 4rem;
}

#contact form {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--accordion-width);
  margin: 0;
}

label {
  margin-bottom: 0.5rem;
  font-weight: bold;
}

#contact form input,
#contact form textarea {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.5rem;
  font-family: 'BodyDefense', sans-serif;
}

button {
  padding: 0.75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: 'TitleDefense', sans-serif;
}

/* Contact form send button specific styling */
#contact button {
  font-size: 1rem;
  border-radius: 2rem;
  width: 25%;
  margin: 0;
  transition: background-color 0.3s ease, transform 0.1s ease;
}

#contact button:hover {
  transform: translateY(0px);
  filter: invert(25%);
}

/* Footer and social icons */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  background: var(--nav-bar-color);
  display: flex;
  justify-content: center;
  align-items: center;
}


.copyright {
  margin-top: 1.5rem;
  margin-bottom: -1.0rem;
  text-align: left;
  font-size: 0.65rem;
  color: #999;
  font-family: 'BodyDefense', sans-serif;
  letter-spacing: 0.05rem;
  white-space: nowrap;
}

.socials {
  display: flex;
  transition: transform 0.3s ease;
}

.socials a {
  margin: 0 0.5rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.0rem;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.socials a:hover {
  background-color: rgba(0, 0, 0, 0.15);
}

.socials img {
  width: 32px;
  height: 32px;
  filter: invert(100%);
  transition: filter 0.3s ease, transform 0.1s ease;
  transform-origin: center center;
}


.socials.hovering img {
  transition: filter 0.3s ease, transform 0s ease;
}

/* Accent overlay color on hover for social icons */
@media (hover: hover) and (pointer: fine) {
  .socials a:hover img {
    /* Transform the white SVG shape into the accent color (#980000) */
    /* Transformation numerically calculated using https://codepen.io/sosuke/pen/Pjoqqp */
    /*filter: brightness(0) saturate(100%) invert(77%) sepia(16%) saturate(611%) hue-rotate(315deg) brightness(93%) contrast(74%);*/
    filter: invert(50%);
  }
}

/* Detail-view panel */
.detail-view {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--detail-width);
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
}

.detail-view.open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  padding: 0 var(--side-margin);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 210;
  transition: box-shadow 0.3s ease;
}

.detail-header::after {
  content: '';
  position: absolute;
  left: var(--extra-offset);
  right: var(--extra-offset);
  bottom: 0;
  border-bottom: 1px solid #ddd;
}

.detail-header #closeDetail {
  margin-right: 1rem;
}

.detail-header #detailTitle {
  font-family: 'TitleDefense', sans-serif;
  font-size: 2rem;
  color: var(--accent);
  margin-left: 2rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-header.scrolled {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.detail-body {
  padding: var(--extra-offset) var(--side-margin) var(--side-margin) var(--side-margin);
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
}

/* Slide pageContent when detail open */
@media (min-width: 768px) {

  /* shift content so that your centered layout's left edge sits at the side margin */
  #pageContent.slide {
    transform: translateX(calc(var(--side-margin) - ((100vw - var(--content-max-width)) / 2)));
  }
}

@media (max-width: 767px) {
  #pageContent.slide {
    transform: translateX(-100%);
  }
}

/* Close button centering */
#closeDetail {
  position: absolute;
  top: calc(var(--side-margin) - 1.1rem);
  left: calc(var(--side-margin) - 1rem);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 300;
  color: var(--accent);
  padding: 0.4rem;
}

#closeDetail svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#closeDetail:hover {
  background-color: var(--dark-hover);
}


/* Download resume alignment -> View Gallery alignment */
.view-gallery-wrapper {
  width: var(--accordion-width);
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.view-gallery {
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  text-decoration: none;
  position: relative;
  z-index: 0;
  padding: var(--hover-overlay-padding-vertical) var(--hover-overlay-padding-horizontal);

  /* Reset button styles */
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.view-gallery::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-hover);
  border-radius: var(--hover-overlay-radius);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.view-gallery:hover::before {
  opacity: 1;
}

/* Expand All button */
.expand-all-btn {
  border: 1.75px solid var(--accent);
  border-radius: 0.45rem;
  background: none;
  color: var(--accent);
  padding: 0.1rem 0.3rem;
  font-family: 'BodyDefense', sans-serif;
  font-size: 0.7rem;
  cursor: pointer;
  margin-left: 0.1rem;
  transition: opacity 0.3s ease;
}

.expand-all-btn.hidden {
  opacity: 0;
  pointer-events: none;
}


@media (max-width: 767px) {
  .detail-body {
    padding: var(--extra-offset) var(--side-margin-mobile) var(--side-margin) var(--side-margin-mobile);
  }
}


/* Spinner styling */
.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--spinner-size);
  height: var(--spinner-size);
  margin: calc(var(--spinner-size) / -2) 0 0 calc(var(--spinner-size) / -2);
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 999;
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Ensure hidden spinner is hidden */
.spinner.hidden {
  display: none;
}

/***********************************/



/****************************/
/* MARKDOWN RENDERING STYLE */
/****************************/

.detail-body ul,
.detail-body ol {
  padding-left: 1.5rem;
  /* indent list levels for readability */
  margin-bottom: 1rem;
  /* add space below lists */
}

/* Add spacing between individual list items + justified text */
.detail-body li {
  margin-bottom: 0.5rem;
  text-align: justify;
}

/* Ensure paragraphs have bottom margin for proper text flow + justified text */
.detail-body p {
  margin-bottom: 1rem;
  text-align: justify;
}

/* Style fenced code blocks with background, padding, and scroll */
.detail-body pre {
  background-color: #f6f8fa;
  /* light gray background for contrast */
  padding: 1rem;
  /* inner padding for readability */
  overflow-x: auto;
  /* allow horizontal scrolling for long lines */
}

/* Style inline code snippets for emphasis */
.detail-body code {
  background-color: #f6f8fa;
  /* match code block background */
  padding: 0.2rem 0.4rem;
  /* small padding around text */
  border-radius: 3px;
  /* subtle rounded corners */
}

/* Style markdown links to use the site's accent color */
.detail-body a {
  color: var(--accent);
  /* use the defined accent color */
  text-decoration: underline;
  /* underline for clarity */
}

/* Hover state for markdown links */
.detail-body a:hover {
  color: var(--accent-hover-md-url);
  /* slight darker shade on hover */
}

/* Center figures and captions */
.detail-body figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
}

.detail-body figure figcaption {
  margin-top: 0.5rem;
  text-align: center;
}

.detail-body figure figcaption>div {
  margin: 0 auto;
}


/* Table styling for markdown tables */
.detail-body table {
  display: block;
  /* Wrap Markdown tables in a scrollable block to avoid full-page horizontal scrolling */
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  /* Collapsed borders for cleaner look */
  border-spacing: 0;
  margin-bottom: 1rem;
  border-top: var(--table-border);
  border-bottom: var(--table-border);
}

.detail-body th,
.detail-body td {
  padding: 0.5rem 0.5rem;
  text-align: center;
  /* Center align generally */
}

/* Add borders to merged cells specifically */
.detail-body td[colspan] {
  border-top: var(--table-border);
  border-bottom: var(--table-border);
}

.detail-body td:first-child,
.detail-body th:first-child {
  text-align: left;
  /* Left align text labels */
}

/* Vertical separators for columns in body only */
.detail-body td {
  border-left: var(--table-border);
}

.detail-body td:first-child {
  border-left: none;
}

/* Header styling: Top/Bottom separators, no vertical */
.detail-body th {
  color: var(--accent);
  border-bottom: var(--table-border);
  border-top: var(--table-border);
  /* Ensure header top is clear if table border overlaps */
  border-left: none;
}


/***********************************/
/* End of MARKDOWN RENDERING STYLE */

/* Everboard carousel styles */
.header_carrousel {
  width: 380px;
  aspect-ratio: 380 / 630;
  margin: 1rem 0;
  overflow: hidden;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.header_carrousel .c_iphone {
  width: 70%;
  height: 550px;
  margin: auto;
  background-image: url('../img/everboard-carousel/iphone_frame.png');
  background-size: contain;
  background-repeat: no-repeat;
  overflow: hidden;
}

.header_carrousel .iphone_screen {
  width: 229px;
  height: 406px;
  margin-top: 65px;
  margin-left: 17px;
  overflow: hidden;
}

.header_carrousel .screen_wrapper {
  display: flex;
  transition: margin-left 1s ease;
}

.header_carrousel .screen_wrapper img {
  width: 229px;
  flex-shrink: 0;
}

.header_carrousel .c_icons {
  margin-top: 10px;
  height: 57px;
  position: relative;
  overflow: hidden;
  width: 100%;
  /* Fade icons at edges */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 15%, black 85%, transparent 100%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.header_carrousel .icon_wrapper {
  display: flex;
  transition: transform 1s ease, margin-left 1s ease;
}

.header_carrousel .icon {
  width: 57px;
  height: 57px;
  border-radius: 13px;
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 23.6px;
  cursor: pointer;
}

.header_carrousel .icon:first-child {
  margin-left: 0;
}

.header_carrousel .icon img {
  width: 110%;
  height: auto;
  margin-top: -2px;
  margin-left: -3px;
}

/* Video mockup container styling */
.video-mockup-container {
  /* Configurable mockup container width (% of page width) */
  --mockup-width: 50%;
  /* Configurable mockup aspect ratio (height/width) */
  --mockup-aspect: 2;
  /* adjust to your mockup image ratio */
  /* Configurable video width (% of mockup width) */
  --video-width: 80%;
  /* Configurable horizontal offset from center */
  --video-offset-x: 0px;
  /* Configurable vertical offset from center */
  --video-offset-y: 0px;

  position: relative;
  width: var(--mockup-width);
  max-width: 100%;
  height: 0;
  padding-top: calc(var(--mockup-aspect) * 95%);
  margin: 1rem auto 1rem;
  /* space below to prevent overlap */
  background: url("../img/canvas_mockup_iphone6.png") no-repeat center center;
  background-size: contain;
}

.video-mockup-container video {
  position: absolute;
  top: calc(50% + var(--video-offset-y));
  left: calc(50% + var(--video-offset-x));
  transform: translate(-50%, -50%);
  width: var(--video-width);
  height: auto;
}

.multicol-md {
  display: flex;
  align-items: flex-start;
  gap: var(--multicol-gap, 2rem);
}

.multicol-md-text {
  flex: var(--multicol-text-flex, 1.5);
  margin: var(--multicol-text-margin, 0);
  padding: var(--multicol-text-padding, 0);
}

.multicol-md-figure {
  flex: var(--multicol-figure-flex, 1);
  margin: var(--multicol-figure-margin, 0);
  padding: var(--multicol-figure-padding, 0);
}

@media (max-width: 767px) {
  .multicol-md {
    flex-direction: column;
  }

  .multicol-md-text {
    width: 100%;
  }

  .multicol-md-figure {
    width: 65%;
    margin-left: auto;
    margin-right: auto;
    margin-top: var(--multicol-figure-mobile-margin-top, -2rem);
    margin-bottom: var(--multicol-figure-mobile-margin-bottom, 2rem);
  }
}

/* Hover effect for accordion headers */
.accordion-header:hover {
  font-weight: bold;
  transform: translateY(-2px);
}

.accordion-header:hover span {
  font-weight: normal;
}

/* Tooltip for social icons on hover-capable devices */
@media (hover: hover) and (pointer: fine) {
  .socials a {
    position: relative;
  }

  .socials a::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + var(--tooltip-distance));
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.0s ease;
    font-size: 0.75rem;
    z-index: 100;
  }

  .socials a::before {
    content: '';
    position: absolute;
    bottom: calc(100% + var(--tooltip-distance));
    left: 50%;
    transform: translateX(-50%) translateY(5px) rotate(45deg);
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 0 0 2px 0;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.0s ease;
  }

  .socials a:hover::after,
  .socials a:hover::before {
    opacity: 1;
  }
}

/* Disable hover overlays on touch devices to prevent stuck overlays */
@media (hover: none) and (pointer: coarse) {

  .toggle-bio:hover::before {
    display: none !important;
  }

  #contact button:hover {
    transform: none !important;
    filter: none !important;
  }
}



/* Image Viewer Styles */
.image-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  /* Above everything */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: default;
  /* Ensure click events aren't blocked */
}

.image-viewer.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Desktop default: Black transparent overlay */
.image-viewer {
  background-color: rgba(0, 0, 0, 0.9);
}

/* Viewer Track (replaces simple image container) */
.viewer-image-container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  /* Prevent browser navigation gestures on mobile */
  overscroll-behavior-x: none;
  z-index: 1010;
  /* Above counter, below navigation/close */
}

.viewer-track {
  position: relative;
  width: 100%;
  height: 100%;
  /* take full height */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  /* Fully disable browser gestures to allow custom pinch/pan */
}

.track-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform;
}

.image-wrapper {
  position: relative;
  display: inline-block;
  line-height: 0;
  text-align: center;
  max-width: 90%;
  /* Ensure wrapper doesn't exceed screen height, reserving space for caption if needed?
       Actually, viewer-image max-height handles the image size.
       Wrapper just hugs it. */
}

.viewer-image {
  width: auto;
  height: auto;
  max-width: 80vw;
  /* Reduce max-height to ensure space for caption below without flying off screen?
     Or keep 90% and risk caption being cut off on small screens?
     Let's use 80vh to be safe. */
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--image-radius);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
  will-change: transform;
  backface-visibility: hidden;
}

.detail-body img {
  border-radius: var(--image-radius);
  /* Default rounded corners for all images */
  transition: border 0.2s ease, transform 0.2s ease;
  border: 2px solid transparent;
  /* Ensure images don't overflow */
  max-width: 100%;
  height: auto;
}

.viewer-caption {
  font-family: 'BodyDefense', sans-serif;
  color: #fff;
  margin-top: 1rem;
  text-align: center;

  /* Positioning below the image */
  width: 100%;
  /* Match wrapper width which matches image width */
  min-width: 200px;
  /* Prevent being too squashed if image is tiny */

  /* If wrapped in .image-wrapper, normal flow blocks go below inline-block image?
     No, .image-wrapper is inline-block but contains img (inline) and div (block).
     So div will break to next line.
     But line-height:0 on wrapper might squash text lines?
     Reset line-height on caption. */
  line-height: 1.4;

  font-size: 1rem;
  opacity: 0.9;
  z-index: 1020;

  /* Center horizontally relative to wrapper (which is centered) 
     and ensure it flows BELOW the image. */
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);

  /* Ensure it doesn't overflow screen width if image is wide */
  max-width: 90vw;
}

.image-viewer.visible .viewer-image {
  transform: scale(1);
}

/* Image Counter */
.viewer-counter {
  position: absolute;
  /* Vertically align center with viewer-close (top: 2rem + 1.5rem center = 3.5rem) */
  top: 1.5rem;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Centered on the point */
  color: #fff;
  font-family: 'TitleDefense', sans-serif;
  font-size: 1.2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 1005;
  /* Above background, but below image container */
  pointer-events: none;
  opacity: 0.9;
}

/* Close button - similar to detail close but white/contrasting */
.viewer-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1020;
  /* High z-index to stay on top */
  transition: background 0.3s ease;
}

.viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.viewer-close svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Navigation Buttons */
.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  /* Fallback / Default */
  border: none;
  border-radius: 50%;
  /* Circle shape like show more button effectively */
  width: 3rem;
  height: 3rem;
  display: flex;
  /* Flex to center svg */
  align-items: center;
  /* Center vertically */
  justify-content: center;
  /* Center horizontally */
  cursor: pointer;
  z-index: 1020;
  /* High z-index to stay on top of image container */
  transition: background 0.3s ease;
  padding: 0.5rem;
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  .viewer-nav {
    background: rgba(100, 100, 100, 0.2);
    /* Clear glass */
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
  }
}

.viewer-nav:hover {
  background: rgba(100, 100, 100, 0.5);
  /* More opaque/white on hover */
}

.viewer-prev {
  left: 2rem;
}

.viewer-next {
  right: 2rem;
}

.viewer-nav svg {
  width: 1.5rem;
  height: 1.5rem;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Rotate the "V" arrow to point Left/Right */
.viewer-prev svg {
  transform: rotate(90deg);
  /* Points Left */
}

.viewer-next svg {
  transform: rotate(-90deg);
  /* Points Right */
}

.viewer-nav.hidden {
  display: none;
}

/* Hover highlight for images in detail view */
.detail-body img {
  border-radius: var(--image-radius);
  /* Default rounded corners for all images */
  transition: border 0.2s ease, transform 0.2s ease;
  border: 2px solid transparent;
  /* Ensure images don't overflow */
  max-width: 100%;
  height: auto;
}

/* Only highlight border on hover for zoomable images */
@media (hover: hover) {
  .detail-body img.zoomable:hover {
    cursor: pointer;
    border-color: var(--accent);
  }

  /* Non-zoomable images should default to default cursor */
  .detail-body img:not(.zoomable) {
    cursor: default;
  }
}

/* Mobile Adjustments */
@media (max-width: 767px) {
  .image-viewer {
    background-color: #000;
    /* Solid black base */
  }

  .viewer-image-container {
    padding: 0;
    /* Full usage */
    /* Enable custom horizontal swipe handling while allowing vertical panning if needed */
    touch-action: pan-y;
  }

  .viewer-image {
    width: auto;
    /* Let aspect ratio determine width */
    height: auto;
    /* Let aspect ratio determine height */
    max-width: 100%;
    max-height: 80vh;
    /* Match desktop for vertical space */

    border-radius: var(--image-radius);
    /* Default rounded corners unless full width */
  }

  .viewer-image.is-full-width {
    border-radius: 0;
  }

  /* Also remove radius from loader if full width */
  .image-loader-wrapper.is-full-width .loader-overlay {
    border-radius: 0;
  }

  .viewer-close {
    top: 1rem;
    right: 1rem;
    width: 3rem;
    /* Enforce consistent container size */
    height: 3rem;
  }

  /* Ensure icon size matches desktop */
  .viewer-close svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  .viewer-prev {
    left: 0.5rem;
  }

  .viewer-next {
    right: 0.5rem;
  }
}

/* Image Loader & Placeholder */
/* Define custom property for rotation to allow animation */
@property --loader-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.image-loader-wrapper {
  position: relative;
  display: block;
  width: fit-content;
  margin: 0 auto;
  max-width: 100%;

  /* Loader Configuration */
  --loader-speed: 1.0s;
  /* Custom easing to create a pulsing velocity effect (never stopping, but accelerating/decelerating) */
  --loader-ease: cubic-bezier(0.5, 0.2, 0.5, 0.8);
  --loader-color: var(--accent);
  --loader-width: 2px;
}

.image-loader-wrapper {
  position: relative;
  /* Ensure absolute children (preview, loader) position correctly */
}

.image-loader-wrapper img {
  opacity: 0;
  transition: opacity 0.5s ease;
  display: block;
  /* Remove bottom whitespace gap */
}

.image-loader-wrapper.loaded img {
  opacity: 1;
}

/* Viewer Preview Image (Upscaled Thumbnail) */
.viewer-preview {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Match object-fit of viewer-image */

  z-index: 1;
  /* Below main image (2) and loader */
  pointer-events: none;

  /* Match .viewer-image transform logic */
  transform: scale(0.9);
  transition: transform 0.3s ease, opacity 0.5s ease;
}

.image-viewer.visible .viewer-preview {
  transform: scale(1);
}

/* Preview visible when loading */
.image-loader-wrapper:not(.loaded) .viewer-preview {
  opacity: 1 !important;
}

/* Preview hidden when loaded */
.image-loader-wrapper.loaded .viewer-preview {
  opacity: 0 !important;
}

/* Main image above preview */
.viewer-image:not(.viewer-preview) {
  position: relative;
  z-index: 2;
}

.image-loader-wrapper.loaded .loader-overlay {
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Apply the mask to the overlay container for better compatibility and valid corners */
.loader-overlay {
  /* Use CSS border instead of SVG to avoid corner distortion on non-square images */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  /* Ensure border is inside the bounds */
  border: var(--loader-width) solid var(--loader-color);
  border-radius: var(--image-radius, 8px);
  /* Match image radius */

  pointer-events: none;
  z-index: 10;

  -webkit-mask-image: conic-gradient(from var(--loader-angle), transparent 0%, #000 80%, #000 100%);
  mask-image: conic-gradient(from var(--loader-angle), transparent 0%, #000 80%, #000 100%);

  /* Animate the variable */
  animation: loader-spin var(--loader-speed) var(--loader-ease) infinite;
}

.loader-overlay svg {
  display: none;
}

/* Hide the old SVG elements as we are now using the container border */
.loader-snake {
  display: none;
}

@keyframes loader-spin {
  0% {
    --loader-angle: 0deg;
  }

  100% {
    --loader-angle: 360deg;
  }
}

/* Integrity fix for Everboard carousel with image wrappers */
.header_carrousel .screen_wrapper .image-loader-wrapper {
  flex-shrink: 0;
  /* Match the image styling that defined the slide width */
  width: 229px;
  margin: 0;
}

/* Language Switcher (Footer - Bottom Left) */
.lang-switcher-container {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
}

.lang-btn {
  background: #fff;
  border: none;
  border-radius: 6px;
  color: #000;
  padding: 0.35rem 0.6rem;
  font-family: 'TitleDefense', sans-serif;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.lang-btn .chevron {
  width: 10px;
  height: auto;
  transition: transform 0.3s ease;
  stroke: #000;
}

.lang-switcher-container.open .lang-btn .chevron {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  bottom: 120%;
  left: 0;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  min-width: 140px;
  padding: 0.5rem 0;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transform-origin: bottom left;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-switcher-container.open .lang-dropdown {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.lang-dropdown .lang-option {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  transition: background 0.2s ease;
}

.lang-dropdown .lang-option:hover {
  background: var(--dark-hover);
}

.lang-dropdown .lang-option img {
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  width: 20px;
  height: auto;
}

/* Mobile: Ensure it doesn't overlap excessively */
@media (max-width: 600px) {
  .lang-switcher-container {
    left: 1rem;
    padding: 0;
  }

  .lang-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

}

/* Mobile Navigation Buttons in Project Detail View */
.detail-nav-buttons {
  display: none;
  width: 100%;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  margin-bottom: -1rem;
  border-top: 1px solid #eee;
}

@media (max-width: 767px) {
  .detail-nav-buttons {
    display: flex;
  }
}

.nav-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  color: var(--accent);
  font-family: 'TitleDefense', sans-serif;
  font-size: 1rem;

  cursor: pointer;
  display: flex;
  align-items: center;
  max-width: 50%;
  transition: background-color 0.3s ease;
  border-radius: var(--hover-overlay-radius);
}

.nav-btn:hover {
  background-color: var(--dark-hover);
}

.nav-text {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  /* Allow text to shrink/truncate */
  min-width: 0;
}

.nav-icon {
  width: 1.5rem;
  height: 1.5rem;
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-btn.prev {
  text-align: left;
}

.nav-btn.next {
  text-align: right;
  /* Next button is aligned right via flexbox, but keep text aligned right inside */
}

.nav-btn.prev .nav-text {
  margin-left: 0.5rem;
}

.nav-btn.next .nav-text {
  margin-right: 0.5rem;
}

.nav-icon.left {
  transform: rotate(90deg);
}

.nav-icon.right {
  transform: rotate(-90deg);
}

/**************************/
/* GALLERY GRID STYLING   */
/**************************/

.gallery-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 1rem;
  --gallery-columns: 4;
  /* Default desktop columns */
}

@media (max-width: 768px) {
  .gallery-grid {
    --gallery-columns: 3;
  }
}


.gallery-row {
  display: flex;
  align-items: center;
  /* Vertically center images in the row */
  justify-content: space-between;
  /* Distribute items evenly */
  width: 100%;
  /* Separator line */
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  /* Using accent color for visibility, or #ddd per preference. User said 'thin horizontal line' */
  /* Margin logic: 0.1rem between line and edges */
  padding-bottom: 0.15rem;
  margin-bottom: 0.15rem;
  gap: 0.3rem;
  /* Small gap between items in a row */
}

/* 
   Last row usually shouldn't have a separator if "between every SINGLE row" implies strictly between. 
   "Separate every single row of images" -> usually means row 1 | row 2 | row 3. 
   Usually last row doesn't need a bottom separator unless it separates from content below.
   User said "separate every single row", implies inter-row. 
   Let's remove it from the last child. 
*/
.gallery-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--image-radius);
  /* Width is now controlled by flex-basis/width in JS or explicit Calc here if we knew column count strictly in CSS */
  /* But since we shift to JS controlled rows, we can set flex: 1 to fill space evenly */
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;

  /* Ensure images don't stretch taller than they should */
  height: auto;
}

/* Add margin to items except the last one to ensure spacing if justify-content isn't enough?
   With gap: 0.3rem on flex container, we don't need margins on items.
*/

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--image-radius);
  transition: transform 0.5s ease, filter 0.3s ease, border-color 0.2s ease;
  backface-visibility: hidden;
  border: 2px solid transparent;
}

.gallery-item:hover img {
  border-color: var(--accent);
}

/* Caption Overlay */
.gallery-caption-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--image-radius);
  padding: 1rem;
  pointer-events: none;
}

.gallery-item:hover .gallery-caption-overlay {
  opacity: 1;
}

.gallery-caption-text {
  color: #fff;
  font-family: 'BodyDefense', sans-serif;
  text-align: center;
  font-size: 1rem;
  line-height: 1.2;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

/* Responsive adjustments mainly handled by JS regrouping now */
/* We can keep media queries to help JS read state or just rely on ResizeObserver/window.width in JS */
