/* ==========================================================================
   Adam Kácha — vertical one-page (odd-meter style)
   Owner: Adam Kácha
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --text: #6d6d6d;
  --text-body: #5d5d5d;
  --menu-idle: rgba(255, 255, 255, 0.8);
  --menu-hover: rgba(255, 255, 255, 0.92);
  --menu-active: #ffffff;
  --menu-col: clamp(220px, 34vw, 400px);
  --transition: 0.5s ease;
  --menu-weight-transition: 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  --mobile-menu-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --snap-margin-top: clamp(2rem, 6vh, 4rem);
  --snap-margin-bottom: 2rem;
  --content-pad-x: clamp(1.5rem, 5vw, 4rem);
  /* Height-based cover cap — mid size on desktop, larger on ultrawide */
  --media-max-w: calc(62dvh * 16 / 9);
  --project-stack-gap: clamp(4rem, 12vh, 8rem);
}

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

html {
  scroll-behavior: smooth;
  scroll-snap-type: none;
  overflow-anchor: none;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  font-size: clamp(15px, 1rem + 0.35vw, 18px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text-body);
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1rem;
  background: #fff;
  color: #000;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* Page shell — two columns: menu | content -------------------------------- */

.page {
  display: grid;
  grid-template-columns: var(--menu-col) 1fr;
  min-height: 100dvh;
}

.page__menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--menu-col);
  z-index: 100;
  display: flex;
  align-items: center;
  padding-left: clamp(20px, 3vw, 48px);
  pointer-events: none;
}

.page__name {
  position: absolute;
  top: calc(clamp(1.25rem, 3vh, 2rem) + env(safe-area-inset-top, 0px));
  left: clamp(20px, 3vw, 48px);
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(0.875rem, 1.15vw, 1.125rem);
  font-weight: 600;
  font-variation-settings: 'wght' 600;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  text-shadow: 0 0 15px #131313;
  transition: color var(--transition);
  pointer-events: auto;
}

.page__name:hover {
  color: #fff;
}

.side-menu {
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: auto;
  max-width: calc(var(--menu-col) - clamp(20px, 3vw, 48px));
}

.menu-btn {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.8rem, 5.5vw, 5.5rem);
  line-height: 0.75;
  letter-spacing: -0.05em;
  text-align: left;
  font-weight: 100;
  font-variation-settings: 'wght' 100;
  color: var(--menu-idle);
  transition:
    color var(--menu-weight-transition),
    font-weight var(--menu-weight-transition),
    font-variation-settings var(--menu-weight-transition);
  text-shadow: 0 0 15px #131313;
  padding: 0;
  text-transform: uppercase;
  text-decoration: none;
  display: block;
  white-space: nowrap;
}

@media (hover: hover) {
  .menu-btn:hover {
    font-weight: 800;
    font-variation-settings: 'wght' 800;
    color: var(--menu-hover);
  }
}

.menu-btn.is-active {
  font-weight: 800;
  font-variation-settings: 'wght' 800;
  color: var(--menu-active);
}

/* Mobile: always-visible top menu ----------------------------------------- */

.mobile-header {
  display: none;
}

.mobile-menu {
  display: none;
}

/* Main content — right column only ---------------------------------------- */

.main-scroll {
  grid-column: 2;
  min-width: 0;
  padding: clamp(2rem, 6vh, 4rem) var(--content-pad-x);
  padding-bottom: calc(4rem + var(--safe-bottom));
}

.page-section {
  min-height: 50vh;
  padding: 0;
  scroll-margin-top: var(--snap-margin-top);
}

.page-section:first-child {
  /* Match .main-scroll top padding / --snap-margin-top so refresh
     and magnet-snap to the first project share the same gap. */
  padding-top: 0;
}

/* Same rhythm between categories as between projects inside one category */
.page-section + .page-section:not(.page-section--contact) {
  margin-top: var(--project-stack-gap);
}

.page-section__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.page-section__projects {
  display: flex;
  flex-direction: column;
  gap: var(--project-stack-gap);
  align-items: stretch;
  width: 100%;
}

/* Project — image + text stacked, full content width ---------------------- */

.project {
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
  scroll-margin-top: var(--snap-margin-top);
  scroll-margin-bottom: var(--snap-margin-bottom);
}

.project__media {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cover_container {
  position: relative;
  display: block;
  /* Full content+bleed width, but never taller than ~68dvh via 16:9 */
  width: min(calc(100% + var(--content-pad-x)), var(--media-max-w));
  margin-right: calc(-1 * var(--content-pad-x));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
}

.cover_video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background-color: #0a0a0a;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.cover_hint {
  position: absolute;
  z-index: 2;
  right: 2.75rem;
  bottom: 2.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.55);
  transition: color 0.4s ease, transform 0.4s ease, opacity 0.4s ease;
  opacity: 0.7;
  pointer-events: none;
}

.cover_hint__label {
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.cover_hint__arrow {
  display: block;
  width: 2rem;
  height: auto;
}

.cover_container:hover .cover_hint,
.cover_container:focus-visible .cover_hint {
  color: rgba(255, 255, 255, 0.95);
  opacity: 1;
  transform: translateX(0.35rem);
}

.cover_container:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.project__info {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  max-width: min(100%, var(--media-max-w));
}

.project__text-col {
  min-width: 0;
}

.project__title {
  font-weight: 300;
  font-size: clamp(1.75rem, 2.8vw, 2.75rem);
  margin: 0;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text);
}

.project__excerpt {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-body);
  margin: 0;
}

.project .project__text-col .project__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.read-more {
  appearance: none;
  background: none;
  border: none;
  padding: 0.625rem 0 0;
  font-family: inherit;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: color 0.3s;
}

.read-more:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* Contact ----------------------------------------------------------------- */

.page-section--contact {
  scroll-snap-align: start;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding-top: clamp(3rem, 12vh, 6rem);
  padding-bottom: calc(4rem + var(--safe-bottom));
}

.contact-stage {
  width: 100%;
  max-width: 58rem;
  text-align: left;
}

.contact-email {
  display: block;
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  font-weight: 300;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
  transition: color var(--transition);
}

.contact-email:hover {
  color: #fff;
}

.contact-bio {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.contact-bio__label {
  margin: 0;
  font-size: clamp(0.75rem, 0.95vw, 0.875rem);
  font-weight: 600;
  font-variation-settings: 'wght' 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.contact-bio__content {
  display: grid;
  grid-template-columns: minmax(0, 18rem) 1fr;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  align-items: start;
}

.contact-bio__photo {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  object-position: center 12%;
}

.contact-line {
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  line-height: 1.7;
  color: var(--text);
  margin: 0;
}

.contact-line--role {
  font-size: clamp(0.95rem, 1.25vw, 1.125rem);
  color: rgba(255, 255, 255, 0.72);
}

.contact-line--muted {
  color: var(--text-body);
}

/* Project lightbox — centered column like previous portfolio ------------ */

body.lightbox-open {
  overflow: hidden;
}

.project-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1100;
}

.project-lightbox[hidden] {
  display: none;
}

.project-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.project-lightbox__inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Horizontal padding only — bottom inset lives on the body so short
     content can flex-grow and avoid a phantom scrollbar. */
  padding: 0 1.5rem;
}

.project-lightbox__close {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  z-index: 3;
  appearance: none;
  background: none;
  border: none;
  padding: 0.5rem 0;
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 600;
  font-variation-settings: 'wght' 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: color 0.3s, opacity 0.3s;
}

.project-lightbox__close:hover {
  color: #fff;
}

/* Centered column: width ≈ 50dvh × 16/9 so media is exactly 50dvh tall */
.project-lightbox__media,
.project-lightbox__body {
  width: min(100%, calc(50dvh * 16 / 9));
  max-width: 100%;
}

.project-lightbox__media {
  position: relative;
  flex: 0 0 50dvh;
  height: 50dvh;
  min-height: 0;
  container-type: size;
  container-name: lightbox-media;
}

.project-lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050505;
}

.project-lightbox__video,
.project-lightbox__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-lightbox__embed {
  position: absolute;
  inset: 0;
}

.project-lightbox__embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.project-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  appearance: none;
  background: none;
  border: none;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 100;
  line-height: 1;
  letter-spacing: -0.05em;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: color 0.3s, transform 0.3s;
}

.project-lightbox__nav:hover {
  color: rgba(255, 255, 255, 0.9);
}

.project-lightbox__nav--prev {
  left: 0.25rem;
}

.project-lightbox__nav--next {
  right: 0.25rem;
}

.project-lightbox__nav--next:hover {
  transform: translate(0.15rem, -50%);
}

.project-lightbox__nav--prev:hover {
  transform: translate(-0.15rem, -50%);
}

.project-lightbox__nav[hidden] {
  display: none;
}

.project-lightbox__body {
  /* Grow to fill leftover space so short copy doesn't leave a 1px scroll */
  flex: 1 0 auto;
  min-height: 0;
  text-align: left;
  padding-top: 1.5rem;
  /* No bottom padding — it was forcing a tiny scrollbar when media + text already fit */
  padding-bottom: var(--safe-bottom);
}

.project-lightbox__info {
  display: block;
  margin-bottom: 0.75rem;
}

.project-lightbox__info .project__title {
  font-size: clamp(1.125rem, 2.1vw, 1.375rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 0.5rem;
}

.project-lightbox__info .project__text-col {
  min-width: 0;
}

.project-lightbox__description {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
}

.project-lightbox__description p {
  margin-bottom: 0.5rem;
}

.project-lightbox__description p:last-child {
  margin-bottom: 0;
}

.project-lightbox__description em {
  font-style: italic;
}

.project-lightbox__description strong {
  color: #fff;
  font-weight: 500;
}

.project-lightbox__tags {
  margin: 2rem 0 0;
  padding: 0;
  font-size: clamp(1.125rem, 2vw, 1.5625rem);
  font-weight: 300;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.33);
}

.project-lightbox__tags[hidden] {
  display: none;
}

/* Desktop+ — grow menu around the height-capped media rail --------------- */

@media (min-width: 1100px) {
  :root {
    --content-pad-x: clamp(1.25rem, 1.5vw, 2rem);
    /* Content column = media width; leftover width becomes menu */
    --menu-col: max(380px, calc(100vw - var(--media-max-w)));
  }

  .main-scroll {
    padding-right: 0;
    padding-left: var(--content-pad-x);
  }

  .cover_container {
    /* Fill the whole content column, flush to the right edge */
    width: calc(100% + var(--content-pad-x));
    margin-left: calc(-1 * var(--content-pad-x));
    margin-right: 0;
    max-width: none;
  }

  .project__info {
    max-width: none;
    width: 100%;
    padding-right: var(--content-pad-x);
    box-sizing: border-box;
  }

  .contact-stage {
    padding-right: var(--content-pad-x);
    box-sizing: border-box;
  }

  .menu-btn {
    font-size: clamp(2.5rem, 6vw, 7rem);
  }

  .page__name {
    font-size: clamp(0.95rem, 1.1vw, 1.2rem);
  }
}

/* Ultrawide — larger projects + bigger menu type -------------------------- */

@media (min-width: 1600px) {
  :root {
    --media-max-w: calc(70dvh * 16 / 9);
    --menu-col: max(520px, calc(100vw - var(--media-max-w)));
  }

  .menu-btn {
    font-size: clamp(3.25rem, 7vw, 9.5rem);
  }

  .page__name {
    font-size: clamp(1rem, 1.15vw, 1.35rem);
  }
}

@media (min-width: 2200px) {
  :root {
    --media-max-w: calc(72dvh * 16 / 9);
    --content-pad-x: clamp(1.25rem, 1.2vw, 2rem);
  }

  .menu-btn {
    font-size: clamp(4rem, 7.5vw, 11rem);
  }
}

/* Mobile ------------------------------------------------------------------ */

@media (max-width: 900px) {
  :root {
    --snap-margin-top: calc(var(--mobile-menu-h) + env(safe-area-inset-top, 0px) + 0.5rem);
    --content-pad-x: 1.25rem;
  }

  .page {
    display: block;
    height: 100svh;
    overflow: hidden;
  }

  /* The URL bar hides only when the document scrolls. Pin the page to the
     screen and scroll inside .main-scroll so the bar stays put. */
  html,
  body {
    position: fixed;
    inset: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .page__menu {
    display: none;
  }

  .mobile-header {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: env(safe-area-inset-top, 0px);
  }

  .page__name--mobile {
    display: none;
  }

  .mobile-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 0.85rem;
    min-height: var(--mobile-menu-h);
  }

  .mobile-menu .menu-btn {
    flex: 1;
    font-size: clamp(1.15rem, 5vw, 1.65rem);
    line-height: 0.85;
    letter-spacing: -0.05em;
    font-weight: 100;
    font-variation-settings: 'wght' 100;
    text-align: center;
    padding: 0.35rem 0.1rem;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition:
      color var(--menu-weight-transition),
      font-weight var(--menu-weight-transition),
      font-variation-settings var(--menu-weight-transition);
  }

  .mobile-menu .menu-btn.is-active {
    font-weight: 800;
    font-variation-settings: 'wght' 800;
    color: var(--menu-active);
  }

  @media (hover: hover) {
    .mobile-menu .menu-btn:hover {
      font-weight: 800;
      font-variation-settings: 'wght' 800;
      color: var(--menu-hover);
    }
  }

  .main-scroll {
    height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Overlay thumb tracks the frozen window, not this scroller. */
    scrollbar-width: none;
    padding-top: calc(var(--mobile-menu-h) + env(safe-area-inset-top, 0px));
    padding-left: 0;
    padding-right: 0;
    padding-bottom: calc(2rem + var(--safe-bottom));
  }

  .main-scroll::-webkit-scrollbar {
    display: none;
  }

  html {
    /* Native scroll. Mandatory snap was fighting the finger on iOS/Android. */
    scroll-snap-type: none;
    touch-action: manipulation;
  }

  .page-section {
    scroll-margin-top: calc(var(--mobile-menu-h) + env(safe-area-inset-top, 0px) + 0.5rem);
    min-height: auto;
    padding: 0;
  }

  .page-section:first-child {
    padding-top: 0;
  }

  .page-section + .page-section:not(.page-section--contact) {
    margin-top: 0;
  }

  .page-section__projects {
    align-items: stretch;
    gap: 0;
  }

  .project {
    width: 100%;
    /* svh stays stable when the mobile browser chrome shows and hides. */
    min-height: calc(100svh - var(--mobile-menu-h) - env(safe-area-inset-top, 0px));
    display: flex;
    flex-direction: column;
  }

  .project__media {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    min-height: 0;
  }

  .cover_container {
    width: 100%;
    margin: 0;
    flex: 0 0 auto;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .cover_hint {
    display: none;
  }

  .project__info {
    flex: 0 0 auto;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0 var(--content-pad-x) 1.25rem;
  }

  .project__title {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .page-section--contact {
    min-height: 100svh;
    padding-top: clamp(2rem, 8vh, 4rem);
    padding-bottom: calc(3rem + var(--safe-bottom));
  }

  .contact-stage {
    padding: 0 var(--content-pad-x);
  }

  .project-lightbox__inner {
    padding: 2.5rem 0 0;
    align-items: stretch;
  }

  .project-lightbox__close {
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    right: 1.25rem;
  }

  .project-lightbox__media,
  .project-lightbox__body {
    width: 100%;
  }

  .project-lightbox__media {
    flex: 0 0 auto;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .project-lightbox__body {
    padding: 1.5rem 1.25rem var(--safe-bottom);
    box-sizing: border-box;
  }

  .project-lightbox__info {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .project-lightbox__tags {
    margin-top: 2.5rem;
    margin-bottom: 0;
  }

  .page-section--contact {
    justify-content: flex-start;
    padding-bottom: calc(3rem + var(--safe-bottom));
  }

  .contact-stage {
    width: 100%;
  }

  .contact-bio__content {
    grid-template-columns: 1fr;
  }

  .contact-bio__photo {
    width: min(100%, 16rem);
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
