/* === N27 FONT FACES === */
@font-face {
  font-family: 'N27';
  src: url('fonts/n27/n27-regular.woff2') format('woff2'),
       url('fonts/n27/n27-regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'N27';
  src: url('fonts/n27/n27-bold.woff2') format('woff2'),
       url('fonts/n27/n27-bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'N27';
  src: url('fonts/n27/n27-thin.woff2') format('woff2'),
       url('fonts/n27/n27-thin.woff') format('woff');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

/* === BASE === */
html { font-size: 16px; }
@media (max-width: 768px) {
  html { font-size: 14px; }
}
body {
  margin: 0;
  font-family: 'N27', sans-serif;
  font-weight: 400;
  background-color: #fff;
  color: #111;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}
body.fade-in { opacity: 1; }

a { color: #111; text-decoration: none; }
a:hover { text-decoration: none; }

/* === STAR MENU TOGGLE ("*") === */
.menu-toggle {
  position: fixed;
  top: 1.4rem;
  left: 1.4rem;
  z-index: 1201 !important;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  width: 3.6rem;
  height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}
.plus {
  font-family: 'N27', sans-serif;
  font-weight: 100;
  font-size: 3.5rem;
  color: #111 !important;
  background: none;
  line-height: 1;
  user-select: none;
  display: block;
  z-index: 1202 !important;
  pointer-events: auto;
}

/* --- MOBILE STAR & LANGUAGE EXACT ALIGNMENT --- */
@media (max-width: 600px) {
  .menu-toggle {
    top: 0.95rem;
    left: 1vw;
    width: 3.3rem;
    height: 3.3rem;
  }
  .plus { font-size: 2.6rem; }
  .language-switcher {
    top: 1.1rem;
    right: 1vw;
    font-size: 0.9rem !important;
  }
}

/* === MENU DROP (NO BOX, NO SHADOW) === */
.menu {
  display: flex;
  flex-direction: column;
  margin-top: 0.7rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  position: absolute;
  top: 2.3rem;
  left: 0;
  min-width: 7.5rem;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: none !important;
}
.menu a {
  text-decoration: none;
  color: #111;
  font-size: 1rem;
  opacity: 0;
  padding: 0.4rem 1.1rem;
  background: none !important;
  transform: translateY(-10px);
  transition: opacity 0.35s, transform 0.35s;
}
.menu-toggle:hover .menu,
.menu-toggle:focus-within .menu {
  opacity: 1;
  pointer-events: auto;
}
.menu-toggle:hover .menu a,
.menu-toggle:focus-within .menu a {
  opacity: 1;
  transform: translateY(0);
}
.menu-toggle:hover .menu a:nth-child(1) { transition-delay: 0.1s; }
.menu-toggle:hover .menu a:nth-child(2) { transition-delay: 0.18s; }
.menu-toggle:hover .menu a:nth-child(3) { transition-delay: 0.26s; }
.menu-toggle:hover .menu a:nth-child(4) { transition-delay: 0.34s; }

/* === SITE HEADER === */
.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  text-align: center;
  background: #fff;
  width: 100vw;
  border: none;
  box-shadow: none;
}
.site-header .logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  width: 100vw;
  margin: 0;
  padding: 1.1rem 0 0.1rem 0;
  line-height: 1.2;
  z-index: 1002;
  background: transparent;
}
.site-header .name {
  font-size: 2.4rem;
  font-family: 'N27', sans-serif;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  line-height: 1.1;
  margin: 0;
  padding: 0;
}
.site-header .tagline {
  font-size: 0.9rem;
  font-family: 'N27', sans-serif;
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  margin: 0.2rem 0 0 0;
  line-height: 1;
  opacity: 0.8;
  padding: 0;
}

/* === LANGUAGE SWITCHER (DESKTOP DEFAULT) === */
.language-switcher {
  position: fixed;
  top: 1.4rem;
  right: 1.4rem;
  z-index: 1201 !important;
  display: flex;
  gap: 0.5rem;
  background: none;
  width: auto;
  height: auto;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.language-switcher a {
  font-size: 0.96rem;
  text-decoration: none;
  color: #111;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.language-switcher a:hover,
.language-switcher a.active {
  opacity: 1;
}

/* === DESKTOP PROJECTS (carousel, unchanged) === */
.carousel-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.carousel-window {
  width: calc(3 * clamp(300px, 60vw, 600px) + 2 * 4rem);
  max-width: calc(3 * 600px + 2 * 4rem);
  overflow: hidden;
}
.projects {
  display: flex;
  gap: 4rem;
  transition: transform 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
}
.project-preview {
  flex: 0 0 clamp(300px, 60vw, 600px);
  max-width: 600px;
  text-align: center;
  position: relative;
  text-decoration: none !important;
}
.project-preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s;
}
.project-preview:hover img { filter: grayscale(0%); }
.project-preview .hover-title {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: #111;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  font-family: 'N27', sans-serif;
  font-weight: 400;
  font-style: normal;
  text-transform: none;
  text-decoration: none;
}
.project-preview:hover .hover-title { opacity: 1; text-decoration: none !important; }
a .hover-title { text-decoration: none !important; }

/* === MOBILE PROJECT LIST (hidden on desktop) === */
.mobile-project-list {
  display: none;
}

/* === INVISIBLE CLICKABLE AREAS FOR CAROUSEL NAVIGATION === */
.carousel-side {
  position: fixed;
  top: 0;
  width: 15vw;
  height: 100vh;
  z-index: 1003;
  cursor: pointer;
  opacity: 0;
  background: transparent;
}
.carousel-side.left { left: 0; }
.carousel-side.right { right: 0; }

/* === FORCE MOBILE LAYOUT FOR ALL TOUCH DEVICES (PHONES & TABLETS) === */
@media (pointer: coarse) and (max-width: 3000px) {
  .carousel-wrapper,
  .carousel-side { display: none !important; }
  .mobile-project-list {
    display: flex !important;
    flex-direction: column;
    gap: 2.5rem;
    width: 100vw;
    margin-top: 5.9rem !important;
    background: #fff !important;
    padding-bottom: 3rem;
  }
  .mobile-project-tile {
    display: block;
    position: relative;
    width: 92vw;
    max-width: 540px;
    margin: 0 auto;
    text-decoration: none;
    color: inherit;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    overflow: hidden;
    transition: box-shadow 0.18s;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-project-tile img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1/1;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.3s;
    background: #fff !important;
    pointer-events: none;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .mobile-project-tile.active img {
    filter: none;
  }
  .mobile-title {
    display: block;
    width: 100%;
    text-align: center;
    font-family: 'N27', sans-serif;
    font-size: 1.12rem;
    font-weight: 500;
    margin: 0 auto;
    padding: 1.1rem 0 1.2rem 0;
    color: #111;
    background: #fff;
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.25s;
    position: static;
    border-radius: 0;
    z-index: 1;
  }
  .mobile-project-tile.active .mobile-title {
    opacity: 1;
  }
  .mobile-project-tile:not(.active) .mobile-title {
    opacity: 0;
  }
  /* Hide focus outline on click for mobile project tiles */
  .mobile-project-tile:focus {
    outline: none;
  }
  .mobile-project-tile,
  .mobile-project-tile img {
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  /* Mobile menu animation */
  .mobile-project-list,
  .menu {
    transition: opacity 0.42s cubic-bezier(0.4, 0.3, 0.2, 1);
  }
  .mobile-project-list {
    opacity: 1;
    pointer-events: auto;
    will-change: opacity;
  }
  .mobile-project-list.mobile-fade-out {
    opacity: 0;
    pointer-events: none;
    transition-delay: 0s;
  }
  .menu.mobile-fade-in {
    opacity: 1 !important;
    pointer-events: auto !important;
    transition-delay: 0.15s;
  }
  .menu:not(.mobile-fade-in) {
    opacity: 0 !important;
    pointer-events: none !important;
    transition-delay: 0s;
  }
  /* Bottom bar for mobile/tablet */
  .project-bottom-bar {
    position: fixed;
    bottom: 1.3rem;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1100;
    padding: 0 4vw 0 4vw;
    box-sizing: border-box;
    background: none;
    pointer-events: none;
  }
  .project-title {
    font-size: 0.97rem;
    font-family: 'N27', sans-serif;
    font-weight: 400;
    color: #111;
    background: rgba(255,255,255,0.94);
    border-radius: 1.2rem;
    padding: 0.2rem 1rem 0.3rem 1rem;
    user-select: none;
    transition: box-shadow 0.15s;
    pointer-events: auto;
    cursor: pointer;
    white-space: nowrap;
  }
  .page-counter {
    font-size: 0.97rem;
    font-family: 'N27', sans-serif;
    font-weight: 400;
    color: #111;
    background: rgba(255,255,255,0.85);
    border-radius: 1.2rem;
    padding: 0.2rem 1rem 0.3rem 1rem;
    user-select: none;
    pointer-events: auto;
    white-space: nowrap;
  }
  /* Hide the old floating title and counter on mobile */
  .old-project-title, .old-page-counter { display: none !important; }
}
/* Hide desktop bar on touch devices */
@media (pointer: coarse) and (min-width: 3001px) {
  .project-bottom-bar { display: none !important; }
}

/* --- MOBILE FINE TUNING --- */
@media (max-width: 600px) {
  .mobile-project-tile { max-width: 98vw; }
  .mobile-title {
    font-size: 0.96rem;
    padding: 1.05rem 0 1rem 0;
  }
  .site-header .name,
  header .name { font-size: 1.4rem !important; }
  nav, .language-switcher { font-size: 0.9rem !important; }
}
