* { box-sizing: border-box; }
:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --text: #151515;
  --muted: #969696;
  --line: #e4e4df;
  --max: 1180px;
  --side: 240px;
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Proxima Nova", Montserrat, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side);
  padding: 54px 42px 38px 54px;
  display: flex;
  flex-direction: column;
  gap: 48px;
  color: var(--muted);
  z-index: 5;
}
.brand { display: block; width: 82px; height: auto; overflow: visible; }
.brand img { display: block; width: 100%; height: auto; object-fit: contain; filter: contrast(1.2); mix-blend-mode: multiply; }
.nav { display: flex; flex-direction: column; gap: 9px; font-size: 16px; }
.nav a { transition: 160ms ease; }
.nav a:hover { transform: translateX(3px); }
.nav-projects { margin-top: 10px; }
.nav-projects > a:first-child {
  display: inline-block;
  width: fit-content;
  padding-bottom: 3px;
  border-bottom: 1px solid currentColor;
}

.social { margin-top: auto; display: flex; gap: 16px; align-items: center; color: var(--muted); }
.social a { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; color: var(--muted); }
.social svg { width: 24px; height: 24px; display: block; fill: currentColor; }
.social a:hover { color: var(--text); }

.site-main { margin-left: var(--side); padding: 28px 72px 96px; }
.section { max-width: var(--max); margin: 0 auto; padding: 72px 0; scroll-margin-top: 40px; }
.hero { container-type: inline-size; min-height: auto; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; text-align: center; padding: 140px 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 6.4cqw, 64px); line-height: .92; letter-spacing: -0.07em; margin: 0; text-align: center; }
.hero h1 { width: 100%; max-width: 980px; margin-left: auto; margin-right: auto; margin-bottom: 50px; text-align: center; }
.lead { max-width: 760px; color: var(--muted); font-size: 16px; line-height: 1.45; margin: 0 auto 34px; }
h2 { font-size: clamp(32px, 5vw, 53px); line-height: .95; letter-spacing: -0.06em; margin-bottom: 24px; }
.copy p { color: var(--muted); font-size: 16px; line-height: 1.45; }
.copy p { margin-bottom: 26px; }

.cases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 38px 22px; padding-top: 0; }
.case-card { border: 0; appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer; background: transparent; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.case-card:focus-visible { outline: 2px solid var(--text); outline-offset: 6px; }
.case-thumb { display: block; width: 100%; aspect-ratio: 1 / 1; background: var(--paper); overflow: hidden; border-radius: 5px; }
.case-thumb img, .case-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 260ms ease, opacity 260ms ease; }
.case-card:hover .case-thumb img, .case-card:hover .case-thumb video { transform: scale(1.035); opacity: .92; }
.case-title { display: block; color: var(--text); font-size: 16px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; transition: color 180ms ease; }
.case-card:hover .case-title { color: var(--muted); }

.more-cases-card {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  background: var(--paper);
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  text-align: center;
  transition: color 180ms ease, background-color 180ms ease;
}
.more-cases-card:hover { color: var(--text); background: #ffffff; }
.more-cases-arrow {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}
.more-cases-card:hover .more-cases-arrow {
  animation: arrow-nudge 620ms ease-in-out infinite;
}
@keyframes arrow-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(7px); }
}

.two-column { display: grid; grid-template-columns: .9fr 1.1fr; gap: 80px; border-top: 1px solid var(--line); }
.skills { border-top: 1px solid var(--line); }
.skills p { max-width: 980px; color: var(--text); font-size: clamp(16px, 2vw, 20px); line-height: 1.45; letter-spacing: 0; font-weight: 700; }
.contact { border-top: 1px solid var(--line); }
.contact-links { display: flex; flex-direction: column; gap: 8px; font-size: 20px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; margin: 24px 0 0; }
.contact-links a:hover { color: var(--muted); }

body.modal-open { overflow: hidden; }
.case-modal { position: fixed; inset: 0; z-index: 50; display: none; }
.case-modal[aria-hidden="false"] { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: #ffffff; backdrop-filter: blur(12px); }
.modal-panel {
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
  width: min(1360px, calc(100vw - 80px), calc(100vh - 80px + 420px));
  height: min(860px, calc(100vh - 80px));
  background: #ffffff;
  color: var(--text);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 4;
  border: 0;
  background: transparent;
  color: #ffffff;
  mix-blend-mode: difference;
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
  transform-origin: center;
  transition: transform 420ms ease, opacity 180ms ease;
}
.modal-close:hover {
  opacity: 0.65;
  transform: none;
}
.modal-close:focus-visible { outline: 2px solid var(--text); outline-offset: 6px; }

.modal-gallery {
  position: relative;
  min-width: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
}
.slide-wrap {
  width: 100%;
  max-width: calc(min(860px, 100vh - 80px));
  aspect-ratio: 1 / 1;
  background: #ffffff;
  overflow: hidden;
}
.case-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.case-media-video { background: #000; }
.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #ffffff;
  mix-blend-mode: difference;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 180ms ease, transform 180ms ease, color 180ms ease;
}
.modal-arrow:hover { opacity: .72; transform: translateY(-50%) scale(.96); }
.modal-arrow-prev { left: 18px; }
.modal-arrow-next { right: 18px; }
.gallery-dots {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  background: transparent;
}
.gallery-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .52);
  box-shadow: none;
  transition: transform 180ms ease, opacity 180ms ease, background-color 180ms ease;
}
.gallery-dot.is-active {
  background: #ffffff;
  transform: scale(1.12);
}

.modal-copy {
  min-width: 0;
  background: #ffffff;
  border-left: 1px solid var(--line);
}
.modal-copy-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 28px 84px 24px 24px;
}
.modal-description {
  color: var(--text);
  font-size: 14px;
  line-height: 1.42;
}
.modal-description p {
  margin: 0 0 18px;
}
.modal-description p:last-child {
  margin-bottom: 0;
}
.modal-description strong {
  font-weight: 800;
}
.case-meta {
  margin: auto 0 0;
  border-top: 1px solid var(--line);
}
.case-meta div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.case-meta div:last-child { border-bottom: 0; }
.case-meta dt { color: var(--muted); }
.case-meta dd { margin: 0; color: var(--text); font-weight: 700; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; padding: 28px 24px; display: block; }
  .brand { width: 64px; height: auto; }
  .nav-primary, .nav-projects, .social { display: none; }
  .site-main { margin-left: 0; padding: 0 24px 64px; }
  .hero { text-align: left; min-height: auto; padding: 36px 0 72px; }
  .lead { margin-left: 0; margin-right: 0; }
  .section { padding: 56px 0; }
  .cases { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 16px; }
  .two-column { grid-template-columns: 1fr; gap: 24px; }

  .modal-panel {
    inset: 14px;
    transform: none;
    width: auto;
    height: calc(100vh - 28px);
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow: auto;
  }
  .modal-gallery {
    justify-content: stretch;
  }
  .slide-wrap {
    width: 100%;
    max-width: none;
  }
  .modal-copy {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .modal-copy-inner {
    padding: 20px 72px 20px 20px;
  }
  .modal-description {
    margin-bottom: 34px;
  }
  .case-meta {
    margin: 0;
  }
  .case-meta div { grid-template-columns: 1fr; gap: 4px; }
  .modal-close { top: 16px; right: 16px; }
}

@media (max-width: 560px) {
  .cases { grid-template-columns: 1fr; }
  .modal-arrow {
    width: 38px;
    height: 38px;
    font-size: 28px;
  }
  .modal-arrow-prev { left: 12px; }
  .modal-arrow-next { right: 12px; }
  .gallery-dots { bottom: 12px; }
}


/* Instagram tile */
.instagram-tile {
  display: block;
}

.instagram-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  background: #ffffff;
  border-radius: 5px;
  color: var(--muted);
  padding: 28px;
}

.instagram-link-text {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.instagram-arrow {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  color: currentColor;
  transition: transform 260ms ease;
}

.instagram-tile:hover .instagram-arrow {
  animation: arrowNudge 720ms ease-in-out infinite;
}

.instagram-tile:hover .instagram-thumb {
  color: var(--text);
}

@keyframes arrowNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(7px); }
}

@media (max-width: 560px) {
  .instagram-link-text {
    font-size: 18px;
  }

  .instagram-arrow {
    width: 20px;
    height: 20px;
  }
}

.mobile-social { display: none; }


/* Mobile sticky header */
@media (max-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: auto;
    min-height: 0;
    padding: 18px 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: #ffffff;
    z-index: 40;
  }

  .sidebar .brand {
    width: 64px;
    flex: 0 0 auto;
  }

  .sidebar .nav-primary,
  .sidebar .nav-projects,
  .sidebar > .social {
    display: none;
  }

  .mobile-social {
    margin: 0;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: flex-end;
    color: var(--muted);
  }

  .mobile-social a {
    display: inline-flex;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    color: var(--muted);
  }

  .mobile-social svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: currentColor;
  }

  .mobile-social a:hover {
    color: var(--text);
  }
}


@media (max-width: 900px) {
  .hero h1 {
    margin-bottom: 50px;
  }
}


/* Mobile popup fix: 1:1 media + scrollable text */
@media (max-width: 900px) {
  .modal-panel {
    overflow: hidden;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .modal-gallery {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: auto;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .slide-wrap {
    width: 100%;
    max-width: none;
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .case-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .modal-copy {
    min-height: 0;
    overflow: hidden;
  }

  .modal-copy-inner {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 36px;
  }
}

@media (max-width: 560px) {
  .modal-panel {
    inset: 12px;
    height: calc(100dvh - 24px);
  }

  .modal-gallery {
    aspect-ratio: 1 / 1;
  }

  .slide-wrap {
    aspect-ratio: 1 / 1;
  }
}


/* Mobile popup close contrast */
@media (max-width: 900px) {
  .modal-close {
    color: #ffffff;
  }

  .modal-close-icon {
    color: #ffffff;
    mix-blend-mode: difference;
  }
}


/* Mobile carousel swipe */
.modal-gallery {
  touch-action: pan-y;
  user-select: none;
}

.slide-wrap img,
.slide-wrap video {
  -webkit-user-drag: none;
}


/* Safari close button fix */
@supports (-webkit-touch-callout: none) {
  .modal-close {
    -webkit-transform-origin: 50% 50%;
    transform-origin: 50% 50%;
  }
}


/* Stable swipe/drag carousel */
.modal-gallery {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  overscroll-behavior: contain;
}

.modal-gallery:active,
body.is-dragging-carousel .modal-gallery {
  cursor: grabbing;
}

body.is-dragging-carousel {
  user-select: none;
}

.slide-wrap {
  position: relative;
  overflow: hidden;
}

.slide-wrap img,
.slide-wrap video {
  -webkit-user-drag: none;
}

.swipe-media {
  position: absolute;
  inset: 0;
  transform: translateX(0);
  transition: none;
  will-change: transform;
}

.slide-wrap.is-animating .swipe-media {
  transition: transform 260ms ease;
}



/* Stable rotating SVG close icon */
.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 12;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.modal-close-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #ffffff;
  mix-blend-mode: difference;
  transform: rotate(0deg) translateZ(0);
  transform-origin: 50% 50%;
  transition: transform 420ms ease, opacity 180ms ease;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
}

.modal-close-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.modal-close-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.modal-close:hover .modal-close-icon {
  transform: rotate(360deg) translateZ(0);
}


/* Keep hero headline on exactly two lines */
.hero h1 span { display: inline-block; white-space: nowrap; }


/* Hero two-line mobile sizing */
@media (max-width: 560px) {
  h1 {
    font-size: clamp(24px, 8cqw, 38px);
  }
}


/* Mobile hero: left aligned like before */
@media (max-width: 900px) {
  .hero {
    container-type: normal;
    align-items: flex-start;
    text-align: left;
    padding: 36px 0 72px;
  }

  .hero h1 {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    text-align: left;
    font-size: clamp(42px, 13vw, 64px);
  }

  .hero h1 span {
    white-space: normal;
  }
}
