:root {
  --yellow: #FFFF00;
  --magenta: #FF00FF;
  --cyan: #00FFFF;
  --blue: #0000FF;
  --green: #00FF00;
  --red: #FF0000;
  --general-font-size: 16px;
  --general-font-family: Helvetica, Arial, sans-serif;
  --main-color: var(--blue);
  --link-hover-color: var(--dynamic-color);
  --landing-padding: clamp(10px, 2.5vw, 50px);
  --dynamic-color: transparent;
  --text-column-max-width: 620px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-size: var(--general-font-size);
  font-family: var(--general-font-family);
  line-height: 1.2;
}

body {
  background: #ffffff;
  color: var(--main-color);
  min-height: 100vh;
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  min-height: 100svh;
}

a { 
  color: var(--main-color); 
  text-decoration: none; 
  -webkit-tap-highlight-color: transparent;
}
a:hover { color: var(--link-hover-color); }
/* add → after links in content areas only (exclude gradient links, footer, etc.) */
.about-text a:after,
.title a:not(.back-link):after,
.page-container:not(.projects) a:not(.gradient-circle-left):not(.gradient-ellipse-right):not(.close-button):not(.back-link):after {
  content: '→';
  display: inline-block;
  margin-left: 0.2em;
}
a[href^="http"]:after { transform: rotate(-45deg) }

#content {
  /* padding-bottom: 4rem; */
  min-height: 100vh;
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  min-height: 100svh;
  /* padding-bottom: 4rem; */
}

.studio-header {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.studio-header .names,
.studio-header .contact { 
  display: block;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.studio-header .names {
  margin-bottom: -7px;
}

.studio-header .contact {
  margin-top: -7px;
}

.studio-header.is-expanded .names,
.studio-header.is-expanded .contact { 
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  max-height: 500px;
}

/* Toggle dot animation - moves down when header is expanded */
/* Uses JavaScript-measured height of names for precise positioning */
.studio-header.is-expanded .toggle-dot {
  transform: translateY(var(--names-height, calc(1.2em * 2)));
}

/* Staggered animation for individual paragraphs */
.studio-header.is-expanded .names p:nth-child(1) {
  transition-delay: 0.08s;
}

.studio-header.is-expanded .names p:nth-child(2) {
  transition-delay: 0.15s;
}

.studio-header.is-expanded .contact p:nth-child(1) {
  transition-delay: 0.22s;
}

.studio-header.is-expanded .contact p:nth-child(2) {
  transition-delay: 0.3s;
}

.studio-header.is-expanded .contact p:nth-child(3) {
  transition-delay: 0.38s;
}

.studio-header.is-expanded .contact p:nth-child(5) {
  transition-delay: 0.45s;
}

.studio-header p { 
  margin: 0; 
  line-height: 1.2;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-dot { 
  width: 60px; 
  height: 60px; 
  cursor: pointer; 
  background: none; 
  border: 0; 
  padding: 20px;
  margin: -20px;
  border-radius: 50%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-dot svg { display: block; width: 100%; height: 100%; }
.toggle-dot svg circle { fill: var(--blue); transition: fill .2s ease; }
.toggle-dot:hover svg circle { fill: var(--dynamic-color); }

/* Prevent hover state from sticking on mobile devices */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover effects on touch devices */
  .toggle-dot:hover svg circle {
    fill: var(--blue);
  }
  
  .gradient-circle-left:hover {
    transform: translateY(-50%) scale(1);
  }
  
  .gradient-ellipse-right:hover {
    transform: translateY(-50%) scale(1);
  }
  
  /* Use touch-active class to show hover state only during tap */
  .toggle-dot.touch-active svg circle {
    fill: var(--dynamic-color);
  }
  
  .gradient-circle-left.touch-active {
    transform: translateY(-50%) scale(1.15);
  }
  
  .gradient-ellipse-right.touch-active {
    transform: translateY(-50%) scale(1.15);
  }
}

.footer-links {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: block;
  width: fit-content;
  /* padding-top: 2.4rem; */
  margin-left: 0;
  margin-bottom: 0;
}
.footer-links.below {
  position: relative;
  margin-top: 2.4rem;
}

.footer-links a {
  color: var(--dynamic-color);
}

.footer-links a:hover {
  color: var(--blue);
}

/* Footer and contact links don't need arrows (excluded from content rule above) */

.landing {
  position: absolute;
  width: 100vw;
  height: auto; 
  min-height: 100vh;
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.image-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--landing-padding);
  min-height: 0;
}

.image-container img { cursor: pointer; }

/* Unit containing image and caption - Flexbox solution */
/* Container adapts to image width, caption automatically matches image width */
.landing .slide-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  /* No gap - caption directly below image */
  gap: 0;
  /*
    Reduce initial layout jump: before JS sets an explicit width, avoid an
    overly-wide intrinsic box that makes the image appear left-aligned.
    JS will later set slideContent.style.width precisely to the rendered image width.
  */
  width: fit-content;
  max-width: calc(100vw - 2 * var(--landing-padding));
  /* Height adapts to content (image + caption) */
  height: auto;
  max-height: calc(100vh - 2 * var(--landing-padding));
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  max-height: calc(100svh - 2 * var(--landing-padding));
  /* Center container horizontally within parent */
  margin: 0 auto;
  /* Container width is determined by image, not caption */
  min-width: 0;
}

/* Image container - determines container width */
.landing .image-stack { 
  position: relative;
  display: inline-block;
  line-height: 0;
  /* Container adapts to image width - this determines slide-content width */
  /* inline-block ensures container shrinks to fit image */
  width: auto;
  max-width: calc(100vw - 2 * var(--landing-padding));
  /* Height adapts to image aspect ratio */
  height: auto;
  /* Ensure container respects aspect ratio from image */
  min-width: 0;
  /* Flex-shrink: 0 prevents image-stack from shrinking, ensuring it determines width */
  flex-shrink: 0;
  align-self: flex-start;
}

/* Image sizing - CSS-only proportional scaling with aspect-ratio */
.landing .image-stack img {
  display: block;
  /* Use aspect-ratio from inline style to reserve space immediately */
  /* Keep natural width from attributes, scale if exceeds container */
  width: auto;
  height: auto;
  max-width: 100%;
  /* Respect container max-height constraint (leaves space for caption) */
  max-height: calc(100vh - 2 * var(--landing-padding) - 3rem);
  /* Use small viewport height for mobile Safari */
  max-height: calc(100svh - 2 * var(--landing-padding) - 3rem);
  object-fit: contain;
  /* Browser reserves space immediately based on width/height attributes + aspect-ratio */
  /* This prevents layout shift before image loads */
}

/* First image should be visible immediately to prevent layout shift */
.landing .image-stack img.first-slide {
  opacity: 1;
  visibility: visible;
  position: relative;
}

/* Other images positioned absolutely for slider effect */
/* Hide by default to prevent flash before JS initialization */
.landing .image-stack img[data-slide]:not(.first-slide) {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  visibility: hidden;
}

/* Caption - left-aligned, automatically same width as image */
.landing .title { 
  margin: 0.4em 0 0; 
  line-height: 1.2;
  padding: 0;
  text-align: left;
  /* Caption matches container width (which is determined by image width) */
  width: 100%;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
  /* Limit caption width to 80% for readability, but never exceed container */
  max-width: 80%;
  /* Caption cannot exceed container width - flex-shrink allows it to shrink if needed */
  flex-shrink: 1;
  align-self: flex-start;
  /* Caption is directly under image in flexbox flow, aligned to left edge */
}

/* media query for small screens */
@media (max-width: 768px) {
  .title {
    max-width: 100%;
  }
}

.title a { display: inline-block; }

.title .back-link {
  margin-right: 0.2em;
}

.title .back-link:before {
  content: '←';
  display: inline-block;
  margin-right: 0.2em;
}

.gradient-circle-left {
  position: fixed;
  left: -26.4vh;
  top: 50%;
  width: 50.4vh;
  height: 50.4vh;
  cursor: pointer;
  z-index: 10;
  transform: translateY(-50%) scale(1);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  clip-path: circle(50%);
}

.gradient-circle-left svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(1);
  opacity: 0.85;
  animation: breathe 4s ease-in-out infinite;
  will-change: transform, opacity;
}



@keyframes breathe {
  0%, 100% {
    opacity: 0.85;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.gradient-circle-left:hover {
  transform: translateY(-50%) scale(1.15);
}

.gradient-circle-left:hover svg {
  animation: breathe-hover 4s ease-in-out infinite;
}

@keyframes breathe-hover {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.close-button {
  position: fixed;
  top: 1rem;
  right: 1rem;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 40px;
  line-height: 0.8em;
  width: 21px;
  height: 21px;
  color: var(--blue);
  text-decoration: none;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: -0.1em;
}

.close-button:hover {
  color: var(--link-hover-color);
  cursor: pointer;
}

/* Gradient close button for legal pages */
.close-button.gradient-close {
  top: 1rem;
  right: 1rem;
  width: 120px;
  height: 120px;
  font-size: 0;
  line-height: 0;
  margin: 0;
  transform: scale(1);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  clip-path: circle(50%);
}

.close-button.gradient-close svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(1);
  opacity: 0.85;
  animation: breathe 4s ease-in-out infinite;
  will-change: transform, opacity;
}

.close-button.gradient-close:hover {
  transform: scale(1.15);
  color: inherit;
}

.close-button.gradient-close:hover svg {
  animation: breathe-hover 4s ease-in-out infinite;
}

.close-button.gradient-close stop {
  transition: stop-color 100ms linear;
}

/* Media query for small screens - gradient close button */
@media (max-width: 768px) {
  .close-button.gradient-close {
    top: 1rem;
    right: 1rem;
    width: 80px;
    height: 80px;
  }
}

/* Prevent hover state from sticking on mobile devices - gradient close */
@media (hover: none) and (pointer: coarse) {
  .close-button.gradient-close:hover {
    transform: scale(1);
  }
  
  .close-button.gradient-close.touch-active {
    transform: scale(1.15);
  }
}

/* Close button doesn't need arrow (excluded from content rule above) */

.gradient-circle-left stop,
.gradient-ellipse-right stop,
.close-button.gradient-close stop {
  transition: stop-color 100ms linear;
}

.gradient-ellipse-right {
  position: fixed;
  right: -25vh;
  top: 50%;
  width: 55vh;
  height: 145vh;
  cursor: pointer;
  z-index: 10;
  transform: translateY(-50%) scale(1);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  clip-path: ellipse(50% 50%);
}

.gradient-ellipse-right svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(1);
  opacity: 0.85;
  animation: breathe-ellipse 4s ease-in-out infinite;
  will-change: transform, opacity;
}


/* media query for small screens */
@media (max-width: 768px) {
  .gradient-circle-left {
    left: -12vh;
    top: 50%;
    width: 26.4vh;
    height: 26.4vh;
  }
  .gradient-ellipse-right {
    right: -8vh;
    top: 50%;
    width: 22vh;
    height: 92vh;
  }
}


@keyframes breathe-ellipse {
  0%, 100% {
    opacity: 0.85;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

.gradient-ellipse-right:hover {
  transform: translateY(-50%) scale(1.15);
}

.gradient-ellipse-right:hover svg {
  animation: breathe-ellipse-hover 4s ease-in-out infinite;
}

@keyframes breathe-ellipse-hover {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

/* Gradient links don't need arrows (excluded from content rule above) */

.page-container {
  padding: 1rem;
  max-width: 1300px;
  margin: 0 auto;
}

.page-container.projects {
  max-width: 100%;
  padding: 1rem 0 1rem 1rem;
  /* min-height: 100vh; */
}

.page-container.legal {
  margin-left: 0;
  --legal-indent: 3.2rem;
}

.page-container.legal h1, h2, h3, h4, h5, h6, strong {
  /* margin-top: 0; */
  font-size: 1rem;
  font-weight: normal;
}

.page-container.legal h1 {
  text-transform: uppercase;
  margin-left: var(--legal-indent);
}

.page-container.legal h2 {
  margin-left: var(--legal-indent);
  text-decoration: underline;
}

.page-container.legal h3, .page-container.legal strong {
  text-decoration: underline;
}

/* Hide gradient ellipse on projects page */
.projects .gradient-ellipse-right {
  display: none;
}

/* Projects links don't need arrows (excluded from content rule above) */

/* Split-screen layout for projects */
.projects-split {
  display: flex;
  min-height: calc(100vh - 2rem);
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  min-height: calc(100svh - 2rem);
  gap: 0;
}

.projects-list {
  width: 50%;
  min-width: 500px;
  padding-right: 1rem;
}

@media (max-width: 768px) {
  .projects-list {
    min-width: 100%;
  }
  
  .page-container.projects {
    height: auto;
    overflow: visible;
  }
  
  .projects-split {
    height: auto;
  }
}

.projects-item {
  margin: 0;
  margin-bottom: 0.5rem;
  cursor: pointer;
  max-width: var(--text-column-max-width);
}

.projects-item:last-child {
  margin-bottom: 0;
}

.projects-image-container {
  width: 50%;
  position: relative;
  overflow: hidden;
  padding: 0;
  margin: 0;
  margin-top: -1rem;
  min-height: 100%;
}

.projects-preview-image {
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  object-position: top right;
  margin: 0;
  padding: 0;
}

main[data-barba="container"] {
  position: relative;
  min-height: 100vh;
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  min-height: 100svh;
  overflow-y: auto;
}

/* .project-images {
  margin-bottom: 2rem;
} */

.project-images img { 
  display: block; 
  width: 100%; 
  height: auto; 
  object-fit: contain; 
  margin-bottom: 7px;
}

/* On desktop, portrait images should not span full width */
@media (min-width: 769px) {
  .project-images img.is-portrait {
    max-width: 50%;
    margin-left: 0;
    margin-right: auto;
  }
}

/* On mobile, show project-body2 below project-images */
@media (max-width: 768px) {
  .project-content {
    display: flex;
    flex-direction: column;
  }
  
  .project-body {
    order: 1;
  }
  
  .project-images {
    order: 2;
  }
  
  .project-body2 {
    order: 3;
  }
}

/* Limit text width in project pages */
.page-container:not(.projects):not(.about) p {
  max-width: 800px;
}

/* Remove margin-top from first paragraph in project pages */
.page-container p:first-of-type {
  margin-top: 0;
}

/* About page styles */
.page-container.about {
  max-width: 100%;
  padding: 1rem 0 1rem 1rem;
  min-height: 100vh;
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  min-height: 100svh;
}

/* Split-screen layout for about */
.about-split {
  display: flex;
  min-height: 100%;
  gap: 0;
}

.about-text {
  width: 50%;
  padding-right: 1rem;
  overflow: visible;
}
.about-text p {
  max-width: var(--text-column-max-width);
}

.about-image-container {
  width: 50%;
  position: relative;
  overflow: hidden;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

.about-image-container .slide-content {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: end;
  align-content: start;
  margin: 0;
  padding: 0;
}

.about-image-container .image-stack {
  position: relative;
  display: block;
  line-height: 0;
  grid-column: 1;
  margin: 0;
  padding: 0;
}

.about-image-container .image-stack img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  /* max-height: calc(100svh - 2rem - 3rem); */
  max-height: 100vh;
  /* Use small viewport height for mobile Safari (accounts for browser UI) */
  max-height: 100svh;
  object-fit: contain;
  object-position: top right;
  margin: 0;
  padding: 0;
  /* Ensure first image is visible */
  opacity: 1;
  visibility: visible;
}

/* Hide other slider images on about page (if multiple images) */
.about-image-container.has-slider .image-stack img:not(.first-slide) {
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.about-image-container.has-slider .image-stack img {
  cursor: pointer;
}

.about-image-container .title {
  margin: 0.4em 0 0 !important;
  grid-column: 1;
  justify-self: start;
  width: 100%;
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
  padding: 0;
  text-align: left;
  line-height: 1.2;
}

/* Responsive: stack on smaller screens */
@media (max-width: 768px) {
  .page-container.about {
    height: auto;
    overflow: visible;
    min-height: 100vh;
    /* Use small viewport height for mobile Safari (accounts for browser UI) */
    min-height: 100svh;
  }
  
  .about-split {
    flex-direction: column;
    height: auto;
  }
  
  /* On mobile: image first, text second */
  .about-text {
    width: 100%;
    padding-right: 1rem;
    height: auto;
    overflow: visible;
    order: 2;
  }
  
  .about-image-container {
    width: 100%;
    margin-top: 0;
    margin-bottom: 1rem;
    /* margin-left: -1rem; */
    justify-content: flex-start;
    height: auto;
    /* min-height: 50vh; */
    order: 1;
  }
  
  .about-image-container .slide-content {
    height: auto;
    align-content: start;
  }
  
  .about-image-container .image-stack img {
    max-height: none;
    object-position: top center;
  }
}


