/* ========================================
   DESIGN SYSTEM & BASE STYLES
   ======================================== */

:root {
  --bg: 0 0% 0%;
  --ink: 26, 10%, 86%;
  --panel: 26, 10%, 86%;
  --accent: 194 100% 51.4%;
  --glass: 0 0% 13.7% / 0;
  --light: 0 0% 0%;
  
  --radius: 31px;
  --radius-card: 23px;
  --radius-full: 50%;
  
  --shadow-elegant: 0 10px 32px rgba(0, 0, 0, 0);
  
  --transition-smooth: all 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-menu: all 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-modal: all 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-theme: background-color 800ms cubic-bezier(0.4, 0.0, 0.2, 1), color 800ms cubic-bezier(0.4, 0.0, 0.2, 1);
  
  --font-large: 2.6rem;
  --font-medium: 1.43rem;
}

:root.light-theme {
  --bg: 0 0% 100%;
  --ink: 206, 10%, 14%;
  --panel: 206, 10%, 14%;
  --light: 0 0% 100%;
}

/* ========================================
   GLOBAL RESET & BASE
   ======================================== */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=') 0 0, none !important;
}

html {
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Shared scrollbar hiding for all scrollable elements */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.modal-right::-webkit-scrollbar,
.modal-left::-webkit-scrollbar {
  display: none;
}

/* Theme transitions - simplified and faster */
body,
.hero,
main,
.pill,
.contact-bar {
  transition: background-color 400ms ease-out, 
              color 400ms ease-out;
}

.brand-text,
.brand-dot,
.bluedot-label,
.menu-item,
.menu-item-sub,
.menu-item-sub2,
.modal-left,
.modal-subtitle,
.contact-left,
.contact-label,
.avatar-caption,
.about-col-top,
.about-col-top-right,
.about-col-bottom-left,
.about-social a {
  transition: color 400ms ease-out;
}

.avatar-card,
.contact-input {
  transition: background-color 400ms ease-out, 
              color 400ms ease-out;
}

svg {
  transition: fill 400ms ease-out, 
              color 400ms ease-out;
}

/* Override for interactive elements - fast hover + theme */
.menu-item,
.menu-item-sub,
.menu-item-sub2,
.brand-dot-button,
.contact-button,
.modal-close,
.about-social a {
  transition: color 400ms ease-out,
              transform 150ms cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

body {
  background: hsl(var(--bg));
  color: hsl(var(--ink));
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: -0.07em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

button {
  background: none;
  border: none;
  font-family: inherit;
  text-transform: lowercase;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: -0.07em;
}

/* ========================================
   CUSTOM CURSOR
   ======================================== */

.custom-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  background: hsl(var(--accent));
  border-radius: 50%;
  pointer-events: none !important;
  z-index: 2147483647;
  transform: translate(-50%, -50%);
  transition: background 114ms ease;
  mix-blend-mode: normal;
  will-change: transform;
}

.custom-cursor.clicked {
  background: hsl(18, 100%, 50%);
}

/* ========================================
   HERO SECTION
   ======================================== */

.hero {
  position: fixed;
  top: 2.5vh;
  left: 50%;
  transform: translateX(-50%);
  max-width: 1820px;
  width: calc(100% - 86px);
  padding: 0 83px;
  height: clamp(600px, 80vh, 900px);
  background: hsl(var(--panel));
  border-radius: var(--radius);
  box-shadow: var(--shadow-elegant);
  overflow: visible;
  z-index: 1;
}

.brand-mark {
  position: absolute;
  top: 42px;
  left: 62px;
  z-index: 10;
}

.brand-text {
  display: block;
  font-size: var(--font-large);
  font-weight: 700;
  color: hsl(var(--light));
  letter-spacing: -0.07em;
}

.brand-dot-button {
  padding: 0;
  margin: 5px 0 0 0;
  background: none;
  border: none;
  display: block;
}

.brand-dot {
  width: 50px;
  height: 50px;
  display: block;
  color: hsl(var(--light));
  pointer-events: none;
}

/* Blue Dot & Spline 3D Object */
.bluedot {
  position: absolute;
  bottom: -15vh;
  left: 40%;
  transform: translateX(-50%);
  width: 75%;
  max-width: 800px;
  aspect-ratio: 1;
  background: hsl(var(--accent));
  border-radius: var(--radius-full);
  z-index: 1;
}

.spline-container {
  position: absolute;
  bottom: -20.4vh;
  left: 39.6%;
  transform: translateX(-50%);
  width: 49%;
  max-width: 1078px;
  height: 49vw;
  max-height: 1078px;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
  /* Performance optimizations */
  will-change: transform;
  /* Start hidden, fade in when loaded */
  opacity: 0;
  transition: opacity 800ms ease-out;
}

.spline-container.loaded {
  opacity: 1;
}

.spline-container spline-viewer {
  position: absolute;
  top: 46%;
  left: 41%;
  transform: translate(-50%, -50%) scale(0.85);
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none !important;
}

.spline-container * {
  pointer-events: none !important;
}

.bluedot-label {
  position: absolute;
  bottom: -12vh;
  right: 33%;
  z-index: 3;
  font-size: var(--font-large);
  font-weight: 700;
  color: hsl(var(--ink));
  line-height: 0.78;
}

.bluedot-label > div:first-child {
  text-align: right;
}

.bluedot-label > div:last-child {
  text-align: left;
  margin-left: -30px;
}

/* ========================================
   SHARED BUTTON HOVER ANIMATION
   ======================================== */

.menu-item,
.menu-item-sub,
.menu-item-sub2,
.brand-dot-button,
.contact-button,
.modal-close,
.about-social a {
  will-change: transform;
}

.menu-item:hover,
.menu-item-sub:hover,
.menu-item-sub2:hover,
.brand-dot-button:hover,
.contact-button:hover,
.modal-close:hover,
.about-social a:hover,
.about-social a:focus {
  transform: translateY(-1px);
}

/* ========================================
   NAVIGATION MENU
   ======================================== */

.menu {
  position: absolute;
  top: 20px;
  right: 62px;
  z-index: 10;
  max-width: 260px;
}

.menu-root {
  list-style: none;
  text-align: right;
}

.menu-item,
.menu-item-sub,
.menu-item-sub2 {
  color: hsl(var(--light));
  font-size: 1.70rem;
  padding: 0;
  line-height: 0.75;
  letter-spacing: -0.07em;
  width: 100%;
  text-align: right;
}

.menu-item {
  font-weight: 700;
}

.menu-item-sub {
  font-weight: 700;
  opacity: 0.9;
}

.menu-item-sub2 {
  font-weight: 400;
}

.menu-level1,
.menu-level2 {
  list-style: none;
  margin-top: 2px;
  padding-bottom: 5px;
  padding-right: 21px;
  animation: fadeIn 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-level2 {
  padding-bottom: 6px;
}

/* ========================================
   MAIN CONTENT
   ======================================== */

main {
  position: relative;
  z-index: 10;
  background: hsl(var(--bg));
  margin-top: 100vh;
  padding: 20px 0 0;
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.section-about {
  max-width: 1820px;
  margin: 0 auto;
  padding: 0 83px;
  flex: 1;
  width: 100%;
}

.pill {
  background: hsl(var(--panel));
  color: hsl(var(--light));
  padding: 8px 83px;
  padding-left: 25%;
  border-radius: 100px;
  font-size: var(--font-large);
  font-weight: 700;
  text-align: left;
  margin: 0 -83px 62px;
}

.about-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 65px;
  position: relative;
}

.about-col-top,
.about-col-top-right,
.about-col-bottom-left {
  font-size: var(--font-medium);
  line-height: 0.96;
  text-align: justify;
  font-weight: 700;
}

.about-col-top {
  flex: 1 1 30%;
  min-width: 250px;
  order: 3;
  margin: -2% 44% 0 30%;
}

.about-col-top-right {
  flex: 1 1 20%;
  min-width: 200px;
  order: 2;
  margin: -14% 18% 0 61%;
}

.about-col-bottom-left {
  flex: 1 1 45%;
  min-width: 280px;
  order: 1;
  margin: 3% 44% 0 18%;
}

.about-col-bottom-left p {
  text-indent: 2em;
}

.about-avatar-wrapper {
  flex: 0 1 auto;
  width: 18%;
  min-width: 180px;
  order: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin: -17% 0 0 56%;
}

.avatar-card {
  width: 70%;
  aspect-ratio: 1;
  background: hsl(var(--bg));
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: 5px;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-caption {
  font-size: var(--font-large);
  font-weight: 700;
  text-align: right;
  color: hsl(var(--ink));
  width: 100%;
}

.about-social {
  flex: 0 1 auto;
  min-width: 150px;
  order: 4;
  font-size: var(--font-medium);
  font-weight: 700;
  text-align: left;
  line-height: 1.08;
  margin: -15% 5% 0 76%;
}

.about-social a {
  color: hsl(var(--ink));
  text-decoration: none;
  display: inline-block;
}

.about-social p {
  margin: 0;
}

/* ========================================
   FOOTER
   ======================================== */

footer {
  position: relative;
  z-index: 10;
  background: hsl(var(--bg));
  padding: 0 0 40px;
  flex-shrink: 0;
}

.contact-bar {
  max-width: 1820px;
  margin: 40px auto 0;
  padding: 25px 83px;
  background: hsl(var(--panel));
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 62px;
}

.contact-left {
  font-size: var(--font-medium);
  font-weight: 700;
  color: hsl(var(--light));
  line-height: 0.9;
  margin-left: -0.7em;
}

.contact-left p {
  margin: 0;
}

.contact-right {
  display: flex;
  align-items: center;
  gap: 21px;
  padding-top: 10px;
  margin: -1.4em -4em 0 0;
}

.contact-label {
  font-size: var(--font-large);
  font-weight: 700;
  color: hsl(var(--light));
  white-space: nowrap;
}

.contact-form {
  position: relative;
  display: flex;
  align-items: center;
}

.contact-input {
  background: hsl(var(--light));
  color: hsl(var(--ink));
  border: none;
  border-radius: 100px;
  padding: 3px 62px 10px 26px;
  font-size: var(--font-medium);
  font-family: inherit;
  width: 260px;
  outline: none;
}

.contact-input::placeholder {
  color: hsl(var(--ink));
  opacity: 0.5;
}

.contact-button {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: hsl(var(--ink));
  font-size: var(--font-large);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  width: 31px;
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========================================
   MODAL
   ======================================== */

.modal-backdrop,
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms;
}


.modal-backdrop {
  background: transparent;
  pointer-events: all;
  cursor: pointer;
}

.modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.lightbox-backdrop {
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
}

.lightbox-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: hsla(var(--glass));
  border: 1px solid hsla(var(--light) / 0.08);
  border-radius: 29px;
  box-shadow: var(--shadow-elegant);
  max-width: 1300px;
  width: 100%;
  height: 85vh;
  position: relative;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.show {
  animation: modalCardEnter 600ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.modal-card.exit {
  animation: modalCardExit 500ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes modalCardEnter {
  0% {
    opacity: 0;
    transform: scale(0.96) translateZ(0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateZ(0);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
}

@keyframes modalCardExit {
  0% {
    opacity: 1;
    transform: scale(1) translateZ(0);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
  100% {
    opacity: 0;
    transform: scale(0.96) translateZ(0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  left: 22px;
  color: hsl(var(--light));
  background: none;
  border: none;
  padding: 10px;
  z-index: 10;
  font-size: var(--font-large);
  font-weight: 700;
  line-height: 1;
}

.modal-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 62px;
  padding: 21px 22px 22px 72px;
  flex: 1;
  overflow: hidden;
}

.modal-left {
  color: hsl(var(--light));
}

.modal-title {
  font-size: var(--font-medium);
  font-weight: 700;
  text-transform: uppercase;
  margin: 40px 0 0 0;
  letter-spacing: -0.07em;
  text-align: right;
}

.modal-year {
  font-size: var(--font-medium);
  font-weight: 700;
  margin: 0 0 20px 0; 
  text-align: right;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-subtitle {
  font-size: var(--font-medium);
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0 8px 0;
  color: hsl(var(--light));
  text-align: left;
}

.modal-text {
  font-size: var(--font-medium);
  line-height: 0.96;
  margin: 0 0 8px 0;
  font-weight: 400;
  text-align: justify;
  text-indent: 2em;
}

#modal-working-with .modal-text {
  text-align: right;
  text-indent: 0;
}

.modal-right {
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mosaic-item {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--radius-card);
  aspect-ratio: 1;
}

.mosaic-item-wide {
  grid-column: span 2;
  aspect-ratio: 2 / 1;
}

.mosaic-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mosaic-video-container,
.mosaic-youtube-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(0 0% 0% / 0.3);
  position: relative;
  overflow: hidden;
}

.video-cursor-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=') 0 0, none !important;
  pointer-events: none;
}

.mosaic-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-card);
  background: hsl(0 0% 0%);
  pointer-events: auto;
}

.mosaic-youtube {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--radius-card);
  pointer-events: auto;
}

video,
video *,
video:hover,
video *:hover,
iframe,
iframe *,
iframe:hover,
iframe *:hover {
  cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=') 0 0, none !important;
}

.mosaic-video:fullscreen,
.mosaic-video:-webkit-full-screen,
.mosaic-video:-moz-full-screen,
.mosaic-video:-ms-fullscreen {
  object-fit: contain;
  background: hsl(0 0% 0%);
}

/* ========================================
   LIGHTBOX
   ======================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 62px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms;
}

.lightbox.visible {
  opacity: 1;
  visibility: visible;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-elegant);
  object-fit: contain;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Combined modal enter with blur and scale */
@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.98);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
}

/* Combined modal exit with blur and scale */
@keyframes modalExit {
  from {
    opacity: 1;
    transform: scale(1);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
  to {
    opacity: 0;
    transform: scale(0.98);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  body {
    min-height: 100vh;
  }

  .hero {
    top: 2vh;
    width: calc(100% - 62px);
    padding: 0 31px;
    height: clamp(400px, 65vh, 600px);
  }
  
  main {
    margin-top: 100vh;
    padding: 20px 0 0;
    min-height: 100vh;
    box-sizing: border-box;
  }

  .brand-mark {
    left: 31px;
    top: 31px;
  }

  .menu {
    right: 31px;
    top: 31px;
  }

  /* Blue Dot & Spline - Mobile */
  .bluedot {
    width: 80%;
    bottom: -12vh;
  }

  /* Disable Spline on mobile for performance */
  .spline-container {
    display: none !important;
  }

  .bluedot-label {
    bottom: -14vh;
    right: -5%;
    font-size: var(--font-large);
  }

  .bluedot-label > div:last-child {
    margin-left: -20px;
  }

  .section-about {
    margin: 0 auto;
    padding: 0 31px;
    width: 100%;
  }

  .pill {
    margin: 0 0 62px;
    padding: 16px 31px;
    padding-left: 33%;
  }

  .about-grid {
    flex-direction: column;
    gap: 31px;
  }

  .about-col-top,
  .about-col-top-right,
  .about-col-bottom-left {
    flex: 1 1 100%;
    min-width: 100%;
    margin: 0;
    text-align: left;
  }

  .about-col-top {
    order: 4;
  }

  .about-col-top-right {
    order: 3;
  }

  .about-col-bottom-left {
    order: 1;
  }

  .about-avatar-wrapper {
    flex: 1 1 100%;
    width: 100%;
    min-width: 100%;
    order: 2;
    align-items: flex-start;
    margin: 0;
  }

  .about-social {
    flex: 1 1 100%;
    order: 5;
    margin: 0;
    text-align: left;
  }

  footer {
    padding: 0 0 31px;
  }

  .contact-bar {
    margin: 81px 31px 0;
    padding: 31px;
    flex-direction: column;
    align-items: flex-start;
    gap: 31px;
  }

  .contact-right {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .contact-input {
    width: 100%;
  }

  .modal-content {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0;
    padding: 83px 31px 31px;
    overflow: hidden;
    height: 100%;
  }

  .modal-card {
    margin: 0;
    border-radius: var(--radius);
    height: 96vh;
  }
  
  .modal-left {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    padding-bottom: 20px;
  }
  
  .modal-right {
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 20px;
  }
  
  .modal-title,
  .modal-year,
  .modal-subtitle,
  .modal-text {
    text-align: justify;
  }
}
